*** MOVED ***

NOTE: I have merged the contents of this blog with my web-site. I will not be updating this blog any more.

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.

As I have noted before, to someone coming from a place like Bangalore where traffic is always slowed down by congestion and potholes, the fast traffic on the smooth and wide roads of New Delhi comes as a bit of a shock. Taxi drivers drive even faster than the other folks, not bothering to slow down for junctions or turns. Everyone snakes in and out of traffic lanes with abandon and freely exchanges expletives at the slightest provocation.

Despite the presence of so much traffic, the air-pollution seems to be manageable, no doubt helped by the mandatory installation of Compressed Natural Gas (CNG) systems in public vehicles. New Delhi also has a lot of green trees, quite unlike that jungle of concrete, Mumbai. One of the more surprising sights for me in New Delhi was the row of toll booths at the entry to the DND Flyway, something that you rarely see in a developing country like India.



Among the standard tourist attractions, some of the places were either only mildly interesting or particularly underwhelming. However, I was particularly fascinated by Humayun's Tomb, the Qutub Minar complex and the Red Fort.

I had not expected Humayun's Tomb to be such a big, peaceful and beautiful complex. It was restored and beautified only as recently as 2003. The main mausoleum is particularly remarkable since it looks so similar to the Taj Mahal, although it was constructed almost 100 years before the latter. Some of the other buildings in the complex are also nice, although many of the places reek very strongly of bat droppings.



Even the Qutub Minar surprised me with its height and beauty. It has beautiful carvings on its walls and a nice pattern to the first three storeys. Sadly however, the last two storeys, which were later additions, are quite discordant with the rest of the tower. While the Qutub Minar is quite impressive by itself, one can only imagine the magnificence of the entire complex in its prime by looking at its sad remains. Some of the walls still retain bits of intricate carvings.



The Red Fort was built by the Mughal emperor Shah Jahan as a palace for his eponymous new capital Shahjahanabad. It is a splendid structure and seems fairly well-preserved. Of particular note are the royal residence, the "deewan-e-aam" (where the emperor met the common people), the "deewan-e-khaas" (where the emperor met his ministers and important guests) and the museum housing some interesting artefacts of that era. The "deewan-e-khaas", the emperor's seat in the "deewan-e-aam" and the royal residence are lavishly decorated and are a must-see.



I have created a Picasa web-album that has some more pictures from New Delhi.

2007-11-13

Pachmarhi

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.

Pachmarhi gets its name from a set of five caves carved into a big rock. These caves are called Pandava Caves because it was believed that the Pandavas stayed here for some time during their exile from their kingdom. However, it turns out that these caves were really carved out by Buddhist monks who used them as shelters.



Most of the rocks in Pachmarhi are made of soft sandstone. These rocks soak up water during the rains and then slowly release it throughout the rest of the year. This water feeds the many streams that flow through Pachmarhi and provide its beautiful waterfalls. A remarkable thing about these rocks is that some of them clearly show layers of embedded round pebbles. Though it is at a high altitude now, Pachmarhi must have been under water a long time ago.



We decided to stay in Glen View, a hotel developed by Madhya Pradesh Tourism. We also took their bus from Bhopal to reach Pachmarhi. The bus usually takes around five hours for the journey. As luck would have it, we ran into a chakka jam (road blockade) organised by the BJP that day to protest against the Sethusamudram project. This delayed us by three hours.

Pachmarhi is a very small town, most of which is occupied by the Indian army. It has a very unhurried and quiet feel to it. The local people are very friendly and helpful. It is surrounded by stunningly beautiful forests, valleys, waterfalls and caves. There are several trekking trails for enthusiasts. Some of the caves have pre-historic rock paintings. It also has several Shiva temples, each one associated with a myth relating to his fight against Bhashmasura. There are so many places to see that it can easily take about five days to explore everything properly.



It is not easy reaching these beautiful spots though. You have to have a car with a four-wheel drive and an expert driver to drive it. You should also have a bit of stamina because the car would not be able to take you all the way everywhere and you would have to go about 200 to 400 metres up and down a hill to reach many a spot.

I had an especially tough time reaching these spots because I found it hard to breathe. That was because I had a very bad cold. That in turn was because the air-conditioner in our room could only be run at its full strength. The ceiling fan was not enough for the hot and humid weather at the time. This was one of the worst colds I have ever suffered. It took a full two weeks for me to recover completely from it.

