Friday, April 24, 2009

Funny comments in code.

Came across this thread at StackOverflow - http://stackoverflow.com/questions/184618?sort=votes
Some of them are really funny!
(Caution: Somewhat risque language on the page. You have been warned.)

Related Content

Thursday, April 23, 2009

I voted.

      I voted! After multitudes of trips to election centres since the last couple of months I finally got my name into the list. I went to a computerized centre near our place to check whether my name is in the list. Amazingly, it was there! They had made it 'Praveen' instead of 'Pranav' but, that is okay. I could vote after showing my driving license. I guess, today is the only day when you can show your middle finger to everyone, proudly ;)
      At the computerised centre, I could not help observing how they were treating the computer. The computers there were loaded with a Visual FoxPro based software (VFP I guess, because the software used DBF files). The machine was a P4 running Windows XP with <= 512 MB of RAM. The search was working at an acceptable speed. Suddenly, the operator realized that the machine was not responding to the keyboard. I was standing close and I pressed CAPS LOCK to check whether the keyboard led would respond. And indeed the keyboard was the problem, the wire was loose. By the time I could replug the wire, the operator had pressed the restart button! For the 15-20 mins I was standing there, she restarted the machine thrice. Only then I realized her expectation. She, very rightly, expected the machine to just work. She neither cared nor knew about filesystems getting corrupted, or the thrashing caused by insufficient RAM or the low speed due to mechanical harddisks. When she saw that, the machine was not performing well, the restart button solved her problem most of the times. In general, for a non-tech person, restarting Windows (rather than going to the root of the issue) is a nice way to temporarily get rid of the problem ;) With all those cold reboots, lets hope that the OS will survive the day...

Related Content

Native memory management in the JVM

Understand garbage collection and memory management is an essential when one wants to run business critical apps in a JVM. Although exhausting native memory is rarer than exhausting the Java heap, knowing when and how native memory allocation works would be a plus. Here is a nice article about how the JVM manages its native memory - http://www.ibm.com/developerworks/java/library/j-nativememory-linux/index.html

Related Content

Wednesday, April 22, 2009

Avoid URL shortners!

     Bit.ly is my favorite URL shortner. For the uninitiated, 'URL shortners' are web sites which allow you to convert long and wierd looking links to short ones. The advantage being, shorter links are easy to copy/paste, do not contain unusual characters (+, =, ? etc) and look tidy. URL shortners' popularity rose to a new high since the arrival of Twitter. URL shorterners ('US's from here onwards) are awesomely useful to the '140 challenged' twitter users ;)

     But, recently I realized that there is a big disadvantage of using USs. The disadvantage is - loss of data due to the camouflage. The disadvantage dawned upon me when after furiously searching all my mails for a particular link I could not find it. I distinctly remembered to have shared it with a friend over email. The link I knew was to a book from Amazon so, I tried to search for 'Amazon' but did not work. Finally when i found the mail, I saw that the link was a bit.ly shortened url.

     The shortened URL hid my own data from me. This was a good enough reason to stop using USs. Another reason is that, with a shortened URL you don't know what site it will open until you click it. In addition, there is yet another very serious reason to rethink about using USs. Today, there are dozens of USs. But, not all will survive the competition. Looking at their business models, some are bound to shutdown one day or the other. Then, what will happen to all the links they shortened ? Of course, those links will be dead. Sadly, the links which were shortened by the US might be very much alive then. Even then, they would be inaccessible just because the US site died. In other words, we are entrusting our data into the hands of not-sure-whether-reliable services. Effectively, once shortened my data is locked into the US's private DB.

     That was only the personal impact. I think there might be a much bigger impact. Out of curiosity I ran a couple of 'real time' searches for 'tinyurl.com' at twitter. From some observation and a rough calculation, I concluded that around 10 tinyurl.com links are tweeted per second! That is close to one million links a day just for tinyurl.com, just at twitter. Thus, one must agree that twitter has become heavily dependent on tinyurl.com whether it wishes or not. An outage at tinyurl for an hour and, tens of thousands of tweets around that hour will become meaningless! However, twitter can easily avoid US. They can change their 140 character limit to something like - 140 characters + one url (say upto 280 chars). The characters beyond the 140 limit would be ignored(as usual) unless they are part of a URL.

     If USs proliferate widely on the internet (i.e on newsgroups, forums, blogs, articles, howtos etc) we would have created for ourselves critical points of failure. The worst part would be - if a big US fails we would not even know what we would have lost. If millions of URLs suddently go defunct, the web might lose a large part of its connectedness! To add to it, US make it no easy for search engines. I wonder how much additional energy would be spent in first resolving shortened urls before they can be of any use to the search engine.

     I know, I have been a bit too skeptical throughout this post. But, theoretically, the things mentioned here could very much happen. Who would have believed 10 years ago that, going ahead majority of people will come to depend on one single company (Google) for their web search, emails, social networking(orkut), news, other reading(reader), shopping(froogle, google checkout) , maps, photos(picasa) and many more services.

