Sunday, April 20, 2008

When should a kid start using computers?

I didn't use a computer until I was 18 years old. But now-a-days, kids demand to use computers as soon as they are 5 months old. The first thing that my daughter demanded in all her life was not a toy or a food, but my laptop. Tough days ahead for me!

Friday, April 18, 2008

What have YOU won in all these years?

Now-a-days, there are a number of programs on TV where they ask you to either send SMSes or make phone calls for various reasons. The most common of these, of course, are talent shows where you think you are deciding the winner of the competition by sending lots of messages and your mobile service provider walks laughing all the way to the bank! The other kind is where they give out 'prizes' to the callers. One such program runs on a Kannada TV channel in the afternoon. It works like this: You basically send as many messages as you want/can on the previous day to 'register' for the program next day. The program is run live, where they call the people who have sent highest number of messages. They show a sari and ask us to guess it's price. If you guess it correctly, or if your guess is closer to the actual than others on that day, the sari is yours. Simple?

One of these days (18th March), my wife got the crazy idea of actually competing in this event. Off she went, sending a few messages, but she sent it in my daughter's name. The next day she was in front of the TV in the afternoon, to see how she fared. Unfortunately, the number of messages she had sent was nowhere close to the highest numbers that day. There was no way they were going to call her. However, as she sat there watching the program, it turned out that a number of people who the TV anchor called either did not pick up the call or were unreachable or busy and so on. As a result, the last person to be called for the day turned out to be my daughter! As the anchor announced the name of my daughter, there was a lot of cheering in my home from all. Celebrations had already begun. We didn't get the sari, but we got the consolation prize - cosmetics worth Rs. 1000. But my mom and wife didn't mind that. They were celebrating as if my daughter had got the first rank in CAT exams. My daughter, meanwhile, being all of 5 months old, was blissfully unaware of her achievement(!) and was thinking exactly what most babies of her age think, that is, "Should I cry now or later?" and "Huh?"

Now, winning the prize is one thing, actually going to the office of the TV channel and getting it from there is totally another. Considering that we were only going to get a box of cosmetics, most of which may be unusable, I was not even close to thinking of actually going and getting it. But my mom and wife had other ideas. "What have you won on TV in all these years? Nothing. She is just 5 months old and she has already won something in her very first attempt. At least for that reason you must go and get the prize". It was only then that the importance of my daughter's achievement and the gravity of the situation started sinking in to me. I quickly realized that I had no choice.

The office of the TV channel was right in the middle of the city, with no parking available anywhere in 2 Km radius of it. Finding the office was an appropriate job for Indiana Jones. Further, I had to make two trips to their office because of their restrictive timings. Finally, there was a little shocker. They wanted the person who had won the prize to come and claim it! We convinced them that the 'winner' was a 5 month old baby who won't claim anything in the world as hers for another few months. Finally, the prize was ours! It was a package of various cosmetic items from an obscure Japanese company which mostly sells in Sri Lanka. Not bad. Hey, my daughter must now be famous in Japan and Sri Lanka too. What an achievement!!!

Thursday, April 17, 2008

Human alcohol meter

A few days back, I was at the Kempegowda bus stand, a.k.a "Majestic", at around 11PM. I was dropping off someone for a late night bus. I started heading back and was at the first traffic signal, near Sangam, where a traffic policeman stopped my car by literally standing in my path. When he approached me I rolled down the glass of my car, wondering what this was about. He then put his head _into_ my car, so far inside that it seemed as if he was going to kiss the steering wheel. Well, I too like my car quite a bit, but not so much as to kiss it. While I was wondering whether this guy is drunk, he said "Your good name please, sir?" I quickly answered and he said "Okay okay. Just checking", took his head out and asked me to carry on. I was still surprised, but I carried on. Only after a couple of seconds did I realize why he did that: He was checking if I was drunk and he wanted to smell my breath to confirm. He was a human alcohol meter! I left pretty amused, but impressed. I ho
pe they take all drunk people out of roads and make roads safer for driving in the night.

Tuesday, April 08, 2008

How cpu frequency scaling can affect applications

I have seen a very interesting problem while playing "Cricket 2007" game on Windows. The problem is probably caused by cpu frequency scaling and it gives an interesting perspective on how power management in operating systems and hardware can affect application writers.

My laptop runs at around 800MHz when it is on battery and at around 2.1GHz when it is connected to the mains. Lets say I boot the system running on batteries and connect it to the mains after it boots up fully. If I run Cricket 2007 game on this now, it runs way too fast. The game is almost unusable at this stage. The only way I have found to rectify this is to reboot the system while it is connected to the mains. Alternatively, if I boot up the system while it is connected to the mains and later switch to battery before starting the game, it plays too slowly, far slower than a typical slow-mo replay. It is not the problem with the battery, because if I boot the system on battery and continue to run the game while it is on battery, it plays correctly.

The problem is pretty interesting. I suspect it is because of cpu frequency scaling because I can't attribute it to anything else. However, whose fault is it? application's? operating system's? I have some thoughts, but I have no idea of Windows internals, so I can't be sure.

The application has no idea that the cpu frequency has changed before it is started. It must be doing some calibration for timing when it is started, by reading the frequency of the cpu from the OS. It is quite possible that the OS does not provide correct information to the application. Lets say the system was booted at 800MHz and the OS stores this value somewhere. Later the system could be running at 2.1GHz, but when the application queries, OS still says it is running at 800Hz. The application does it's calibration based on this number and it goes horribly wrong because the cpu is running much faster.

On second thought, it is not correct for the application to depend on cpu frequency being constant. This frequency could be varying all the time on modern hardware, so any application that depends on this value for it's timing calculation could go wrong. The same holds for any application that performs time calculations based on TSC. Depending on TSC is an even bigger mistake on SMP systems.

Saturday, April 05, 2008

What is a .docx file?

Today someone sent me a MS Word file in an e-mail. Being a Linux user, I don't quite like working with MS-Office documents. However, I have accepted it as a reality of life. Also, Openoffice is now good enough to handle most MS-Office files.

The file I got today in mail had a .docx extension to it. I initially thought the sender had saved the file with wrong extension, but soon realized that Openoffice doesn't know how to open it. "file" command on the file says it is a zip file. Hmm... okay, let's unzip it. It contained a bunch of xml files among other things. I wasn't sure what was happening. The obvious next stop was google.

Google told me that .docx is an ooxml file, which is the latest standard for office documents being pushed by Microsoft. Openoffice doesn't support it yet, so there was no way (that I know of) to open it on my Linux. I booted to my Windows partition and showed the file to MS-Word. It too refused to open it. Hmm... some more googling revealed to me that the ooxml format is the default on newer MS-Office versions, whereas older versions don't support it. There is an update available from Microsoft that makes old versions of MS-Office handle ooxml files. The update was 26MB in size, so instead of pulling it down, I asked the sender to save the document in older MS-Word format and resend it.

A couple of things that surprise me are, a) MS-Office has been using ooxml format as the default for a while and I don't even know about it. b) Users of new MS-Office will typically save their files in new format because that is the default. That means all users of old versions will need to pull down this 26MB update to see these files. 26MB is not a very small size for low-bandwidth users.

I hope ODF benefits from all this.

Tuesday, April 01, 2008

What makes software great?

As time goes by, I have started appreciating usability much more than any feature in software. For that matter, anything. Using a well-designed product is so much more fun that using a feature-rich but difficult to use product. Did I hear someone say "The GIMP"?

Today I was in a well-known hospital who had their registration and billing software custom-made by one of the biggest software services companies in India. I am not going to call names, but lets just say it is the company that is largely owned by one of the richest persons in India. They charged me registration and consultation fees upfront and everything was fine until I was about to leave, when they had to charge some more fees due to the doctor. The software raised an exception that consultation fees cannot be charged two times. There was no other category to put the fees under that would allow the money to go to the doctor and not the hospital. Further, the consultation fees was fixed by the administrator and the lady handling billing system could not change it. After a number of phone calls, she caught hold of the administrator who provided a lengthy workaround to the problem. No wonder, she was cursing the software and the company who wrote it :-)

I wonder how much of actual field testing is done before deploying such software. Do they hand it over to real-world people to try it in actual day-to-day scenarios or just sit in the offices, think of possible scenarios, write the code based on their assumptions and roll out the product.