Sunday, December 30, 2007


Some people clearly have too much time on their hands, witness lolcatshost!
(Via Little Gamers)

UPDATE: actually, it seems like the site was inspired by that Little Gamers webcomic.


Via Boing Boing:

A silent concrete monster follows a nervous businessman through Montreal in Terminus, an eerie and darkly funny short film directed by Trevor Cawood

Go here to watch, it's only eight minutes, well worth your time.

Friday, December 28, 2007


So, just as Christmas passes on December 26, I suddenly fall sick. Perfect. I haven't logged a single sick day for more than over a year, maybe even two years, and now that I'd have few spare days to spend on things I'd like to do, I'm more-or-less tied to bed. Don't worry, nothing too serious, just stuffed nose, terrible coughs, and enough fever and chills to keep me not wanting (or, in fact, being too able) to move anywhere outside of the bed. The usual "season's greetings", you might say.

I'm reading though. I read some wicked good books in the past months, including Charlie Stross' Glasshouse, as well as an überweird Cory Doctorow piece (Somebody Comes To Town, Somebody Leaves Town) as well as few Karl Schroeder novels. I'm through most of them by now and am tasting some Vernon Vinge momentarily, which isn't as good as the more contemporary guys (Stross and Schroeder) are, but is still much better than Iain M. Banks is.

Or even better, I listen to wife reading Mr. Pratchett's The Bromeliad Trilogy to kids (and me!). I picked up Truckers in a book store about a month ago without knowing it is targeted for children, but after reading it I realized it'd be great fun to read it to kids in the evenings. Usually it is me doing the reading, but with sore throat... So, we finished Truckers today (second reading for me), and started on the Diggers (which, along with the closing volume of the trilogy, Wings, I picked up today at the same bookstore. I have a habit of buying only the first novel in a series and making subsequent purchases based on whether I'm still interested in it after the first book ends. For me, Iain M. Bank's first Culture novel didn't hit the bar, so I'm avoiding it for now).

Anyway, my Mom was over for holidays, and listened in to our reading of Truckers. As a result, I gave her one of Discworld novels (Mort) to read on her way home. I'm pleased to say that Mr. Pratchett has obtained yet another (in this case, 58 year old) fan :-)

Anyway, days are a bit bleak. I'm usually not well enough to hack or even to play much with kids, or anything of the sort. Getting to a store to shop for groceries to get us through New Year's Eve was quite an effort and I felt much worse afterwards.

Oh, I also picked up Half Life 2 retail box three weeks ago on an impulse while shopping for Christmas presents. Tried to install it this morning (lacking better pastime since I couldn't sleep from my cough rush), and it claims the CD key is invalid. Swell. Valve support didn't answer within a workday. Knowing me, if I don't get to try playing it during the holidays, I probably won't find time for it anytime soon, so it's as good as money thrown out of the window if they don't resolve this quickly. Way to go, selling people unusable DVDs.

I also managed to drop my photo camera from a waist height on a hard stone floor during Christmas - I was trying to take pictures of kids while they were having fun with Sparklers. In response to the drop, the camera's objective developed a very ugly skew. Not entirely surprisingly, it doesn't work anymore... Closest Canon service (and the only one in the country) is of course, where else, in Budapest, 200km away. Buying a new one might be a more viable option.

Oh well. I guess I'm going back to bed. Sorry everyone for a bad-mood rant...

Thursday, December 27, 2007 hacked?

Does anyone know what happened to It's supposed to be the website of Open Source Initiative, but it looks like right now it serves the same content as, whatever that might be... It is either hacked, or maybe the two sites are collocated on the same physical HTTP server and there was a config glitch. Anyway, quite annoying...

Rhino in Spring 1.2

So, I've used some free time around the holidays to put the finishing touches on a new release of Rhino in Spring. The new release is 1.2, and it has one major new feature (as well as few featurettes). The major big thing: it is now fully clusterable with Terracotta!

Actually, that's pretty much it. There's few other featurettes as well, but the real big leap forward was restructuring of the internals so that it plays nicely in Terracotta distributed clusters. Configuration for clustering is dead easy: it comes with a Terracotta "configuration module", a special JAR file hosting an XML file with clustering declarations for the code. You just reference it in your tc-config.xml and that's it. The rest is Terracotta magic :-)

Friday, December 07, 2007

FreeMarker 2.3.11 released

We released FreeMarker 2.3.11 on Wednesday. There are few new feature goodies as well as some significant performance improvements (both speed and memory) in there, not to mention bugfixes, so you might consider upgrading from earlier 2.3.x version. Head over to the project website for more info and download.

Wednesday, November 28, 2007

Tuesday, November 27, 2007

Working Java 6 on Mac OS X - but not from Apple

Turns out there's a working Java 6 for both Mac OS X Tiger and Leopard. It is a port of the Java Research License licensed codebase for BSD, so to use it legally, you need to agree to JRL first. It's developed by a person named Landon Fuller, and he says on the page:

The Mac OS X work is based heavily on the BSD Java port, which is licensed under the JRL. The BSDs develop Java under the JRL; FreeBSD has negotiated a license with Sun to distribute FreeBSD Java binaries based on the JRL sources.

As the Mac port stabilizes, I am merging my work upstream into the BSD port, and in turn, it is a goal of the FreeBSD Java project to merge their work into OpenJDK. I've signed a Sun Contributor Agreement in preparation for this...

There are some minor features lacking (minor if you're like me, using Java for server side): sound doesn't work yet, nor is there a native Aqua Swing UI.

Via Charlie Nutter (who also perftested it with JRuby and sounds quite impressed).

Sunday, November 18, 2007

New MacBooks finally have 3D graphics in hardware

I just noticed that new MacBook models ship with Intel GMA X3100 graphics chipset instead of GMA 950 in previous models. Notable difference is that X3100 has 3D rendering hardware - a shader processor with 8 execution units fully supporting transform & lighting, with support for DirectX 10.

That's quite a big news for people who previously dismissed MacBook as an option because of weak graphics chipset (i.e. people who'd dual boot into Windows for gaming).

On the downside, GMA X3100 still doesn't have dedicated RAM, and it'll actually take away 144MB of system RAM (160 if you use an external display), compared to 80MB that GMA 950 used, so YMMV.

Saturday, November 17, 2007

"Some thoughts on security after ten years of qmail 1.0"

There's a paper "Some thoughts on security after ten years of qmail 1.0" written by qmail's author, Daniel J. Bernstein. (I found it though Bruce Schneier's weblog). The paper is well worth reading because Daniel is extremely security-conscious. As he says:

In March 1997, I took the unusual step of publicly offering $500 to the first person to publish a verifiable security hole in the latest version of qmail: for example, a way for a user to exploit qmail to take over another account. My offer still stands. Nobody has found any security holes in qmail. I hereby increase the offer to $1000.
He actually gives lots of practical advice on how to make your code more secure: security holes are bugs, so you should strive to eliminate bugs in general. Also, you should strive to eliminate code (as number of bugs is usually proportional to number of bugs). Finally, you should minimize the amount of trusted code and have all untrusted code run in a sandbox (using his words, a "prison").

Now, to reflect a bit on sandboxing myself from a Java point of view, Java is fortunately quite well suited for minimizing trusted code. When you run a Java program under a security manager, code gains privileges based on where it came from, and the privileges of the current stack frame are the intersection of privileges of its code and all of its callers down the call stack.
There's a facility for privileged execution, SecurityController.doPrivileged(), where the code within the privileged block will run with full set of its own privileges, and not get narrowed down further with security restrictions placed on its callers. It can be a dangerous feature, and must be used judiciously lest you create an exploit vector through it. I.e. if your code accepts a file path from its callers, reads the file in a privileged block, and returns the file content to the caller, then a caller can potentially exploit this to gain access to contents of files it would otherwise not be able to see.
I'm actually quite conscious to enable easy integration with Java security manager in software I write - you will find a PolicySecurityController class in Rhino, as well as a SecureTemplateLoader in FreeMarker, both allowing running JavaScript code or FreeMarker templates, respectively, with their own set of privileges defined in the effective JVM-wide security policy based on where they're loaded from or whether they're digitally signed (same aspects are used to assign privileges to Java code). FreeMarker also uses SecurityController.doPrivileged() in few places judiciously.

Anyway, back to Daneil's paper: there's a wealth of food-for-thought for any practicing software developer: how we often sacrifice security for speed, how hidden data flow (global variables and singletons, people!) leads to security issues, and how this can be fixed by further decoupling of components with explicit narrow communication (i.e. message passing across processes), and so on.
A section entitled "Avoiding parsing" also speaks very closely to my heart.
So, recommended reading.

Friday, November 16, 2007

Wired profiles Randall Munroe

Wired has a profile article on Randall Munroe. Munroe is the Xkcd guy. If you didn't know Xkcd before, you can thank me later for pointing it out for you.

Wednesday, November 14, 2007

"JVM Dynamic Languages Metaobject Protocol" now released

I finally got around to packaging up the current state-of-art of my metaobject protocol library as a downloadable release (source + binaries + documentation), plus putting up a very basic website (hosting an information page + JavaDoc) for it.

I haven't got around to setting up yet, so the website is for now hosted at

The fact there is now a release does not intend to confer either a sense of completeness or rigidity. It is versioned at humble 0.3. It is pretty much open to modifications and is also probably not complete yet (i.e. I fully expect people to need further features for integrating with their particular language runtime). The release just strives to make it easier for people to get started with it, as it's now available as a HTTP download instead of only through SVN. Also, having a release means there's now a baseline for purposes of tracking changes in a changelog file etc. Unit tests cover about 75% of the code right now, so it's fairly safe to say it does what it is intended to do, but of course, bugs are always to be expected.

In completely unrelated news, today's my birthday too :-)

Monday, November 12, 2007

Leopard firewall breaks Skype

Apparently, on Mac self-modifies its application package. Leopard OTOH digitally signs application packages after you download them from the net and allow them to run, and also when you allow them to accept connections through firewall. Skype's self-modification causes the signatures to get invalidated. After this, Skype will completely fail to launch. It'll bounce twice in the dock, and that's it.

Options: (a) don't use Skype (b) disable firewall. Damn. I'm going with (a) until Skype fixes this. Actually, I tried disabling the firewall, and for me even that didn't help. Double damn.

New Language Features for JDK7 - from the Java Community

A newsletter from Belgian Java User Group (BeJUG) landed in my Inbox yesterday, and boy, am I glad to see it. You can read it here. Basically, BeJUG is submitting the JSR for closures in Java, based on Neal Gafter's proposal. This is huge news for several reasons. Reason one, we need closures in Java NOW. Reason two, this is the first JSR filed by a Java Users Group, and also the first Java language JSR led outside of Sun Microsystems.

The second jolly good news in the same newsletter is that Google also submitted a JSR for a "collection of smaller language features". Smaller? They're proposing type inference, extension methods, catch for multiple exception types (Brian Goetz will be glad. Hell, me too!), and improved syntax for easing the catch-rethrow pattern. These ain't small in my book.

We need to realize that C# has had type inference, extension methods, object initializers, anonymous types, and lambda expressions for two years now. It'd be about time for Java to catch up with the times, and I'm really glad to see community finally taking initiative to make it happen and not waiting for Sun.

Thursday, November 08, 2007

Network traffic prioritization by specific cost

I've been following with some interest the recent Comcast scandal where the ISP started inserting TCP reset packets into BitTorrent traffic of its clients, thus disrupting it.

Comcast claims they do it to protect the ability of "normal" users to use the bandwidth from "excessively using" users that hog it.

(I personally believe Comcast tries to minimize the overall amount of traffic that flows out of its network to other ISPs as it costs them money in the fiscal clearing of cross-ISP traffic.)

But let's entertain the idea for a moment that Comcast would really like to protect their "normal" (read: low-traffic) users from their "excessively using" users. How would I go about implementing a fair system that achieves this goal?

Well, certainly not by disrupting the traffic.

Below is an idea that I believe would result in fair allocation of bandwidth within the network of a single ISP with paying customers. I must forewarn you that while I design software systems for living and often need to deal with management of limited resources, I'm just a layman when it comes to the narrow field of packet-switched network traffic management, so what's written below might not make sense at all because of some arcane aspect or the other that I know nothing of :-)

Anyway, here it goes:

The ISPs already measure the amount of traffic generated by every user within a billing period, that's how they are able to detect "excessively using" users today. However, instead of handicapping a user that "excessively" uses the bandwidth, the metrics would be used only to select which user's packet to drop when there is insufficient bandwidth on the routers' outbound lines, but only then.

The strategy would be to always drop the packet coming from the IP address of the user who had the highest traffic in the billing period so far. Or, in case of differently priced packages, or even different billing periods, the user with highest traffic/fee ratio for his current billing period, expressed nominally in byte/dollar.

This way, the proverbial "only checking his mail" user would always experience a fast connection, followed by a user who listens to online radios and watches some amount of online videos, while the "excessive" p2p users would be only competing for leftover bandwidth among themselves.

It'd be easy to suitably extend the idea to a nondeterministic scheme where a packet to be dropped is picked randomly, but the probabilities are weighted by their user's dollar/byte ratio. That'd give a user who heavily used p2p at the start of the month a standing chance to still be able to check his e-mail even when another user comes along who floods the network with p2p traffic near the end of the month.

Feel free to point out why this wouldn't work, doesn't make sense, or is already invented in this or similar form and used somewhere :-) I've tried uncovering this technique using Google, but have found only port/service/application based QoS prioritizing, and didn't find anything specifically describing this -- namely, prioritizing based on user's specific monetary cost of traffic, amortized over a billing period.

