*** MOVED ***

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

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.

As an aside, Firefox on Linux also seems to behave quite differently from Firefox on Windows. For example, on Linux Firefox seems to consistently consume more CPU time and memory than on Windows. Some pages are rendered differently on Windows and Linux (perhaps due to the availability, or otherwise, of the fonts requested by the page designer and the rendering infrastructure). I have personally also noticed bug-337093 on Windows but not on Linux.

2007-05-14

VU3RDD Gets $2.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!

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.

I think I ended up asking him a bit too much about how he managed to remain a freelance programmer for so long, that too in Milwaukee, since it is something that interests (as well as scares) me.

2007-05-09

Wayanad

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.

A couple of Anusha's friends, along with their spouses, also joined us on this trip. We drove from Bangalore to Wayanad via Mysore, Nanjangud, Gundlupet and Sultan Battery, taking SH-17 and NH-212 and passing through the Bandipur wildlife sanctuary. The roads were quite good in general and the road from Bangalore to Mysore was excellent in particular. We covered the distance in about 5.5 hours, including a couple of short breaks. We stayed in Edakkal Hermitage, a resort quite close to the Edakkal Caves.

Pre-historic Carvings of the Edakkal Caves

Kerala is one of the most beautiful states in India. Even for someone from a generally green city like Bangalore, the lush and pervasive greenery of Kerala is an exhilarating change. As with The Tall Trees Resorts in Munnar that we had visited earlier, the cottages of Edakkal Hermitage were located on the quiet slopes of a mountain in a way that allows one to soak in the beauty of nature in relative privacy while affording a fantastic view of the valley below. The two resorts were also very similar in the amazing service provided by the respective staff and the delicious food that were served by them.

Our Cottage

On the first day, after having refreshed ourselves and having had lunch at the resort, we drove down to the Pookote Lake. This lake turned out to be a disappointment. It was small, filthy and full of tourists. We didn't stay there long, moving on to a view-point and then returning to our resort. Later in the evening, we had our dinner in a cave in the resort that was beautifully lit by more than a hundred candles.

The next morning, we visited the Edakkal Caves and admired the pre-historic carvings on the walls of the caves. The climb to the caves is a bit difficult and is not everyone's cup of tea. Three of our party, including me, wanted to climb further up the mountain and on to the summit, while the others preferred to stay back on a landing waiting for us to come back. We kept climbing up till we reached a rock-face that was a bit steep. There was a single rope for support and not many footholds. Not being experienced climbers and only having our ordinary shoes for support, we chickened out. We tried to find an alternate route to the summit and turned back on not finding any. I regret this now and wish I had mustered the courage.

Our only consolation was spotting a huge butterfly on the way back. It was the biggest butterfly I had ever seen and must have been about 20 to 25 centimetres (8 to 10 inches) across. We were able to get very close to the butterfly and even touch it - it just moved its wings and continued to sit on its tree.

The Butterfly

Tired from our trek, Anusha and I chose to relax in our cottage that afternoon while the rest of the party drove to the Suchipara waterfalls. In the evening we had our dinner in an amphitheatre in the resort.

The next morning we went for a safari through the Muthanga wildlife sanctuary. The safari was utterly disappointing for the most part with not many animals in sight (as has been our luck on all such occasions), when it suddenly turned rather interesting towards the end. Our way was blocked by a herd of at least seven elephants, one of which was a baby elephant. The driver of the Jeep was evidently quite scared and was ready to scoot at the slightest hint of trouble. Retreating was a bit difficult since the path was rather narrow (you had to either retreat in reverse gear or find a clearing large enough to turn the Jeep around) and there were other Jeeps behind us. We had to wait for about half an hour before the herd moved away and we could proceed. Other than the elephants, we were able to spot a Malabar Squirrel, different types of deer, langurs and peacocks.

The Elephants

That afternoon we headed back to Bangalore, regretting that we could not stay longer and dreading the plunge back into the daily grind of our lives.

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.

WINE allows you to run many a Windows application natively on Linux, including IE (albeit with a few tweaks). IEs4Linux makes it really simple to install one or more versions of IE on your Linux system, something that is very difficult on Windows itself, if not impossible! You can also view Flash content and run Java applets within such an IE. The latter requires a bit of tweaking with the current release of WINE (0.9.34), if you want to use Sun's JVM instead of that provided by Microsoft, as explained below.

