*** MOVED ***

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

2005-12-31

Hacks

Yumpee pointed me to an old story about a guy who used a BBC Micro monitoring a decaying prawn sandwich to tell the time!

Jockey is a cool user-space program execution recording and replaying library for Linux. It actually scans the code page of a process to recognise system call instructions and rewrites them to jump to a trampoline instead.


By the way, my favourite Free 3D modelling tool Blender has reached version 2.40 featuring tonnes of cool improvements.


(Originally posted on Advogato.)

"The Perils of JavaSchools"

It is not often that I fully agree with an article written by Joel Spolsky, but this one is an exception. As someone who has been interviewing people for his employers for over eight years, I can attest to the steady deterioration in the quality of candidates I talk to and the depressingly continuous lowering of my expectations over the years when I walk into the interview room.

(Originally posted on Advogato.)

2005-12-29

Terrorists Strike in Bangalore

Terrorists opened indiscriminate fire and killed at least one person and seriously injured four to six others yesterday. What was particularly appalling was their choice of the Indian Institute of Science (IISc) and researchers attending a conference on Operations Research as the target!

(Originally posted on Advogato.)

2005-12-23

StanChart Sees the Light

Among the financial institutions I deal with and whose online facilities I use regularly, Citibank India, HDFC Bank and ICICI Bank have had great support for Firefox. The only exception was Standard Chartered India who did not seem to want to support anything other than IE or Netscape Communicator 4. I had pointed this out to their Customer Service several times and even pointed out where in their JavaScript code they were making the mistake, but I was always presented with a verbose, albeit nicely written, message asking me to just use the supported browsers and stop ranting. Needless to say, I was irritated and frustrated.

To my pleasant surprise, I discovered last week that they had silently started supporting Firefox as well. Perhaps it came about because a lot of their developers themselves use Firefox; perhaps a lot of customers actually complained; perhaps they saw that by most accounts, Firefox has around 8-10% of the "browser marketshare". Whatever be the reason, I am happy. It is also heartening to note that a lot of sites these days increasingly seem to just work with Firefox instead of requiring IE.


(Originally posted on Advogato.)

2005-12-21

New Software

SeaMonkey is the new avatar of the Mozilla Application Suite, kept alive by people who prefer the old monolithic application approach to the new approach of having standalone browser (Firefox), mail client (Thunderbird), etc. components. SeaMonkey has just released 1.0 Beta. I personally prefer the old approach as well, but have decided for the moment to not switch back from Firefox/Thunderbird simply because I have now become quite used to these applications and have begun to rely on some of the superb extensions created by the community for them.

QEMU 0.8.0 is out (as is VMWare Player 1.0). By the way, QEMU can be easily used to create virtual machine discs for use with VMWare Player. However, I still prefer to use QEMU.


(Originally posted on Advogato.)

Planet GCC

I set up a simple Wiki page listing the weblogs of various GCC hackers as a temporary measure till such a time that we have a "Planet GCC" weblog feed aggregator of our own. Please feel free to update it with links to weblogs of GCC hackers that you find missing.

(Originally posted on Advogato.)

Free Source Code Browsing Tools

I would like to use a tool that would allow me to easily browse large bodies of source code (for example GCC). I do not need an IDE. The tool should:

  • be able to run on a modern Linux system.

  • be free to use and free to modify.

  • support at least C, C++ and Java out-of-the box, with easy extensibility to other languages.

  • be fast (to create indices, to respond to user actions), lean on resources and intuitive.

  • be kept up-to-date and actively maintained.

  • have a graphical user interface (desirable, but not necessary).

I have looked at Exuberant Ctags (for vi), Source Navigator, Hypersrc/Pypersrc, GLOBAL etc., but do not fully like any of them. Source Navigator comes the closest to filling my needs, but has an ugly interface and (more importantly) does not seem to be maintained at all (for example, no one has bothered to fix the usage of "-fwritable-strings", which newer GCCs do not support anymore).

So for people who do not use IDEs, is there no tool that measures up to these requirements?

(Originally posted on Advogato.)

2005-12-15

Preview of the Next Edition of The Dragon Book

Addison Wesley have put up a sneak preview of what is in the long overdue and much anticipated updated edition of The Dragon Book (a.k.a. "Compilers: Principles, Tools and Techniques" by Aho, Ullman and Sethi). For some insane reason, they have decided to use JavaScript, Flash and pop-ups to show these chapters, prompting instant revulsion in yours truly. I'd rather wait for the dead-tree edition than subject myself to such torture.

(Originally posted on Advogato.)

The Battle for Bangalore

Just when I was wondering how ironic it was to have FOSS.in 2005 and Microsoft's developer bash happen within a week of each other in Bangalore and at the same venue (Bangalore Palace), comes this article. Bill Gates also launched a rather "The Apprentice"-like code4bill contest while he was here, apart from promising to invest 1.7 billion dollars into India. The Times of India and NDTV did not shy from calling him a corny "Geek No. 1" (in reference to a series of hit Hindi movies named "Hero No. 1", "Coolie No. 1", etc.).

So which way would the Bangalore hackers sway?


Despite having a very large number of Software Engineers, I come across only a very few here in Bangalore who are even interested in coding and Computer Science and precious few who are willing to hack on FOSS and give back their changes to the community. For all the brouhaha in the general media about India being an IT superpower, it is a depressing scene for someone who actually likes CS.

(Originally posted on Advogato.)

2005-12-08

www.hackgnu.org To Become Available Soon

Ramakrishnan is giving up his domain www.hackgnu.org. Any Free Software hacker who wants to take it over should contact Ramakrishnan before it lands in the hands of domain squatters.

(Originally posted on Advogato.)

2005-12-07

Google Quiz in FOSS.in 2005

With a little help from the Google search engine (the irony!), I have found the sources of "inspiration" for the questions asked in the "Google Quiz" (GQ) in the recently concluded FOSS.in 2005.

The first problem was the same as #2 in the problem set for the 9th World Puzzle Championship (Qualifying Test) (PDF). The second problem was the same as #2 in the 2002 US Championship Puzzles. The third problem was the same as #1 in the 2000 US Championship Puzzles. The fourth problem was essentially the same (verbatim, except for the actual numbers) as #22 in the problem set for the 10th World Puzzle Championship (Qualifying Test) (PDF).


Not being someone who solves puzzles regularly (except for Sudoku, of course), I was quite impressed by these problems since most of them involved considering multiple alternatives, proceeding with one of the alternatives and then backtracking and proceeding with another if that proved invalid, continuing till one finds a solution. They should also be fun to solve using computer programs. (I know of at least one person who did precisely that.) I had asked some of the people at the Google booth if I could reproduce these puzzles on my web site to share with my friends, but they were not sure of the copyright issues and clearance for publication. Well, now we know where they got the puzzles from and have found some more interesting puzzles to work on!


(Originally posted on Advogato.)

2005-12-02

"Hello World" Sans Semi-Colons (Java)

Srikanth has a better solution that works with JDK1.5:

public class Sriki
{
public static void main( String[] args)
{
if( System.out.append( "Hello World!\n") != null)
{
}
}
}


(Originally posted on Advogato.)

FOSS.in 2005

FOSS.in 2005 has finally ended. You can find daily reports and impressions on Planet FOSS.in.

Personally for me, it was a mixed event. I could finally meet some of the people whose work I have admired immensely over the years and I also attended a couple of really illuminating sessions. On the other hand, I didn't get to meet as many people as I had hoped to meet and some of the sessions were bad.


Alan Cox was the star of the event as far as I could tell. He was always surrounded by admirers or people just curious to see how he looks. He always had the Red Hat red hat on and talked very nicely to one and all. Like RMS, he seems to have a bit too much of facial hair and has the same habit of frequently twitching as well. I also met Andrew Cowie (java-gnome), Johnathan Corbet (LWN.net), Sirtaj Singh Kang (KDE) and Harald Welte (iptables/netfilter). By the way, I had imagined Harald to be an old person for some reason all this while so I was rather surprised to find a rather boyish looking young man with a lot of enthusiasm and a cool haircut.


