Skip navigation

Monthly Archives: July 2008

Over the last few years, I have very consciously shifted away from web interfaces into what most people call the back-end: systems, databases etc. I had grown tired of browser incompatibilities and unpredictability! You may find trouble in server-side land, too, but, in most cases, you’ve done something wrong and there is a perfectly reasonable, rational (and sometimes obscure) explanation waiting to be discovered.

So, I am completely out-of-touch with recent UI advances, as simple CSS + Javascript pages and extensive Perl-Tk and pygtk coding probably don’t count as UI advances for most people. And I tend to code things the hard way: ViM

Now, Java is trying to re-enter the RIA arena with JavaFX and reclaim some rich UI tech real-estate from frameworks such as Adobe Flex and Microsoft Silverlight. And thanks to Peter Pilgrim and Skills Matter, I have just had a very interesting introduction to the history, concepts and potential of JavaFX.

Now, Chris Oliver, the guy who started F3, which has now developed into JavaFX, sounds exactly like my kind of guy: Form-Follows-Function, list comprehensions, SQL influences, declarative stuff. Pre-compiled UI definitions running on top of the JVM… Imagine, if you like, writing something like JavaScript, with syntactical goodies derived from Lisp and SQL, including UI element binds and definable triggers, which may execute any arbitrary Java code. Now, for me, this puts fun back into computing (and Java, which often is the C++ of our times). It’s not quite stable yet, but there should be a Preview release coming out end of this week from Sun Microsystems.

Now, I don’t think I am making this appealing to the majority of RIA developers. They usually think: timelines, SceneGraphs, rich media, GUIs, WYSIWYG, ActionScript etc. JavaFX, of course, has been developed to handle such concerns.

But to me, it seems like JavaFX might turn out to be the framework of choice for people who hate coding for UIs (but love coding in general), people who want them to be easy and fun, yet very powerful. I am, probably, one of the very few people who write Java in vi. Projects like Ant have made this possible.

If JavaFX matures in the current direction, it looks like I might be able to get away with designing rich UIs in vi, too. And before any of you start screaming: we don’t care about writing Java UIs using vi, may I simply point out: isn’t this the most convincing argument for the promised power of JavaFX? – they must be doing something right!


Yet another work-related post. I have been asked to write a better automatic database update system and against my natural tendencies toward Perl and Python I have opted to do it in Java. Now, previous attempts in Java had been abandoned because they were not performing very well, but I wanted to build something with potential for integration with the company’s infrastructure, so I rolled up my sleeves and decided to investigate.

A quick Google search produced some interesting discussions (please see the Interesting Links below). In summary, the official JDBC Postgresql driver does not support COPY operations and people complain that it’s slow for bulk updates, however, our update sql files are not very structured and, in fact, may contain any (as in different each time) valid SQL code. So, COPY is not what I’d use, anyway.

Some hope for reasonable performance appeared in the form of the driver’s batch mode. So, I wrote some Java classes which read multiple lines of sql statements from an sql text file into a String buffer of configurable size. When this size is reached, these sql statements are added to the reused Statement object with addBatch() and are executed in their own transaction (I have set auto-commit to off) through executeBatch().

Now, I have tried inserting one million rows into a table using a different buffer size each time, i.e. grouping sql statements in batches of one, ten, hundred and thousand statements per transaction. The results are quite promising, don’t you think? (low spec machine, btw)

  • batches of 1 –> 49m 55s
  • batches of 10 –> 15m 04s
  • batches of 100 –> 08m 21s
  • batches of 1000 –> 33m 12s

Interesting links (References):

multi-statetement JDBC updates in batch mode:

making batch updates in JDBC applications:

no copy from postgres JDBC:

copy for PostgreSQL 8.x JDBC Driver:

One of the nicest things I have done recently was to attend the First International Erlang eXchange in London ( It was jam packed with exciting information on a variety of topics, and I expect a lot of this information will be popping up over the next few weeks one way or the other. Now, one of the things I discovered at the eXchange was Tsung, a distributed performance-load-stress testing tool for http and postgresql servers written in Erlang – loads of scaling-up potential there. Now, this happens to be an important part of my new job, so please expect more on the topic very soon (real examples, tutorials etc.)

Apparently, there are subtle differences between the terms performance, load and stress testing, you may read an opinion here:

UPDATE: If you’ve come this far, you may also have a look at the following posts (tutorial):

pgTsung: app-specific testing methodology

Have you ever wondered how and why things are organised in Linux filesystems? Do /opt, /var, /home, /usr baffle and confuse you? Now, I have been a Linux user for several years and, having used several different Linux distributions I have a pretty good idea where things usually reside. But, somehow, I hadn’t come across this before, and it’s such a useful thing to have read, especially if you are a linux newbie! Thanks, Lance.

The pdf link at the bottom of the page is an interesting read.

So, you want to print from Java applications in Linux (through CUPS, which is the default printing system in Ubuntu and other distributions)…

Turns out it’s easy: Select a particular Page Orientation in your printer’s Job Options panel. Thank you techexplorer…