PHP-Showing image having name with “%2F”

If you want to display an image on an HTML page, you can simply use the <img> tag. But if the image name consists of the html entity “%2F”, it is difficult to do that. For example:

The image name is : foo%2Fbar.png

<img src=”/images/foo%2Fbar.png” title=”image” alt=”image” />

The html page will try to get the image from the directory: /images/foo/bar.png

This way the page will never get the image and won’t be able to display that. I have a trick to solve this problem. Here it is:

<?php

<html>

<p>The correct image is:

<img src=”<?php echo substr_replace(”/images/foo%2Fbar.png”, ‘%252F’, -10, -7) ?>” alt=”image” title=”image” />

</html>

?>

This code will display the image by replacing “%2F” with “%252F” and you will not be blamed to have extra subdirectories.

Breaking News!!

breakinig news

You open the TV to get some news updates. You rush to a news channel who claims to be the best news channel. Suddenly you hold your breath seeing the Breaking News heading. The breaking news is:

Breaking News:: Tulsi ki wapasi………………

Your excitement ends up with frustration and irritation. You change the channel. After some time, you again reach the same channel, now the breaking news is::

Breaking News:: Mumbai ke zoo me ek magarmacchh ne anda diya……….

Now either you want to break your head or the TV. Obviously you don’t do any one. So you simply switch off the TV. After 1 hour you again open the TV with some hope. Now the best news channel is showing the clippings of some idiot Saas-Bahu daily soap which is becoming the epic in television history. Now I don’t have words to express your frustration level. Finally you start searching for the news paper having older but better news.

This is now the standard of news channels. They try to make the simple news, sensational. They have hours to discuss what Khali did in WWE, but don’t have even 5 minutes for successful launch of 10 satellites at one go. They have full time to discuss about Dhoni’s hair style but not to discuss about the people who spent their lives serving for society.

I suggest, they should claim to be the best entertainment channel.

When my heart broke

Here you can see what happened, when I proposed the first girl in my life :-)

Fool or lack of information!!

Few days back, I asked one of my good friend to send me some money. He agreed and went to the nearest ATM to deposit money. He simply filled all the information regarding my account on the envelop and drop that into the “Cheque Drop Box”. When I didn’t get the money after expected days, I called him to ask. When he told, what he did, I died of laugh at his foolishness. The amazing thing was, he doesn’t have account in that bank too.

After sometime I thought that, why to blame only his foolishness. People do lots of things carelessly. He may be dump but the banking system was also a big “Dump”. This is the responsibility of the “System ” to be informative enough to suggest right steps to use them. If someone is giving wrong input to any system, either software or hardware, the system is responsible. I think he should claim for his money but he doesn’t have any proof ( this is surely his foolishness :) ).

The banking system should provide “what to do” along with “what NOT to do(At least what mistakes one can do.)”.

I think bank should paste/print these on the envelop or on ATM centers:

1- You can not deposit cash here if you don’t have account with us.

2- Please do not drop cash in the “cheque drop box”.

3- You must have ATM card to deposit cash at ATM points.

.NET Framework:: Basics

net.jpg

I am posting some basic questions on .NET Framework which will help the beginners.

1- What is .NET framework?
Ans :

Wiki defines

“The Microsoft .NET Framework is a software component that is a part of modern Microsoft Windows operating systems. It provides a large body of pre-coded solutions to common program requirements, and manages the execution of programs written specifically for the framework.”

Another one

A programming infrastructure created by Microsoft for building, deploying, and running applications and services that use .NET technologies, such as desktop applications and Web services. It provides a highly productive, standards-based, multi-language environment for integrating existing investments with next-generation applications and services, as well as the agility to solve the challenges of deployment and operation of Internet-scale applications.
.NET Framework consists of 3 main parts :

  • Common Language Runtime,
  • .NET Framework class library,
  • ASP.NET

2- What is CLR?

