Markdown

Heading 1

Below is some text for heading 1.

Heading 2

And Here is some text heading 2.

Heading 3

Some text for heading 3.

Heading 4

Some text for heading 4.

This is some quote from John Gruber. How about another.

But a blog cannot be complete without some some code:

for (int i = 0; i < 100; i++)
    Console.WriteLine ("Hello World");

This is bold and this is italics.

See you later.

Sublines 1.0.0.2 is available now

There was a problem in earlier version of Sublines which caused problems in other types of subtitles. This problem has been fixed and latest code is uploaded. You can download the latest client from sublines site.


Sublines - Easy subtitles on Mac

I have started an open source project called "Sublines" which allows the users to download subtitles on Mac OS X. Project is hosted on Google code site. Feel free to download and use if you need it.

Project Site: http://code.google.com/p/sublines/


Leaving no stone unturned

As a programmer myself, I used to think that I do my job very carefully. I used to think that I am the person who really thinks about possibly everything before I actually write code and ship it.

I was wrong! I currently have an opportunity to work with a person who taught me what it means to put your heart and soul to software you are writing. He taught me what really unit testing means. He taught me the real meaning of "leaving no stone unturned".

And whats more surprising is the delight you get when all the hard work is done. You hear the validation engineer saying "I am already confident with this software, we have almost no issues". When you ask the market facing people about their demo setup, they say "all is going well". Writing a quality code takes efforts first time but makes us free from support trouble for a long time after that.


Visual Studio 2010 - Released

Visual Studio 2010 is officially released now. Full information here.


Unexpectedly big Nokia device software


Today I was trying to update the firmware of my Nokia E71. So I launched Nokia Ovi Suite and started the update operations. I was simply shocked to see the device software size:


Total phone memory is 128 MB. Does the device software takes 102 MB? Can you image you buying a laptop with 120 GB hard disk only to find out that your operating system takes 100 GB and you are left with only 15 GB to play with.


Windows Experience Index

Today I ran the windows assessment test on both my earlier HP laptop and new MacBook. And here are the results:

HP Laptop (hardware details):

MacBook (hardware details):

Having done this, it is definitely unfair to compare both since:
  1. I bought HP laptop more than 2 years back whereas my Mac is brand new.
  2. My HP laptop was priced $650 and my Mac is of $750.
Another interesting thing to note is that windows reports that my Mac is 64 bit capable.

Tuning the backlog for TCP server

Yesterday we spent a lot of time of analysing the effects of backlog parameter on a server performance. It seems to affect the new connection acceptance rate. But what should be the right value for a high performance server?

It turns out that a right balance must be maintained when deciding the right value of backlog parameter. Selecting a too low value will result in new connections being refused in case of a connection burst and selecting a too high value will make your server vulnerable to syn attacks (taking food in the plate more than you can eat is always going to create problems).

So the backlog parameter must be decided based on following 2 criteria:
  1. What maximum connection acceptance rate you are designing your server for?
  2. What is maximum time you can take between serving new connections?
For example, if you are designing your server for maximum 100 connections per second and your server is so busy that it might not server new connection request for 500 msecs then your backlog should be 50!

But there are more interesting things. Various operating systems exhibit different behaviour with different backlog values.

Windows XP and Windows 7 both have a hard limit of 200. So any value of more than 200 will not have any effect and real backlog will be of 200 only. Though it does make sense considering these are desktop operating systems and aren't supposed be hosting real world high performance server applications.

Windows Server 2003 (Standard edition) is very polite (may I say too polite) because it assumes an infinite value for backlog if given any value beyond 64.

To summarize:

For Windows XP and Windows 7:

Given Value: 10: > Effective Value: 10
Given Value: 100: > Effective Value: 100
Given Value: 200: > Effective Value: 200
Given Value: 500: > Effective Value: 500

For Windows Server 2003 (standard edition):

Given Value: 10: > Effective Value: 10
Given Value: 50: > Effective Value: 50
Given Value: 63: > Effective Value: 63
Given Value: 64: > Effective Value: Infinite
Given Value: 100: > Effective Value: Infinite

Last surprise what that when experimented with Windows Server 2008 (standard edition), it showed the same behaviour as Windows XP and Windows 7! Well that was strange. I think the server must have some configurable parameter to control this behavior. But I couldn't experiment with it since it was too late in the office yesterday and my wife was yelling at me...

Picking IP address and port number when using UDP

I have just finished experimenting with UDP using C# and .NET 3.5 and thought it would be nice to throw the findings on the blog to stop myself loosing track of them.

Listening on port n

First of all, when you are listening for packets, it doesn’t matter whether that packet was only intended for you or it was a broadcast. Suppose you are member of an email group in your organisation. You receive emails sent to that group but you also receive emails that are sent only to you. The way you receive and read your emails is unaffected by the fact that whether it was sent to the whole group or just to you.

Similarly, when listening for UDP packets, you just get one when you should. So when we are listening for packets, life is simple and we just listen on given port:

socket.LocalEndPoint = new IPEndPoint (IPAddress.Any, n);

//Remote end point can be defined in following 2 ways:

socket.RemoteEndPoint = new IPEndPoint (IPAddress.Any, 0);
//or 
socket.RemoteEndPoint = new IPEndPoint (IPAddress.Broadcast, 0);

Broadcasting on port n

If you wish to broadcast some packet to a given port, specifying local end point is not mandatory. If none is provided, a free port will be automatically picked. But we do need to specify remote end point:

//socket.LocalEndPoint = Not mandatory;
socket.RemoteEndPoint = new IPEndPoint (IPAddress.Broadcast, n);

Sending a packet on given IP address and port

If you wish to send an UDP packet to one computer specifically, you just need to define that IP address when setting remote end point. Local end point still remains optional:

//socket.LocalEndPoint = Not mandatory;
socket.RemoteEndPoint = new IPEndPoint (IPAddress.Parse("w.x.y.z"), n);