*** MOVED ***

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

2008-12-25

"Dimensions"

I came across the "Dimensions" video via Reddit. It tries to help you visualise four-dimensional objects via their projections onto ordinary three-dimensional space. If you have even the slightest interest in mathematics, you should check it out. You can either view it on-line or order a reasonably-priced DVD. The video is about two hours long.

2008-12-20

Decision Tables

I still see a lot of code with complicated if-then-else conditions that can be simplified quite a bit by the simple technique of using decision tables. A decision table is a compact yet exhaustive way of encoding conditions and the actions to be taken under those conditions. The rows and columns of a decision table denote the conditions and the cells denote the actions. Since it simplifies complicated conditional logic, it can make your code a lot easier to maintain and a lot less error-prone.

2008-12-14

"You Can Leave Any Feedback You Want..."

"...as long as it is good." This seems to be the unwritten instruction on feedback forms handed out to diners by many restaurants in the city. If you thought that such forms help a restaurant to improve itself by taking the feedback of its customers into account, you are apparently mistaken. Such forms are seemingly designed only to stoke the egos of the restaurants' owners and managers. A couple of recent incidents have led me to this conclusion.

2008-10-16

2008-10-13

Indian Edition of the Purple Dragon Book

After a long wait, the low-priced Indian edition of the Purple Dragon Book ("Compilers: Principles, Techniques and Tools", 2nd Edition, by Alfred Aho and others) is finally available in bookshops. The ISBN for this edition of the book is 9788131721018.

2008-08-19

Investment Basics for Indians

My colleague Ryan stumbled upon a nice guide that explains the basics of equity and debt investment for Indians. It is available via the web-site for the National Stock Exchange (NSE) as the study material for the "Financial Markets (Beginners)" module of its certification programme.

2008-07-17

ICFPC 2008

I participated in the ICFP contest again this year. The task this year was to write a programme that guides a rover on the planet Mars towards its home base within a time-limit of 30 seconds, while avoiding boulders, craters and hostile Martians. The rover would get telemetry data from its sensors (which could see over a very limited portion of the terrain at a time) roughly every 100 milliseconds. As usual, we were given 72 hours to solve this problem. As it turned out, I encountered an unexpected problem during the contest and my final submission turned the rover into a "buggy", if you get the drift.

2008-07-02

Major Programming Contests This Month

There are a couple of major programming contests coming up this month. The first one is the ICFP Programming Contest 2008 (11-14 July). The second one is the Google Code Jam 2008 (qualification round on 16 July).

There was also an article in DDJ about programming contests a couple of months back. It is an interesting read, but there is nothing new in there for those who are already familiar with TopCoder.

2008-06-15

Firefox 3

I have been using the release candidates of Firefox 3 on Linux for some time now. The experience has been quite good so far. I would encourage you to try it out for yourself - in fact, download it on the 17th of June and help Mozilla set a world record.

Firefox 3 comes with quite a lot of fixes and improvements. The "Field Guide to Firefox 3" is a nice page summarising the more important improvements. It seems to have improved a lot in terms of memory usage and speed. You just have to use Gmail to see the difference in speed for yourself. Since I never open too many tabs, use too many extensions or keep the browser open for too long, I have never personally run into memory-usage issues with previous releases of Firefox and I can't really say if the improvements in this area are that drastic.


One of the more important fixes for Indian users of Firefox on Linux is its improved support for complex text layout, which is used in quite a few Indic scripts. I have complained about it before and I am happy to report that it now seems to work fairly well:



Devanagari Text Rendering on Linux: Firefox 2 (left) v/s Firefox 3 (right)


The composite screen-shot above shows the difference between Firefox 2 and Firefox 3 when rendering Devanagari text (from Josh18) under Linux. I have circled some of the words that were rendered incorrectly by Firefox 2 and correctly by Firefox 3. (Click on the image above to see a larger version.)