I really enjoyed some of the talks, especially on topics that I knew nothing about. Jaya Kumar's talk on how to put together an embedded Linux system, right from selecting the hardware to customising Linux and burning it into the device, was awesome. The guy really knows his stuff and talks with an infectious enthusiasm on a lot of topics. His other talk on GPL and non-GPL kernel modules was also very nice.


Harald's talk on how he figured out what made up his Motorola A780 mobile phone (that runs Linux), hacking his way to getting telnet access to the phone and finally building and uploading updated kernel and applications was also awesome. He followed it up with a live demonstration. The results of his efforts are at OpenEZX.org. By the way, he uses an encrypted filesystem on his laptop to store everything.


There was a talk on hacking the GCC ".md" machine-description files for a quick-and-dirty solution to a code-generation problem and another on using GCJ with SWIG to interface Ruby with Java. However, I felt that these talks were a bit hurried and would have left most of the audience utterly clueless. By the way, the speaker for the former talk, Amber Ved, had recently fractured his left arm and had it in a sling. It was quite evident that it was excruciatingly painful for him but he persisted and managed to finish his talk. All I can say is, "Wow!". However, I still think GCC is severely under-appreciated and I wish I had put together a talk on GCJ or at least GCC. There's so much that has been happening with GCC that people deserve to know.


Another highlight of the event for me was the Google Quiz or "GQ". This was a set of four logic puzzles handed out to whoever they could lay their hands on and if you completed all four, you had a shot at winning an iPod nano. I really enjoyed solving these puzzles and they kept me busy for quite a bit of time.


Unfortunately for me, the schedule of the talks was such that sometimes I had to make a difficult choice of selecting a single talk among three to four very interesting sounding talks and sometimes I wasn't interested in attending a single talk in a given time slot. "You can't please all the people all the time" and all that. But no one can complain that there wasn't enough stuff going on - this surely must have been the biggest FOSS event ever in this part of the world. I am already eagerly looking forward to attending the next year's event. A big THANKS to Atul Chitnis and his gang of volunteers for pulling this off!

(Originally posted on Advogato.)

2005-11-28

Semi-Colonoscopy

Can you write a valid Java program to print out "Hello" on the standard output without using a single semi-colon in the source code?

When Srikanth asked me this question, my immediate and disingenious response was to hide the semi-colon using a Unicode escape sequence like this:

public class Sriki
{
public static void main( String[] args)
{
System.out.println("Hello")\u003b
}
}

However, he has a better solution:

public class Sriki
{
public static void main( String[] args) throws Exception
{
if( System.out.getClass( ).getMethod(
"println",
new Class[] { String.class}).invoke(
System.out,
new Object[] { "Hello"}) == null)
{
}
}
}

Can you come up with a better solution?

(Originally posted on Advogato.)

2005-11-24

"Information Wants to be Free!"

I really hate it when I come across a reference to a paper or a standard and I am not able to read it because I must buy it or be a member of a subscription plan at prices that are atrocious by the standards of developing nations. In my line of interest (Computer Science), the biggest culprits are the ACM Digital Library and ISO. Fortunately, most of the times I can work around this limitation by using Google with a query like '"<title of the paper>" filetype:pdf' or by taking the help of a friend. I really wish researchers use arXiv or an equivalent service more often. The whole point of publishing papers is to help advance your field, not to retard it, right? (Apparently, the situation is still bearable in Computer Science but is unbearably ridiculous in basic sciences like Physics and Mathematics; hence the genesis of arXiv.)

If I ever publish a useful book, an article or a paper, I would try my best to make it publicly available for all.

(Originally posted on Advogato.)

FOSS.in 2005 Sessions

The detailed schedule of sessions for FOSS.in 2005 is available now (check out the names of the halls!). The good thing is that there are so many speakers and sessions to choose from. The bad thing is that many of the sessions one wants to attend either clash horribly with one another or overlap partially in incompatible ways. For example, on the very first day at 3:15PM, I have to choose between "Google and Open Source" by Zaheda Bhorat, "GCC Backend and Machine Description file" by Amber Ved, "equivalence configuring" by Andrew Cowie and "Introduction to cross-platform programming techniques" by Jaimon Jose!

Delegates from outside Bangalore might want to check out the annual book sale by the great Strand Book Stall while they are here in Bangalore. The venue for the sale is the Chinnaswamy cricket statium and is quite close to the venue for FOSS.in 2005. Veteran bibliophiles in Bangalore would readily tell you how friendly a store Strand is and how you can get some really good deals (up to 80% off) on books during their annual sale. Unfortunately for them, both Landmark and Crossword have now opened big stores in Bangalore. These stores do not usually give you as good a price on books as Strand, but are closer to the watering holes of many young people and have much more space where you can actually sit down and peruse a book at your leisure. I personally get most of my non-technical books from Landmark now simply because it happens to be much closer to my house and my place of work.

(Originally posted on Advogato.)

2005-11-22

More Videos

Apart from the SICP Lecture Videos, also interesting to watch are the Knuth videos, the Alan Kay videos (Part 1 and Part 2), the Hans Bethe videos and the FORTRAN 25th anniversary film. Some stuff in the DDJ Technetcast is also interesting.


(Originally posted on Advogato.)

2005-11-21

More Improvements to GCC

Apart from the projects already planned for GCC 4.2, we now have proposals for Link-time Optimisation, New Register Allocation Method and LLVM Integration. The integration with LLVM, should it happen, would be the most significant change to GCC since Tree-SSA. Pretty exciting times for a hacker to be involved with GCC!


(Originally posted on Advogato.)

SICP Lecture Videos

Thanks to Ramakrishnan (a.k.a. "VU3RDD" on Amateur Radio), I now have the complete set of SICP Lecture Videos. Now I need to burn these videos to DVDs and then take the time to watch them. Thanks a lot to all the others as well who offered to help me get these videos.

By the way, my first attempt to burn these to DVDs failed because I had not realised the sundry incompatible formats in which DVDs come. I had access to a DVD+RW drive and I had initially bought DVD-R discs. Thankfully, I could get a refund on all the discs except the one that I had opened.

(Originally posted on Advogato.)

2005-11-15

Subversion, Old Dog, New Tricks

It turns out that I do not need too much of extra disc space for working on trunk and gcjx-branch using SVN compared to CVS after all. This is because I used to always create a snapshot of GCC sources and use it as a working copy for fear of messing up my checked-out sources. Since SVN always keeps a copy of the pristine sources around (which is the major cause of the increased disc space usage) and it is easy and fast to use svn diff to figure out the damage and to use svn revert to restore sanity, I no longer need to continue with my weird model of development. It is also quite simple to just ignore everything from the GCC SVN repository except for the interesting stuff - for the gcjx-branch, my checkout only has the bare minimum stuff needed to bootstrap C, C++ and Java and run the libjava testsuite, while for trunk I have removed all the Ada stuff since I can't build Ada anyways. Of course, all this would probably have been possible with CVS as well, but there weren't nice instructions in the GCC Wiki for lazy souls like me for doing this with CVS.


(Originally posted on Advogato.)

FOSS.in 2005

Andrew Cowie has bullied me into attending FOSS.in 2005 after all. He made me realise what a shame it would be to miss this once-a-year opportunity to meet like-minded Free Software hackers from all over the place when it is happening right here in Bangalore. Of course it also helps to have supportive bosses to grant you leave from work for the period. So here's looking forward to meeting kindred souls. Thanks Andrew!


(Originally posted on Advogato.)

2005-11-10

Videos of SICP Lectures

Most of the coders who have read Structure and Interpretation of Computer Programs (SICP) would agree that it is a profoundly insightful book that teaches you a whole new way of coding. So when I found out that the videos of the SICP lectures given by Abelson and Sussman are now available for download, I was excited. However, my excitement turned to dismay when I found out that the videos were huge - even a single DivX-compressed video of a lecture would bring me perilously close to my monthly broadband download quota, not to mention take an awful amount of time.

So if any of you out there have all these videos already downloaded, would you be willing to burn it to a DVD-R and send it to me? I am of course willing to pay for the cost of the media, package, postage and reasonable labour charges. Drop a message to rmathew AT gmail DOT com if you can. I would prefer the DivX-compressed versions. I had already written to Hal Abelson to know if they provided such a service and they indicated that they don't.


