Category Archives: Programming

Demonoid is back

If you know what is Demonoid, then you might already knew that its back, hurayyyy!!. and by sheer factor of luck if you don’t have any idea what this would mean, then my sympathies are with you. :P.

Demonoid, is a site for sharing torrent files. It hosts a large no. of torrent files. Torrents are sort of links to actual files which are hosted on different peers all over the world. Bit Torrents is p2p technology for sharing large files. Users usually get a torrent file from servers like Demonoid, piratebay, meganova,torrentbox. These torrent files contain links to the tracker of the data file ( e.g movies, Linux distro etc). The actual downloads are not hosted on the servers and are dispersed over a no. of peers. Most of the time, torrent client is downloading different chunks from a large no. of peers. Trackers are used to collect statistic about a torrent i.e no of uploaders a.k.a seeders, and no of downloaders a.k.a leechers, and are very vital to the torrent network. Most of the torrents sites are usually available for free, you might required to create an account. However some requires paid subscription for accessing the listed torrents and only allows registered members to access the tracker. Some sites, although free, but require you maintain certain DL:UL ratio (usually at least 0.5), you may receive a warning if your ratio get too low. This is intended to promote a sharing community, because without sharing, torrent community will come to its knees. It is often recommended to upload at least the amount which you have downloaded.

So, what’s so cool about Demonoid. I think, it is the best torrent site, I have ever landed on. It is free if you want to access only latest uploaded torrent files, but to access the older files, you are required to be registered. Registration is also free, but opens only at some unannounced time during each month(usually start /end of month). Torrents are usually of good quality and categorized making them easy to locate.

Demonoid has been receiving law suits threat from the beginning, they moved their server from Germany to Canada ( afaik ) to avoid them. Last week they received another notice from CRIA. (Why these anti-piracy morons always come when something is hitting the big scene, where were they, when the technology was in its infancy, I am sure an intelligent investment at that time would not only benefited them but also they might have contributed something important to the computer industry.)Their website was down for few days, though the server was replying to ping messages. Now they are back. welcome back!!






gotdotnet, is now being phased out. Although Microsoft has extended the timeline, so the users can coupe up with the changes but eventually it has to end someday. There are several others community platform which Microsoft has recently launched. Two of them I would like to mention, Codeplex (sort of sourceforge like initiative). and (for supporting windows application on .net). I don’t like Codeplex thing, but its better to have something instead of nothing. Windows Client is a better site with forums, and articles to help .net developers on windows desktop applications. It targets winform as well as windows presentation foundation (WPF). These two sites may provide a better replacement for gotdotnet. Lets see.



Default ThreadPool size in .net 2.0 SP1

ThreadPool in .net framework , as the name applies ,  a pool of thread, that an application can use to execute diiferent code section concurrently, instead of creating its own thread. Application borrows thread from thread pool to exectue via ThreadPoolQueueUserWorkItem , which queues the request , the request is furnished when a thread is available in the thread pool. After execution , the thread is returned to the pool so other requests in the queue can use it. Thread pool are mostly utilized in Asynchronous Programming model.

In the release of .net framework 2.0 , the default max no. of available threads in the pool was 25 per processor. You can set it to a different value, but it is usually discouraged to set to a value too higher, and you may need to reconsider your application (profiling etc) , since it may lead to starvation of the threads. With .net 2.0 SP1 , this max no of thread has been elevated to 250 threads per cpu . Joe Duffy has discussed about necessity of this higher limit in his post.

well I think it is not a good decision, setting a default 250 limit, will result in larger startup time to intialize the thread pool. Though you can set your limit to a lower level,(do it as early as you can). But I think this feauter should be an opt-in feature , instead of an opt-out (as .net framework 2.0 already presents it).



Blog Publisher source code uploaded

I have uploaded the blog publisher (messenger add-in)  source code, and added it to my projects section. Check the projects page. 

I will be adding few more fun apps soon , so do check back later.



some activities