As far as I can tell, this method preserves network neutrality, as it does not discriminate based on either the type of traffic or the destination of the data. It also doesn't degrade the throughput for anyone in any way as long as there is sufficient free bandwidth.

Monday, November 05, 2007

Leopard so far

This Thursday, I upgraded my MacBook Pro to Mac OS X 10.5 Leopard. It was a holiday over here, so I had four days (Thursday to Sunday) to work out the wrinkles in case something didn't work. I did the usual precautions: mirror the boot drive to an external drive, boot from the mirror to make sure it works, then shut down the computer, physically disconnect the external drive, and only after all this start the OS install.

I decided to give myself a chance to avoid reinstalling everything, and thus chose the "Upgrade" option instead of a clean install. After an hour of DVD consistency check and an hour of copying files, the machine rebooted and I was greeted by a working Leopard. It went incredibly smoothly.

I proceeded checking whether everything works. First on the list was Cisco VPN Client which I need for work. I was sceptical, as the Cisco VPN client integrates tightly into the system, installing kernel extensions for networking. To my very pleasant surprise - it worked! Next was ssh, which also worked. VMWare also works, no problems there.

Then there's some more arcane stuff:

An unsupported printer driver for my Xerox Windows-GDI printer, cross compiled to a PowerPC binary from a Linux CUPS driver - works!

My heavily customized, start-on-boot MySQL setup - works!

There's of course no Java 6 yet, as discussed earlier, but the good news is Java 5 is at least upgraded from 1.5.0_07 (found in Tiger) to currently latest 1.5.0_13 in Leopard.

Eclipse 3.2.2 works overall. There are keyboard issues though. I.e. if I press Command+Shift+U ("Occurrences in File"), it brings up a context menu (to choose among "Identifier", "Implementing Methods", and "Throwing Exceptions"). However, both the menu and editor window receive the keyboard events for arrows, and when I hit Return, the context menu disappears altogether (without performing the selected operation), and the key is interpreted by the editor (i.e. inserts a new line...). That's one minor annoyance.

One of my pet peeves is also fixed finally: I can finally use the Return key to activate the "Allow" button in Keychain Access' "Copy to Clipboard" dialog. Oh, progress! Previously, if I didn't want mousing, I had to do Tab-Tab-Tab-Return. Still no keyboard equivalent to invoke the said dialog though... Also, the "new password assistant" palette now syncs with the password field, so I needn't copy/paste a generated password back to the main editor window of Keychain Access anymore. Yeah, small things, but they do matter.

Also, there was something amiss in my user account in Tiger - lots of programs forgot their license number when I logged off (Delicious Library and Disco most prominently), and it also lost my keyboard shortcuts whenever I logged off, so after a while I lost the habit of using custom shortcuts, as you can imagine... Upgrading to Leopard fixed both issues.

The system is noticeably snappier. Tiger had the tendency to stall under heavy load. "Heavy" is when I run a Terracotta server and two clustered Tomcat instance on the MacBook Pro, talking to a special Linux appliance running in VMWare, occasionally recompiling the code or interactively debugging from Eclipse. Oh, and running a BitTorrent client in the background to boot it. Now, Tiger did have issues with this even with 2GB of RAM, to the point of UI freezing up for 20-30 seconds whenever I switched applications with Command-Tab. Leopard tolerates such loads much better. I guess virtual memory management got smarter with regard to handling applications' working sets, and there are probably lots of minor kernel optimizations and reentrancy improvements. Overall, noticeably better. Lot less beachball sightings.