Related Content

Saturday, April 18, 2009

A really wierd experiment by me.

Yesterday evening I set out from office to go to 'Relax' - the regular meeting place where we school pals meet every other weekend or two. It was around 8pm and there was quite some traffic on the road. At a signal on the way (name unimportant :)) I reached the crossing just as the light turned red.

        I was already dead slow and had almost stopped. Then I observed the middle-aged policewoman who was standing in the chowk to my right side at a distance of around 10-15 feet. Looking at the expressions on the face and her overall posture, I had a hunch that she would not be interested in stopping me(or anyone else for that matter) even if I went right through the red light. So, just to verify my (rather nonsensical) hunch I decided to jump the red signal, right under the nose of the police! It was an absolutely crazy idea, but for some unknown reason I was ready to risk a 100 buck fine to test it. So, I put my bike into first gear and slowly passed by her! Under normal circumstances, I would have been surely and easily caught, but yesterday it did not go the normal way. I missed the racing traffic from other directions by just a few feet. The couple of seconds it took me to cross the chowk seemed like a minute or so!(more on this phenomenon sometime later).
        I could feel the same kind of stress one feels when breaking one's principle or copying in an exam or while stealing some thing after making sure that nobody is looking(just a guess, haven't done it myself :)). But the big difference here was - there was stress but, there was no fear! Since, I was prepared beforehand to shell out the fine if the trial failed I could 'savour' (for lack of a better word :( ) the stress as i slowly drove past. It was a very different experience, worth writing on the blog!
        The important question that remains is - was my intuition that the policewoman wouldn't bother, an informed one or a pure stroke of luck ? I don't know the answer. One thing is sure though, I had never thought of or planned doing it before this time, it was a decision made in a split second. If I assume that, it was an informed decision then, can i define the decisive parameters employed in analzying the police's expressions ? No, I can't. And that's why I referred it to as a 'hunch' and 'intuition'. The only logic which can somewhat explain the phenomenon is to accept that, there is more to the brain than meets the consciousness! In other words, our brain does a *lot* of processing internally which we are not consciously aware of. Some of that 'invisible' processing is used to produce results which we call hunches or intuitions. After all, intuitions have to be a result of some orderly processing our brain does on non-random input. Intuitions definitely cannot be created from random input and random processing on it inside the brain.
        The hallmark of an 'experiment' is - acute control on your input variables; which, unfortunately, I entirely lack here. So, from the point of view of a purist, calling this episode an 'experiment' would be wrong. But who cares ;) I ain't writing a paper, its just a blog! So 'experiment' is fine :)
        Just to be clear, through this post I'm *not* trying to put forward any hypothesis like 'guessing people' without active interaction with them is easy or that I can do it (even to the slightest extent). I feel that, yesterday's experience of mine can be more easily attributed to serendipity than anything else.
        Lastly, shame on me for breaking a traffic regulation!!

Related Content

Friday, April 17, 2009

Amazing imitator bird!

Nature is great!




Related Content

LOD 30

A useful site to check out and compare side by side different fonts - http://www.typetester.org/
The side by side comparison IMO is the more useful feature.

Related Content

Tuesday, April 14, 2009

Violinist in a metro.

