Creating ‘mailto’ and ‘tel’ Link Handlers in C#


Many business websites show their email addresses and phone numbers so their customers can contact them. In this lesson we will create wrapper classes around ‘mailto’ and ‘tel’ HTML links in C#. Those classes will allow you to read and generate those links with ease.

Continue reading

Installing IIS on Windows XP, Vista, and Windows 7

هذه المقالة متوفرة أيضا باللغة العربية، اقرأها هنا.


When you install Windows, it doesn’t automatically install IIS for you. Instead, you have to install it manually. If you have downloaded a new version of IIS from IIS website, you can use the setup file to install IIS on your machine. If you prefer the version of IIS that ships with your Windows edition, you can install it using Windows Components installer, and that what we are going to do next.

IIS on Windows XP

To install IIS on Windows XP follow those steps:

  1. Go to Control Panel -> Add or Remove Programs -> Add/Remove Windows Components.
  2. Go down in the list and check Internet Information Services (see figure 1.)
  3. You can also click Details to choose additional services and functionalities to install (e.g. SMTP service.)
  4. Click Next and provide your Windows CD or Windows installation files folder to continue.

Figure 1 - Installing IIS on Windows XP

Figure 1 - Installing IIS on Windows XP

Now you can go to Control Panel -> Administrative Tools and run IIS from there. You can also browse to http://localhost and see your new homepage (enjoy!)

IIS on Windows Vista and Windows 7

Installing IIS on Windows Vista/7 is very similar, just follow those steps:

  1. Go to Control Panel -> Programs and Features -> Turn Windows Features on or off.
  2. In the Windows Features dialog (see figure 2,) check Internet Information Services node.
  3. You can also select any additional services to install from the child nodes (e.g. FTP services.)
  4. Click OK to complete the installation. A system reboot might be required.

Figure 2 - Installing IIS on Windows Vista and Windows 7

Figure 2 - Installing IIS on Windows Vista and Windows 7

Now go to Control Panel -> Administrative Tools to run the IIS. You can also go to http://localhost to see your new homepage.

Running IIS

Personally, I don’t like running IIS from Administrative Tools. I like to use the Run command to run everything on my PC and that’s, on my opinion, 3 times faster than everything else (of course when using the keyboard not the mouse.)

To be able to launch IIS from the Run command, you need to add the IIS directory (%windir%System32inetsrv) to the command search path which is available in system environment variables, and that can be done using the following steps:

  1. Open System Settings (right click Computer and choose properties, or preferably by pressing Start + Pause Break buttons.)
  2. If you are using Windows Vista or Windows 7 choose Advanced System Settings from the left pane.
  3. Go to Advanced -> Environment Variables (see figure 3.)
  4. In the bottom list (System Variables) select Path and click Edit.
  5. Beware not to fail this step. In the Variable Value field, add the symbol ; to the end of the value (if it’s not already added) and then append the following text:
  6. Click OK 3 times.

Figure 3 - Setting the Path Environment Variable

Figure 3 - Setting the Path Environment Variable

Now go to Run (Start + R) and write inetmgr (the name of the IIS Manager) to run the IIS Management tool.

Have a nice day!

How I love Formspring 404 Not Found page!

Just liked to say that I really like Formspring 404 not found page, it’s really cool :P, see it below or try to navigate to any page that doesn’t exist.

I like also to mention this great article by Chris Coyier from CSS-Tricks that talks about 404 pages best practices. You should really read it.

Enjoy your day!

UPDATE 07/09/2011:

Keep yourself updated with brilliant 404 pages by following this blog.

Converting between color decimal and hexadecimal representation

هذه المقالة متوفرة أيضا باللغة العربية، اقرأها هنا.


Contents of this article:

  • Contents
  • Introduction
  • Color Represenatation
  • Converting Decimal to Hexadecimal
  • Converting Hexadecimal to Decimal
  • Try it Yourself


Before we begin our article we need to know first what is decimal and what is hexadecimal.

Using decimal representation means using base-10 representation of numbers which means that every digit of the number can be one of 10 values, 0 through 9.

A good example is 195. It’s is 3 digits and every digit is between 0 and 9.

On the other hand, hexadecimal is base-16 representation which means that there are 16 of base values that every digit in the number can be one of. These base values are 0 through 9 and A through F. From 0 to 9 are the same in dec (the shorthand for decimal). A equals 10, B equals 11, C equals 12, etc.

An example is 14 (decimal). If we need to represent it in hexadecimal we can say D.

Another good example is 9 (decimal). If we need to represent it in hex (the shorthand for hexadecimal,) you can say 9 too.

Color representation

You already know that a colors consists of 3 values; RGB (Red, Green and Blue). Although, there’re times when we blend it with another value (Alpha) to make color transparent, however it is not common. So we end up with 4 values (ARGB) to represent our color. True? Every value of these four occupies a single byte in memory so every value ranges from 0 to 255.

In HTML for instance you can represent any color by its name (if it is a known color like Red) or by combining the RGB values using hexadecimal (HTML doesn’t support Alpha.) You cannot use decimal values to represent colors in HTML. So you need to know how to convert between every decimal value to its equivalent hexadecimal and vice versa.

Converting decimal to hexadecimal

You already know that decimal values from 0 to 15 have the hex counterparts 0 through 9 and A through F so conversion will be very easy in this range. For a decimal value greater than 15 you need to apply a simple formula to convert it.

  1. First, divide the value by 16 (because hex is base-16), then add the hex result (e.g. A for 10) to the left.
  2. Second, divide the value by 16, and then add the remainder (modulus) to the right of the last number.


- 11 (dec)
11 = B
Result = B (hex)

- 160 (dec)
160 / 16 = 10
160 mod 16 = 0
10 = A
0 = 0
Result: A0 (hex)

- 254 (dec)
254 / 16 = 15
254 mod 16 = 14
15 = F
14 = E
Result = FE (hex)

Because every value of ARGB occupies a single byte, then the values range from 0 to 255 so in hexadecimal they range from 0 to FF!

Converting hexadecimal to decimal

For hex values from 0 through 9 and A through F, they have equivalents in decimal.

For values greater than F (15) all you need is to reverse the steps you did in converting decimal to hex.

  1. First, take the left digit and convert it to decimal. Then, multiply the result by 16.
  2. Second, take the right digit and convert it to decimal. Then, sum it with the result of the first step.


- B (hex)
B = 11
Result = 11 (dec)

- A0
A = 10
0 = 0
A * 16  = 160
160 + 0 = 160
Result = 160 (dec)

- FE
F = 15
E = 14
15 * 16 = 240
240 + 14 = 254
Result = 254 (dec)

Easy, isn’t it? A color like khaki (RGB: 240, 230, 140) in hexadecimal equals FF F0 E6 8C. To represent it in HTML you can say #F0E68C.

You can use Windows Calculator (in scientific mode) to make such conversions.