(Originally posted on Advogato.)

2005-11-07

FOSS.in 2005

There are so many talks I would like to attend in FOSS.in 2005, but it happens to fall bang in the middle of a work week, that too at a time when I cannot afford to take too many days off work. Uggghhh!


(Originally posted on Advogato.)

Back From Vacation

I am back from a wonderful vacation in Ooty and the Deepawali holidays. Before going on vacation, I discovered that my Creative 52x CD-ROM drive had gone completely bonkers, randomly opening and closing by itself under any operating system. Apparently, this is not uncommon for these drives from Creative. In any case, I have taken it out and have put in a hard disc that I had lying around in the IDE slot that was thus freed. This was a remarkable coincidence as GCC also moved to Subversion in the interim and I was looking for extra space to fit the bloated copies of the SVN repositories. However, I must first take a backup of the existing stuff on the hard disc onto CDs and that is a painful process I am not really looking forward to.


(Originally posted on Advogato.)

2005-10-25

Subversion and GCC

GCC would be moving to Subversion around this weekend. In general, I feel this is a good move and will probably help our prolific developers a lot. I do have concerns about its alarming usage of disc space relative to CVS though. As it is, my home PC is under a bit of a strain trying to squeeze in GCC mainline and gcjx-branch copies, not to mention snapshots of these that I actually use as working copies, on the hard disc partitions that I have provided to Linux. After the move to Subversion, I will have to make some adjustments to the disc partitions to fit all this stuff in.

However, this will probably have to wait as I would be on vacation in Ooty most of next week.

(Originally posted on Advogato.)

SPAM

I made the mistake of inadvertently posting a single message to comp.compilers using my office email address and within a day I was being spammed hard! That account had remained SPAM free for almost three years and it is rather painful to see it in the hands of these idiots. Thankfully, Thunderbird is getting better and better every day at detecting this SPAM, so there is some relief.

(Originally posted on Advogato.)

OpenOffice.org v2.0

I have been waiting for this release for quite some time now, so as soon as it came out, I downloaded the Linux tarball. To my horror, I find that unlike previous releases it does not contain a simple installer but many RPMs! Why did they have to do this? It is so silly. An alternative for me is to build it from sources, but I do not have the energy or the enthusiasm to do it. Sheesh!


(Originally posted on Advogato.)

2005-10-14

Dumping Parse Trees

GCJX now accepts an "-fdump-tree" option that prints out the abstract syntax tree of a Java source file to stdout.

(Originally posted on Advogato.)

2005-10-10

A Walk Among The Trees

I implemented a simple pretty-printer for the AST used in GCJX over this weekend. It works just like the debug_tree() function in GCC and is accessed by using the dump_tree() function in GCJX. For convenience, I just change "-fdump-methods" to call dump_tree() instead of dump_method(). That way I can easily see the ASTs created for various Java source files. For someone like me who is new to GCJX in particular and compiler construction in general, this can be quite enlightening.

While debugging the GCJ front-end, I have found debug_tree() to be an immensely useful tool. I hope dump_tree() proves similarly useful for GCJX.


By the way, I added a small page to the GCC Wiki describing how to go about debugging GCJX.


(Originally posted on Advogato.)

2005-10-07

Digital Nirvana

Apple, Google and Microsoft want to liberate us from the tyranny of folders and file names. You would never have to remember the name of a file or the folder in which you put it in to retrieve it. In a way, this is already how a lot of us use the Internet - I for one, just Google for a page rather than bookmark it and try to locate it within my labyrinthine bookmarks folder. This is good and I appreciate it. However, unlike the World Wide Web, your desktop PC would some time run out of disc space. When that happens, you can either just buy another hard disc or try to clean your existing hard disc. If you choose the latter, how do you find stuff you do not want? These tools make it easy for you to find stuff you want but not what you do not want.


IBM has created a Universal Virtual Computer to solve the problem of digital decay. Does any one else think this is an overkill? Is using well-documented document or image formats with portable reference reader implementations not good enough? What is to stop subtle errors in porting the UVC to new platforms from preventing the documents to be displayed as originally intended?


(Originally posted on Advogato.)

The American Prophet

When the leader of the most powerful nation on this planet talks like this, you desperately wish it is not true.


(Originally posted on Advogato.)

2005-10-03

Madness

After "7/7", Britain seems to have gone bonkers just like the US did after "9/11". If you have access to the latest issue of The Economist, also read "Conference kick-out" in the "Britain" section. Sheesh!

(Originally posted on Advogato.)

2005-09-30

Mauled in ICFPC 2005

Our entry in ICFPC 2005 was mauled by just the judges' cops! Looking at the playback of the robber's performance, I want to hide my head in shame.

(Originally posted on Advogato.)

2005-09-28

Bangalore Computer Graphics Group

Anirban Deb, who is a colleague of mine, has started the Bangalore Computer Graphics Group along with like-minded enthusiasts, which aims to bring together people in Bangalore who are interested in computer graphics (not the Photoshop or Maya stuff). If you are interested in such things, or know of someone who is, spread the word. Their initial plan is to meet at least once a month to discuss interesting stuff and to get to know like-minded people and to eventually become the local SIGGRAPH chapter.

In other news, look who's blogging! Now that Andrew and Tom are blogging, Bryce is the only one in the Red Hat GCJ Triumvirate who doesn't. Who wants to persuade him to blog?


(Originally posted on Advogato.)

2005-09-23

Miscellany

I have been granted write access to the CVS repositories of GNU Classpath and Mauve. I have also started messing with GCJX (again) that was started by Tom Tromey. It has come a long way since the last time I had taken a look, but it sure can use some help from willing hackers. Would you like to help develop a first-class Java compiler?

By the way, Tom has become one of the Java front-end maintainers for GCC.

(Originally posted on Advogato.)

2005-09-13

C++ Madness

Compile the following program with "g++ -fno-implicit-templates foo.cpp" and admire the error message that you get. Just how is a mortal programmer supposed to make sense of this?

#include <string>
#include <map>
using namespace std;
int main( void)
{
map<string,string> foo;
return 0;
}

The example might look bogus, but consider this: you have been told that explicit template instantiations can some times considerably speed up your build process, not to mention save space used up by the object files, so you begin by creating an explicit instantiation file that you try to populate with template instantiations that are actually used by your program. You compile all other source files using "-fno-implicit-templates", but not the one special file. If you have not caught all template instantiations however, you will hit the monster of an error message that I sought to show per missing template instantiation. You are supposed to then figure out from these error messages which of the template instantiations you have missed out. Should anyone be surprised if you lose all hope at this point and just ditch the idea?

(Originally posted on Advogato.)

2005-09-06

PGP Public Key

I now have my own PGP Public Key (Key Identifier: 6C114B8F, Key Fingerprint: D6E5 B9C2 5522 ED3D 09DC 3B40 61BD 61C7 6C11 4B8F) that I will try to use with my email messages. Of course, this will not work with the web interfaces provided by Gmail and Hotmail, but it works nicely with Thunderbird using the Enigmail extension. I have published this key to a couple of keyservers. I do not foresee being able to participate in a Free Software hackers' key-signing party any time soon, but I have signed the keys from Mark Wielaard, Michael Koch and Andrew Haley for whatever it is worth.

(Originally posted on Advogato.)

n Factor

I just found out that my blog (as well as those of many GCJ/Classpath hackers) is also being aggregated by n Factor besides Planet Classpath.

(Originally posted on Advogato.)

More on WFL Nodes

I found the original patch from Jeff Law that removed WFL nodes from the rest of GCC and includes an analysis of why WFL nodes are bad. Note in particular his analysis of the Java front-end, where 30% of all generated tree nodes are EWFL nodes! WFL nodes are thus a waste of space and time, not to mention a source of unnecessarily-added complexity in the front-end that ultimately only frustrates hackers. So I repeat my war cry, "Death to WFL nodes"!

By the way, GCJ already gets the column numbers pretty wrong on almost all diagnostics, so it's not as if we lose much by losing EWFL nodes.

(Originally posted on Advogato.)

