Friday, May 26, 2006

We love your apathy

Saw this link ( on chris's site. Basically a hellkom copy ; unfortunately it's a poor one, and as far as i'm concerned it's missing the point quite drastically. Hellkom is about pushing for deregulation in the telecoms industry - we need this, we really do. Powerloss is about whining, and not much else.

This really annoys me, not least the response to it (featured on 5fm? come on.) I completely agree that there are problems with Eskom, with the governement, with many, many things - DO SOMETHING ABOUT IT. On a side note, there is absolutely no reason to repeatedly make your point with multiple exclamation marks. !!

There's so much real, relevant advocacy out there. If you're a designer looking for a project, you could look here.

I'm much too idealistic, as usual.

Thursday, May 18, 2006

./configure problems - MapServer on FreeBSD

It's very frustrating to be told by a script that something you know is at a particular location, isn't. Like this:

# ./configure --includedir=/usr/local/include --libdir=/usr/local/lib --with-jpeg=/usr/local/lib --with-png=/usr/local/lib --with-gd=/usr/local/lib --with-libiconv=/usr/local/lib --with-tiff=/usr/local/lib --with-xpm=/usr/X11R6/lib/

configure: checking whether we should include JPEG support...
"Could not find jpeglib.h or libjpeg.a/ in /usr/local/lib."

# ls /usr/local/lib | grep


Anyway it turns out that actually, you have to replace /usr/local/lib (where the libraries are) with /usr/local (where they are not)... which then works fine. So:

./configure --includedir=/usr/local/include --libdir=/usr/local/lib --with-jpeg=/usr/local --with-png=/usr/local --with-gd=/usr/local --with-libiconv=/usr/local --with-tiff=/usr/local --with-xpm=/usr/X11R6/lib/

Monday, May 15, 2006

Little Red Men

With forked tails, actually. And, quite cute :p

Conquered my fear of the unknown and installed FreeBSD today - mostly painless, much to my surprise. Even got the linux compatiblilty stuff installed, and PostgreSQL 8.1 (which, incidentally, gave far less trouble than it did the last time I tried to install it on Debian). The server is named olive, after Olive Schreiner.

Somewhat unrelatedly, I came across these two articles recently - both presenting a more realist/pessimist view of Open Source software in the developing world. They bring up some very valid points about what doesn't work, worth considering when trying to come up with something that does.

Algorithms in Africa , an oldish (2001) article from LinuxJournal

Comparison study of free/open source and proprietary software in an African context

Sunday, May 14, 2006


(happy mothers' day, melissa
from gobbolina the witch's cat)

Thursday, May 11, 2006

Confident, cocky, lazy, dead

From the transcript of an press conference with Jacob Zuma on Radio 702:

The reporter responded: "But Mr Zuma, Aids is a big problem in this country and saying things like taking a shower..."

Zuma retorted: "And hygiene is a big problem in this country. Clean yourself."

If there is a god, please, smite him now.

Wednesday, May 10, 2006

"You represent a threat, something new, something that can't quite be understood [...] That is dangerous.

A very cool article on open source in Brazil, here. I really like the comparison to cannabilism, although maybe because at the moment, I'm all for slow, agonising deaths for anything religion-related.

"In 1556, not long after the Portuguese first set foot in Brazil, the Bishop Pero Fernandes Sardinha was shipwrecked on its shores and set about introducing the gospel of Christ to the native "heathens." The locals, impressed with the glorious civilization the bishop represented and eager to absorb it in its totality, promptly ate him.

Thus was born Brazilian culture. Or so wrote the modernist Brazilian poet Oswald de Andrade, whose interpretation of the incident in a 1928 manifesto exalted the cannibals as symbolic role models for all of his country's cultural practitioners. Four decades later, his argument inspired a pair of hyperarticulate pop stars named Caetano Veloso and Gilberto Gil. Veloso and Gil formed the core of tropicalismo - a very '60s attempt to capture the chaotic, swirling feel of Brazil's perennially uneven modernization, its jumble of wealth and poverty, of rural and urban, of local and global. For the tropicalistas, as for Andrade, there was only one way to thrive in the midst of so much contrast: You couldn't flinch from what was alien to you. You couldn't slavishly imitate it, either. You simply had to swallow it whole."

Monday, May 08, 2006

Times Like These

it's times like these you learn to live again
it's times like these you give and give again
it's times like these you learn to love again
it's times like these time and time again

Converting SQL JasperReports to use HQL (Updated)

One problem with JasperReports is the lack of documentation (there's an official manual, but isn't free) - you'd think this would encourage people to write HOWTOs, but these seem pretty thin on the ground, too.

So, a JasperReports HOWTO on converting existing reports using sql queries via jdbc, to use HQL (hibernate query language). HQL makes reports are independent of the underlying database, which is attractive, and as far as syntax HQL is broadly similar to SQL.

I used iReport 1.2.2, a graphical report designer for JasperReports. Before you can use iReport with hibernate, you need to put the jdbc driver for the database you are using (postgresql, in my case) in the lib/ directory of iReport. If you don't do this, you will be given the helpful error "General Error: Could Not Open Connection" when you try to execute the report.

So, to convert you reports to HQL using iReport:

1. Configure your classpath (options>classpath). Make sure your jdbc driver is on it, as well as your hibernate.cfg.xml file and all the hibernate mapping files (.hbm.xml). The persisent classes you are mapping (for example, Drug.class, which is mapped by Drug.hbm.xml) should also be on the classpath.

2. Add the report connection (Data>Connections/Datasources). Add a new connection of type Hibernate Connection.

3. Open a report. Open the Report Query (Data>Report Query). Select HQL as the query language from the drop-down box, and write your query in HQL. Note that it may work better to uncheck 'Automatically Retrieve Fields' while you are writing the query. A good HQL reference is here.

4. If you have a subreport, you will need to a new subreport parameter to pass the hibernate session. The parameter name is HIBERNATE_SESSION and its value is $P{HIBERNATE_SESSION}. You should obviously also edit the subreport to use HQL, as described in steps 1-3, and compile it.

5. You should now be able to run your report in iReport. To fill the compiled report from your application, you will need to pass the hibernate session as a parameter, HIBERNATE_SESSION, as in this snippet (if more code is needed, I can post it):

File n = new File("Reports";
HashMap map = new HashMap();
map.put("patientId", thePatientId);
map.put("path", n.getCanonicalPath());
map.put("HIBERNATE_SESSION", HibernateUtil.currentSession());

// Report to use
FileInputStream fileInputStream = getJasperReportFromJRXMLorJASPER("Reports"

// Define the connection
Connection connection = HibernateUtil.currentSession().connection();

JasperPrint jp = JasperFillManager.fillReport(fileInputStream, map,
JasperViewer.viewReport(jp, false);

As it turns out, this is now different in the current version of Hibernate. You do not need to pass the hibernate session from the main report to the subreport, as all the builtin parameters are passed automatically. If you do try and pass the session the old way, it overwrites the builtin session and the subreport gets a null value.

Friday, May 05, 2006

Food (or not) for thought

From a article, 'The Case For Globalized Labor'

The U.S. poverty line, defined by the Census Bureau in 2005 at $10,160 for individuals under 65, outstrips the per capita income of every African country.

Wednesday, May 03, 2006

Automatic Updates Using StableUpdate

StableUpdate is an open source java project that can be included in applications to add automatic update functionality (allowing the user to check for new versions of the program). It also includes an update generator, which works by comparing an two installations of the software and generates a jar containing the differences.

The documentation isn't all that easy to follow, and I had to change one method (Update.setUpdateFrom(url[] URLS) ) from private to public to get it to work. It also needs to work with a specific directory structure (one main application jar, which needs to be in the bin/ subdirectory along with autoupdate. jar). Once it worked though, it seemed to work really well.