Ans :
CLR stands for Common Language Runtime. It is the implementation of CLI, Common Language Infrastructure which defines the execution environment for program code. The role of CLR starts after the compilation of the code written in the different languages by their respective compilers. The compiler converts the code into the CIL(Common Intermediate Language). The CLR’s just-in-time compiler converts this CIL code into the native code specific to the operating system at runtime. The CLR also provides other important services including:

  • Memory Management,
  • Thread Management,
  • Exception Handling,
  • Security,
  • Garbage Collection

3- What is CLI?

Ans:

This is the main component of .NET framework. CLI stands for Common Language Infrastructure. CLI is a “specification” which defines an environment that allows multiple high-level languages to be used on different computer platforms without being rewritten for specific architectures. The implementation of CLI is known as CLR, Common Language Runtime. CLI describes four aspects:

  • Common Type System (CTS),
  • Metadata,
  • Common Language Specification (CLS),
  • Virtual Execution System (VES)

4- What is MSIL?
Ans:
MSIL stands for Microsoft’s Standard Implementation Language. Now it is known as CIL, Common Intermediate Language. This is the bytecode formed after the compilation of the program code.

5- What is CTS?
Ans:
CTS stands for Common Type System. It is a part of CLI. The .NET framework supports type definitions which are independent of any specific programming language, and CTS covers a range of topics related to type handling. These topics include type safety, cross-language sharing of typed data, type behavior and features, and performance.

6- What is JIT compiler?
Ans:
JIT stands for Just-in-time compiler and is a part of the CLR. JIT compiler, at runtime, compiles the CIL (bytecode) into the native code specific to the operating system.

7- What is CLS?
Ans:
Common Language Specification is a set of basic language features needed by many applications. It helps enhance and ensure language interoperability by defining a set of features that developers can rely on to be available in a wide variety of languages.

8- What is VES?
Ans:
VES stands for Virtual Execution System. It provides an environment for executing managed code. It also gives the support for a set of built-in data types, defines a hypothetical machine with an associated machine model and state, a set of control flow constructs, and an exception handling model.To a large extent, the purpose of the VES is to provide the support required to execute the Common Intermediate Language instruction set.

9- What are .NET Assemblies?
Ans:
.NET Assemblies contain the intermediate CIL code. Assemblies are stored in the Portable Executable (PE) format. It consists of one or more files, but one of these must contain the manifest, which has the metadata for the assembly. The complete name of an assembly contains its simple text name, version number, culture and public key token.

I will continue with some more stuff on different topics.

Life is changing:

smart1.jpg
Life can take any turn at any moment. Sometimes others experiences guide you and most of the times yours own. Your own experience will last forever, so better to follow that. Life is like a dice with different phases. Sometimes it shows happier moments and sometimes critical ones. According to the phase, you will require to take decisions. My life is changing and showing totally new phases to me. Few months back I changed my working technology, now again I have to change it. I welcome this change because this will give me better exposure to the tech world. I know it would be hard for me to pick up the new challenge, but still I am ready to take this. Let’s see what is behind the hills. I don’t know my decision is good or not. but I will go for it. Its better to die rather than sitting idle.

OpenId::New way to login

You visit the web sites like the blog sites. After reading some interesting stuff, you tried to comment on that. It asks you to login first using your username and the password. Any how you memorize that and login and commented the blog. Then you visited some forums and tried to post some query. What the hell is this? It also asks you to login and being weak by memory, like me, you forgot either the username or password. Then what to do? Either create a new account or leave the idea to post something.
Thanks God! there is solution for these kind of situations i.e. OpenId. OpenId grants you to forget different login details at different websites, How?? Let me explain.

  • What is OpenId?

1- OpenID is a decentralized single sign-on system.