2005-09-04

EXPR_WITH_FILE_LOCATION

I hate EWFL tree nodes in GCJ. So many of the ICEs (internal compiler errors) I have seen in GCJ are because some piece of code expects or doesn't expect an EWFL node. To put it simply, the current front-end wants a WFL-wrapped expression node whenever there is a need to emit a warning or an error about that expression, but not otherwise.

This can easily frustrate anyone wishing to fix some of these ICEs in the hopes of making GCJ better. For example, here I am discovering that many ICEs in the Jacks testsuite are because the body of an empty block ({}) or statement is not being wrapped in an EWFL for diagnostics about unreachable statements, finding that it is trivially fixed and then discovering that doing this creates a whole mess of new ICEs on other tests, which have to be individually addressed in this manner potentially creating yet other ICEs in other places, ad nauseum.


To quote Jeff Law (gcc/ChangeLog.tree-ssa), "Death to WFL nodes"!


(Originally posted on Advogato.)

2005-09-01

GNU Classpath Copyright Assignment

My copyright assignment papers for GNU Classpath were cleared by the FSF today.

(Originally posted on Advogato.)

2005-08-19

R.I.P.: Old Bytecode Verifier

The old bytecode verifier used by the GCJ compiler has now finally been removed. It was a small and straightforward verifier but had a few bugs that made it difficult to use GCJ with random JARs. At the same time, the newer bytecode verifier (written in C++) used by the GCJ interpreter gij had far fewer bugs and could handle almost all JARs found in the wild. Since no one was fixing the bugs in the old verifier, GCJ could not work with many JARs for a long time and thus was unusable for a large number of potential users. Bryce made the new bytecode verifier work with the GCJ compiler to support the work on the new Binary Compatibility ABI. After some time I made the new verifier the default for even the old C++ ABI.

I feel guilty and sad now because once upon a time I had resolved to fix some of these bugs but never actually got around to fixing them. I had studied the source code and had read several papers on bytecode verification, especially some of the excellent ones by Alessandro Coglio, but never implemented any of the techniques. Not good.


(Originally posted on Advogato.)

2005-08-16

Scratching An Itch: Terry Laurenzo, GCJ and Generics

One of the stumbling blocks in supporting generics in native programs created by GCJ is the fact that the C++ method-name-mangling used by GCJ does not encode the return type of the method and thus cannot support the Java 1.5 kludge for implementing generics (PR9861).

Terry was just another bloke who was trying to make his program work with GCJ when he hit this issue. Unlike most other blokes however, he has decided to do something about it. Cool!


(Originally posted on Advogato.)

2005-08-12

Sabbatical

VikGup takes a sabbatical for three months starting next week. I really envy him and I wish I could do the same.

Sabbaticals might be quite common in the west, but here in India they are very rare. Even when people want to take sabbaticals, many a time they are discouraged. I hope more people take off on sabbaticals like VikGup has done so that employers and family realise that it is OK, and actually quite healthy, to take a sabbatical.


Have fun VikGup!


PS: Is Mohan back?


(Originally posted on Advogato.)

2005-08-11

McCarthy-ism

I have been meaning to check out Lisp (or one of its dialects) for a very long time now. I first came across functional languages (via Standard ML) when we studied Principles of Programming Languages (PoPL) at college. PoPL was also responsible for introducing us to declarative programming (via Prolog). I found these two styles of programming very difficult to grasp as I had been programming with imperative languages (BASIC, Pascal and C) for around 4 years by then. The unfortunate part was that by the time we "got it", the semester was over and we moved on to other things. I told myself at that time that I would learn Lisp and Prolog on my own "soon".

Almost eleven years have passed since then and I still have not come around to actually learning these languages and the programming styles associated with them. Lisp at least keeps appearing on my radar every now and then. The urge to learn it becomes particularly strong when I read about the ravings of the early oldskool hackers in Steven Levy's "Hackers" or one of Paul Graham's articles on Lisp or SICP. Tromey's recent blogentries have once again aroused my interest in Lisp.


Instead of continuing to procrastinate, I want to start learning Lisp now. I think I would start by reading "Practical Common Lisp". I also hope to be able to understand the origins of Lisp by reading John McCarthy's original paper on Lisp. I hope to be able to overcome my revulsion for seeing so many parantheses in even the most trivial of programs.


(Originally posted on Advogato.)

2005-08-01

GoF Honoured by ACM SIGPLAN

The authors of "Design Patterns" have been honoured by ACM SIGPLAN this year with the "Programming Languages Achievement Award". I personally think that this award is justly deserved. Their book has had a strong influence on the way I approach designing a program. I would gladly recommend this book to any programmer - you do yourself a disservice if you haven't read this book yet, for whatever reason.

Unfortunately, I see either a rampant abuse of Design Patterns ("Let's see how many design patterns we can fit into our design for this project") or a refusal to accept that they can have any merit besides being useful in impressing your PHB. Whether by diktat or by choice, if you are trying to come up with an object-oriented design for a project, it helps tremendously to know how other people have solved some of the specific problems in a way that allows the design to remain flexible while solving the immediate constraints. The flexibilities are precisely what come in handy in the face of ever-changing requirements. A secondary benefit is being able to use a common vocabulary to describe parts of your design to others, who can then immediately grasp what you are trying to do.


(Originally posted on Advogato.)

2005-07-31

Prelinking

I have now become yet another fan of pre-linking. It works wonders on the startup times of most applications. Many thanks to Jakub Jelinek for creating prelink for Linux.

(Originally posted on Advogato.)

2005-07-28

100 Inane Ramblings

I have put in more than 100 inane entries into my Advogato diary by now.
Here is a nice weblog entry (try to ignore the awfully distracting background image) by James Gosling talking about the problems in "correctly" implementing sin() and other trigonometric functions in Java.

Yumpee had pointed me to some nice papers by some of his fellow Googlers a while ago. They make for some great reading. Try to at least read the papers on Google FS, MapReduce and Sawzall (in that order).


Some day, I hope to be able to decipher what Graydon says about programming languages.


(Originally posted on Advogato.)

2005-07-22

GCC v/s glibc

I had configured and built GCC 3.4.4 with "--with-arch=pentium3" and was happily using it for everything till I decided to compile glibc 2.3.5 with it. The build failed with a weird assembler error message as noted in glibc bug-701. That bug however, had been been closed unceremoniously and marked a duplicate of bug-333, which itself looks unnecessarily obnoxious.

After a bit of poking around, I found out that GCC pre-defines "__i686" if "-march=pentium3" is used (see $GCC_SRC_DIR/gcc/config/i386/i386.h) and this was causing the problem with glibc (see $GLIBC_SRC_DIR/sysdeps/i386/elf/setjmp.S). So I had to explicitly use "-march=i386" with GCC to be able to compile glibc. However, "make check" still fails. I will now build and install a vanilla GCC 3.4.4 and see if that is able to properly build glibc.


By the way, glibc 2.3.5 can not be built with GCC 4.0.1, though Dan Kegel seems to have patches to enable you to do it. It can not be built with anything lower than GCC 3.2 either.


(Originally posted on Advogato.)

2005-07-21

Miscellany

I come back from a two-week vacation in Bhopal and find that GNU Classpath crosses a million lines of source code and that Tom has done the big GNU Classpath merge into libgcj that should make importing changes from GNU Classpath much easier than before. I also found out that people were still discussing the semantics of overflow of signed integers in C on the GCC list and that Zack Weinberg has left GCC development.

Daniel Berlin has set up an automated patch queue for GCC patches. All you have to do now is to include a line like:

:ADDPATCH java:

in your patch message and it would be added to the patch queue for the area "java". Cool!

Nvu, the new incarnation of Mozilla Composer and a standalone program like Firefox and Thunderbird, has reached version 1.0. I took it for a spin and was able to easily create a few nice-looking HTML documents. Apparently it also supports CSS, XHTML, etc. but I don't know much about them yet to find out how good it is at supporting them.


After having ignored all this while the RSS and other feed aggregation capabilities of Mozilla Thunderbird, I now find this feature absolutely indispensible and liberating. Now I can waste even more of my time reading weblogs and sites that I otherwise would not have bothered to visit with such regularity.