Install a version of IE using IEs4Linux into, say, $HOME/.ies4linux (the default). Assuming that you choose to install only IE 6.0 SP1, IEs4Linux will create a WINE "bottle" named "ie6" within "$HOME/.ies4linux", separate from your regular WINE bottle (which is present by default in "$HOME/.wine"). IEs4Linux can also automatically install Adobe Flash Player along with IE. Run IE at least once to verify that it is working.

Now install the Java Runtime Environment (JRE) making sure that you correctly specify the WINEPREFIX environment variable by pointing it to the IE WINE bottle. For example:

export WINEPREFIX=$HOME/.ies4linux/ie6
wine jre-1_5_0_11-windows-i586-p.exe

For some reason, RegUtils.dll is not correctly copied during the installation of the JRE and therefore you must copy this file from a Windows machine that has exactly the same version of the JRE. This file is usually found in the "bin" sub-folder of the JRE installation folder. Without this file, the Java Control Panel applet will not be able to register Sun's JRE with IE.

Now run the "javacpl" programme found in the "bin" sub-folder of the JRE installation folder. With the current WINE release, this would cause your display to flicker or black out since it does not yet fully support DirectX-based acceleration (but where the maximum development effort currently seems to be directed). To avoid this, you can also invoke the Java Control Panel applet alternatively like this in the "lib" sub-folder of the JRE installation folder:

java -classpath deploy.jar \
-Dsun.java2d.noddraw com.sun.deploy.panel.ControlPanel

Go to the "Advanced" tab and uncheck the check-box for "<APPLET> tag support" for "Internet Explorer", apply your changes and close the applet. Restart the applet once again and this time check the check-box, apply your changes and close the applet. You should now be able to see Java applets within IE using Sun's JRE.

If you wish to avoid the flicker/blacking-out of the display whenever you run Java GUI applications, you can either pass the JVM option -Dsun.java2d.noddraw to Java applications and applets or disable DirectX-based acceleration for Java 2D completely by looking for a registry key like:

HKEY_CURRENT_USER\Software\JavaSoft\Java2D\1.5.0_11

and setting the value of "DXAcceleration" to "0". (WINE includes a "regedit" programme just like its Windows counterpart.)

With IE, Flash and Java Applets with you, you are now ready to savour the worst of the internet first-hand on your Linux desktop instead of hearing about it from your friends who use Windows.

(The method outlined here seems to work with WINE 0.9.34 on Fedora Core 6, IE 6.0 SP1 as installed by IEs4Linux 2.0.5 and Sun's JRE 1.5.0_11 - your mileage might vary.)

Update (2007-07-03): With WINE 0.9.40 on Fedora 7 and Sun's JRE 1.5.0_12, I don't see the problem with "RegUtils.dll" and the JRE installs just fine. Another way of avoiding the blackening of the entire desktop while using Java Swing applications (and for getting a much more accurate display) is to enable a "virtual desktop" that will hold your Windows applications. To do this, invoke "winecfg", select "Enable a virtual desktop" under the "Graphics" tab and provide a size for the virtual desktop (say, 800 by 600 or 1024 by 768).

Update (2007-10-31): The default location used by IEs4Linux is $HOME/.ies4linux (notice the period in front of the directory name). Changed the post to use this location instead as people were getting confused by the location used earlier.

2007-03-16

NX

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.

NX performs incredibly well, especially when you compare it to VNC, ssh with compression and X forwarding, etc. The desktop client, especially on Windows, still has a few bugs that are mildly irritating but nothing catastrophic. The sheer improvement in the response of your remote applications more than makes up for these minor shortcomings.

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:

S = P × (1 + r)n


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":

S = P × ((1 + r)n - 1) / 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-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:
  1. gcj
  2. tangram history
  3. ranjit mathew
  4. paradoxical puzzles
  5. gcj windows
  6. hostingzero
  7. matthew symonds economist
  8. how to beat voldemort on harry potter goblet of fire gameboy advance
  9. "* dataone it"
  10. ananth chandrasekharan
I know that I have mentioned each of these terms somewhere on my web site, but I feel a bit sorry for the folks who arrive at my web site following the links from their search results - except for #3 and perhaps #5, they are going to be quite disappointed by the lack of any useful information about the things for which they were searching.

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.

Quite sobering.

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

I have started using Xfce instead of KDE as the desktop environment on my Linux PC.

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.

2007-02-02

LibraryThing

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.