Tuesday, May 30, 2006

Geek post: subpixel decimation and filtering on Linux

Of the three platforms I use on a daily basis (Linux on my office PC, OSX on my trusty if slowish Powerbook, and WinXP on my wife's laptop) I think I like WinXP's Cleartype fonts best. Actually, OSX's rendering is not "worse" than XP's---it's just different. Hinting seems to be lighter, and the emphasis is on getting font shapes right, rather than maximizing crispness. This is probably a good thing if you are a graphics / desktop publishing person trying to get a feel for how your document will look on paper. But, in terms of crispness, XP wins.

Unfortunately, Linux font rendering used to fall quite a bit behind both. Until last week. David Turner (of Freetype fame) released a set of patches to Xft2 and Cairo that (finally!) implement decent filtering of subpixel-rendered fonts. You are much better off getting the details from the source, but the results are really quite impressive. I upgraded from Ubuntu Breezy to Dapper last week, and today I installed the .deb's that a very kind soul has made available. Really, really sweet!

Friday, May 05, 2006

Linux in the wild

Just a quick note. I have now been to two theory talks this quarter where the speakers used Linux-powered laptops for their presentation. The first was David Levine (who, incidentally, has very interesting and provocative thoughts on patents and IP in general: check out his web site). The second was my colleague Jeff Ely, who is a founding member (and major force behind) the first open-access journal in Economic Theory, aptly named Theoretical Economics.

I am not an empirical economist, so I don't know if this qualifies as a trend :-)

Monday, May 01, 2006

Java and C# for cross-platform development

Well, I haven't posted in a long, long time, so let me jot down a few quick thoughts to liven up this blog.

In my work, I have to deal with three platforms: Linux (I run Ubuntu Breezy on my office PC), Mac OSX (on my laptop) and Windows XP (my coauthors are all running standard-issue Dell PC's with standard-issue OS's).

Collaborative writing has long been a non-issue: LaTeX is wonderfully cross-platform, and even though one of my past co-authors insisted on using Scientific Word (which produces appalling LaTeX code), I have had no problems making things work smoothly enough.

However, one of my current projects involves running numerical simulations. I am the one doing most of the coding, but I'd like my coauthor to be able to run the simulations, experiment with different parameters, etc. So, it is essential for me to write code in a cross-platform environment. Since execution speed is important, too (although not crucial at this stage), Java and C#/.NET seem to be reasonable alternatives.

I must admit I have a fair bit of bias against Microsoft "solutions". However, I am willing to consider C#, partly because it does have a few nice features that Java still lacks, and partly because it is straightforward for my Windows-based coauthor to install and use the .NET framework. Also, the Mono projects supposedly provides a cross-platform implementation of .NET (there is also another effort, Portable.NET, which also aims at porting the "dotnet" stuff to non-Windows platforms).

However, it turns out that the Mono OSX port is quite a bit behind its Linux counterpart. In particular, Windows Forms is basically non-functional on the Mac, and Gtk# requires installing a bunch of extra stuff from Fink, and requires X11. Now, the Gtk# issues are not too serious per se; however, as an added complication, if I do decide to go the Gtk# route, I would have to ask my coauthor to install the required DLL's and assemblies, whereas Windows Forms is part of the .NET Framework and so works "out of the box".

On the other hand, Java is truly, 100% cross-platform (for my purposes at least). I am not enough of an expert to comment on the finer points of language design, but I must say that I like languages that adopt one particular "metaphor" and stick to it --- it makes things predictable and consistent. In Java, everything is a class, including events and event handlers. There is a certain elegance to it. On the other hand, C# introduces "ad-hoc" constructs (events and delegates) that may save some typing but, at least in this writer's opinion, remain... well, adhockeries. There, I've said it!

Bottom line: for the time being, I'm sticking with Java. But I'm keeping my eyes open.