Barry Andrews became yet another person to let out a primal cry of joy and pride after he successfully built GCJ 4.0.1 for Win32 by following my document. Based on his suggestions, I have refactored the document a bit and have highlighted some of the more important points.


(Originally posted on Advogato.)

2005-07-01

GCC Developers' Summit

The proceedings of the 2005 GCC Developers' Summit are now available (PDF). As usual, they make for very interesting reading. I was particularly interested in reading Vladimir Makarov's paper on the new register allocator infrastructure that he is working on since register allocation, especially for register-starved architectures like x86-32, is GCC's Achille's Heel. It seems that the new Tree-SSA infrastructure particularly aggravates the register pressure.

Dan Kegel also maintained a diary of his visit to the summit.


(Originally posted on Advogato.)

Projects for GCJ

Here are some random projects for GCJ of varying complexity that I would personally like to see implemented as soon as possible:

  • Generics - Although Ken Arnold says generics are a mistake, they are still very useful in my personal opinion and GCJ should be able to handle them. Of course, it would mean fixing PR9861 first.

  • Assembler - a Java assembler is a very useful tool to have, especially when you want to create invalid class files to test bytecode verification. We should either get Jasmin integrated into Classpath Tools, or create one ourselves. The latter option would be eased if we could get ASM integrated into Classpath Tools via Archit Shah's work on a new RMI compiler (which is still waiting to be checked in for some reason).

  • JIT Interpreter - I think QEMU's portable dynamic translation is a really nifty idea and it seems to work rather well judging by the speed at which QEMU emulates a guest operating system. This can perhaps be used by gij to implement a "real" JIT.



(Originally posted on Advogato.)

2005-06-28

ICFP 2005 Programming Contest

Yumpee and I participated in the ICFP 2005 programming contest over this weekend. The problem was quite interesting and quite open-ended in that one could keep trying different strategies and play them against each other to see how they fare. In the end however, we ran out of time and we could only submit rather rudimentary cops and robbers - a cop that walks about randomly on the map hoping to catch a robber by serendipity rather than by design, a robber that just tries to rob the nearest bank while trying to avoid cops with a two-level lookup and a robber that walks about randomly on the map merely avoiding running into cops.

In terms of the implementation choice, the only middle-ground for the two of us turned out to be C++. I wasted much of the time debugging silly problems that arose mainly because C++ and the STL do not seem to have been designed with comprehension for lesser mortals like me in mind. Oh and we leaked memory with a perverse and gleeful abandon! (And our memory footprint at the end of any match was still less than the default no-op cop written in PLT Scheme that came with the BDK.)

I really enjoyed the coding binge and it was funky trying to coordinate rapid coding with a fellow hacker in a timezone that was 12 hours behind. At the risk of forfeiting the judges' prize, we still have two weeks to tweak our code and implement better strategies before the other half of the problem is announced. However, I'll be bang in the middle of my vacation during that period so it will entirely be up to Yumpee alone.

(Originally posted on Advogato.)

2005-06-16

JumpDrive: Reprise

Today I received a replacement for the dead JumpDrive USB drive from Lexar Media. I am happy with the wonderful customer support service from Lexar Media.

(Originally posted on Advogato.)

2005-06-15

"BSA or just BS?"

Some time back The Economist published a small article titled "BSA or just BS?" (subscription required) that questioned the rather dubious statistical method used by IDC on behalf of the Business Software Alliance (BSA) to come up with an estimate of lost revenues due to pirated software and use that to lobby for even more draconian legislation.

In short, they asked a small group of users for the number of applications installed on their computer (ignoring free applications like Firefox, WinAmp, etc.), used the average number of applications per PC thus obtained to extrapolate to get the number of applications installed on all PCs bought in the country and subtracted the actual sales of applications to get their figure for the revenue lost due to piracy. Very bad and rather disingenious use of statistics that doesn't even stand up to common sensical analysis. So The Economist naturally called it a load of crap.

This apparently enraged the BSA which promptly wrote a gem of a letter that appears in the latest issue and that is worth quoting in its entirety:

SIR - Your article on software piracy was extreme, misleading and irresponsible (``BSA or just BS?'', May 21st). The headline was particularly offensive. The implication that an industry would purposely inflate the rate of piracy and its impact to suit its political aims is ridiculous. The problem is real and needs no exaggeration.

Beth Scott
Business Software Alliance
London

I found the deadpan assertion of the penultimate line rather funny.

The Economist also had
an article on the recently released OECD report questioning the music industry's dubious assertions that the loss of sales of music CDs is entirely due to file sharing via P2P applications (and not at all due to the alarming lack of quality of the "music" churned out by the industry) which it then uses to convince legislators to come up with draconian laws limiting file sharing.

(Originally posted on Advogato.)

2005-06-13

Sudoku Mania

The first time I read or heard of Sudoku puzzles was in an article in The Economist. A little over a fortnight later, The Times of India's Bangalore edition started publishing regular Sudoku puzzles of moderate difficulty and I have been hooked to them ever since. For those who can't get enough of them, there is also a GPL-ed Sudoku solver and generator.

(Originally posted on Advogato.)

2005-06-07

Dumb's Up

It seems to me that either the manufacturers of cosmetic brands like Garnier, Dove, Fa, Biotique, etc. think their female customers are rather dumb or women willingly ignore the dumb and sometimes condescending text on the labels of many cosmetic products and happily continue to buy them. Perusing my wife's cosmetics collection, I am quite amused by gems of silliness like:
  • a moisturising cream claiming to include the mysterious "Acqua" and "Sodium Chloride" among its ingredients.

  • a skin cream showing off the thoroughness of the manufacturers in certifying it to be "dermatologically tested".

  • a moisturising lotion claiming to contain the cool "HydrOxygen Complex" (peroxide? water?).

  • a herbal shampoo claiming to have "Bio Henna".
Et Cetera.

I guess women would not really get worried about these things till these vile manufacturers start sneaking in Dihydrogen Monoxide into their cosmetics!

(Originally posted on Advogato.)

2005-06-06

Judy Arrays

A single data structure that allows ultra-fast searching, takes very little space and is also cache-friendly? "Judy Arrays" could to be the answer.


(Originally posted on Advogato.)

Advogato Abuse

richym,
otomoto,
smb,
accord,
dbit,
sixtyk,
gauss,
jmors,
greenj,
odinv, etc. seem to be dummy accounts created just so that someone could play with Advogato's ranking system and perhaps use it to inflate their own certification.


(Originally posted on Advogato.)

2005-06-01

2005-05-30

Havoc in Bangalore

The past week was terrible for people in Bangalore. Almost every day of the week, the weather would follow the same pattern - it would get very hot during the day and then the evening would arrive with very strong winds, heavy rain and lots of lightning and thunder. Apart from the usual flooding of roads as well as the houses of some unfortunate folks and consequent traffic snarls, this time many more (at least 150, by most estimates) than the usual number of trees were uprooted. Most of these were Gulmohar (Royal Poinciana) trees that line many of Bangalore's roads and that look beautiful when in bloom. These trees seem to have awfully shallow roots for their size and they fell over electric wires, telephone wires, cable TV wires, vehicles, houses, etc.

So we have had intermittent power, noisy telephone lines, now you see it, now you don't cable TV, no internet connectivity, etc. in our house. Many people were much worse off. I hope this week would bring better weather.


As if this was not enough, the software engineers of Bangalore now have their lives made even worse by robbers. In the last few months, quite a few techies have been increasingly becoming the targets of robbers and muggers who perceive them to be "soft targets" with loads of money and offering little by way of resistance. In the last month alone, two people from my office were mugged in two separate incidents in the vicinity of our building in the night. Call centre and BPO workers have also been hit similarly. To make matters worse, the police commisioner thinks Bangalore has actually become safer in the last few years and quotes some questionable statistics to prove his point. We have already given up on our government which seems more eager to cling on to power by appeasing its coalition partners than bother to develop the state and the city.


(Originally posted on Advogato.)

2005-05-17

Sort Your Environment Variables for Win32

