Skip navigation

Category Archives: Code

a Postgresql Bulk Updater in Java

pgBee is a set of Java classes I wrote for automating bulk updates of Postgresql databases on Linux servers. It requires Java (doh!) and Ant (as a build/execute front-end), it is cronnable and performs very well, especially in multi-threaded mode, which takes full advantage of multi-core CPUs in modern servers. The source of inspiration for pgBee has been previously described.

This code is released under a GNU General Public License (GPL).

Ant sometimes refuses to run in the background, so the best way to make pgBee work as a cron job is probably to call a simple shell script from cron, like the one below:

export JAVA_HOME=/usr
export ANT_HOME=/usr/local/ant
/usr/local/bin/ant -f /path/to/build.xml run </dev/null &

All configuration is done in the settings.xml file, but some options may be set through the command line, e.g.

ant -f /path/to/build.xml -Dlock=yes -Dthreads=8 -Dparallel=yes run

pgBee processes all files it finds in a particular (in) directory and moves them to either a done directory or a rejects directory, if there were SQL errors. You’ll need to create the right directory structure and configure pgBee settings before starting. The pgBee process catches SIGTERM, SIGHUP etc. signals and exits gracefully, ready to resume from where it stopped the next time it is run. So, it should be quite reliable, in the absence of hard resets and kill -9. Having said that, I am supplying no guarantees of fitness for any purpose of any kind 🙂 Please use at your own risk.

If you need to make sure a particular set of statements is processed in the same transaction, you only have to include all statements in the same line of an input file, separated by semi-colons. There’s no limit to how many SQL statements you may include in a single line. More information about input file format, usage and configuration may be found in the downloadable tarball



This is rather old stuff, I was looking for an easy way to create html templates in an easy but open source kind of way. It is a perl-fu plugin for Gimp which allows you to draw your template as a multi-layered image, then automatically export it to html + individual png files. It was originally written for Gimp v.1, but it seems to work fine with Gimp v.2
# AUTHOR: Michael K. Nacos
# DESCRIPTION: perl-fu plugin for gimp which converts a multi-layered
# image to an html template + corresponding png images
# DEPENDENCIES: you need gimp, perl (doh!) and the Gimp::Perl module
# INSTALL: satisfy the above, then place script in ~/.gimp plug-ins dir
# USAGE: start by creating a new image (e.g. 1024x76 8) and adding all
# individual decorative elements in individual transparent gimp layers
# each layer will be converted to a separate png file with the same
# name as the gimp layer, size cropped to a minimum
# an appropriate html file with individual div blocks and css positioning
# will be automatically created
# KNOWN BUGS: you have to save at least once the layered file (.xcf)
# before application of this script. images are deposited in the dir
# you select but html file is deposited in the directory gimp runs in
# (this is not a problem if you cd to the directory you want before running
# gimp from the command line. in gimp 2 you may not undo the flatten
# operation after this script completes.
# DISCLAIMER: this is an old file. it works for me! please don’t flame.

Please make sure you understand the above.

Click here to download.