Mind Your Own Business


What other people think of you is none of your business.


Times of India:

Don't pray for things you are not willing to work for.

Sublines 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.

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 summarise:

Windows XP and Windows 7
Given Value Effective Value
10 10
100 100
200 200
500 500
Windows Server 2003
Given Value Effective Value
10 10
50 50
63 63
64 Infinite
100 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 behaviour. 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);
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);

Review - 2 States: The Story of My Marriage

Chetan Bhagat brings the same witty sense of humour that we all have learnt to love. Still you can’t say you didn’t find anything new in book.

2 States: The Story of My Marriage
2 States: The Story of My Marriage

This book is about a punjabi boy Krish who falls in love with a madrasi, o’oh Tamilian Iyer Brahmin girl named Ananya during the course of his MBA from IIM, Ahemedabad. But don’t think the book is about how they fall in love. That’s just first 25 pages after which you find them in love (and sex off-course). The book is about what happens after that. The book is about how the boy starts his difficult journey to his marriage. Which means both his and her family has to love each other. Which becomes a herculean task considering both comes from very different states, culture and expectations!

Krish’s mother is very talkative and she gives all the reasons to Ananya’s family to hate the boy but he doesn’t give up. He wins the heart of girl’s family one by one. Once that mission is accomplished, its now girls turn to impress boy’s family. Just when you think everything is going well, some ugly incidents take them back to square one.

The thing that stands out in the novel is the flow of events that happen in Chennai which brings the boy in the good book of Ananya’s family. Nothing seems unnatural or unbelievable when slowly but surely boy does his magic. The non-stop of supply of quick-humours makes it a splendid reading. But the incident which makes the Krish’s mother to accept the girl looks a slight bookish and even though my heart wants to believe it, brain refuses to do so. Apart from that one incident, other things fit well and even though the story of their marriage comes back on track almost by a miracle, it easily becomes understandable.

I don’t know if it is only me but at one point you think that boy is doing so much to make that marriage work and he loves the girl a lot but somehow you don’t feel the same way about the girl. She doesn’t seem to do enough to commit herself to marriage. At some places, you even find her arrogant and too harsh on the boy. You feel bad for him!

I have always been confused about how much of the novels that Chetan wrote, is actually true. Various novels seem to have a link with Chetan’s life and with each other. Off course, all of the stuff is not true because it takes more than just a single life to make so many interesting novels. But I can sure conclude following points which I believe are true incidents:

  • Chetan did study at IIT Delhi and IIM Ahmedabad! (Okay that was very naive to start with :)
  • Chetan did love a girl during his study at IIT-D which didn’t conclude well.
  • Chetan’s grades during the IIT are actually NOT good.
  • Chetan did love a girl during his study at IIM-A and eventually married her.
  • Chetan did find it hard to convince his in-laws. May not be as dramatic but still difficult enough.

Things I liked about the book:

  • Sense of humour (I just love the witty lines)
  • Perfect characterisation of punjabis (Not sure about Tamilians since I don’t know them well enough)
  • Flow of events

My recommendation? Just read it. It will be a fun ride!

Ingenious Fools

In Mostly Harmless by Douglas Adams:

A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools.