The latest issue of The Week has an article titled “The Taste of India” by Vir Sanghvi, where he tries to explain why most foreigners do not appreciate Indian cuisine. Apart from being a famous journalist and a television interviewer here in India, Vir Sanghvi has also been writing about food for some time. He also hosts the show "A Matter of Taste" on Discovery Travel & Living. In this article he argues that what the foreigners normally get to taste is not the real Indian cuisine and that Indian cuisine is far too varied and subtle when compared to other cuisines.
Archive for 2007
[2007-12-26] Indian Cuisine
[2007-12-22] IIT Kanpur
I had a chance recently to visit my alma mater IIT Kanpur. It has been over 11 years since I graduated from that place. This is the first time in all these years that I got to visit the place, though I had been yearning to do so all the while. It turned out to be a mixed experience - I found IIT Kanpur to be familiar and estranging at the same time.
[2007-12-18] Website Hosting Provider Changed
HostingZero has disappeared mysteriously and has been unavailable for at least about three or four weeks now. This website was therefore down as well. I was hoping to see HostingZero get back on-line, but it has been quite some time now and I am giving up hope.
[2007-12-04] The Golden Compass
Some days back, I saw the trailer for the film "The Golden Compass". I am eagerly looking forward to watching this film, as it is based on the eponymous book that is the first in the fantastic "His Dark Materials" trilogy by Philip Pullman.
[2007-11-15] New Delhi
In a quirk of modern air-travel, it is usually cheaper to travel from Bhopal to Bangalore via New Delhi, which is about 750 kilometres in the opposite direction, than via Mumbai which would appear to be a much shorter route. This time Anusha and I decided to use the opportunity thus afforded to stay over in New Delhi for a little over a day and see some of the main tourist attractions.
On a recent trip to Bhopal, Anusha and I visited Pachmarhi. Pachmarhi is a little-known, but very beautiful, hill-station in Madhya Pradesh that deserves to be more popular. It is the highest town on the Satpura range of hills, situated about 900 metres (3,000 feet) above the sea-level. It is surrounded by the Satpura National Park.
[2007-11-11] Website Design Tweaked
I have tweaked the design of this website a bit. It should now be slightly easier to get a quick overview of the available content on some of the pages. (Note: You might need to reload script.js and custom.css to properly see the effect of the changes, if you have visited this website some time in the recent past. This is to avoid the problems caused by stale copies of these files cached by your web browser.)
[2007-10-19] Lossy Marvels
JPEG and MP3 are very popular formats for storing photographs and music respectively. They are both lossy formats and yet achieve amazing compression ratios without a loss of quality that is easily perceptible by normal people. I have always wondered how this is achieved.
The Economist carried an obituary for Alex some time back. Alex was an African Grey parrot that Irene Pepperberg had trained to actually understand what it was talking about, unlike the parrots raised as pets which merely repeat whatever they hear.
[2007-10-11] ICFPC 2007: Epilogue
The results of ICFPC 2007 have finally been announced. Team Smartass from Google has come first (yet again), followed by United Coding Team from the University of Cape Town (South Africa) in the second place and Celestial Dire Badger (a lone hacker named Jed Davis) in the third place.
[2007-10-03] Product Reviews by “Wayne Redhart”
Kingshuk pointed out the amusing reviews of products posted by a "Wayne Redhart" to the website of Amazon UK.
[2007-08-21] Tools for Indians by Google Labs India
The Google Labs India folks have just announced a couple of cool new tools for Indians. This includes being able to search in a number of Indian languages as well as a transliteration tool for easily typing in Devanagari using an ordinary keyboard.
[2007-08-20] Calculating Interest Rates
You want to buy that fancy LCD TV that costs Rs 60,000 but you do not have that much money with you. You see an advertisement in a newspaper for the TV from a dealer who offers to sell it to you if you make a down-payment of Rs 10,000 and pay Rs 4,380 every month for one year. You see another advertisement in the newspaper for the same TV from another dealer who offers to sell it to you if you make a down-payment of Rs 20,000 and pay Rs 1,330 every month for three years. How do you calculate the rate of interest each dealer is charging you for what is, in effect, a loan?
[2007-08-15] Advogato Diary Imported
[2007-08-09] Blog Tweaks
I tweaked this blog in the last couple of days in the hopes of making it a little better - a little better-looking and a little better-behaved. Read on for the details.
[2007-08-08] Disabling atime Updates
A recent article on KernelTrap highlights the high cost of supporting
atime ("last-accessed time") updates on Linux file-systems. It has been suggested that desktop machines should just mount their file-systems using the "
noatime" option to avoid this overhead.
[2007-08-06] Blog Comments
[2007-08-01] The Amiga
[2007-07-25] ICFPC 2007
I spent most of this weekend taking part in the ICFP contest for 2007. As in 2005, I took part in the contest with Yumpee as my team-mate. Our team was called "Kalianpur Bakaits" (an IIT-K reference) in the beginning, but we changed it to "The Great Indian Rope Trick" later, for reasons that should become obvious in a while.
[2007-07-11] “Finance, Investments ’n’ Trading”
"Finance, Investments 'n' Trading" is a weblog by Shobhit that tries to bring some sanity to the general mania currently surrounding the Indian stock markets.
[2007-07-04] Expiry Dates
If medicines and food items become dangerous to consume after their expiry dates, shouldn't pesticides become more powerful after their expiry dates?
[2007-07-02] Dragon Ball Z
Many years ago, a cartoon TV channel in India started showing Dragon Ball Z. They showed 53 episodes of this series comprising the Vegeta Saga and the Namek Saga. Just as the series got really interesting, they yanked it off the air without notice and without even a word of apology.
[2007-06-23] Data Visualisation with Gnuplot
Visualisation of data using charts and other types of plots is immensely helpful in getting a feel for it without carrying out detailed analyses. Gnuplot is a freely-available tool for data visualisation that is also very simple to use. The article "Visualize your data with gnuplot" is a nice introduction to this tool. Gnuplot proved to be quite handy for me recently.
[2007-06-12] iTunes and QuickTime
iTunes and QuickTime would probably be the applications by Apple that most non-Mac-OS-X users get exposed to and it is a shame that these applications are so frustratingly unintuitive, not to mention bloated and slow. Are these really made by the same company that is famous for putting a lot of emphasis on the usability of its hardware and software products?
[2007-05-26] Indic Scripts and Linux
If you have the fonts for Indic scripts (for example, the Lohit fonts), Firefox on Linux is able to display the Devanagari text on sites like BBC Hindi and Google News in Hindi. (Devanagari is the primary writing system for languages like Hindi, Sanskrit, etc.) However, if you are using the builds released by mozilla.com, you would notice that the matras (diacritics) are not applied properly to form the correct ligatures. For example, the word "??????" ("Hindi") itself is not rendered properly. Konqueror does not suffer from such problems.
[2007-05-23] “Superstition Reigns”
"Superstition Reigns" by Rahul Singh, published in The Times of India today:
"Amitabh Bachchan, an icon for tens of millions of Indians, makes his daughter-in-law [Aishwarya Rai] perform outlandish ceremonies because she is supposedly under the evil influence of Mars. Politicians routinely consult astrologers before taking important decisions, despite abundant proof that astrology is no science at all, just quackery. Horoscopes continue to be cast in most families and palmists consulted. A newly-inducted cabinet minister insists that her bungalow be completely redesigned because it does not follow vaastu principles, a system nobody had heard of till only a few years ago."
[2007-05-23] ICFP Contest 2007
[2007-05-21] “The Search”
“The Search” is a book by John Battelle that seeks to explain “How Google and Its Rivals Rewrote the Rules of Business and Transformed Our Culture”. The book highlights how searching for something or someone on the Internet is becoming such an integral part of our lives and how companies are trying to profit from this opportunity.
[2007-05-19] Firefox 3 and Linux
Mike Connor blogs about the proposed requirements for Firefox 3 to run on Linux. A nasty surprise for me was the inclusion of GNOME as a dependency. While the GTK/Pango/Cairo/etc. requirements are quite understandable, I don't understand why it should need GNOME. Many of us are happy with KDE or Xfce and would like to avoid the bloat and the dependency hell of GNOME for the sake of running a browser.
[2007-05-14] VU3RDD Gets .56 From Donald Knuth
VU3RDD (a.k.a. Ramakrishnan Muthukrishnan) recently received a cheque for $2.56 from Donald Knuth as a reward for spotting a mistake in TAoCP Volume 2. Among the people I have met, he is the first such person. Congratulations!
[2007-05-14] Mohan Embar
I met Mohan Embar this weekend. He used to maintain the Windows port of GCJ. It was nice to finally be able to associate a face and a voice with the name, since our interaction so far had only been over email. He turned out to be much thinner, more soft-spoken and more boyish than I had imagined.
The Labour Day holiday last Tuesday, combined with a day's leave off work on Monday, offered us a four day long weekend that Anusha and I used for a mini vacation in Wayanad in Kerala.
[2007-04-25] “The Intelligent Investor”
Benjamin Graham, known as “The Dean of Wall Street” and as “The Father of Value Investing”, was one of the greatest investors and teachers of investing principles. His disciples include some of the most famous investors, including Warren Buffett, and his approach of “value investing” still retains a dedicated following despite the advent of fancier and more popular approaches like “Modern Portfolio Theory”. He is credited with bringing discipline to the field of investing via the influential textbook “Security Analysis” that he co-authored with David Dodd and that was first published in 1934.
[2007-04-13] Running Java Applets in Internet Explorer on Linux
One of the unfortunate things about the current state of the internet is that some web sites refuse to work with anything other than Internet Explorer (IE). Some of these also require you to run Adobe Flash Player and/or Sun's JVM within IE. Most of these sites can be happily avoided, but some of them just can't, especially when they run important applications within a corporate intranet. This can seriously dampen the enthusiasm of people willing to try out Linux as their primary desktop.
[2007-03-24] “Alistair Cooke's America”
“Alistair Cooke's America” is a book derived from an eponymous 13-part television series about the United States of America and its history. If you are even vaguely familiar with the history of the USA, this is the book that can provide great perspectives on the events that shaped the country and wonderful insights into the character of its people.
NX allows you to remotely access a Linux or Solaris machine and makes applications using X Windows appear quite responsive even over slow links. It even supports resuming, from anywhere, a session with the server suspended for any reason (for example, a broken network connection). The "Free Edition" of NX is free for personal use. The core NX libraries are Free Software. There is also FreeNX that provides a Free implementation of the NX server licenced under the GPL.
[2007-03-11] Investing For Retirement
(Note: This post might not be of interest to those not from India.)
Most of us do not even think about planning for retirement until we reach the age of 30. Some of us "live for the moment" and don't care for the future, some of us feel uncomfortable thinking about retirement and pretend like the proverbial cat that closing our eyes to the problem will make it go away and some of us just do not know how to assess our financial requirements three decades into the future.
Unfortunately for us, there is not much of a government-provided social security in India for old folks, we cannot realistically expect our children to take care of all our expenses, inflation constantly lessens the value of our savings and interests on assured-return investments (fixed-deposits, EPFs, etc.) keep falling. We must have some idea of our needs at the time of our retirement and know how much to invest now to be able to afford the same lifestyle that we are currently used to.
The good news is that we can use basic mathematics to calculate these figures. We will make use of two equations. The first equation (call it "E1") tells us the final amount "S" that an initial amount "P" grows to if it grows at a compounded rate of "r" over "n" years:
The second equation (call it "E2") tells us the final amount "S" that a regular annual investment of "P" over "n" years gives if it grows at a compounded rate of "r":
Note that since the rates are usually quoted as percentages, you need to divide them by 100 to get the value of "r" usable in these equations. For example, a quoted rate of 8% translates to "r" equal to 0.08.
Now assume that you are aged 30 years, plan to retire at the age of 60 years, have a montly expenditure of 20,000 rupees and the rate of inflation is about 5% on the average. Using E1, you can see that at the time of your retirement 30 years hence, your monthly expenditure would become about 86,438.85 rupees simply because of inflation! That translates to about 10,37,266 rupees in annual expenditure. With old age come many an ailment for which you would need to spend money - at about 1,00,000 rupees per year at today's rates, you would need about 4,32,194 rupees at the time of your retirement to meet medical expenses. So you would need an annual income of at least 14,69,460 rupees at the time of your retirement just to sustain your current lifestyle and cope with the inevitable medical expenses!
How will you generate an income like this at that time? It is very likely that your appetite for risk would have considerably diminished at that time and you would only be willing to invest for assured-returns and thus lower rates of interest, say, about 5%. This in turn means that you would need a sum of 2,93,89,200 rupees (5% of which is the amount you need per year) at the time of your retirement. You need to have raised about 3 crore rupees by the time you retire just to be able to afford your current lifestyle!
To raise this kind of money, you either need to invest a certain amount annually till the time you retire or do a one-time investment. If you assume an annual return of 8% on your investments, you either need to invest about 2,59,431 rupees annually for the next 30 years (using E2) or about 29,20,620 rupees at a single shot (using E1). If you assume a more aggressive (though riskier) annual return of 15% on your investments, the amounts change to about 67,601 rupees and about 4,43,867 rupees respectively.
If you had started at the age of 25 years, you would have had 35 years to raise the money. At a per-annum return of 8%, you would have either invested about 1,70,533 rupees annually or about 19,87,725 rupees at a single shot. At a per-annum return of 15%, these figures become about 33,352 rupees and about 2,20,680 rupees respectively.
If you postpone investing for your retirement by another five years, you would have 25 years to raise the money. At a per-annum return of 8%, you would need to either invest about 4,02,008 rupees annually or about 42,91,349 rupees at a single shot. At a per-annum return of 15%, these figures become about 1,38,112 rupees and about 8,92,774 rupees respectively.
So the earlier you start investing for your retirement, the better it is for you. The folks at Personalfn.com have a report titled "Retirement Planning and You" that provides a more detailed analysis of this situation as well as the available investment options suitable for retirement planning.
Of course, these are simplified calculations. They do not take into account the fact that you will very likely have to pay income tax on the returns from this investment. They also do not take into account the fact that because of inflation, you would need slightly more and more every year after you retire instead of the fixed amount assumed here. Hopefully the average rate of inflation for India for the next 30 years will be less than the 5% assumed here.
[2007-02-16] “Guns, Germs, And Steel”
Why was it that the Europeans came to dominate over the native Americans, the Africans and the aboriginal Australians and not vice versa? Why was it that civilisation flourished early on in places like the Middle East, India and China while places like sub-Saharan Africa, Australia and the Americas languished far behind for several thousand years?
[2007-02-06] Google Webmaster Central
A post on the Google blog pointed me to the Google Webmaster Central service. To access this service, all you need to have is a Google account (you already have it if you use Gmail, Blogger, Orkut, etc.). You can easily add your site to this service and verify your access to your web site either by uploading a page to your site with a unique name provided by Google or by adding a META tag to the default page of your site with a unique content provided by Google.
Among other things, this service lets you find out who links to your site. The difference between this service and the "link:" operator in Google searches is that this service actually works. The service also lets you know which search queries lead people to your site and how likely they are to hit your site for a given search query. If you have ever wondered how people discover your site, this is a fascinating way of knowing a large part of the answer to that question.
For example, currently these are the top 10 search queries on Google that are likely to lead people to my web site:
- tangram history
- ranjit mathew
- paradoxical puzzles
- gcj windows
- matthew symonds economist
- how to beat voldemort on harry potter goblet of fire gameboy advance
- "* dataone it"
- ananth chandrasekharan
Most of the links to my web site are created due to the signature that I attach to the messages that I send to various mailing lists and that then gets archived all over the place. The second most common reason is that my blog and the blogs of some of my friends have a link to my web site in their "Links" section, which then gets replicated in the individual page for each of their posts. The third most common reason is that my profiles on sundry web sites link to my home page. There are actually very few "third parties" that link to my web site.
Of course, some of this information is also provided by the referrer logs and the analysis tools provided by Hosting Zero.
[2007-02-03] Xfce and KDE
It is easy to compile Xfce 4.4.0. It even has a self-extracting installer that first compiles a GUI installer, which interviews you and then proceeds to automatically configure, compile and install the Xfce modules. The environment is quite configurable, the file manager and the terminal emulator quite usable and it integrates well with an existing KDE installation.
My PC now boots into a usable desktop environment after a cold start far faster than before and there is considerably more free memory and CPU cycles for use by applications. (For some reason, artsd from KDE used to eat up a lot of CPU cycles on my PC.) Everything feels so much snappier now.
KDE has become increasingly bloated over the years. Unlike the Linux kernel, which has also become more bloated over the years but at least makes it easy to leave out unwanted features using "make menuconfig" before compilation, there is no simple way to avoid the increasing bloat in KDE other than to hack the Makefile templates. With each release, each of the KDE core packages seems to pick up more utterly useless, functionally-overlapping and half-developed applications.
KDE has also remained rather buggy throughout the years. Applications crash every now and then for no apparent reason. Watching the numerous panicking messages from applications fly by on the console makes one constantly wonder how the desktop still manages to hold up and fills one up with an urgency to just get the work done as soon as possible and close the panicking application before it eventually crashes. About the only "improvement" in newer releases seems to be a dialogue-box asking the user to submit a bug report to the developers when an application crashes. The applications still crash about as often as they used to.
About every two years, I check out the latest release in the last stable KDE branch. I do this with the hope that the bugs affecting me would have been fixed by then. They usually are, but their place is then taken up by newer bugs. Compiling a KDE release is not a pleasant exercise and not just for the fact that each release takes longer and longer to compile than the previous release on the same hardware (understandable, since there is more code from more applications and GCC also generally keeps getting slower and slower at compiling C++ with successive releases). Each KDE release seems to require more and more dependent libraries (or updated versions of existing dependencies), which in turn require yet more dependent libraries - this is the kind of dependency hell that put me off GNOME in the first place. Each KDE release seems to fail compilation for me in the most basic of ways (for example, ksysguard in 3.5.6 has an unguarded call to strlcpy( )). Some times there are issues with the tarballs themselves. For example, the 3.5.6 tarball for kdelibs that I downloaded off a mirror had the timestamps for the files set to 31 October 2007 for some reason, with the result that when it finally finished compilation after several hours on my PC, I executed a "make install" only to discover that it proceeded to compile everything from the beginning all over again! Needless to say, this is very frustrating.
I know that Konstruct is supposed to ease the pain of downloading and compiling a KDE release, including automatically applying fixes for problems discovered only after the release, but I never found its insistence on downloading and compiling dependent libraries, even though I already have the necessary versions, particularly appealing.
Even after switching to Xfce, I still haven't removed KDE from my PC. After all, it does have some nifty applications, not least of which are two of my favourite games Kmahjongg and Ksirtet (a Tetris clone). I also like its well-integrated look and feel and its almost infinite configurability. Some day perhaps KDE will be able to iron over its current problems and I would again be tempted to go back to KDE. For the moment however, I'm happily sticking with Xfce.
On a side note, has anyone tried to compile the ultra-modular 7.1 release of the X.org server? Every little thing has now been broken into its own little module with the result that there are just too many modules without an easy way of choosing the ones you want (again, like "make menuconfig" for the Linux kernel). There are scripts to automate the download and build, of course, but they still don't seem to make it easy to choose among the modules.
If you are a bibliophile with a non-trivial collection of books, sooner or later you would feel the urge to catalogue it. If you use a computer, you would either use a software like Delicious Library or hack up something yourself if you have the skills, the time and the enthusiasm.
LibraryThing is a web site that allows you to maintain this catalogue online, with your catalogue being either publicly visible or being private. With a free account, you can catalogue up to 200 books. Since many users catalogue their books like this, you can also use the web site to meet other people who have a taste similar to yours in books and you can also get suggestions about new books you might want to check out based on your existing collection. You can also find lots of reviews about books you actually intend to check out.
This is not all. Since the most boring part of cataloguing your books is entering in all the data (even if you only enter the ISBNs and then the software looks up the details itself), they provide a CueCat bar-code scanner for automating this job at a price that is cheap even by Indian standards. I ordered one as a way of showing my support for the site. It is surprisingly easy to get it working - under Linux, if you have USB HID enabled (quite likely), any application can read the scanned-in bar-codes as if they were directly typed in at the keyboard. Of course, the CueCat obfuscates its output so that applications cannot readily make sense of the data, but it is very easy to get back the plain text or to "declaw" it altogether.
LibraryThing understands the obfuscated output of the CueCat and it supports a "bulk import" feature - you scan in the ISBN bar-codes of your books into a text file, upload it and LibraryThing uses Amazon.com, the Library of Congress, etc. to query the details of the books and automatically add them to your online library. The process is so simple that I was able to scan in two shelves of books in under 10 minutes, upload it to LibraryThing and see my online library populated automatically over the next three days! The reason it took three days was that LibraryThing is nice enough to throttle its querying of free online catalogues so as to not overwhelm them with such requests.
When she saw that I had bought a funny-looking bar-code scanner just for cataloguing my books, Anusha gave me one of those "What a weirdo!" looks. She had earlier burst out laughing when I had said that I was toying with the idea of getting one for myself. However, bar-code scanning is so much fun that she was soon merrily scanning in books with me. Her criticism is considerably muted now.
Although “Concepts, Techniques, and Models of Computer Programming” by Peter Van Roy and Seif Haridi looks intimidatingly big at around 900 pages, I found it surprisingly easy to read. It has a good balance of theoretical and practical descriptions of the concepts covered by it. It has a cohesive overview of the major programming styles in a manner that I have not seen in any other book. I would rank it as a must-read for the serious programmer along with classics like “The Art of Computer Programming” and “Structure and Interpretation of Computer Programming”.
I just finished reading "Concepts, Techniques, and Models of Computer Programming" by Peter Van Roy and Seif Haridi. If you are the kind of person who thinks that "The Art of Computer Programming" and "Structure and Interpretation of Computer Programs" are good books, then you owe it to yourself to check this book out.
There is a slightly-dated version of the book available online (PDF, 3.4 MB), if you want to preview some of the content before buying it. There is also an Indian edition of the book published by Prentice Hall of India (ISBN: 81-203-2685-7) and priced at Rs 450. The book's web site links to some reviews and you can also read my review of the book.
[2007-01-20] Local Variables in Java
The other day I was reviewing some Java code written by a colleague. I noticed that he was in the habit of declaring all the variables used by a method at the beginning of the method body rather than in the places where they were first used. I pointed out that declaring a variable only when it is first required makes the code more readable.
While he agreed to change the style of his code, he was still reluctant to move the declaration of a variable used only within a loop from outside it to inside it. For example, he was reluctant to change:
for( int i = 0; i < 10; i++)
s = String.valueOf( i);
for( int i = 0; i < 10; i++)
String s = String.valueOf( i);
He believed that only one variable is created in the former case while 10 variables are created in the latter - clearly it is more efficient to declare a single variable outside the loop and keep reusing it inside the loop!
I then pointed out the section in the JVM specification that says that a JVM uses a fixed-size array for storing the values of local variables used in a method and each local variable maps to an index in this array. A Java compiler calculates the size of this array during the compilation of a method and declares it in the generated bytecode for the method.
Since he was still sceptical, I compiled both the variants to bytecode, used
javap -c to produce the dissassembled code and used
diff to show that the generated code was the same in both the cases (except for the indices used for
i). I then used a simple modification of using the JVM Emulator Applet written by Bill Venners as a standalone application to show the bytecode variants in execution and demonstrate that the size of the local variables array really remains constant throughout.
He was finally convinced.
On the other extreme, I have another colleague who is in the masochistic habit of introducing new scopes to isolate the local variables used only in a section of a method's body. That is, something like:
Foo x = wombat.snafu( );
// Use x here.
Bar y = new Bar( a, b, c);
// Use y here.
[2007-01-11] Generics in Java and Return Types
Consider a class
C that implements an interface
While the following is allowed:
I foo( )
return new C( );
the following is not:
ArrayList<I> foo( )
return new ArrayList<C>( );
In the first case, callers expect to get an object implementing the interface
Iand therefore it is correct for
foo( )to return an object of class
C. In the second case, callers expect to get an
ArrayListcontaining objects implementing the interface
Iand therefore it should again be correct for
foo( )to return an
ArrayListcontaining objects of class
Consider what happens if the compiler were to allow such code to compile. Callers can then add objects of another class
X, which also implements the interface
I, to the returned
ArrayList with the result that the original
ArrayList, which is only supposed to contain objects of class
C, now also contains objects of an incompatible class
A better way to define the second case is:
ArrayList<? extends I> foo( )
return new ArrayList<C>( );
(You can also return an
ArrayList<I>instead, but that loosens up the definition of the returned object.)
Thanks to Steve Onorato for clearing up my muddied thinking.