It has not been all wonderful though. There are still some issues that make my experience with Firefox 3 less than ideal. The most egregious of these is how some web pages using Flash either cause Firefox 3 to freeze up or just crash with a segmentation fault (of course, this could be due to a badly-written Flash Player plug-in). The other issue that has persisted from Firefox 2 but now seems to have become worse for me is how Firefox would just freeze for a second or so every now and then, especially noticeable while scrolling up and down large web pages. This might be related to garbage-collection cycles, but I am not sure about it.

Incidentally while Firefox 3 itself mercifully does not require GNOME (I am a happy KDE-only user), its new crash-reporting tool does need a few of the GNOME libraries. This tool is now based on Google Breakpad. I found that the crash reporting tool itself would crash while trying to send a crash report to Mozilla. That was fixed only after I installed GConf, ORBit, libIDL, D-Bus and dbus-glib. It still failed to send the crash reports and it turned out that I must also install and configure Curl. Of course, ordinary Linux users with a typically-bloated Linux distribution would not run into such issues.

By the way, there is now a new pseudo-URL named "about:crashes" that would let you to lovingly admire the crash reports that your instance of Firefox has generated and submitted to Mozilla.

2008-05-24

ACM

I received a mass-mailed letter this week from the ACM (Association for Computing Machinery) asking me to join it. The ACM is an organisation of computer scientists and professionals. It publishes several magazines, journals and newsletters related to computer science and engineering. It organises conferences, has several Special Interest Groups (SIGs), conducts programming competitions and provides a network for seeking jobs. The ACM Bangalore chapter in particular has been quite active in recent times.

2008-05-18

Electronic Book Readers

As I have lamented before, I do not have access to a well-stocked and conveniently-located library here in Bangalore that lends books at reasonable rates. The alternative of buying all the books that I want to read is not just an expensive proposition - I also do not have enough space in my home to stock all such books. For some time now, I have been eyeing electronic book readers as a solution to this problem. It looks like I will very soon (but not quite yet) be able to get such a device at an affordable price.

Besides saving lots of space and providing unprecedented portability, electronic books also have some additional advantages over ordinary books:

  • There are lots of freely-available electronic books. For example, Project Gutenberg provides electronic versions of thousands of classic books.

  • You can easily make backup copies of (non-DRM-crippled) electronic books. This is unlike ordinary books, which can get damaged, lost or stolen.

  • It is much easier to search through an electronic book.

  • It is easier to enlarge the font of an electronic book or have the text read out by a text-to-speech software to help the visually-impaired folks.

  • You save trees from being cut to produce paper.

  • Electronic books should be cheaper than ordinary books since the publisher can very easily produce as many copies of such books as it wants.

  • The Internet makes it much faster to deliver an electronic book than an ordinary book, when you order them through an on-line retailer. You also save on the shipping costs.

  • Since software is usually used to write and typeset books these days, electronic books can be produced with no additional effort.


Of course, electronic books will never quite have the "feel" of ordinary books. Some of us also love the different smells of different books. An electronic book reader is quite delicate and more expensive when compared to an ordinary book. Unless an electronic book is in an open format like plain-text, HTML or PDF, it is quite possible that future electronic book readers will not be able to read it. Some publishers intentionally cripple electronic books with DRM making it more difficult to do things that are otherwise quite simple to do with an ordinary book (for example, share it with a friend). Many of the electronic books are unreasonably priced compared to the corresponding paper versions in spite of the fact that it is far cheaper to produce and distribute an electronic version of a book.


All this aside, there has been a huge downside of electronic books till recently - reading electronic books has not been as comfortable as reading ordinary books for most people. It is quite straining on the eyes to read lots of text on a computer monitor or on the tiny LCD screens of smart-phones and PDAs. It is also difficult to read such text in bright light. Even the dedicated electronic book readers have suffered from this problem. You can print out an electronic book to ordinary paper, but this is either too expensive or not feasible for most people.


This has now changed due to the availability of "electronic paper" displays. These displays look just like ordinary paper and are therefore quite easy on the eyes. They only use power when the displayed image needs to be changed and thus can run on a battery charge for much longer periods than LCD displays. Though the technology has been around since the 1970s, it has only recently become commercially viable. There are now several electronic book readers based on this display technology and judging by the reviews of these devices, we might just have passed an inflection point in the history of electronic books.