It seems that the CreateProcess() Win32 API expects the explicitly-passed environment variables, if any, to be in alphabetically sorted order. It is documented in passing in the API description, but you have to really look out for it to notice it. Without doing this, you might find that the spawned process is not able to retrieve some of the environment variables you are passing to it. This also seems to affect programs spawned using Runtime.exec() in Java, so even if you do not work on Windows yourself, you might want to keep this in mind for your hapless users.

Thanks to Saju for the explanation and to Rahul for bringing it to my attention.


(Originally posted on Advogato.)

2005-05-15

"How to Solve it"

I found this classic book on problem-solving by G. Polya to be worthy of every praise that has been heaped on it by generations of budding mathematicians and programmers. It requires a bit of perseverance and suspension of cynicism to fully benefit from this book. As with most self-help books (if I may use the term), the basic approach and the given heuristics are rather simple and "obvious", but the real benefit for the reader lies in appreciating their significance and in applying them consistently to solving problems. Very highly recommended.

(Originally posted on Advogato.)

2005-05-11

"Technology and Courage"

"Technology and Courage" (PDF) by Ivan Sutherland. (Thanks Prakash!)

(Originally posted on Advogato.)

gmane.comp.java.harmony.devel

Some kind soul has helped the Harmony mailing list be available on Gmane as the newsgroup "gmane.comp.java.harmony.devel". Thank you!

As was also observed by someone else, I find it rather amusing, and sad, that several years of effort on GCJ, Kaffe and Classpath did not seem to generate as much buzz as a single announcement of an intention by the ASF to create a J2SE 5 implementation.

(Originally posted on Advogato.)

2005-05-09

IITs

(Disclaimer: I am an alumnus [B.Tech.] of IIT Kanpur with Computer Science as my major, so read the following rant with this fact in mind and your preferred measure of salt.)
I feel that in the last few years the Indian government, irrespective of the party that comes to power, seems hell-bent on killing these awesome engineering institutions which have a largely justified and well-earned reputation worldwide. They started by almost doubling the number of available seats in some departments, notably Computer Science, then by increasing the number of institutes branded "IIT" (from the original 5 to a current target of 11 in total) and finally by making the entrance exams (JEE) much easier for students to crack!


In the short term, they will be able to boast of a much larger number of IIT graduates but will they be able to ensure the quality as well? Are they not killing by dilution the very brand that they wish to exploit? Sheesh!


(Originally posted on Advogato.)

Harmony: Quo Vadis?


The announcement of the Harmony project which aims to create a Free reimplementation of J2SE 5 under the umbrella of the Apache Software Foundation (ASF) seems weird to a lot of people (including yours truly). The initial FAQ does not help much either.

My personal opinion is that if you need Free (as in liberty) Java you have either Kaffe or GCJ depending on whether you prefer the traditional Java execution model or ahead-of-time compilation, respectively, not to mention many other VMs. Both depend on GNU Classpath to provide an implementation of the humongous and unwieldy "core" Java runtime class libraries. Without any elaboration, the "All of these efforts provide a diversity of solutions, which is healthy, but barriers exist which prevent these efforts from reaching a greater potential" from the announcement seems hollow and a serious case of the NIH syndrome.


Lastly, Java isn't even that great a language or has a great runtime that so many talented hackers should be wasting their time on it. Isn't there anyone who can come up with a good general purpose programming language with a good and minimal standard runtime environment and a Free language and runtime specification? I am talking of an imperative language with the ability to easily do OO-programming but where OO is not sickeningly mandated.

(Originally posted on Advogato.)

2005-05-04

Worm Bites Hard

Once again, my Hotmail account is being hammered really hard by a burst of spam almost all of it containing the payload for the WORM_SOBER.S worm! Unlike Gmail, Hotmail doesn't show me the IP address from where the message was received unless there is an explicit "X-Originating-IP" header, so I can't trace it to its origins. The irritating thing is that Hotmail already knows that the payload is a worm and thus refuses to let me download the attachment. Why can't they give me an option to tell them to delete such mails immediately upon receipt?

The rate of incoming junk is far higher than previous such bursts and I have to constantly keep cleaning my mailbox. Interestingly, some of the forged sender addresses indicate that someone reading the GCC list has been infected hard - I can't imagine how else the worm would have got hold of the email addresses of such a disproportionately large number of GCC hackers as well as so many CS-related sites.


(Originally posted on Advogato.)

2005-05-03

R.I.P. JumpDrive Secure (16 Sep 2003 - 2 May 2005)

After over 1.5 years of continuous service, my JumpDrive Secure 256MB USB drive has gone dead after I dropped it on hard floor in a moment of unpardonable carelessness yesterday. It was a good buy and it was tremendously useful. On Lexar's site for the JumpDrive Secure, there are incredible testimonials of this drive having survived various ordeals, including being washed with a person's laundry, and emerging unscathed. Alas, no such luck for me!

I even tried to pry it open and see if there was an obviously loose component anywhere that I could set right, but it's literally a couple of chips soldered onto a small PCB connected to a USB plug. As with almost all purely electronic devices, I cannot do anything here. This is rather unlike mechanical or simple electrical devices where I usually can figure out the problem and sometimes rectify the problem.


(Originally posted on Advogato.)

2005-05-02

libtool and libjava Build Times

rth did a few experiments on the libjava build times in the current GCC mainline and found that libtool alone took 2/3 of the total build time for libjava! Very interesting.

(Originally posted on Advogato.)

2005-04-30

Firefox: 50,000,000 Users and Counting

Firefox has been downloaded by at least50 million users worldwide. Awesome! Congratulations to the Firefox hackers for creating such a wonderful browser loved by so many people.

I hope some ostriches get their heads out of the sand and take a look at the world around them. :-/

(Originally posted on Advogato.)

2005-04-28

Miscellany

QEMU 0.7.0 is available now.


"Fortress" (PDF) is a new language from Sun. (Yes, courtesy LtU once more.)


(Originally posted on Advogato.)

GCC Bootstraps

As anyone working on GCC would know, GCC bootstrap times are getting worse. It is so excruciating on some platforms that it is nearly impossible to keep those platforms up-to-date even if people want to. Of course, many more optimisations, new languages and their ever-bloating runtimes, more comprehensive support for language standards, etc. make it inevitable that bootstrap times increase, but does it really have to increase so much?

On my home PC, a "c,c++,java" bootstrap takes more than three hours and a complete testsuite run takes a lot of time as well. Considering that any change to the main compiler needs a complete bootstrap and testsuite run twice over (once without and once with your patch), that too in the best case of no regressions, is it small wonder that many people who might want to otherwise volunteer to help with GCC development just cannot afford to? I have only so much free time left after my job and my family and many a time I feel I am much better off reading a good book or watching a good movie, for example, than literally losing sleep over GCC. Small wonder then that almost all of the prolific contributors to GCC either work on it as a part of their job or on really fast machines with loads of memory (or both).


Perhaps it is not a good idea after all to have a single compiler codebase support so many languages and runtimes at the same time. Perhaps it would be better to start over by creating a well-defined (in terms of the structure and contract) set of language and platform-independent intermediate languages (different avatars of GENERIC and RTL) and have the front-ends and the back-ends as separate projects from the core framework. Of course, if things were this simple people would have done it already, but a man can dream, can't he?

(Originally posted on Advogato.)

2005-04-26

2005-04-23

Qt Assistant as a Java API Viewer

I was trying to learn Qt to create a simple Java API Viewer on Linux for my own use, when I stumbled upon the fact that Qt Assistant can be configured easily for displaying one's own help documentation. With a little bit of ugly shell scripting, I was able to create a Qt Assistant "profile" from the JDK documentation index files and now I have a simple but quick and effective JDK API viewer on Linux. Cool!

Needless to say, my interest in learning Qt has evaporated and so has my desire to create a native Java API viewer for Linux.


(Originally posted on Advogato.)

2005-04-22

Coding Competitions

There is a weekly coding competition for Indian coders running right now at www.azealots.com and there are fairly attractive prizes to be won. This is apart from the regular TopCoder competitions. train.usaco.org seems to be a nice site for practising for such things.

By the way, I found a nice set of slides explaining the Static Single Assigment (SSA) form here (PDF).