As for games: Diablo II works nicely even on an Intel mac (it's a PowerPC binary). Of course, only when you install it using the "carbonized" installer, the version on the CD requires Classic subsystem, which is gone from Leopard.

Age of Empires III has issues though. In single player, all is dandy, but playing in network is completely borked by network sync issues. Few seconds into a multiplayer session it'll say "Out of sync. Exit and try again". Truth be told, the other machine still had Tiger on it when my son and me tried it; I installed Leopard on it since.

After two days when I was sufficiently convinced that it works okay, I installed it on my wife's iMac G5 as well, and faced an interesting limitation. You know those custom iChat backgrounds Apple showcases as new iChat features? The ones where you can have the room behind your back replaced with a moving Niagara falls scenery? Well, you won't get them on a PowerPC Mac. I wanted to try it out for fun between our two machines, but the iMac's 2.1GHz G5 CPU is apparently not strong enough for them. Intel Macs only. Now, come on, Apple, I don't buy it. You probably just had a nice hand-optimized assembly with MMX and SSE instructions in there somewhere, and couldn't be bothered to port it over to PowerPC AltiVec. You know, the one you touted as being the superior vector unit. I think we're experiencing the first signs of PowerPC users falling out of grace. I don't want to sound dramatic, but I mean, I can maybe, just maybe understand a G4 not being strong enough for this task, but a 2.1 GHz G5? What about people with dual or quad G5s? This is a minor, but sad letdown.

Also, my MacBook Pro took on the habit of waking up at precisely 1:00:00 AM every night after the Leopard upgrade, without anything being set in the file. Since 1 AM in my timezone (GMT+1) is actually midnight GMT, I suspected this to be some stray zero making its way into EFI or something. Pretty much, after I overwrote it by setting "Start or wake up every day" in Energy Saver to 9 AM, the phenomenon went away.

Well, that's it so far. I'm also fooling around with XCode 3. It's a very polished development environment, and I'm toying with the idea of creating some native Mac OS app. Y'know, just to unbox myself a bit from my "server side Java" box and try the "desktop app in Objective-C" world for change.

Tuesday, October 30, 2007

Scapegoating for Java crisis on Mac OS X

So, pretty much all Java developers working on Mac OS X are filling up the blogosphere (sorry for using the cheesy term) screaming how Apple left them behind not releasing Java 6 for Leopard. This article (via DF) summarizes the overall sentiment (and somewhat hysterical atmosphere). Apple's own java-dev list is another place where people are raising concerned voices.

It's understandable where this outcry comes from. Go to any major Java conference. The Mac laptops are totally over-represented in the audience.

I could well be among them. I'm guilty of amplifying the "Macs are everywhere" effect at conferences myself with my MacBook Pro. I too am a Java developer working on Mac OS X.

I just see a different perspective to things. First off, it always struck me as actually very unnatural that Sun ships Java for Windows, Linux, and Solaris, but does not ship it for Mac OS X. I don't feel let down by Apple here.

I feel let down by Sun.

Sun already publishes a JDK and JRE for three different OS platforms. How hard would it be for them to publish it for Mac OS X as well?

It appeared to me that Sun just recently started natively supporting OpenOffice on Mac OS X. The concept is not completely alien to them, then.

Looking realistically, what is the supposed rationale behind having Apple ship Java for Mac OS X? My educated guess is that the reasons are twofold:

One, OS X was originally so small marketshare-wise that Sun simply couldn't be bothered. They probably had they doubts about the success of the OS. So Apple undertook porting Java to increase the potential software base of the OS and its overall utility. Remember, Mac OS X at the time was still quite young. Hopefully this has changed by now, especially seeing how lots of Sun employees also use Mac OS X. So there's me hoping that in 2007, Sun could actually be bothered.

Two, Apple provided some Apple-specific functionality, like Swing that looks almost like native Mac UI, plus a Cocoa bridge (which is not updated to keep up with Cocoa improvements for quite some time, and is declared by Apple to not be updated ever again).

Don't get me wrong, but the vast majority of Java developers on Mac doesn't give a shit about either Swing or Java-Cocoa bridge, or anything else there might be. Java isn't doing particularly well on desktops; strong Java market is on the server side. As a consequence, vast majority of Java developers don't deploy their software on Mac OS X. They deploy it on enterprise irons that typically run Linux or Solaris. I'm in this crowd.

Let me repeat: I don't give a flying shit about Mac OS X specific Java functionality. If I wanted to write a Mac desktop app, I'd use Objective-C. If I wanted to write a cross-platform desktop app (ha!), I'd probably first talk myself out of it, and if I really couldn't, I'd go for SWT. I'd be more than happy with Java on Mac that allows me to do my command line and server side stuff. I wouldn't care that it has us an ugly looking UI with Swing (as it does on all other platforms, anyway).

And I firmly believe it is Sun's job to give us one, not Apple's.

If you're following what Apple is doing with its developer strategy, it'd be clear to you Apple doesn't have any interest in Java on Mac OS X, and I can't actually blame them for that. Apple is slowly abandoning lots of technologies. It is slowly abandoning Carbon (Carbon will have no 64 bit support, ever). Apple is slowly abandoning non-Cocoa QuickTime bindings (they too will have no 64 bit support). Apple's developer strategy is unification: everything is Cocoa and Objective-C.

In an interesting twist that seemingly (but only seemingly) contradicts what I wrote above about unification, Apple ships Ruby and Python bundled with the OS. However, please observe that both of these are (a) open source and (b) support compiling on Mac OS X in their mainline source code. That is to say, the original developers of the code provide OS X support by sprinkling required #ifdef blocks around the code. Apple just needs to take it and bundle it, without further tailoring. That's what they do. To Apple, Python and Ruby are just Darwin-level tools. And even if they didn't bundle it, it'd be trivial for anyone to compile them from the source and install. Fink and DarwinPorts can give you newer versions of either if you need them. Neither (a) nor (b) can be said of Java. OpenJDK is not Java. Not yet. Sun is definitely heading in the right direction with open sourcing Java, but they started too late to avoid this particular crisis.

Relying on Apple to deliver the Mac part of the WORA promise was a mistake, one that could be easily seen by anyone for years, as Mac users were getting their JDK updates with six months or longer delays compared to platforms serviced by Sun. Sun would've had plenty of time to act upon this mistake.

Again, is it Apple's fault that we don't have an industry-grade open-source Java implementation that supports Mac OS X in its mainline source code? I don't think so. If you want to be angry at someone, or better yet, you want to petition someone about the situation, please direct your energies at Sun.


  • OS X Java Definitive Timeline shows the problem of letting Apple - a party for who Java is low-priority business - take care of delivering it on its platform: worst lag in release schedule was 21 months for Java 1.4 to show up in Mac OS X.

  • Also there, Comic: Apple’s Pathetic Java Support? Oh Really? saying
    Dear Steve,

    Writing your own JDK is really hard. Maybe you should follow Microsoft’s lead and let Sun do the dirty work?
    Well, yeah, if only Sun wanted to do it.

  • In Shipping means prioritizing Gruber also reinforces my point:
    Perl, Python, and Ruby pretty much compile out of the box on Mac OS X. Apple doesn’t have to do much at all — at least relative to Java — to include them on Mac OS X. Why? Because that’s how these tools are designed and engineered — they’re made to “just build” on any Unix-like OS. It’s not Apple’s responsibility that Java isn’t like that — it’s Sun’s.
    He's also quite confident we'll see Java 6 in Mac OS shipped soon, if the timeline above is any indication.

Fastest Vista laptop is MacBook Pro

According to PC World's "The Most Notable Notebooks of 2007" article, of all laptops they tested this year, the one that runs Windows Vista fastest is - MacBook Pro! They conclude with:

... MacBook's score is far more impressive simply because Apple couldn't care less whether you run Windows.

(Via Daring Fireball)

Thursday, October 18, 2007

Linux preinstalled on Acer laptops - a scam?

Here's a bit of a firsthand bitter experience with laptops and Linux from last week. (It's also another hard reminder why I run Apple computer gear exclusively for myself for two years now.)

My wife's aunt wanted to buy herself a computer. She wanted the "usual" functionality, y'know, browse the web, e-mail, listen to music, watch movies, online chat. It also must have a hungarian UI. I suggested she gets a desktop computer, but she insisted on a laptop. Oh well, it's her money.

Her budget was half of what you'd need for a MacBook. Not wanting to enrich Microsoft's Windows division, I suggested we get a laptop that comes with Linux preinstalled. I had some successes installing Ubuntu Linux on some machines lately (one of them an oldie IBM ThinkPad where Ubuntu even recognized the PCMCIA wireless card without a hitch). Also, seeing how she lives 100 km from here, I didn't feel like doing tech support on it often, which is something I believe I would end up doing with Windows (if my wife's machine is any indication).

My argument was that for the same money, we'll get a stronger machine, since the manufacturer didn't have to scale back the hardware budget to accomodate a Windows license.

We ended up buying an Acer Aspire 5315 that's distributed locally in a Linux configuration for 120000 HUF (660 USD).

Now, the first thing is that it comes with a Linux distribution named "Linpus Linux". There's no install CD so I can't reinstall it if anything goes wrong. Also, I can't install any graphical interface. That's right. In 2007, a machine equipped with a 1280x800 screen, gigabit ethernet, wifi, DVD burner, and bluetooth comes with a preinstalled OS that dumps you to a shell prompt upon boot. No graphical environment whatsoever is preinstalled. I've tinkered with it a bit, and noticed it doesn't actually bring up the wireless network interface. We'll see later why.

Ok, so let's install a proper Linux on it. I started with Freespire - it's an Ubuntu derivative, but comes with non-free media codecs. Just what I need, so auntie doesn't nag me later that she can't play back MP3 and WMA files. It went up without a hitch, but I hit exactly three problems with it:

  • Sound drivers claim to work, but no sound comes out.

  • The Atheros wifi chipset is too new, so it's not yet supported by pci_ath

  • An attempt to install hungarian language ends up with error message saying qt_language_selector is not found

Trust me, I've spent fair ammount of time browsing all sorts of support forums to solve these, but had to throw in the towel in the end.

Next, I tried a mainline Ubuntu distro (Feisty Fawn). This ended rather quickly - I got dumped into a BusyBox command prompt by the installer. Turns out FF doesn't recognize the chipset, and thus can't detect the hard disk drive properly, and as a last ditch measure gives me a command prompt. Geez...