This was not the only problem with our room though. The water from the taps was always reddish-brown from the rust in the pipes for a while in the beginning and you had to leave it on for some time for it to approach something close to transparency. Even then it had an unpleasant iron flavour to it. The hotel staff was extremely nonchalant about it, informing us that it was quite normal for all the rooms in the hotel.

Pachmarhi does not have good options for accommodation at this time. None of the well-known hotel chains have their presence here, so you tend to err on the side of caution by opting for what is touted as a luxury hotel. Glen View is promoted as a luxury hotel by MP Tourism. Judging by our experience, they seem to have a rather peculiar definition of "luxury". To add insult to injury, they insist on collecting 100% of the hotel tariff for all the days you plan to stay there, in advance at the time of booking, with no scope for refunds. The hotel also does not accept credit cards, so you better carry some good cash to pay for the ridiculous amount it charges for its unremarkable food.

We were so disappointed by our hotel and the lack of other options that we cut our visit short by a day, losing some money in the process. We took some solace in the fact that we had saved almost 30% by booking it during the off-season. We would love to go back and see Pachmarhi again and explore the sites we could not visit, but not until there are better options for accommodation there.

I have created a Picasa web-album that has some more pictures from Pachmarhi.

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 respective technical specifications are unfortunately too complicated to follow for a layman. Purportedly "explanatory" articles elsewhere gloss too much over the important points leaving me quite unsatisfied. I have fortunately come across two articles recently that seem to strike the perfect balance between these extremes.

"The Audiofile: Understanding MP3 Compression" was published in Ars Technica some time back and very nicely explains the compression algorithm behind MP3 as well as shedding some light over some of the apparent idiosyncrasies of this format. "Image Compression: Seeing What's Not There" was published by the American Mathematical Society and does a similar service for JPEG, including its successor JPEG 2000. (Come to think of it, these articles are "lossy" marvels in their own right.)

Now let us see if I can find an article with a similar depth that explains the MPEG video formats.

2007-10-16

Alex

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.

For a parrot, Alex had impressive linguistic capabilities. It could describe objects, materials, shapes, colours, etc. It could express its desires. It could also ask questions. It could also count up to six and even had a notion of "zero". Very impressive.

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.

The organisers of the contest have an interesting report on the contest that also contains the "ideal" way one would go about solving the puzzles. Interestingly, Jochen Hoenicke managed to find a perfect DNA prefix some time after the contest was over. Impressively, Jed Davis came third by using a brute-force approach that won him the Judges' Prize - he was declared to be "an extremely cool hacker".

Update (2007-10-24): The organisers have now shared the video of their presentation about the contest at ICFP 2007.

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.

For some of the products reviewed by him, I found the product on offer more amusing than the review itself.

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.

The transliteration tool is especially nice. For example, it automatically converts "ramesh" to "रमेश". If you did not want the word automatically put in by the tool, you can select the desired word from a set of alternatives or explicitly type it out yourself.

Note that you might have to tweak things a little to correctly display Indic scripts.

Update (2007-08-23): QuillPad seems to have been in existence for some time now and has support for more Indian languages than the Google transliteration tool (which only supports Hindi at the moment).

Update (2007-08-29): Raftaar also allows you to search in Hindi using a transliterating interface.

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?

In "Calculating EMIs", we derived the formula for calculating the "Equated Monthly Installment" (EMI) on a loan. If "E" represents the EMI, "P" represents the principal amount in the loan, "r" represents the monthly rate of interest (one way of arriving at it is to divide the annual rate of interest, quoted as a percentage, by 1,200) and "n" represents the number of months in the tenure of the loan, then:

     E = P × r × (1 + r)n / ((1 + r)n - 1)

In the current example, we know the values for "E", "P" and "n" and wish to calculate "r". Unfortunately it is not that simple to calculate "r" using just the high-school algebra that most of us manage to remember. Fortunately there is a simple algorithm that can help us in this situation.

Let us first rewrite the formula above as an equation:

     P × r × (1 + r)n / ((1 + r)n - 1) - E = 0

Our task now is to find the roots of this equation - that is, the values of "r" that will make the left-hand-side (LHS) of this equation evaluate to zero.

To find the roots of a given equation "f(x) = 0", the algorithm in question can be described as follows:

  1. Find a value "a" for which "f(a)" evaluates to a negative value.

  2. Find a value "b" for which "f(b)" evaluates to a positive value.

  3. Let "c" be the average of "a" and "b".

  4. If "f(c)" is close enough to zero, "c" is the desired root.

  5. Otherwise, if "f(c)" is a negative value, substitute "c" for "a" and repeat the procedure from step #3 and if "f(c)" is a positive value, substitute "c" for "b" and repeat the procedure from step #3.