Lastly, GCC 4.0.0 has been released!


(Originally posted on Advogato.)

2005-04-20

Java Language Specification: Finally Updated

JLS3 is finally available, though only as one big PDF right now. It took them quite a while to update it to reflect the new features introduced with JDK1.5.

I think it is really weird that the specifications for C and C++ are not freely available and that you have to shell out moolah to get them from ISO. Every programming language meant for general developers must have its language specification freely available. On that count, Java fares much better and full marks to Sun for ensuring that.


(Originally posted on Advogato.)

2005-04-16

Broadband Ahoy!

After many a pestering call and almost two months of waiting, I finally have BSNL's DataOne broadband connection. At 256Kbps it is hardly that "broad" a band, but it is so much better than the old dial-up connection as well as those peddled by most of the competing service providers! BSNL is owned by the Indian government and used to suffer from the usual red-tapism and apathy. In recent times however, it has improved vastly and has become quite competitive with the private telecom operators. By the way, the main reason I went with BSNL instead of the private operators was that most of them used to actively block outgoing connections to several network ports (including tcp/6667 for IRC) in the name of "security" while BSNL does not (so far) have any such restrictions. What's the point of an always-on broadband connection if you can't even chat?

Another very cool thing about BSNL's package is that you get a Huawei SmartAX MT880 ADSL modem-cum-router that has a built-in firewall and is rather cheap at Rs 2000/- for outright purchase. All you need is an Ethernet card. At the moment, the private operators are nowhere close to giving such a deal.


(Originally posted on Advogato.)

2005-04-15

Miscellany

Paul Brook has created a Free replacement for kqemu called qvm86. Both are Linux kernel modules that enable QEMU to run guest operating systems at near-native speeds. kqemu is unfortunately closed-source though it is free of cost for non-commercial use.

SRM-238 was only slightly less worse than SRM-236. Muddled thinking ("coder's block"?) once again ensured that I could solve only one of the problems in the given time. I really suck as a coder. I should also stop writing about SRMs.

Mark Wielaard has written a nice article on GCJ in LWN.net. I did not completely grok Nathan Myers's (ncm) problems with the design of the Java language as written in the comments section for that article. Ditto for Jamie Zawinski's problems with Java for that matter. I have a long way to go before I can even begin to understand some of the objections people have for the design of programming language.


It sucks big time that gtkhtml requires the whole GNOME schmear. Unwieldy dependencies seem to be the general rule in Gtk/GNOME-land. Time to learn Qt.


(Originally posted on Advogato.)

2005-04-08

Code Coverage

I hate having to write meaningless tests merely to improve arbitrarily-fixed code-coverage metrics in regression suites.

(Originally posted on Advogato.)

2005-04-04

SRM-236

Yet another miserable performance from yours truly. The first problem was to find out the task finally left from a set of tasks after the n-th task (assuming the list is circular) is removed and the process repeatedly applied till there is only one left. I took too much time on this one, all because of a rather silly off-by-one error. The second problem was to find the n-th smallest Hamming number given a set of factors. If X1,..,Xn are the given factors, a Hamming number is X1^P1 * ... * Xn^Pn, where Pi >= 0. For example, for 2 and 3, the Hamming numbers are 1,2,3,4,6,8,9,.... My brute-force solution was too slow and timed out for large values. I could not finish this one before the deadline and thus could not attempt the third problem.

Naturally, my rating fell yet again, but the good thing is that I'm back in Division 2 where I should at least get easier problems.


(Originally posted on Advogato.)

2005-03-29

Java Web Start (JDK 1.4.2_07) on Linux (Again)

I found a neater way of working around the bug in Sun's javaws
in JDK 1.4.2_07 on a Linux system running kernel 2.6.x and
glibc 2.3.3+ that I referred to in my previous blog entry - I
wrote a wrapper for waitid() that tolerates the
bogus options passed by javawsbin and calls the
real waitid() with saner options. With this code,
I am finally able to run javaws without problems. Note that
this bug seems to have been fixed by Sun in JDK 1.5.0_02.

/* Quick and dirty pre-loaded DSO to make buggy javawsbin
in JDK 1.4.2_07 work on Linux with kernel 2.6.x and
glibc 2.3.4.

Compilation:
gcc -O2 -fPIC -g0 -shared -o mywait.so mywait.c

Usage (Bash):
LD_PRELOAD=/path/to/mywait.so /path/to/javaws <Launcher URL>
*/
#include <dlfcn.h>
#include <sys/wait.h>

int (*real_waitid)( idtype_t, id_t, siginfo_t *, int);

int
waitid( idtype_t idtype, id_t id, siginfo_t *infop, int options)
{
int retVal = -1;

void *handle = dlopen( "/lib/libc.so.6", RTLD_LAZY);
real_waitid = dlsym( handle, "waitid");

options = (options == 0) ? WEXITED : options;
retVal = (*real_waitid)( idtype, id, infop, options);

dlclose( handle);

return retVal;
} /* End pseudo-waitid() */


(Originally posted on Advogato.)

Acrobat Reader

If you remove the utterly useless plug-ins from the Acrobat Reader installation folder, it starts up much faster.


(Originally posted on Advogato.)

Java Web Start on Linux

Due to a bug in Sun's Java Web Start executable in JDK 1.4.2_07 for Linux, I am not able to use it as-is on a system with glibc 2.3.4 and kernel 2.6.11. As should be obvious, if they had made it truly Free, I could have easily fixed the problem and moved on with my life. Since it is not, I have to either use an alternative like OpenJNLP or somehow work around this bug.

On a system where this bug does not manifest itself, I used "ps --columns 2000 -e -o "%a" | grep javaws" to grab the command line that is used by this executable to spawn the Java VM. I tried modifying this command line for my system (adjusting paths) and running it but it failed trying to download the JVM from Sun's site. After a bit of snooping around, I found out that it was looking for a file named "deployment.properties" in "$HOME/.java/.deployment" that is populated by the wrapper executable with the information on the JRE being used. So I just copied this file over from the system where stuff works and adjusted the paths. It finally worked as expected, albeit without the splash screen (which I do not regret losing at all).

(Originally posted on Advogato.)

2005-03-28

JDK API Documentation

One of the minor irritants I face while programming in Java under Linux is that there is no ready equivalent of the JDK API documentation in WinHelp format that comes in so handy while looking up a method or class. The normal HTML format JavaDocs is rather painful for such tasks.


One of the options is to use either xCHM or GnoCHM with the same CHM file that I use under Windows. However the former needs wxWidgets and the latter needs GNOME, neither of which I want to install on my PC. Besides this, I do not want to support a closed-format document format that people are struggling to understand.


It seems that there is a Java-based solution called JHelpViewer to help out with this situation and my limited testing with it indicates that it is decent and does the job to a fair extent. However, I do not like the overhead of keeping a JVM instance running on my PC just to view JavaDocs. I think a better option would be to use something like Gtk2 instead.


Does no one else find it weird that Sun does not itself ship the JDK API documentation in the JavaHelp format?


(Originally posted on Advogato.)

PDF Viewer Under Linux

Mark: Honeymoon? Congratulations!

As for Evince, my PC only has KDE and therefore I don't think I can use it. In any case, I like the way Adobe Acrobat Reader cleanly renders PDFs and I especially like the navigation and zoom controls. The last I checked, both XPDF and KPDF were rather lacking in this area.

(Originally posted on Advogato.)

2005-03-24

Adobe Acrobat Reader 7.0 for Linux

Acrobat Reader 7.0 isavailable for Linux, but for some reason the main download page still shows 5.0 as the last supported version for Linux. This version takes up around 93MB (!) of disc space, but feels and shows documents much better than any of the other PDF viewers for Linux that I have had a look at.

(Originally posted on Advogato.)

"The Five Boxing Wizards Jump Quickly"

This is much better than "the quick brown fox jumps over a lazy dog", which was the only other pangram I had known before seeing this blog entry by X guru Keith Packard. Talking of X, XFree86 released their server version 4.5.0 almost a week ago and I haven't seen references to it on any of the main nerds news sites yet. From the same blog entry by Keith, I came to know that a font designed 530 years ago still looks quite decent.

