Sunday, April 20, 2008

Microsoft .NET team spoiled my weekend

Well the plan for the triple thrill weekend went for a toss and culprit is me and Microsoft. Me for making certain basic assumptions about .NET as a framework and Microsoft for breaking those assumptions :).

Well so here's an interesting fact.
If you have .NET Framework 3.0 installed on your system, it doesn't mean that you have the .NET framework 2.0 SP1 class library as well on your system.

Yeah really i ain't kidding here...
According to the msdn (http://msdn2.microsoft.com/en-us/library/bb822049.aspx) .NET framework 3.0 installer would install 3.0 on top of 2.0 or 2.0 SP1 whatever is available on your system. Now .NET 2.0 SP1 gives some extra classes (I used DateTimeOffset in my code) .

The assumption i made was that if the user has .NET 3.0 on her system of course the class would be available since if a class is present in .NET 2.0 SP1 it won't be absent in a higher version. However it is not true. I can't blame MSFT since they documented it however the fun is that if i install .NET 3.0 SP1 then i have that class again.

So the matrix becomes ...
1) .NET 2.0 Class not available
2) .NET 2.0 SP1 Class is available
3) .NET 3.0 May or may not be available
4) .NET 3.0 SP1 Class is Available


and the 3rd line in the matrix is what spoiled my previous weekend. I got a call from office on a saturday that things are not working and throwing a runtime exception and i had to cancel my all weekend travel plans to figure this out.

Well what can i say except that yeah its a mess up done by me (Since i didn't read the documentation) however i still believe folks at Microsoft messed up.
I think its a happened of deadlines and schedules of the framework release ....

So its a lesson for me that now on i would never believe on classes introduced in SP releases of .NET framework....

~Abhishek

Friday, April 11, 2008

Duplicate e-mails detection by a mail client

This is the topic i worked on for last 2 days and i still do not have a certain answer. Basically i was trying to find out how can a mail client like outlook or may be Exchange server detect a duplicate message.
The scenario i considered is like the following
I send a mail from a@a.com to d@d.com. Now there can be 2 paths from SMTP server for a.com to SMTP server d.com and the paths are a.com->b
.com->d.com and a.com->c.com->d.com Now what happens if a.com relays the message to both b.com and c.com . This can be because of a bug or may be because of some implementation logic. In such a case d.com would receive the same mail twice and then the question is will the SMTP server at d.com or a mail client for d@d.com be able to detect that it is the same copy of 2 messages.
Me and my colleagues' thoughts on looking at the mail headers of various mails in our inbox was that the Message-Id parameter in the message header should help detect and delete/merge such duplicates.
So i did a simple POC by sending 2 messages with same message id (even same header) to my inbox. And i got 2 messages in my inbox as well :(.
Now the question is, is it a exchange/outlook bug or a feature. I still do not have an answer. I'll be trying it for my gmail account soon.
In the meantime i got SMTP specs by Jonathan Postel on http://www.ietf.org/rfc/rfc0821.txt and a cursory look at it makes me conclude 2 things
1) An ideal SMTP server would never do something as crazy as i am thinking (It very clearly discusses the protocol for relaying a message from 1 SMTP to another and i kind of feel that it would do it only to 1 SMTP server and would jump to next only when it gets an error code. No clue on what happens if other SMTP goes down after receiving this message and before giving a OK)
2) Message Id is something we can't rely on as primary key for an e-mail message as it is quite possible that there are malicious SMTP servers which can change the header while mail is passing through their place.

So on the whole my current feeling is ideally the duplicate e-mails won't be generated and if they are then there's no fool proof way to figure them out and merge them at the destination server/ mail client.


~Abhishek

PS :- I am off for triple thrill of Climbing, burma bridge and rappelling this weekend. Will write a post on that once back and some more details on the above topic as well :)

Sunday, April 6, 2008

Conquering the nandi hills on foot

Finally after a long time I did what i wanted to do long back :)
We trekked the nandi hills on foot...
Well the idea was to go to Kalvarhalli Beta (Henceforth K-Beta) for a trek with 4 friends however that didn't work out. We had planned to start at 4 in the morning and the start got delayed by an hour and a half (As usual when its waking up early in the morning me and all my friends are late :) ) Anyhow we started off from my place at 5.30 in the morning and on the way decided to go to nandi hills instead of K-Beta as it would be damn hot by the time we figure out our original destination.
My first reaction in the morning when we got up was forget trekking we'll just go on a drive and be back however by the time we reached nandi hills i was all pumped up :)
So as soon as we reached nandi hills (Around 6.30 ) we did a small trek on a small hill first so as to warm ourselves up and see if we can catch clouds on the peak of this small hill. As luck would have it by the time we reached to the peak the clouds were gone :(
Anyhow it served as a nice warm up trek (4 Kms) for us and the next in line was Nandi hills waiting to be conquered.
So we came down, had a nice breakfast and started Nandi hills trek on foot at around 8.30 AM. On the way we got some nice patches and the brutal sun. By 11.30 AM we were up on Nandi hills and it was quite tiring to walk all the way up. Once up all of us jumped on all the water, melons, anything which can rehydrate us...
We killed some time on the top and then everyone was of the opinion to take a bus back however on persistent pleas made by me and because we had to wait for the bus for at least 45 mins. we all decided to walk all the way back and damn it was fun.
Specially the last 4 Kms as everyone was stretched out of their limits and that's what the treks are meant for. To cross the boundaries of your physical limitations (Wow i can't believe i came up with that :D )
At the end we all reached the foot of the hill and somehow made it back to Bangalore. All tired and dehydrated it was a fun trek and the good thing was to see that the sunburn hit me back after the ski vacation in Auli.
We made a total walking of around 20 Kms during the day :)
At the end of it as they say pictures speak.....
Here are a couple of them from my camera





~Abhishek