ever since I got a domain for my self ,I have been trying different things to make most out of it. At the moment I have set up my googlepages and follow to my home page at Google page. There is nothing much there except a link back to this blog.

I have also set up a wordpress installation on my laptop. Though they claim that it takes merely five minutes to install the wordpress and running, but if you have done any previous installation of mysql and PHP, it might take long.(took me 3 hours).

I started with the download of PHP and mysql. MySql has a community edition, which comes with an installer for windows machines. There is also an extension for php, to enable accessing mysql APIs from php. MySql installation was a breeze , I also installed the UI for interacting with mysql. Then came the turn for Php.

It was I think my first encounter with Php. I didn’t have any idea how php works and how to install it and configure it with the web server. When I reached php website , I found that there are two branches of Php supported by the php team, one is version 4.xx.xx, and other is 5.xx.xx. that made me confuse. To me the difference between the two was not obvious. shouldn’t the 5.xx version is the latest one, then why still keeping 4.xx.xx . well I still don’t know the difference clearly. What I understand from different articles is that , version 5 introduces support of object oriented programming and has an improved core engine. ( please correct me if I am wrong). they are still supporting version 4 as many of the current php installation are using version 4 and version 5 introduces some breaking changes. Well wordpress says that they officially support version 4, but one can also install wordpress using version 5. So , I proceeded to download the latest version of 5.xx.xx series.

After downloading it , I executed the installer, which prompted me for opting how to configure the php with web server (IIS in my case) whether to run it as CGI application or ISAPI filter, later on it asked for installing extensions. I opted all and that was the worst thing in the installation, it enabled each and every extension and completed the installation. There were 103 extensions. and it took me 1-2 hours for hit and trying which to run and which not to, at the end it comes out only 2-3 extensions that were enabled. One important note , use MySql’s mysqllib.dll when enabling mysql extension, not the one supplied by the php installer.

well that’s done , my local blog was up and running. I also did few more things before installing the blog. We have a router in our home connecting our equipments to the Internet. I forwarded the port 80 on router to my laptop  (also enabled my laptop firewall to allow port 80), so that I can host my blog on my laptop, while others can access it easily via Internet. I also made a sub-domain ,, and directed it to the IP of my router. so you can access it via  :). This address may not be alive for the whole time ,specially when I am in Pakistan. but you might check it  from 9 PM – 9am ( uae time )



My Fist Live Messenger Add-in : BlogPublisher

Well Its my first experience with live messenger addin. I wrote a blog publishing addin , that reads RSS feed from the blogs or any other site and updates my Personal Status Message on Live Messenger at regular interval (at the moment it updates after 30 secs) .


Windows Live Messenger exposes the Add-In functionality, though its still in beta stages and not fully exposed to the users. However for the developers, it can be enabled by setting up a key in the registry \HKCU\Software\Microsoft\MSNMessenger

Add a  DWORD “AddInFeatureEnabled” and set its value to “1”.

Now Sign in with your windows live messenger, goto options , you will see  a new add-in tab in the left pane.


Now comes hard part  or should I say the fun part. You can develop a plug-in for yourself too and its easy. Live Messenger exposes its functionality via MessengerClient.dll, which has been exposed as .net 2.0 assembly. As of now , the Live Messenger supports plug-ins targeted for .net 2.0.

To start developing the plugin, just add the reference of MessengerClient.dll , (you can find it in the msn messenger installation folder, default location is <ProgramFilesDir>\MSN Messenger\MessengerClient.dll).

Create a new project in visual studio 2005, or other IDE you are using, add reference to the dll by browsing to the directory. Messenger exposes its add-in functionality through  IMessengerAddIn Interface. This Interface has one method ,Initialize(MessengerClient). This method is invoked when your add-in is being loaded. Here you will receive a messenger client object. The MessengerClient has following members:

  1. Properties
    • AddInProperties : Information about the AddIn, DisplayName , Private Message , Creator Info.
    • LocalUser : Information about the signed in user.
    • SavedState: Storage for pluging specific data (like settings etc.)
  2. Methods
    • SendActionMessage
    • SendTextMessage
    • SendNudgeMessage
  3. Events
    • IncomingTextMessage
    • OutgoingTextMessage
    • ShowOptionsDialog
    • Shutdown
    • StatusChanged