Here are some of the electronic book reader devices based on electronic paper technology currently available in the market, along with their prices as advertised at the moment:


  1. Kindle, by Amazon, $400 (Ars Technica review of the Kindle)

  2. PRS-505, by Sony, $300 (Ars Technica review of the PRS-505)

  3. Iliad, by iRex, $784 (Ars Technica review of the Iliad)

  4. Cybook, by Bookeen, $480

  5. Hanlin, by Jinke, $300

  6. BEBOOK, by Endless Ideas, $400

  7. SoriBOOK, by Diginaru, $400


Ars Technica usually provides in-depth and unbiased reviews and therefore I have also linked to a review of a device on Ars Technica wherever available. MobileRead has a comparison-matrix of electronic book reader devices. You can also find a lot of nice videos on YouTube that show most of these devices in action, giving you a feel for these devices that is very difficult to get by just reading the reviews.


For example, here is a little video review of the Amazon Kindle:




Of these devices, the Amazon Kindle seems to have the best overall package in terms of price, connectivity and availability of electronic books. I like its integration with Project Gutenberg and Wikipedia. I also like its ability to look up the definition of a word in the integrated dictionary. Unfortunately, it also looks like the ugliest of the lot with some rather weird design choices in my opinion. It also cannot natively display PDF files. Amazon should release a newer version of the Kindle that rectifies these mistakes. Some of these devices, including the Kindle, are also unnecessarily saddled with DRM. Many of them have features that are of doubtful utility in an electronic book reader (for example, an MP3 player or a web browser with severely limited features).


Electronic paper still has some way to go before it can become an acceptable replacement for ordinary paper. The resolution of electronic paper still doesn't seem to be anywhere as good as ordinary paper. It cannot display colours other than black and white (or shades of grey), which is all right for ordinary text and figures but not for colourful photographs. The most troublesome aspect seems to be the manner in which the display is redrawn - there is a slight pause, followed by the blackening of the display followed by the final image. Depending on the person, this can either be very irritating or barely noticeable while turning pages.


These devices seem to be almost, but not quite, there. I think I will wait for the next generation of such devices before I buy one for myself.

2008-05-12

Disenfranchisement

I went with great enthusiasm this 10th of May to the nearest polling booth to cast my vote in the current elections here, only to discover that I could not vote since my name was not present in the voters' list. This was despite the fact that I had a valid Electoral Photographic Identity Card (EPIC) issued just a couple of years ago. My name just does not appear in the revised voters' list that was drawn after the recent delimitation of constituencies in Karnataka. I had to come back home disappointed.

When you consider the incredibly small impact that a single vote has on the outcome of an election, you might be tempted to ask "Why vote?". Given that the Congress, the BJP and the Janata Dal (S) are realistically the only parties that will be able to form a government in Karnataka and given their utterly shameless behaviour to grab power the last time round, it is natural for us to be dejected or at best feel apathetic towards this election. Some of us just don't want to take the trouble of going to a polling booth, standing in a queue and casting a vote.


However, democracy is how we have chosen to be governed in this country and voting in an election is the very least we can do to make sure it works as intended. The effect of a single vote might be negligible but the cumulative effect is considerable and is for the greater good of the society. It then feels like a shameful subversion of the democratic process when the names of willing and eligible voters go missing from the electoral rolls and they are thus disenfranchised.


Anyone even slightly familiar with a voters' list in India would agree that there are usually a lot of appalling mistakes in it. It is not uncommon to find a lot of people missing from a voters' list despite having valid EPICs and a lot of people who have long since died still lingering on in the list. Many people have had their names misspelt or their addresses mangled. For example, the last EPIC that I had managed to get everything about me (except my photograph and my sex) wrong in one way or another - it had incorrect entries for my name, my father's name, my address, my date of birth, etc. So I was not completely surprised to find my name missing from the voters' list, but I was surely disappointed.