Note that this is just a binary search algorithm. By "close enough to zero", we mean that the absolute value of "f(c)" is less than some value, usually called "epsilon", that can be as small as we please. The algorithm given above can be rewritten as a function in a pseudo-language as follows:

guessRoot( f, a, b)
{
c := (a + b) / 2;

if( absoluteValue( f( c)) < EPSILON)
return c;
else if( f(c) < 0)
return guessRoot( f, c, b);
else
return guessRoot( f, a, c);
}

You can implement this in your favourite programming language along with a function that calculates the LHS of the equation given earlier. You can choose a value of "epsilon" according to your preference - the smaller the value of "epsilon", the more accurate is the result and the longer it takes to compute it. The time taken for the computation is also affected by how wide is the range between "a" and "b". Note that Newton's method is a much faster way of computing the roots of such equations, though it involves calculating derivatives.

How do you arrive at the values for "a" and "b"? This differs for each function. For our example, we can start with a low guess of "0.001%" ("0%" gives an undefined result) as the annual rate of interest and a high guess of "100%" and this gives us a negative and a positive value for the LHS respectively. With an "epsilon" of "0.00001", a C programme computes the answer in around 25 iterations.

In our example, the first dealer is offering us an effective loan of Rs 50,000 for 12 months with an EMI of Rs 4,380 and the effective annual rate of interest comes to about 9.32%. The second dealer is offering us an effective loan of Rs 40,000 for 36 months with an EMI of Rs 1,330 and the effective annual rate of interest comes to about 12.08%. In terms of the interest rates being charged by the dealers, you should now be able to tell that the first dealer has a better proposition for you when compared to the second dealer.

2007-08-15

Advogato Diary Imported

I have imported all the old entries from my Advogato diary into this blog. These entries are labelled "advogato diary".

It was very simple to do since Advogato used to provide a simple way to import all my entries as an XML file (it does not work any more) and Blogger has a nice and simple API that allows me to post entries automatically, even allowing me to back-date and label them appropriately.

However, I did encounter an unexpected problem during this import. It turns out that if you post too many entries in a single day (in my case the limit seems to be 50), Blogger thinks that you are creating a SPAM blog and turns on "word verification" for posts (a CAPTCHA). While you can still post entries manually, the API provides you no way of retrieving and resolving the CAPTCHA using human input. After 24 hours the word verification is automatically switched off and you can again post using a programme. I had to therefore spread out the import over 5 days since I had 231 entries to import.

By the way, if you worry about search engine rankings for your pages, you might want to note that such mass imports cause Google to downgrade your site for having duplicate content if the old blog is still accessible.

Finally, Advogato is still alive and being maintained.

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.

The tweaks include:

  • Using a better-looking template. The old template was a bit boring and quite minimal. It made it hard for most people to read all the text I was spewing. The new template looks better (at least to me). It has a narrower column width to display the text, somewhat similar to those in newspapers and magazines, which makes it easier for most people to read the text.

  • Showing only the initial paragraph from each post on the main page. You can read the full post using the "Read More..." link at the bottom of each such paragraph. This makes it easier to skip over posts that you are not interested in reading.

  • Showing only a preview of the post in the feeds. I used to feel bad about my banal verbiage eating up lots of space on Planet Classpath and other such "planets". This change should let people easily skip over my posts if they don't care for what they see in the preview and navigate to the page containing the full post if they do. It should also benefit people who have subscribed to this blog using a blog aggregator. To do this a bit better than what was possible with Blogger's own feed mechanism (but still not entirely satisfactorily), I have had to redirect the Blogger feed for this blog to the FeedBurner feed for this blog.

  • Giving at least something back to Google for providing this great service for free. I used to feel bad about being yet another leech on Google's resources. I signed up for Google AdSense via Blogger. Now each page on this blog shows textual advertisements relevant to the context of the page.

I do realise that there are negative aspects of each of these changes that some folks are not going to appreciate. However, I believe that each of these changes is for the better, all things considered.

Update (2007-08-10): Anusha did not like the fact that you navigate to a different page when you click on "Read More...". It is also not fair to the reader since the entire post is already there on the main page, but hidden from view. So now I have changed the blog template to expand and collapse the rest of the post in place using a combination of techniques shown here, here and here, with a few adjustments of my own.

Update (2007-08-29): The feeds now have the full contents of the posts once again.