(Originally posted on Advogato.)

2005-03-23

SRM-235

This morning I took part in my second TopCoder Single Round Match (SRM) - "SRM-235". Because of my rating from the previous match, I got to compete in Division 1 this time, which translated to tougher problems and competitors. Alas, I did pathetically in this match with my final score being zero!

Once again, the two problems that I had a chance to try out were not that difficult, but sloppy coding and muddled thinking made sure that my submissions would fail. The 300-point problem was to find out the minimum positive or negative steps needed by a stepping motor to reach any of the given target positions from a given current position. On this problem, integer overflow and underflow proved to be my undoing.

The 400-point problem was to find out the centre of gravity of a perforated rectangular sheet with rectangular holes. Here my solution just did not come close enough to the official solutions and I kept tweaking the multiplications and casts in my solution to match the results. After some time I even converted my solution over to fixed-point instead of floating-point, but it was still a bit off the mark. Such fiddling around ensured that I could not submit the solution in time, let alone attempt the 900-point problem.

My rating has dropped after this match, but still not enough to get me out of the darn Division 1. I look forward to being mauled once again in the next SRM on April 2.

(Originally posted on Advogato.)

2005-03-18

GCJ on Slashdot

GCJ was discussed on Slashdot recently and this time around there were so many positive comments! This comment in particular made my day - it was referring to PR 20312. As Tom remarked earlier, the number of bugs that have been filed against GCJ have increased dramatically in the recent months, indicating that more and more people are trying it out and are hopeful enough about it to bother to report bugs.

(Originally posted on Advogato.)

2005-03-17

SRM-234

This morning I took part in my first TopCoder Single Round Match (SRM) - "SRM-234". I liked the experience and would like to take part in more of these, time permitting.

The 250-point problem was a simple "find the length of the longest contiguous string of either As or Bs in the input". The 500-point problem was to find the sequence of unit fractions ("1/n") in descending order that add together to yield the given fraction "x/y". The 1000-point problem was to find the derivations needed to get to the input string given the productions of a simple non-left-recursive grammar.

The problems (as I have also noticed in the practice rooms) were not difficult per se, but had to be solved "correctly enough" within the given 75-minutes - much less if you also want to get a good score and ranking.
It does not really matter if your code or design is elegant as long as it manages to pass all system tests as well as the challenges that other coders might throw at it. The permissible input is also severely restrained so that you do not usually have to worry about validating it.

One thing I noticed is that there were not many Indians among the toppers, while there were quite a few people from Poland. This is quite weird as I have met quite a few good Indian coders. Perhaps the lack of awareness, the lack of an enthusiasm for such competitions, the lack of decent net connections, the weird timings of the matches when converted to IST, etc. play a role. If you are an Indian coder reading this, please do consider taking part in these matches and letting your friends know about it.

(Originally posted on Advogato.)

2005-03-16

C++ is Evil

As if sane people needed a proof showing how extraordinarily convoluted the language is - what kind of a language meant for sane coders needs indefinite lookahead and semantic disambiguation in a compiler so that it can parse source code written in that language?

(Originally posted on Advogato.)

2005-02-22

GCJ, Eclipse, Glade

While reading the user comments on an OSNews story about "Escape the Java Trap!", I came across this wonderful Flash demo by Andrew Overholt showing off Eclipse running with GCJ and using Glade! It's a different thing to read about this in the mailing lists but an entirely different thing to actually see it in action! Cool!

(Originally posted on Advogato.)

2005-02-18

GCC v/s ext3fs

I build and test the ever bloating mainline GCC at home on a 2GB ext3 partition (that used to contain the whole of my Linux installation in days gone by). It contains GCC CVS sources, a stripped snapshot of the sources to play with and the GCC build folder. Today the bootstrap of GCC failed complaining that there was no space left on the device for the final libgcj.so - a "df -k" showed that 93% of the space was being used. A dumpe2fs showed me that 5% of the filesystem was reserved for the super-user and the block size was 4K - I moved the data out, reformatted the partition to use 1K blocks and 0% reserved for the super-user and moved the data back in. Now the GCC bootstrap has succeeded and df -k still only shows 70% usage. Pick your lesson to learn from this incident.

By the way, the nVidia 6629 drivers installed and worked perfectly with kernel 2.6.10 and X.org server 6.8.2 - the mistake I made the last time was to not have /usr/include/linux/autoconf.h when I had copied over the kernel headers after building glibc. This gets built when you do a make menuconfig and configure the kernel.

(Originally posted on Advogato.)

2005-02-16

this.ego( ).puncture( )

Intrigued by Sunitha's comments, I checked out a couple of problems in one of the practice rooms in TopCoder. I performed abyssmally - I only got 179 points on a 250 points problem, 242 on a 500 points problem and couldn't even finish a 1000 points problem!

The problems were not difficult per se, but 8 years of "enterprise" software development have blunted whatever little ability I used to have to solve such problems. On the two problems that I did manage to finish, I was stuck for a while with my mind drawing a complete blank on how to solve them - just jammed. Only after a while did my mind clear up a bit and I could code the solutions, but by then I had lost precious time that cost me points.

On the other hand, these are the sort of problems that someone who has absorbed R. G. Dromey's excellent book "How to Solve It by Computer" will find easy to approach and solve well in time. That book seems utterly underrated, as does the classic problem-solving book that was its inspiration, "How to Solve It" by G. Polya. The problems also had guaranteed "good" inputs, so that one does not have to worry about input validation or boundary conditions.

(Originally posted on Advogato.)

2005-02-14

GCJ and OpenGL

Thomas Fitzsimmons implemented JAWT for GCJ and Anthony Green built on that work to let JOGL run with GCJ! This is sweet - could GCJ become a viable platform some day to write cross-platform 3D games?

(Originally posted on Advogato.)

Trouble in QEMU Land

QEMU is a superb (fast and reasonably accurate) emulator for x86 and other architectures and a viable alternative to VMWare. Fabrice Bellard, the extremely talented author of the program, has now written the
QEMU Accelerator Module which apparently drastically improves x86-on-x86 performance. Unfortunately, this is provided as a binary-only module and under a proprietary (non-Free) license. He says he would open up the sources only if some company sponsors the effort or he is somehow compensated for the loss in revenue. This has led to flames, "understanding" posts, etc. on the QEMU mailing list.

(Originally posted on Advogato.)

2005-02-10

Google India Code Jam (GICJ) 2005

The newspaper advertisement yesterday announcing the Google India Code Jam for 2005 has created quite a stir here. Notwithstanding the bragging rights associated with winning a coding competition open to the whole of South Asia, it offers a total of 16,00,000 rupees in prize money to the top 50 coders and a chance of an offer of employment from Google.

(Originally posted on Advogato.)

The Art of Computer Programming (TAOCP)


"A classic is a book everyone wants to have read, but nobody wants to read!" - Mark Twain.

Most coders seem to agree that the TAOCP books are classics, but there seem to be precious few who have actually read it. Moreover, I read some alarming highly-moderated comments on Slashdot recently where people claimed that TAOCP is not as useful as it is made out to be and one should read some other book instead.

To be frank, the TAOCP books would have met a similar fate to the other classics on my bookshelf had it not been for the fact that I read them when I did not know yet that they were supposed to be classics! This was thanks to my father who brought Volume I ("Fundamental Algorithms") from his office library to me seeing my interest in computers while I was in high school. I read it from cover to cover delighted by the ground-up approach, the no-nonsense attention to details, the quirky but immensely insightful use of MIX and the wonderful exercises. I asked him to get the other volumes too, but could not read them as thoroughly as I had the first one.

To this day, whenever I have a doubt or I feel like knowing something more about a particular coding problem, I turn to one of the TAOCP volumes and I have seldom been disappointed. I just wish the newer generations of coders understand and appreciate this.

As an aside, among the few reasons that I respect Bill Gates as a person is because of the following quotes attributed to him:
  • "If you have read this book [TAOCP] from cover to cover, send me your resume!"
  • "The only magazine I take the time out to read is The Economist"

(These are as I remember them and therefore not perhaps correct verbatim.)

(Originally posted on Advogato.)