Skip to main content


Showing posts from November, 2011

Using a separate settings file with Abbot and Sproutcore 1.6

In some cases it is practical in an application to have a single global settings file where all configuration is stored. Most often this configuration file varies between a deployment and another, depending on customer requirements, licensed features, backend technology, etc.

When developing an application with Sproutcore 1.x (1.6 is assumed) it is not immediately clear how to do it, not because it is not possible but just because documentation on Abbot, SC's build tool is, to use an euphemism, well, scarce.

So what do we want to do exactly? We want to have a single config.js file that is included before any other application file and, most importantly, must not be minified and packed so that on-the-fly editing or inspection is still conveniently possible. The file should be kept small anyway so that packing and minifying it is not going to be necessary.

To do this we need to create a new .js file and place it wherever we like in the application tree. A sensible choice would be to…

Postgres maintenance: vacuum hell, cluster to the rescue

I have an OpenNMS server (a PC really) sitting under a desk at a company that I don't hear from often, but I still get weekly backup mail-recaps.
This week the recap brought bad news: postgres stopped accepting connections until the db is vacuumed to prevent transaction id wraparound.

I have know of this issue of postgres for some time and planned accordingly: a cron job every month would run a full vacuum. Unfortunately in one month the db grew so much that vacuum never reached completion because the customer simply rebooted the server thinking that it was 'stuck'.

This vacuum-stuck-reboot had gone on for months until today. As I knew from prior experience this was going to be a painful experience: a quick du on the database folder reported 60GB of data. Vacuum would probably take days.

Luckily for me I had heard from the great Postgresql 9.0 high performance book that there is another tool in the toolbox called cluster.
So I decided to execute this plan this time:

delete …

Fixing GrailsUI infamous 'Cannot create a menubar within a menu'

I personally like/use GrailsUI a lot and I'm sorry that it's been discontinued. Just today while I was upgrading an app from Grails 1.1 to 1.3.6 I found out that my previously working menubar is now spitting out ugly errors (like this one).

The problem lies in the unsafe use of instance variables by the tag library.

Luckily for us the solution is pretty simple, just replace all references to items and group with a request scope variable like request.items and In my case I went a little further and tried to come up with a variable name that would not clsh with other variables actually used by me.

My (working, yup) copy of the menu tag library is available at
To use it just copy it into your project's taglib folder and then build a menubar as you would do with GrailsUI, only using the g: prefix instead of gui:.

Improve OpenLayers performance in a Sproutcore app

When using OpenLayers embedded in a Sproutcore app you will want to set the following option on the OpenLayers.Map constructor:

fallThrough : false

to avoid double handling events (once in OpenLayers and once in Sproutcore).
Map dragging should improve and feel much smoother.

Although deprecated this wiki page explains very clearly Sproutcore event handling.