I think all these members are quite self explanatory. ShowOptionsDialog occurs when the user clicks on the Settings button in the Add-In Screen in Option Dialog.

So Where to start, well create a class , implement the IMessengerAddIn interface and the world is all yours. But watch for the tricky part, Messenger expects the assembly name as per the NamespaceQualified Name of the Addin Type. So if you are implementing the interface in MyTestAddIn, which is in the namespace of MyMessengerAddIns, then your assembly name should be MyMessengerAddIns.MyTestAddIn.dll . yeah yeah I know that’s insane , but its how the add-in works in messenger, might be this behavior change in future as we have the beta right now.

Now invoke your imagination power and do something creative. I worked out a blog publishing plug-in, which will fetch the rss feed from the blogs (which you can specify in the settings box) and then updates your personal messages setting it to the entries in the feed at regular intervals.


I wrote a simple RSS reader, which reads the feed from the URL , then parses it into a model, (it only reads selected properties.)  Reading RSS is quite simple , its simply an XML document. You can get the full specification on the Internet, or just view the source of any rss feed in your browser , you will understand the structure easily. I have two timers in my AddIn one for updating the personal message at regular interval and the other for checking the updates on the feed.

Important Notes:

The Messenger AddIn is executed in Internet Zone (so you have very limited permission to do anything, no file access , no internet access 🙂 ) unless you strong name your assembly and install it in the gac. 

To Debug the add-in via Visual Studio Debugger, goto the Project Properties and set the Start Action to start an external program i.e “msnmsgr.exe” it is in the same directory as the MessengerClient.dll. When you run the project in VS,it will invoke the messenger, which in turn load your dll. Install your assembly into gac , after the messenger is invoked and while it is loading your add-in. that way it will not be obstructed by Code Access Security obstacles.

Each Add-In is executed in it own Application Domain , and it is sandboxed , so that it will not harm other  add-ins.

Resources :

Special Thanks to Bart De Smet for his post “Your first Windows Live Messenger add-in” , a very nice and well written tutorial to the add-in functionality. Another excellent article on CodeProjectCreating Windows Live Messenger Addins” by Filip van der Meeren. For RSS reading , “You Own .Net RSS Feed in C#” by James H. Byrd  and RSS 2.0 Framework by Chris Richner are very helpful.

Where to go from here:

well the options are uncountable. I am thinking about writing a secure chat plug-in so that it will encrypt you conversation using some public key algorithm, so that no more msn sniffing can haunt.

Source Code :

I will upload the source code soon , I am looking for some file hosting site, as the wordpress only uploads images and pdf files. Please check back later, or if you need it immediately then just drop me a comment.


I have working on some reflection and CodeDom stuff in .net 2.0 . My requirement was to create  types at runtime by emitting in memory assemblies (i ll put the details later on) . At one place i encountered a naive and innocent looking function  Type.GetType(string) .  As i typed the method , intellisense popped in and suggested the usage of the method ” Get the Type with the specified name, performing a case-sensitive search.” (its in msdn), so i called  the method with  Type.GetType(“Font”) and to my amazement it returned. i was puzzled as  i was running a winform application and Font type is one of  important types  in winform apps.

I looked for the remarks section in msdn , it says  GetType method takes  a Type name and search for it in the current assembly or mscorlib, if you supply  Assembly Fully Qualified Name (AFQN), then it will load the assembly and search in it. i tried again by giving Typename, assembly name format , but i guess i made a mistake there, which led me to these pages

Type.GetType(string typeName) returns null !?  by  Haibo Lou
TypeName Grammar    by   Yiru

In summary , Type.AssemblyQualifiedName is the typename one should pass when calling Type.GetType(string) with public key token and culture. I think MS should update their documentation, so that API summary should state what it is expecting .