Update (2009-04-22): This article in The Times of India offers a possible explanation for the mystery of vanishing names from the electoral rolls.

2008-05-08

Dr Dobb's Journal

I have had a subscription of the print edition of Dr Dobb's Journal (DDJ) for a little over six months now. This renewed relationship with my favourite professional magazine has been a mixed experience so far.

I first came across DDJ in the IIT Kanpur Library about 15 years ago. For someone interested in computer programming, it was a fantastic magazine. Along with BYTE (published only on-line after 1998), which was a fantastic magazine for people interested in microcomputers, it became regular reading for me at the library. I used to read new issues as soon as they became available in the library and would try to read as many of the old issues as I could lay my hands on (the library used to have bound volumes of old issues of these magazines dating back several years). The early issues provide a fascinating insight into the evolution of the personal computer.


When I started my career as a software engineer, I tried to subscribe to DDJ myself. At about Rs 3,000, the annual cost of the subscription at the time was a bit too much for me. This situation did not improve for several years after that. I had to console myself by ordering "Dr Dobb's CD Release 6", a CD that contained electronic versions of all the DDJ issues from January 1988 to June 1998.


When I noticed recently that the print issues of DDJ were available internationally at just $30 (about Rs 1,200) a year, I jumped at the opportunity to order a subscription for myself. Even though an electronic edition of an issue is immediately made available to subscribers, I always prefer to read the "dead-tree" (print) edition when possible. I eagerly waited for my copy of the print edition to arrive in my mailbox. I was setting myself up for frustration.


My copy of the November 2007 issue of DDJ arrived two and a half months after it was announced! To top that, the December 2007 issue did not arrive at all. To add insult to injury, my email to them inquiring about this problem was rejected by their "Barracuda Spam Firewall" with a terse message stating that "Message content rejected". As if to then really irritate me, they sent a letter in January 2008 asking me to renew my subscription ten months before it was set to expire!


Fortunately for me, the situation improved considerably from January 2008 and the issues started arriving regularly and well in time (as was the case many years ago, an issue of DDJ arrives about a fortnight before the corresponding month - for example, the issue for May 2008 was delivered in mid-April).


The first thing I noticed about these issues was that they were really thin - they seem to be about one-third the thickness of the old issues of DDJ from what I remember. Could that be the reason for the drop in prices? The second thing I noticed in the initial issues was that many of the articles were about web development and other such things in which I do not have that much interest. Was it going to be like this for the rest of the year?


Once again, fortunately for me, the more recent issues have featured some really nice articles. Articles like "Fast String Search on Multicore Processors" and "Detecting Bugs in Safety-Critical Code", for example, provide insights into areas beyond the realm of run-of-the-mill software development. Herb Sutter's "Effective Concurrency" is a really nice column. The issues for April 2008 (Algorithms) and for May 2008 (Programming Languages) in particular were quintessential DDJ.


Most elements of DDJ have not changed much over the years. The articles still have the same feel to them and most of the advertisements for software products are still embarrassingly corny. The PC-lint Bug of the Month series of advertisements are still there, though they are about C++ instead of C as a reflection of the changing times.


So would I still recommend this magazine to a programmer in India? Yes, definitely. Even with the cost of international shipping included, this magazine costs the same or less than comparable Indian magazines (such as they are) and the quality and the depth of the articles is usually much better.

2008-04-29

A Non-Cellular Organism

Granta is a quarterly high-quality literary magazine that attempts to showcase some of the best "new writing" in English. It has had a decent record in recognising some of the best young novelists before they became famous. It recently published a celebratory 100th issue with contributions from the likes of Martin Amis, Doris Lessing, Salman Rushdie, Ian McEwan, etc. Naturally, I had to have it.

I noticed that Granta 100 was available from Indiaplaza at a good discount, even when the shipping charges were included. In fact, Indiaplaza (formerly Fabmall) seems to be offering a good discount on a lot of books and other items these days. For example, if you buy the entire collection of Asterix comics, you get the entire collection of Tintin comics for free. So I decided to order my copy of Granta 100 from Indiaplaza.


