August, 2010 browsing by month


Content types for Response object

Tuesday, August 24th, 2010

I always wondered where to find all the MIME types and subtypes that you usually set in Response.ContentType property? Yes you can Google it. But I found out today that Windows registry has a registry entry under the HKEY_CLASSES_ROOT just for that. This is where you get a complete list of all legal MIME type/subtypes:

HKEY_CLASSES_ROOT\MIME\Database\Content Type

There are five content types Text, Image, Audio, Video and Application. It is the subtypes that have made the MIME\Database\Content Type very large

Examples found under this registry key: application/msword, application/ms-powerpoint, audio/mpeg, application/pdf, audio/x-wav, application/ (for exporting web data to Excel), etc.

Under the MIME\Database, you can also find other goodies such as all the Codepage listing.

Using Google-hosted jQuery library

Monday, August 9th, 2010

Nice thing about using Google hosted jQuery is that I could call jQuery lib from anywhere and take advantage of versioning  and compression maintenance work done by Google. According to some source, the better caching provided by Google actually speed up the loading of the javascripts.

For example, below is a dialog box that uses jQuery UI hosted at Google. Click on the link to see it in action.

Show Dialog

Source code:

<link href=”” rel=”stylesheet” type=”text/css” />
<script src=””></script>
<script src=””></script>
<script type=”text/javascript”>
function showDialog() {

$(“#dialog”).dialog({autoOpen:false, modal:true,buttons: {OK:function(){$(this).dialog(‘close’); }}});




<div id=”dialog” title=”hello dialog”></div>

Install a Window Service

Sunday, August 1st, 2010

Here were the steps I went through to install a Window service called “Yangsoft Greeting” that will simply say a greeting when user first logs in to a PC:

  1. Create a Windows service project using the service template from VS2010
  2. Right click on the service.cs designer surface and add a service installer (ProjectInstaller.cs)
  3. Once I added the ProjectInstaller, there were two installer components needed to be configured properly, one is for service installer and one for service process installer. ServiceInstaller is where you define the name, description, and display name of the service; ServiceProcessInstaller is where you define which account will be used to run the service. The account to choose is LocalService, LocalSystem, networkService and User. The User account requires a user name and password when the service is installed.
  4. After compiling the solution, next step is to install the service so that it will show up in the Windows service list. There are two ways to install a service, one is manually running InstallUtil.exe from command line, for example : C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe    F:\Development\GreetingWinSvc\VoiceGreeting\bin\Release\Yangsoft.VoiceGreeting.exe
  5. The other way is to create a Setup and deployment project and package everything into a MSI file.