At this point, I decided to give Windows XP a try. I had a copy of WXP SP 2 at hand, so I tried installing that if only to see whether the sound might be defective in hardware (if WXP drives the sound chip, then it's apparently not). To my utter surprise and disbelief, WXP installer also failed to recognize there is a HDD in the machine. Ouch. Friends are telling me that I'd need to provide the installer with SATA drivers externally. Yeah. Provided I can find them. And then there's the minor issue that Windows XP installer only accepts external drivers through a - you guessed it - floppy drive! Yes, there are USB FDDs. I've also heard some newer BIOSes can present a USB pen drive as a floppy. Still, what would've it taken to write the damn thing so that it can accept external drivers from a CD?

Back to Linux - there's another Ubuntu derivative named Kiwi. I chose it because, similar to Freespire, it comes with nonfree codecs preinstalled, and can be installed in Hungarian language by default, so Freespire's language selector problems at least won't trouble me. It was also based on next Ubuntu release - Gutsy Gibbon.

Well, what can I say. It did boot and install, but the sound still didn't work, and I still couldn't get wifi to work. Yes, I did try ndiswrapper with Windows drivers, but even after I blacklisted pci_ath and rebooted, some part of the OS still pulled pci_ath, which took precedence, but was unable to drive the new chipset.

So, I had to admit defeat. I wasted sunday evening, monday evening, and part of tuesday evening on this. My time is worth more to me than this.

So I phoned an IT shop in the city and asked them for a quotation on Windows Vista Home Basic. (Seeing how XP doesn't install, how Acer itself suggests Vista, and how the driver CD only contains Vista drivers.) With Vista, sound works (not a hardware problem then), wireless works. All hardware works.

But here's my question: why does a company sell a computer with Linux preinstalled if there's no Linux distribution currently on planet that can, installed out of the box, correctly drive all of its hardware? What can be said of such a marketing practice? In case of Acer Aspire 5315, at least the wireless and audio didn't work (and I haven't tested either the Bluetooth or the DVD burner, so I can't say they either work or don't).

If they aren't aware of the hardware support limitations, shame on them for being unprofessional. If they are aware of it, shame on them for enticing us on purchasing the machine by representing that it has an OS installed appropriate for it. Duh.

Vista install is running as I'm writing this. I'm cheering myself up thinking of how next time I'll be installing an OS it'll be Leopard on my two Macs.

Thursday, October 04, 2007

Language trendspotting at JAOO

Surveying the talks this year at JAOO, it is hard not to notice that nobody is getting too excited about either Java or C# anymore.

Ruby of course had a full track to itself on monday, and a track named "Enterprise Application Frameworks" on Wednesday was also pretty much Ruby/Rails dominated.

On the other hand, other languages were in the limelight too. We had a great introductory presentation on Erlang by Joe Armstrong, one of the principal inventors of the language. Erlang is the old-new contestant for the title of "right answer to concurrency challenge", and it really looks like it solves the challenge correctly for a fair ammount of use cases I can think of. Basically, whenever you can afford a share-nothing message passing architecture.

We also had a presentation of Scala. Scala must be my favorite language for about two years now even if I didn't write anything in it yet :-). You just got to love all the modern amenities in it that are missing from Java: type inference, very good syntax for map and list literals, closures, a really polished generics implementation (it allows contravariance, by golly!), plus assorted functional programming goodies, not the least of them being Haskell-style datatypes. Oh, and it is static and compiles to a plain Java .class, creating a very low (virtually nonexistent) entry barrier for gradual introduction into your existing Java code.

Oh, and people are talking about JavaScript as well :-)

Glenn Vanderburg gave a talk titled "The Overlooked Power of JavaScript", which was exactly what it said. The language had quite an injustice done to it because of its unfortunate name choosing -- as we know and as Glenn pointed it out correctly, it is not related to Java at all, its ancestry comes from Scheme and NewtonScript (useless trivia: I actually wrote a commercial application for Newton in NewtonScript back in 1996).

JavaScript is an incredibly powerful language if you can get rid of the preconception that you need to handle it as you'd handle Java. Once you get past that and actually understand how things work in it, you can develop some mightily beautiful code in JavaScript, as the extreme dynamism of the language allows you refactorings simply not possible in more constrained languages. You can end up with some very tight internal DSLs. And I'm not talking only about code to run in a web browser -- I'm talking about applications running on desktop or on a web server.

To demonstrate the power of the language even further, there was a presentation of Flapjax on JAOO this year. Flapjax feels like a language, but in reality it is "just" a JavaScript library, but one that allows you to program your browser-run client applications in an event driven manner, plus supporting reactive evaluation (think self-recalculating cells in Excel) when events change values. "Event" in Flapjax can be almost anything -- a tick of a timer, a click of a mouse, asynchronous completion of a HTTP request, and so on. You can concisely express your program in terms of reactions to such events, and also always preserve consistent internal state of all variables thanks to its self-recalculations, all with fairly intuitive syntax. That's quite a something from "just a library" in JavaScript :-) Flapjax was covered on LtU as well about a year ago.

So, all-in-all, language diversity is again in fashion. Developers seem to finally recognize that a language is just a part of their toolbox, and that you need to choose the right tool for the right job. Of course, I know that the same developers usually need to also convince their managers about this point of view, but fortunately this seems like it'll become easier with language diversity now being an accepted trend at respected conferences.

Friday, September 21, 2007


Just a heads up that, following what seems to become an established previous tradition, I'll be attending the JAOO conference this year as well. See ya in Aarhus next week!

Thursday, September 20, 2007

Laugh-Out-Loud Cats

I'll admit that I was mildly annoyed by the whole LOLCats meme. I don't say I didn't get it; I did, I just felt it overdone after a while and couldn't be bothered to pay attention to yet another photo with funnilz missspelt all-caps would-be-jokes superimposed on them.

Until Ape Lad created something wonderful out of it.

Ape Lad, or Adam Koford is an illustrator maybe best known for his graphical interpretation of various hobos from John Hodgman's book "Areas of My Expertise", but I think that soon he'll be referred to primarily as "the guy who created Laugh-Out-Loud Cats".

So, what is it he did with the LOLCats phenomenon? He created a 1920-style cartoon featuring two vagabond cats, as he himself says "one Meowlin Q. Kitteh (a sort of cat hobo-raconteur) and his young hapless kitten friend, Pip". These cartoons are produced traditionally, pen-and-paper, and have an incredibly authentically-feeling atmosphere of the '20s, plus a fantastic chemistry resulting from mixture of innocence, mischief, and cuteness overload in the characters. Just click on the image to the left for the gallery -- it's all available for free viewing on his Flickr account, and I'm looking at its RSS feed with most anticipation every morning for updates (and I'm seldom disappointed, because the guy is really prolific)!

Of course, you might as well check out his other fine works, like his graphical interpretations of various HTTP error codes (to the left, you can see "415 Unsupported Media Type").

Tuesday, September 18, 2007

Liquids on planes in Europe will be allowed again!

Frequent air travelers rejoice!

Apparently, Norwegian Ministry of Transportation asked the European Parliament to move to lift the liquid ban on airplanes. They say it is "annoying for the travellers", and a "large cost for society".

And apparently, the European Parliament agrees!

Sorry if I'm sounding euphoric about this, but this mindless fake security measure did cause me lot of headache in the past. Sometimes literally - there are those situations when I need to catch a transfer and the itinerary is so tight I barely can run from one gate to the other and I don't have time to grab an (overpriced) bottle of water at the airport, so I get a headache of dehydration by the end of the trip. small glasses of water and orange juice served at the airplane are not the same thing. Actually, lately I switched to carrying apples with me for liquid replenishment.

In the meantime, I need to find an (a) aerosol deodorant not exceeding 100ml and (b) shaving foam container not exceeding 100ml for my next week's trip to JAOO in Aarhus (I'm flying with hand baggage only). I figure I can just use the hotel bathroom soap in dire need instead of the shaving foam though. Oh man, can't wait for this madness to end.

Sunday, September 16, 2007

Closures in Java NOW!

I remember Neal Gafter's talk about his idea of how to implement closures in Java that he gave at TSSJS in Las Vegas this March, and I have to say, if we had this feature today, it'd be none too soon.

Lack of closures does give Java a reeeally bad feel in 2007. It makes it very backwards looking in terms of modern programming language amenities, compared to languages that already have them.

Here, let me show you an example.

As we all know, in Java, objects can't control their own locking - they can't customize their behavior when used in a synchronized block. Now, that's one entertaining problem in its own right, and would deserve its very own discussion, as basically, it makes correctness of synchronization dependent on implementation. But that's not the point of this post. The point of this post is how one might try to work around this and similar lackings, and how one will inevitably fail...

Okay, the example: let's suppose I have a class A. I sometimes need to lock instances of it. This is a no-brainer in Java and usually has the form of