That is when I ran into an unexpected hurdle - the new order form on Indiaplaza requires a mobile phone number and I do not have a mobile phone. The form would not accept a land-line number and even checks for numbers that do not "look like" a mobile phone number. When I complained to their customer service about this issue, they told me that their "delivery partner" requires this information in case they need to contact me. When I then asked them why their delivery partner shies from calling people on their land-line numbers, they relented and themselves suggested that I use a dummy mobile phone number like "98000 00000" to get past the stubborn order form. It worked and I was able to place the order. The item was delivered after a day without further ado.


This is not an isolated incident. I keep running into situations where the other party makes it mandatory for me to divulge my mobile phone number, even though I don't have one and even though they should be able to provide the service without knowing it. For example, HDFC Bank requires it in their form for enabling third-party transfers (in order to notify you of such a transfer when it happens) and Standard Chartered would not allow you to carry out certain transactions on-line without an additional code that they send to your mobile phone (ostensibly for extra security). In each of these cases, the vendor would be able to provide an additional benefit when it has the number for your mobile phone but that does not mean that it should make it mandatory for you to divulge this information.


Even if I did have a mobile phone, I wouldn't want to give its number to all and sundry, especially when they are known to happily hand it over to telemarketers without any respect for their own customers' privacy. Since mobile number portability is still not available in India, it is not a good idea to bind more and more services with your mobile phone should you wish to change your mobile phone service provider in the future.


I do not carry a mobile phone because of its invasive nature. I sometimes get annoyed by people who carry mobile phones for reasons given in this article. I have land-line phones in both my office as well as my home - when I am not in either of these places, I am most likely unable to or unwilling to have a telephonic conversation (for example, while I am driving or while I am watching a film). I do recognise the utility and convenience of having a mobile phone and some day I might also get one, but I do not have one at the moment and I detest it when people make it unnecessarily mandatory for providing a service.

2008-04-06

Stop Taxing the Interest from a Savings Account

It is utterly unfair for the Indian government to impose an income tax on the interest earned by an individual on a savings account. The government merely adds insult to an injury caused by low rates of interest, lower effective yields and high inflation.

2008-03-18

A Dismal Quest

I am looking for a good introductory book on economics to teach myself the basics of this dismal science. From the little I know about it, I have come to realise how important it is in helping one make sense of much that happens in the modern world. I am looking for a book that systematically provides a comprehensive introduction to the principles of macro-economics and micro-economics.

The most popular text for this purpose, till recent times, seems to be "Economics" by Paul Samuelson and William Nordhaus. However, N. Gregory Mankiw's "Principles of Economics" seems to be becoming increasingly popular these days. Fortunately for me, both of these books are available in cheap Indian editions. I flipped through the pages of these books in a bookshop and I must say that Prof. Mankiw's book looks far more approachable to a layman.

I notice that Paul Krugman has also come out with such a book titled "Economics", though I couldn't locate an Indian edition for the book. There are also freely-available economics text-books published on-line like "Introduction to Economic Analysis" by R. Preston McAfee (an "open-source book") and "Principles of Economics" by Timothy Taylor (an advertisement-supported book). I do not like reading lots of text on the computer screen and I cannot order the "dead-tree" versions of these books until I know for sure that they really are better than the more popular alternatives (viz. the books by Prof. Samuelson and Prof. Mankiw).

I would like to ask those of you who are more knowledgeable in economics: what book would you recommend for this purpose?

2008-01-05

A Taste of Haskell

"A Taste of Haskell" was a tutorial given by Simon Peyton Jones during the OSCON 2007 conference. It introduces programmers to the Haskell programming language using the xmonad window manager for X. The complete video of the tutorial is available in two parts (Part 1; Part 2; about 798 MB in total) and lasts for about three hours. The slides for the tutorial are also available (PDF; about 7 MB; 119 slides). The first time I read about this tutorial was in a post on Jao Ortega's blog. I have been meaning to check the video out ever since, but only now have I been able to finish watching it completely.