Older blog entries for rmathew (starting at number 76)

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.

16 Apr 2005 (updated 16 Apr 2005 at 20:10 UTC) »
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.

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.

Code Coverage
I hate having to write meaningless tests merely to improve arbitrarily-fixed code-coverage metrics in regression suites.
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.

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() */

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).

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

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.

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?

Adobe Acrobat Reader 7.0 for Linux
Acrobat Reader 7.0 is available 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.
"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.

67 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!