synchronized(a) {
... do something...

Let's suppose I also have a subclass B of A. Instances of B have a reference to another object of some class S, and various instances of B share some of their state through shared instances of S for some reason:
public class B extends A {
private final S shared;

Since the S instance is actually shared among several B instances, the correct locking semantics for B would be to always synchronize on the "shared" field of a B, when client code synchronizes on an instance of B. Unfortunately, there's no way in Java to declare to do a synchronized(b.shared) within every synchronized(b).

What's the next best thing I can do - provided I want to encapsulate the behavior and want to avoid some manual monster code1 at every synchronization site? A smart aleck like me would add a method to A:

public void runLocked(Runnable r) {
synchronized(this) {;

Then, I can override it in B:
public void runLocked(Runnable r) {
synchronized(this) {
synchronized(shared) {;

Finally, I can replace all occurrences of a synchronized(a) block with:
a.runLocked(new Runnable() {
public void run() {
... do something...

Sounds okay? Well, it isn't. Aside from the very obvious "too much visual clutter" problem, there are further problems with this:

  • What if "do something" throws a checked exception? (Answer: more monster code2)

  • What if "do something" modifies a local variable? (Answer: yet more monster code3)

  • What if "do something" contains a return, continue, or break statement? (Answer: you are seriously out of luck, but some really horrid monster code might help you out. It is so ugly though that it does question the ROI of the whole approach. No, I won't give an example.)

So, what happens is that you eliminate ugliness in one place, only to have it resurface because of these other problems in another place. It is not really possible to arrive at a win-win situation with current language constructs. (Alternatively, I'm not smart enough to figure it out. Either way, pity). Needless to say, if we had real closures in Java instead of the very weak imitation attempt in form of java.lang.Runnable, none of these would be a problem.

1 the monster code in question would look something like:
synchronized(a) {
if(a instanceof B) {
synchronized(((B)a).getShared()) {
... do something ...
} else {
... repeat do something ...

2 the monster code for working around checked exceptions would be:

try {
a.runLocked(new Runnable() {
public void run() {
try {
... do something ...
} catch(RuntimeException e) {
throw e;
} catch(Exception e) {
throw new UndeclareThrowableException(e);
} catch(UndeclaredThrowableException e) {
Throwable t = e.getCause();
if(t instanceof Exception) throw (Exception)e;
if(t instanceof Error) throw (Error)e;
throw e;

And it can get even more fun if you're trying to only get a specific type of a checked exception (say, IOException) and not a generic Exception across the scope.

3 the monster code for working out local variable modifications would be:

final Object[] embeddedLocalVar = new Object[1];
embeddedLocalVar[0] = realLocalVar;
a.runLocked(new Runnable() {
public void run() {
... do something ...
embeddedLocalVar[0] = newValue;
realLocalVar = embeddedLocalVar[0];

Pure beauty, innit?

Friday, September 07, 2007

"How can a spinozan cast a dualism spell?"

If you enjoy reading works of Jostein Gaarder (come on, you must've read at least "Sophie's World", haven't you?), and if you likewise enjoy reading any or all of Greg Egan, Charles Stross, or Neil Gaiman, then you'd adore a hilarious webcomic about (in no particular order): philosophy (if you can actually get the joke in the post title), quantum physics, psychology (with regular appearances of "Tiny Carl Jung"!), all with a big dose of surrealism.

That's exactly what Dresden Codak is.

If I may recommend, start reading from this one, as it and the next few ones are extraordinarily brilliant (contrasted with the rest, which are just, well, ordinarily brilliant). Then revisit the older ones after you reached the end.

My only woe is that there aren't too many of them yet, and it's not updated too frequently. But hey, quality work needs time!

Sunday, August 19, 2007

The World's Toughest Programmer: "How I became a programmer"

I recently discovered the blog of The World's Toughest Programmer a.k.a Mike Lee, and I can't help already loving him. He hasn't written a lot in his blog for now, but what he did was very thought provoking so far. His newest writing "How I became a programmer" is a must read. Tagline:

I was born a programmer. The rest is just implementation detail.


Wednesday, August 01, 2007

Mac Mini colocation (Seen it referred from here, being mentioned for their superb consumer care).

As tongue-in-cheek as this sounds at first, yep, these guys do actually provide managed hosting of Mac Minis (you can send one to them, buy one from them at Apple's prices, or even rent it). The idea is a bit weird, but makes sense if you need a dedicated server on the net, you want Mac OS X on it because you are familiar with it, and you don't want to shell out for an XServe. Oh, and yes, you can run Mac OS X Server on Minis if you really need it.

Monday, July 30, 2007

Fun and woes with VNC

So, we are at a holiday in Palma de Mallorca momentarily. Unfortunately, we could only bring one of our Macs here - my MacBook Pro ' and had to left wifes 20" iMac at home for obvious reasons (it is not too portable, although I did lug it to UK and back once when it was my primary machine). Our hosts however have an oldie G4 eMac. Since both of us need a machine frequently, I tried to remedy the problem using VNC - Vine VNC server on the MacBook, Chicken of the VNC client on the eMac, so one of us can work logged on in their account from eMac while the other person sits at the MacBook proper.

It mostly works fine. But then, there are annoyances.

First annoyance - the system works on two desktops, except when the user of the remote desktop wants to use VMWare. In that case, using fast user switching hangs the remote VNC sesion. No big deal - we will just have the one of use not using it work remotely. (Surprisingly, that is me - Kriszti actually has some Windows-only software she runs).

Second, much bigger annoyance - keyboard incompatibility. I tried both an Apple keyboard plugged into the eMac as well as a Windows keyboard only to realize there's a deeper reason why I can't punch in many characters (curly brackets included - kills any attempt at coding). The reason is that the MacBook still maps keycodes accordingly to its builtin keyboard. I learned this after many futile attempts to press certain keys and evoke any kind of response, I finally brougt up the Keyboard Viewer, and it pretty much displayed the MacBook Pro uiltin keyboard layout... If I try to press keys on a full size keyboard that aren't present on the laptop's built in keyboard, theyre simply ignored. Quite a lot other keys aren't in the expected place. I guess it's partially to blame that all external keyboards in the house are Spanish and the laptop's is Hungarian... But even switching the keyboard layout in the remote machine to "Spanish ISO" doesn't help anything... I tried to plug in one of the USB keyboards in the laptop, to solve the keyboard mapping mismatch issue, as the OS would then try to map according to that. Didn't work.

So, it's far from being a perfect remote GUI solution, unfortunately. It's okay for casual checking of e-mail (mailbox being on the other machine) but really not much else. Sigh.

Thursday, July 26, 2007

First cut at the JVM dynamic languages metaobject protocol

You might remember I was musing about coming up with a framework library for extensible metaobject protocol to be used for dynamic language runtimes on JVM a while ago. The main thing it would give all those language runtimes is interoperability: you could write your program in mixture of JavaScript, Ruby, Python, etc. - using the best language for a particular subtask (or better yet, cherry-picking existing components regardless of their language), and still pass objects created from code in one language to code in another language, and have them all see those objects as being no different than their native objects.

Well, since talk is cheap compared to working code (and also because if I can express a concept as clearly as to have a computer execute it then I can probably make people understand it better too), I have a first version of the implementation, not yet fully complete, and first and foremost for the purposes of soliciting feedback from the community, available now.

(For the record, I blew several days of my vacation in Palma de Mallorca on getting this code into publishable state and suffered numerous scorns from my wife so far for doing so. Goes with the territory, both ways... ;-) )

The initial announcement was made on the JVM Languages group, go read the details (including where to find the code and documentation) there if you're interested.

Thursday, July 05, 2007

Brief report from a Neil Gaiman signing event

I'm officially crazy in lots of ways. A particular kind of crazy I am is the one I demonstrated yesterday, when I went to a Neil Gaiman signing event in Budapest.

What's crazy about it? Well, probably nothing if you actually live in Budapest. I don't, so for one thing, it's crazy driving 2 hours to Budapest in pouring rain with near zero visibility. Then it's mildly crazy standing in a queue for two hours (part of it in rain outside the bookshop that was the signing venue. No umbrella). The final crazy (although strictly necessary after the first one) is driving home after the event in pouring rain with near zero visibility after dark. Of course, I'm really crazy because I still feel that spending six hours and about forty litres of fuel is a good investment in return for getting seven of my Gaiman books dedicated, and am totally happy about it.

Y'know, in my environment, barely anyone knows who this guy is (now that I think of it, this says something about people surrounding me. I also cannot lend my copies of his books to many folks around here to spread the culture 'cause they're all in English - I don't need no Hungarian translations, most of my friends however can't read the English originals). So I was fairly surprised when I arrived at the bookstore to find a queue extending into the street. The event itself wasn't even too formal - Neil announced it on his blog few days earlier citing as the reason lots of e-mails from local fans (yours truly included) who asked if he could please arrange a signing during his two-week stay in Hungary, seeing how he's otherwise not really often present in this corner of the world.

As for the venue itself, it was the Sárkánytűz ("Dragon Fire"), a bookstore specializing in fantasy books, card games, etc. I really couldn't help feeling that the signing was organized in a wrong location. I look with disdain at most of the contemporary fantasy literature. Most of it is just bad pulp fiction, its authors unable to free themselves from the cliché dominated by elves, trolls, halflings, dragons and knights. Ironically, a genre called "fantasy" really lacks authors that would have any real imagination. Neil Gaiman, on the other hand creates completely original stories, with completely original creatures, and the worlds he paints in his books intersect with our reality. Nothing could be further from the Tolkien-imitating cliché of elves and dragons permeating most of what the bookstore had to offer.

There's apparently a funny phenomenon associated with people queueing in the street in Budapest. Namely, it raises curiosity in strangers. While I was still standing in the part of the queue that extended out in the street, I was approached twice - once by a nicely dressed lady in her fifties, once by a guy resembling a hobo who tries to disguise it. They both inquired about the nature of the event, the wording of their questions implying they were hoping for some sort of a sale. When I told them it was a signing, the guy who looked like a hobo in disguise quickly lost interest. The lady asked who is signing, and when she didn't recognize the name, she asked (seeing how it's a fantasy bookstore) if it is "some sort of fantasy" to which I replied that it definitely isn't. "Then it is sci-fi, right?". This instantly reminded me of "we have both kinds of music" line. I replied patiently that no, it isn't sci-fi either. Then what it is? Well, how do you summarize Neil Gaiman in a single sentence? You don't. I tried to explain to her that she could think of him as maybe a modern day equivalent to Edgar Alan Poe (which I know you might disagree with, as it's both oversimplification and also plain incorrect, but that was the best I could come up with quickly at the spot :-) ) Anyway, she did leave after this...

So, after two hours of queueing I finally got in front of the man himself, got to shake the hand that wrote all those stories and look into the eyes behind them all those same stories were born. Yes, why, I was impressed, even though Neil is really a very friendly and approachable guy (well, approachable through standing in a long queue, but that's barely his fault. I mean, it's really my fault for not reading more obscure authors). Driving up on the highway I had plenty of time to imagine all kinds of witty dialogue I might get into with him, but the cruel reality was that there were still lots of fans waiting for their turn, so it would've been rude to hold them up for inappropriately long time, so we only did a bit of a politeness chat, and I handed over all the seven books I brought for dedication. It'd really be foolish to expect anything more from a signing event, really. I got a drawing of a cracked heart in my copy of Fragile Things - very appropriate. Also, the original printed dedication for Anansi Boys is actually made for easy personalization, which he totally exploited. I can almost see how Neil came up with it after signing his books for years, and felt very smart about it when he wrote it. (If you don't know what I'm talking about, don't worry, just buy a copy of Anansi Boys and read the dedication. Of course, you can also read the rest of the book if you're so inclined, but that won't help you in better understanding what I just said. But it might be worth your time for unrelated reasons, though.)

I also asked whether he has (or at least has a promise to get) a book of Hungarian folklore tales, to which he replied that he actually got one last week and is halfway through it already. If he didn't, I'd have offered to send him one, which was an idea I got while reading The Monarch of the Glen novella from Fragile Things, seeing how it incorporated a motive from Norwegian folklore (namely, a huldra), and Hungarian folk tales definitely have their share of marvels waiting to be incorporated into contemporary literature (I certainly know, I read lots of those to my kids). Anyway, getting Neil to read some of those tales is already been taken care of, hooray. We'll be waiting for the results :-)

A very nice touch at the signing was Neil's daughter Maddy, who was handing out cookies to people standing in the line and later also offering sandwiches at the signing desk. I really needed a bit of refreshments before hitting the road home, so I was really grateful for those as well. I asked Maddy when will she give back her Dad's blog to him, and she said it was her last day as his guest blogger, but she lamented that she can not write the entry because she's here at the signing. I remarked that she could use an exotic technique known as "pen and paper" and later type it up in front of a computer; I have no idea if she took the suggestion, however her goodbye entry was up at 10:01 PM, which I don't actually understand as I can't imagine the signing was over by then and even less that they could reach their hotel room by then - I left at about 9:15, and the queue of waiting fans still extended through the bookstore to the door (nobody waiting on the street anymore though).


So, Kriszti and me have been to Barcelona last week. Nominally, I went to speak at the TSSJS Europe, realistically I attended the conference just long enough to deliver my talk. That's what you get for taking your wife with you, who insists you spend the time going around the city and seeing places, instead of attending, say, Gregor Hohpe's talk about event driven programming (that one I really would've wanted to hear, but alas, I was stuck sightseeing Sagrada Familia instead; woe is me).

Barcelona must be one of the most joyful places I've ever been. The atmosphere of the whole city is amazing, the buildings, the people, everything is vibrant and alive. Architecturally, they have wide main streets with a very wide pedestrian area (usually with greens, benches, and fountains) in the middle, and lanes for cars surrounding it. Drivers are very mindful of the pedestrians and will wait for them to cross the street even when they (the cars) have the green light. Patiently.

Then there's Sagrada Familia. I don't think I've ever been as impressed by a cathedral as I was by it, especially since this is the first one that I can't view purely as a historical monument, main reason being it's still being built. You step into it, and it's full of construction workers. Cathedrals are always monuments to ages in which they were built, and this one is a monument to our age instead of some long gone one, making it even more easier to feel like it you have a personal connection to it. Y'know, like when you visit a cathedral and they tell you "... the XY cathedral has been built for 300 years..."; well, this one is still in its first 100 or so years :-)

Architecturally, it is also quite amazing, and departs from "traditional" cathedrals in quite a lot of places. Pillar structure is such that pillars branch at the top, giving the illusion of trees, further emphasized by the ceiling that also tries (quite successfully) to look like foliage.

Then there are various other Gaudi projects in the city: Casa_Milà, Parc Güell, and so on, all definitely worth several hours of one's time.

We also went to see an evening flamenco show with a dinner (courtesy Klaasjan) which turned out really great, both the flamenco performers and the dinner were terrific. And on the previous evening, we hung out at the hotel's "bierstube" (which is to say, a spanish attempt at emulating a german beer place). A funny moment was when the staff kicked out Kirk and Cliff because they attempted to come in with two boxes of externally acquired pizza. The attitude of the staff was especially rude considering we were otherwise on a table with few hundreds of euros on the tab anyway, so what does it matter if two pizzas are eaten without generating a profit for the venue? Anyway, the guys ended up eating their pizzas from their boxes on the street. Kriszti and myself joined in for a bite (no photos of this overly casual event, regretfully :-) ).

On saturday, wife and me also had the pleasure of meeting with Jon Revusky and his wife Nuria (they're long time Barcelona residents) for lunch. (We were treated to really copious amounts of really great tapas in Cervezeria Catalana.) Jon and me are collaborating on FreeMarker for about five, six, or even more years now, and this was the first time we actually met personally.

The only dark side of the trip was airline luggage handling. Needless to say, they (Lufthansa + Newco, their ground services provider in Barcelona) lost our luggage between our connecting flights. That in itself isn't that bad, but they didn't deliver it until the day of our flight back! So we went out to the airport on sunday, got our boarding passes (from a really helpful lady at the Lufthansa ticketing desk), then went through security into the transit area, found the baggage room, stood in the line at the Lost+Found office, finally got to the front of the queue, been taken to a back room with hundreds of suitcases, found our own, went out from baggage room, back to departures to drop off the suitcase for the trip home, then again through security into the transit area. Simple, huh?

When we arrived home to Budapest, we went to the Lufthansa office at the airport to file a claim for luggage delay. The ladies working there said they don't deal with it as they don't have sufficient capacity to handle all such claims (I can believe that. They certainly gave the impression they have no capacity for anything whatsoever) and they told us to contact their office in the city, for which they can only give us e-mail address and fax number. The lady at the desk then proceeded to jot down the e-mail address on a piece of paper: I respectfully noted that it seems unlikely that this'd be the e-mail address of the city office in Budapest, but she was insistent that it indeed is. I was too tired to argue. I spoke to Kirk on the phone today, and he said Lufthansa office at the Budapest airport is the "most useless place on the planet". I tend to agree.

All in all, the Barcelona trip was great. Got to see a marvelous city, met some new folks and met again some already known ones, eaten lots of good local food, drank some sangria and local wine, did one talk, watched flamenco dancers, seen a great sunset by the sea. What more to expect? (Well, on-time baggage delivery, maybe.)

Thursday, May 31, 2007



(No, the blog hasn't been hacked. Yes, click the link. See for yourself.)


Friday, May 18, 2007

No online Ant API?!

(Warning: disgruntled rant below.)

Ok, so I'm writing an Ant task. I'd need the Ant API. Google "Ant API". First link is Yeah, sounds about right; click. To my surprise, instead of the familiar JavaDoc page, I get this:

Apache Ant API has not been generated

If you see this page online at, it is not a bug, but on purpose. We do not provide an online version of the API docs, they are included with all our distributions.

Now, just how arrogant is that? "On purpose"? Just exactly what purpose is that? Are you guys really this much bandwidth starved?

Just for the record, the JavaDoc is not included in all distributions. Y'know dear Ant team, since the Apache license pretty much takes away the power from you to dictate what's in a distribution, some distributions won't come with JavaDoc.

Like that obscure one that ships with XCode for Mac OS X, installed in /Developer/Java/Ant directory. I guess no one uses that anyway, right? I mean, what Java developer would be as insane to use Mac OS X, let alone the development tools that ship with it, right? I'm probably the only such loser on the planet, I can't imagine anything else can explain why noone has noticed this yet and told you about it, so you removed that silly claim from the page where the API docs should have been, and replaced it with, well, with the API docs. Give me a break.

You could say how that's Apple's fault, and I'd agree with you. But that you aren't helping at all is ridiculous, with as little as to keep an online accessible API docs for one of your highest-profile Java projects. In 2007, what Java open source project aspiring to claims of professionalism would purposefully refrains from hosting its JavaDocs on its site? If for nothing else, then all other factors being equal, people want to use their computers with least effort. With a computer connected to the Internet, the easiest way to get to an API is punch "$projectName API" into the browser's built-in Google search box and then hit the first link. Compare this to trying to find the relevant index.html on one's hard drive. Yeah, we're that spoiled.

Anyway, the first site on Google's search results list that can afford the horrid bandwidth and storage burden of hosting the Ant API is Kudos to them, and shame on whoever is responsible for this lameness in the Apache Ant team.

Wednesday, May 16, 2007


Whenever I'm faced with a programming problem to solve, the logical first thing I do is to rummage around the 'Net, trying to find an open-source library (preferrably non-GPL, i.e CPL or BSD licensed) that already solves it. Because reinventing the wheel is costly, and most of the time the problems are such that I can't imagine to be the first to have came across them.

Few months ago, I had a requirements for passing objects between JVMs. "Doh, serialization", you'd say. Right. Except that the other people on the project felt it'd be very helpful from the diagnostics perspective if we could inspect the objects. So the logical idea - serialize using XML instead of Sun's binary serialization format. Turns out that the JavaBeans API actually provides support for something similar in the java.beans.XMLEncoder and XMLDecoder classes. It will serialize/deserialize JavaBeans using their public property getters and setters. But we really wanted something that operates on the ObjectInputStream/ObjectOutputStream idiom and serializes fields.

Eventually, I found the XStream project at CodeHaus.

The logical second thing I do when I found an open-source library is examine it. Unfortunately, lots of stuff floating out there isn't of particularly high quality, and branding also doesn't guarantee quality, be it "Apache" or "Codehaus" or anything else.

Now, after using XStream for quite a while now, I must say: well done! It delivers on its promises, the code is architecturally sound, and is insanely customizable. The generated XML is rather compact - i.e. if a value of the serialized field is exactly the same type as the declared type of the field, the type is not written out in the XML. Only if a subclass is used as the actual value. What's more, types can be aliased both on serialization and deserialization. This allowed us to ship objects from a GUI frontend JVM to a DB backend JVM, and have them being serialized/deserialized as different subclasses of a common abstract superclass hierarchy. In the GUI frontend, they were deserialized as classes with GUI operations, on the DB backend, they were deserialized as Hibernate enabled classes. Just brilliant.

I know you can do it with Sun's default serialization as well, but you must override resolveClass or replaceObject in the object input stream. Whereas with XStream, you could just configure the aliases in a factory once, and be done with it. Very elegant.

It is also possible to plug in custom serializers for certain types - i.e. we had to make sure Hibernate-specific collection classes were serialized as plain Java collection classes. It probably took me all of a 20 minutes to implement it, relying on documentation and the XStream (quite clear) source code.

Then there's a rather ingenious default mechanism for backreferencing objects. You can configure XStream to slap an "id" attribute on each element representing a serialized object, and when you need to reference it from a later written object, refer it by the ID. Anyone could come up with that, it's rather trivial. But XStream doesn't do that by default. Instead, by default it doesn't write any ID, but if a later written object needs to backreference an earlier written one, it'll use an XPath expression that selects the earlier object's element! (You even have a choice between absolute XPath or XPath relative to the referencing element.) Again, very elegant.

And to top it all, XStream is not for XML only any longer. Since the serializers are pluggable, they currently also have a JSON serializer, which sure can come in handy if you're AJAXing. (I'm not, so can't give an account of experience in this regard.)

All in all, I'm currently very happy with XStream; if you need to serialize/deserialize your Java objects to/from XML or JSON, I recommend you give it a try.

Tuesday, May 15, 2007

My current open-source TODOs

I'll admit that I feel a bit thin-spread lately regarding my open source activities. There's just too much stuff going on that I'd need to attend to one way or the other. Of course, this is all competing for whatever leftover bits of my time after paid work ("urgent/important"), family, an attempt to reinstantiate a regular workout habit (both "not urgent/important") and the also inevitable everyday interruptions ("urgent/not important"). Just to make it clear, OSS work is to me in the same "not urgent/important" quadrant where family and workout take place.

In no particular order my current OSS activity goals are:

  • Implement support for invoking Java vararg methods from FreeMarker (this actually goes off the list, as I completed it on the quiet sunday afternoon while kids were at a birthday party)
  • Implement support for JSP 2.0 SimpleTag interface in FreeMarker's JSP taglib runtime
  • Fix the JSP taglib lookup mechanism in FreeMarker's JSP taglib runtime
  • Make the overloaded method invocation + varargs into a reusable library so I can support vararg methods in Rhino and also have other open-source dynalang communities leverage it
  • Support vararg methods in Rhino
  • Cleanup the LiveConnect implementation in Rhino (primitive booleans not coerced automatically, and in general overloaded method resolution could be better, and it doesn't use JavaBeans bean info, and...)
  • Just generally try to attend to bug reports in Rhino
  • Attempt to refactor Rhino-in-Spring to reuse Spring WebFlow as much as possible, 'cause having two webflow implementations on the same base code would really help it emerge into a flexible foundation worth submitting as a "Java Web Flow" JSR
There you go - I actually feel a bit better having written down all of this. If you wonder why I haven't answered a Rhino question for a week or so, it might be because I was busy working on a FreeMarker issue, or vice versa. Or just there were no birthdays lately, so I didn't have a quiet sunday afternoon at my disposal for some immersive hacking. But rest assured, I'm going forward with all this stuff, just not exactly on "Internet time" speed :-)

Friday, May 11, 2007

Fish Tank

I'm an avid reader of about a dozen different webcomics. Today, I just discovered another one, and it's just incredible in its originality. It's the Fish Tank, about adventures of three fish living in an aquarium (and quite often venturing outside of it). What's original about it? Well, these fishes occasionally get rid of piranhas (on an occasional visit to Brazil) by deorbiting a communication satelite on top of them using a satelite telephone, or get rid of a cat using explosives. Or are (in the current storyline) kidnapped by, of all things, telepath moths. Rooms, houses, or city blocks sometimes get demolished, or Alaskan wild forests set to fire. In general, there's lots of "Mission impossible" action going on, with fish improvising all sorts of devices from stuff found in their tanks and household items (not necessarily plausibly, but that's really not the point of it; they actually have laptops too!). The drawing is loveably sketchy (but consistent), and the characters are incredibly well built, complete with their love/hate relationships and plenty of ingenious throwaway jokes and inspired dialogue. Totally love it.

Thursday, May 10, 2007

Dynamic language interop plans in .Net world too

I've recently explored the topic of in-process cross-language interoperability (think Python program using Ruby created objects etc.) in my "Adapters or Navigators" article.

Interestingly, I stumbled across posts in Jim Hugunin's (Jython and IronPython founder) blog recently about the exact same topic in the context of .Net - they seem to already have some implementation ready as part of their Silverlight initiative. Here are the posts:

A Dynamic Language Runtime

The new Dynamic Language Runtime (DLR) adds a small set of key features to the CLR to make it dramatically better. It adds to the platform a set of services designed explicitly for the needs of dynamic languages. These include a shared dynamic type system, standard hosting model and support to make it easy to generate fast dynamic code. With these additional features it becomes dramatically easier to build high-quality dynamic language implementations on .NET. More importantly, these features enable all of the dynamic languages which use the DLR to freely share code with other dynamic languages as well as with the existing powerful static languages on the platform such as VB.NET and C#.

Next two posts deal with a sort of "universal adapter", a common object model required for cross-language interop:

One True Object (Part 1)
One True Object (Part 2)

In the part 2, he illustrates how a dynamic language runtime queries an object "Do you have member X?", and the object thinks "I'm a Python object, so I'll look it up by Python rules". He envisions the IDynamicObject interface that all object implementations of all languages must implement for interoperability.

This is exactly what I claim to not necessarily be the best approach in my "Adapters or navigators" article, but that having pluggable metaobject protocols instead of an expected interface might be a more flexible solution.

It's nice to see though that other people also have this problem in their crosshairs :-)

Wednesday, May 09, 2007

Parents of kids with Down syndrome campaign against prenatal testing for it

The New York Times carries an article today titled "Prenatal Test Puts Down Syndrome in Hard Focus".

It reports how in US, families rising kids with Down syndrome are campaigning against a new, widely usable prenatal test that can be used to screen for it. 90% percent of pregnancies where the fetus is diagnosed with Down get aborted. Some parents are worried that as population of people affected with Down syndrome dwindles, the care programs for them will also disappear.

But they are also worried about a much more serious problem than that. The practice is well within the area of eugenics, trying to draw a line between eliminating a genetic condition undesired by the would-be parents versus lessening the diversity of the human race. The genetic condition can be viewed as undesired since Down syndrome results in having somewhat weaker physical features, being slightly mentally challenged, and having shorter life expectancy (49 years average), but most of these individuals are still able to live fully enjoyable lives in a loving family, even if they're placing a bigger burden on their parents, and parents who actually raise such kids and therefore have first-hand experience believe how Down is not a sufficient reason to deny those kids existence. I tend to sympathise with this point of view. From the article:

Sarah Itoh, a self-described “almost-eleven-and-a-half,” betrayed no trace of nervousness as she told a roomful of genetic counselors and obstetricians about herself one recent afternoon. She likes to read, she said. Math used to be hard, but it is getting easier. She plays clarinet in her school band. She is a junior girl scout and an aunt, and she likes to organize, so her room is very clean. Last year, she won three medals in the Special Olympics.

“I am so lucky I get to do so many things,” she concluded. “I just want you to know, even though I have Down syndrome, it is O.K.”

Friday, May 04, 2007

In-process cross-language object interaction: adapters or navigators?

There's a new article on my website titled "In-process cross-language object interaction: adapters or navigators?".

I'm discussing two typical approaches for object interaction between a "higher level runtime" (HLR - i.e. a scripting language runtime) and "lower level runtime" (LLR - runtime for whatever language the high-level runtime is implemented in, i.e. JVM or CLR, or even straight C).

The two approaches discussed are the somewhat more common "adapter" pattern, and the somewhat less common "navigator" pattern.

HLR implementations usually go for the adapter approach, but I argue that the navigator approach is superior to it, especially when you want to extend the object interaction from the HLR-LLR dimension (i.e. representing native Java objects in a JavaScript runtime written in Java) to an orthogonal dimension, namely have interoperability between two distinct HLRs running on the same LLR in a decently intuitive manner, without knowing of one another in advance (i.e. use objects created in JRuby from within Jython, without Jython knowing about JRuby at all).

This level of interoperability opens up new possibilities for people implementing software systems, as they become free to implement different subsystems in languages that fit the job most.

Discussion welcome in comments.

Monday, April 09, 2007

Calling Java vararg methods from dynamic languages

I'm adding code to support calling variable-argument methods (introduced in Java 5) from FreeMarker Template Language. What's the big deal, you might ask. A lot, I might answer.

As a matter of fact, it'd be a rather straightforward task if it weren't for a minor detail: overloaded methods.

When a method isn't overloaded, and you need to invoke it from a dynamic language such is FreeMarker, all is dandy and Bob is your uncle - you have to adhere to a single target formal argument list, easy as a breeze.

When a method is overloaded?


The thing is, with dynamic languages it's not as simple as finding the method that satisfies the mathematically precisely defined technical criteria known as "the most specific applicable method for given actual argument types". That's what Java compiler has to do, and believe me, Java compiler has it the easy way. With dynamic languages, we start from one step behind. We operate in another language, y'see, and we first must figure out how to marshal the actual arguments to Java types. Of course, the optimal way to marshal them might depend on the actual method we chose to invoke among all overloads. Which in turn depends on the Java types of arguments we use for invocation.

Chicken and egg. Catch 22. Strange loop. I wrote logic in FreeMarker to handle this years before, and it was quite involved even back then, and we didn't have variable arguments back then.

I had quite a few false starts on it, I'll admit that. Lot of code written and then rolled back. Lots of hours spent thinking about the issue. I have something that works now, written mostly while sitting on the porch of my parents' house where I retreated with wife and kids for Easter. But I'm not committing it to SVN repo just yet - need to test it a bit further before I unleash it on the crowd of lab animals, er, early adopters of FreeMarker 2.4.

There are some downright sinister corner cases, i.e. invoking

foo(a, b)

when you have:

public void foo(SomeClass a, SomeOtherClass b);
public void foo(YetAnotherClass a, SomeBozo b...);

Do you prepare the array of arguments for reflective invocation as [a,b], or [a,[b]] if your algorithm can not know at preparation time whether the fixed arg or the vararg method is going to be invoked? (Under the hood, varargs must always be passed as arrays). My decision was to prepare [a,b], and on the fly convert the last argument to one-element array if it happens that the vararg method was chosen (the ambiguity only arises if the vararg method would receive exactly one argument in its variable part, and would not arise if it would receive zero or more than one - you see what sort of arcane corner cases crop up in dynamic setting).

My ultimate hope is that I can create a sufficiently generic implementation for this that I can share it with other projects as well - Rhino and JRuby, for starters. All dynamic languages on JVM could benefit from a soundly implemented library for this functionality, at least until the bright future arrives where the whole world has already transitioned to JVMs that implement the hypothetical invokedynamic bytecode instruction. Although even if we had it, I actually doubt that the "strange loop" coordination required between marshaling arguments from another language to Java and selection of the most specific method would be handled by it - such marshaling is language specific, and while it can be abstracted behind an interface, extending with interfaces is a mechanism used by libraries in Java, not by the JVM itself, so it looks to me this'll remain a job for the library.

Monday, March 05, 2007

Month of travel

So it starts my month of travel. I'm sitting at the Budapest Airport as I write this (kudos to Pannon for providing free wireless in the airport), passing time until boarding for the London flight. Then flying back home on friday, then a vacation with family from wednesday to sunday next week - lots of driving in Slovenia, but should really be fun. Then flying to Vegas the tuesday after that, then over to New York on saturday when Vegas is over, and finally coming home and putting the suitcase away for hopefully few months on friday, March 29.

They're calling for boarding.

Wednesday, February 28, 2007

New Horizons probe Jupiter flyby

The NASA's New Horizons's probe made its closest approach to Jupiter today morning (well, morning in my time zone, that is) on its way to its ultimate destination (Pluto, to be reached in 2015). It sent back some of the best to-date pictures of Jupiter and some of its moons.

The probe also carries a compact disc that stores a file listing the names of some 430000 people who chose to send their name in the space. Were you nerd enough to sign up? Or even to sign up your kids? (By the time the news of probe reaching Pluto hits the media in 2015, my kids will be 16 and 14 years old respectively, and I hope they'll grow to be geeks as their dad is, thus appreciate this).

Snowflake magnified 36000 times

Yes, I'm sort-of obsessed with snowflakes - this is not the first time I blogged about them. Here's a fascinating series of images of a single snowflake, imaged with an electron microscope, ranging in magnification factors from 93x to 36000x.

I often try to explain to my son just how small scale is the molecular structure of the material world that surrounds us, but it's hard to word it so that a 8-year old understands it. As they say, a picture is worth a thousand words, and these breathtaking pictures certainly prove the point.

Friday, February 23, 2007

You still can't write a good novel

My brother-in-law was given the task of writing some integrated-circuitry emulator in C# on his internship job. He's a soon-to-graduate electrical engineer and rather an alien to software development. He was given a book, "Visual C# Step by Step" to supposedly help him along and complained to me how it doesn't really help him in figuring out how to actually write a good program, it just teaches him a programming language.

I told him that if he attended a course in French language, he still wouldn't learn how to write a good novel in French.

He understood the analogy. The problem is - at least if I remember my university years - an awful lot of educators around here don't get it.

Speaking in Vegas

I'll be attending the TheServerSide Java Symposium (TSSJS) in Las Vegas between March 21 and 23. On friday, I'll be speaking about the Java 6 Scripting API. I'll be delivering the same talk on the European TSSJS event organized at the end of the June in Barcelona as well.

Monday, February 05, 2007

"Iterators are not intended to be serializable." Huh?

In a recent attempt to reduce my "Unread" mailbox, I went back in it marking as "Read" everything that has been, well, read. So it happened that I stumbled across a bug report I filed with Sun around 7 months ago (yes, that mailbox was deep), and went to see what became of it. You can see it here.
The problem I reported is that various iterator objects shipped with Sun's JRE aren't serializable. Looking at the bug's page, I noticed that the "Evaluation" field has been filled out with:

Iterators are not intended to be serializable. Probably.... Not a Defect.
Wow. Whoever evaluated this wasn't particularly, to put it mildly, in short supply of short-sightedness. In accordance to this, the bug was marked as "Request for Enhancement".
Now please tell me if I see it wrong, and if there never-ever can arise a valid class design where a stateful object maintains certain aspect of its state by keeping an iterator into a collection, and said object should be serializable. At least for lists, the concept can even be emulated by holding a reference to the list object and an index variable, so it definitely doesn't sound like a very unsane idea.
I will admit though that I didn't come across an explicit case of it myself. How did I stumble upon this bug then? Continuations. I had a JavaScript program that had a loop going through a collection with an iterator, and captured a continuation within the loop and subsequently attempted to serialize the continuation. Naturally, the continuation being within a loop, the serialization graph of objects reachable through it contained the iterator. Blam.
Now, this admittedly might sound as a more esoteric case of serializing state that contains an iterator, but really, were I to use a "for" loop with explicit indexing instead of an iterator, it wouldn't have been a problem. Therefore, I can't see serializing an iterator to be such an off-the-wall idea to justify the anonymous Sun mouthpiece saying "Iterators are not intended to be serializable"?

Tuesday, January 30, 2007

Jobs: "Nobody uses Java anymore"

I've been going through few weeks worth of the Apple's java-dev mailing list posts, and noticed one that referenced a David Pogue column in NYT from two and a half weeks ago that itself quotes an interview with Steve Jobs centered on iPhone. When Jobs is asked about Java support on iPhone, he says:

"Java’s not worth building in. Nobody uses Java anymore. It’s this big heavyweight ball and chain."
This is worrisome. Jobs didn't explicitly reduce the scope of his statement to iPhone and/or mobile phones in general, although since the interview itself was about iPhone, one can give him the benefit of the doubt and assume the "Nobody uses Java anymore" doesn't apply to the computing world outside the mobile devices and won't affect availability of JDK on Mac OS X in the future. (Which, by the way I do find a bit lacking - JDK/JRE on Mac OS X is still stuck at 1.4.2_09 and 1.5.0_06, while the Linux/Solaris/Windows crowd has long since moved on to much higher service releases.)

Actually, as far as mobile devices are considered, I can agree with Jobs that on them Java is indeed "heavyweight ball and chain". John Carmack writes on his blog about difficulties writing DoomRPG and Orcs&Elves for mobile devices using Java here and here, preferring to use BREW as its alternate development platform, with most memorable sentence being:
... it isn't that BREW is inherently brilliant, it just avoids the deep sucking nature of java for resource constrained platforms...
The biggest problem is that Java is really slow. On a pure cpu / memory / display / communications level, most modern cell phones should be considerably better gaming platforms than a Game Boy Advanced. With Java, on most phones you are left with about the CPU power of an original 4.77 mhz IBM PC, and lousy control over everything.

So yes, Java on mobile devices is a frustration. I still wished Jobs didn't make an overly generic statement...

Saturday, January 27, 2007

Intel announces 45nm transistor technology

The New York Times reports that Intel has announced new technology for building microprocessors that replaces the "silicon gate electrode on a silicon dioxide insulator" design. The new technology uses a metal gate electrode on a hafnium insulator, eliminating much of the current leak that was the major obstacle in going below the 65nm technology. The new technology promises faster, more energy efficient processors, keeping up the Moore's Law. Intel plans to begin making microprocessors with the new technology as soon as the second half of this year.

To quote the NYT article:

Company researchers said the advance represented the most significant change in the materials used to manufacture silicon chips since Intel pioneered the modern integrated-circuit transistor more than four decades ago.
“This is evolutionary as opposed to revolutionary, but it will generate a big sigh of relief,” said Vivek Subramanian, associate professor of electrical engineering and computer sciences at the University of California, Berkeley.

I wonder whether this'll break the industrial trend of introducing ever more cores in a single CPU chip. My bet is that it won't, but it might allow software developers to get away with writing concurrency-unaware applications for a bit longer (not that I welcome that) if Intel can now indeed again make advances in CPU speeds.