A man sat at a metro station in Washington DC and started to play the violin; it was a cold January morning. He played six Bach pieces for about 45 minutes. During that time, since it was rush hour, it was calculated that thousand of people went through the station, most of them on their way to work. Three minutes went by and a middle aged man noticed there was musician playing. He slowed his pace and stopped for a few seconds and then hurried up to meet his schedule. A minute later, the violinist received his first dollar tip: a woman threw the money in the till and without stopping continued to walk. A few minutes later, someone leaned against the wall to listen to him, but the man looked at his watch and started to walk again. Clearly he was late for work. The one who paid the most attention was a 3 year old boy. His mother tagged him along, hurried but the kid stopped to look at the violinist. Finally the mother pushed hard and the child continued to walk turning his head all the time. This action was repeated by several other children. All the parents, without exception, forced them to move on. In the 45 minutes the musician played, only 6 people stopped and stayed for a while. About 20 gave him money but continued to walk their normal pace. He collected $32. When he finished playing and silence took over, no one noticed it. No one applauded, nor was there any recognition. No one knew this but the violinist was Joshua Bell, one of the best musicians in the world. He played one of the most intricate pieces ever written with a violin worth 3.5 million dollars. Two days before his playing in the subway, Joshua Bell sold out at a theater in Boston and the seats average $100.

This was a social experiment about perception carried out around 2 years ago
Had they announced beforehand that Joshua Bell was going to play at that same place, people would have gathered by the hundreds. Although thousands of people passed by him while he was playing, no one could appreciate the music. What must have been the reason ??
One reason was that, those who heard him must have already been biased - how good can someone playing at the station be ? We often are consciously or unconsciously biased by the looks and condition of a performer. I've myself experienced such a bias. At Sawai Gandharva 2007, while I was sipping tea at a stall, standing beside me was a villager. Black in colour, zero in sophistication and wearing typical Maharashtrian white shirt (सदरा) and white cotton pants (पायजमा). I was told that he was going to present a vocal performance in the evening. My thoughts after looking at him were like - will it be worth listening to him ? I doubt how good he will be, etc. His performance in the evening turned out to be one of the best in the day! I remember his Yamani bhajan (कान्होबा तुझी घोंगङी...) to this day! The singer was able but not very well known in Pune(till that day) - Anant Teredal. I was incorrectly biased by his appearance.
Returning to the experiment - another reason for the un-appreciation would be - hardly anyone has enough time to hear music while hurrying for a train to work. This brings to light another important point - art needs you to spend some time with it until it beings to interest you and you appreciate it. Someone who is really interested in the art would have definitely stopped by the player after hearing only a small piece. In fact, one did stop, and he said(in the survey) that, the player at the station was 'superb' and 'technically proficient' and he had 'never heard anyone of that caliber'. Thus, he could enjoy the oddly positioned, unusually timed but brilliant performance which many people failed to notice. I've heard many people say that they do not like (for e.g) classical music. The reason I reckon is that, they've not spent enough time with that form of art to get to know it and decide whether they are interested in it. People tend to form an opinion even before taking enough experience.

A wonderful article describing the whole scene and containing Bell's comments along with a small video clip of his performance resides here.

Related Content

Monday, April 13, 2009

Car controlled using an iPod

Not even close to Bond's car's controls in 'Tomorrow Never Dies', but pretty interesting nevertheless; considering that, this has been put together at home and not at a multi-million dollar govt sponsored lab ;)



Related Content

Thursday, April 9, 2009

My favorite Windows utilities - Part 3

Many a times one needs to know which folders on the disk have taken up how much space. This utility is missed especially when one wishes increase free space on a drive by uninstalling programs and deleting data. Windirstat is the program which comes to use in such a case. Windirstat is actually a clone of kdirstat from the linux world. This utility scans a given drive or folder and graphically displays how much each sub folder costs you. Turns out to be really useful at times.

Windirstat is free and open source. It can be downloaded from here (size 630KB)

Related Content

Monday, April 6, 2009

LOD 2F

http://www.dailybits.com/100-sites-to-download-all-sorts-of-things/

Useful links to download all kinds of stuff - audio, video, ebooks, clipart, fonts, games, graphics, software etc

Related Content

Thursday, April 2, 2009

IPv6 over Social Networks!

Low IPv6 adoption has been long established to be a difficult nut to crack. On the other hand, social networks (Facebook, MySpace, Orkut etc) are facing scaling problems! How about using the burgeoning social network mesh to 'tunnel' IPv6 ?
That is exactly what RFC 5514 suggests. In fact, IP over Social Networks (IPoSN) has been implemented for facebook. Here lies the facebook app implementing IPoSN.
Enjoy ;)

P.S: For the uninitiated - this is a hilarious 'April Fool's' joke; RFC included.


Related Content