2- OpenID eliminates the need for multiple usernames across different websites, simplifying your online experience. OpenID is an open, decentralized, free framework for user-centric digital identity.(http://openid.net/)

  • Where to use OpenId?

You can use the OpenId login on any OpneId enabled website.

  • How to get OpenId?

There are thousands of openId providers (List::http://wiki.openid.net/OpenIDServers). You just need to register on your favorite one. They will provide a URL which is your OpenId. The OpenId looks like:
http://username.wordpress.com
You need to use this Id when you want to login on OpenId enabled website.

  • How OpenId identifies you?

clientdiagram1.gif

When you put the OpenId in the login field and hit the login button, the site uses this url to find the Authentication server. The authentication server after authentication asks the user to login and asks your choice to allow the relying party (with url). If the user allows, the user again lands back to the original website showing the successful login message.

Seems Good!! go and have openid and enjoy multiple website login with single url.

Celebration….cheers!!!!

This is the real masti and enjoyment you can see. I am in yellow t-shirt and the other two are my room mates- Mayank and Sonu. Both are good dancers real good wishers. We celebrated this moment on the change of my job. We cut a cake and the cream was pasted on my face. We all are from UP and celebrating this moment in typical UP style. watch this and enjoy…….

Woh Dekho Software Engineer Ja Raha Hai

Apne Project ke bojh tale daba jaa raha hai,

Wo dekho ek Software engineer ja raha hai,

zindagi se hara hua hai,

par “Bugs” se haar nahi manata,

Apne application ki ek ek line ise rati hui hai,

par aaj kaun se rang ke moje pehne hain , ye nahi janata,

din par din ek excel file banata ja raha hai

Wo dekho ek Software engineer ja raha hai,

das hazaar line ke code main error dhoond lete hain lekin,

majboor dost ki ankhon ki nami dikhayi nahi deti,

pc pe hazaar windows khuli hain,

par dil ki khidki pe koi dastak sunayi nahi deti,

satuday-sunday nahata nahi, week days ko naha raha hai,

Wo dekho ek Software engineer ja raha hai,

Coding karte karte pata hi nahi chala,

bugs ki priority kab maa-baap se high ho gayi,

kitabon main gulab rakhne wala , cigerette ke dhuyen main kho gaya,

dil ki zameen se armaanon ki vidayi ho gayi,

weekends pe daroo peke jo jashna mana raha hai,

Wo dekho ek Software engineer ja raha hai,

maze lena ho iske to pooch lo,

“Salary Increment” ki party kab dila rahe ho,

hansi udana ho to pooch lo,

“Onsite” kab ja rahe ho?

wo dekho onsite se laute team-mate ki chocolates kha raha hai,

Wo dekho ek Software engineer ja raha hai,

kharche badh rahe hain,

baal kam ho rahe hain,

KRA ki date ati nahi,

Income Tax ke sitam ho rahe hain,

lo phir se bus choot gayi, Auto se aa raha hai,

Wo dekho ek Software engineer ja raha hai,

Pizza gale se nahi utarta,

to “Coke” ke sahare nigal liya jata hai,

office ki “Thali” dekh munh hai bigadta,

maa ke hath ka wo khana baar roz yaad ata hai,

“Sprout bhel” bani hai phir bhi, free “Evening Snacks” kha raha hai,

Wo dekho ek Software engineer ja raha hai,

aapne ab tak li hongi bahut si chutikiya,

Software engg. ke jivan ka sach batati ye akhri kuch panktiyan,

hazaron ki tankhwah wala, company ki karodon ki jeb bharta hai,

software engg. wahi ban sakta hai, jo lohe ka jigar rakhta hai,

hum log jee jee ke marte hain , zindagi hai kuch aisi,

ek fauj ki naukri, doosri software engg. ki , dono ek jaisi,

is kavita ka har shabd mere dil ki gehrayi se aa raha hai,

Wo dekho ek Software engineer ja raha hai .

Carwan Guzar Gaya Ghubaar Dekhte Rahe!!

karwan_gujar_gaya_1.gif

This is one of the greatest poetry from Dopal Das Neeraj. I like this, Do you like it?