Archive for December, 2005

Thinkpad power supply replacement

Thursday, December 22nd, 2005

Coming back home for Christmas I forgot to bring my power supply for my Thinkpad, which made me very unhappy. Hesitating between not switching my computer on at all (BTW: I forgot my books as well ;-) ) and getting an expensive power supply, I come up with a home-grown solution.

Thinkpads are quite power-demanding beasts: the power supply has to deliver as much as 16V DC at 4.5A, which rules out most of the non-impulse power supplies you can get. Also 16V is a bit uncommon for any supplies. Fortunately, I noticed that our hallogen lamp uses a 50W transformer, which was almost ideal for my purposes. So I built a simple rectifier and… voila ;-)

Thinkpad Power supply Replacement

BTW: 4Amps is quite a current so need to make sure that you use proper diodes, large capacitor and thick cables (there’s about 0.5V voltage loss on my cables).

Converting JARs to executables (JAR to EXE)

Thursday, December 22nd, 2005

Recently, I found out that Java the program I wrote ages ago has been alive and kicking and, even more, distributed as a single EXE with an install program. I was a bit surprised, as the last stage I left it it, was only a JAR file (with no sources available) ;-)

Looking a bit into it I found out how it can be easily done, which may be useful one day. Not that I want to write Windows programs, but…

* The installation can be done using [Install Creator](http://www.clickteam.com/English/install_creator.htm). The freeware version displays a small ad at the end of the process, but otherwise is free and looks ok.
* For the Java-to-EXE conversion there’s a nice [comparison and discussion](http://www.excelsior-usa.com/articles/java-to-exe.html). In this particular case they used [exe4j](http://www.ej-technologies.com/products/exe4j/overview.html), which is commercial, but there’s a number of other free tools around.

All in all, I must admit they did a good job making my program more user friendly and easier to use. It’s probably a good idea if your target users use a Windows platform (my original program is portable, but I’ve never seen anyone use it on anything but Windows)…

  • [Ruby on Rails](http://www.rubyonrails.org/) it looks like a very cool framework. I really like the scrict M -V-C separation and of cource the AJAX library. (BTW the REST-like concept reminds me of [mod_python](http://www.modpython.org/)).
    [Ruby off Rails](http://www-128.ibm.com/developerworks/library/j-ruby/?ca=dgr-lnxw01RubyOffRails) a nice, though superficial comparison with Java. (0)

PostgreSQL8.1 “client encoding mismatch” with ODBC

Friday, December 2nd, 2005

While connecting to PostgreSQL using UnixODBC (from R, but this doesn’t matter) I got the following error:

[unixODBC]client encoding mismatch

It seems that there is some problem with PostgreSQL 8.1 and the encoding names: see [this post](http://archives.postgresql.org/pgsql-odbc/2005-09/msg00161.php) or [google](http://www.google.com/search?q=%22client+encoding+mismatch%22+postgres). It looks that UTF8 used by default with the new Postgres is not compatible with old ODBC drivers. I am not sure where the problem really is, but a _quick fix_ is to change default encoding for the user connecting to the database:

alter user SET client_encoding to LATIN1;

PostgreSQL 8 performance tuning

Friday, December 2nd, 2005

Here’s my list of pointers:

* [Power PostgreSQL](http://www.powerpostgresql.com/Docs/) – really detailed and up-to-date information on setting PostgreSQL runtime parameters. Don’t forget to check the annotated [postgresql.conf](http://www.powerpostgresql.com/Downloads/annotated_conf_80.pdf) with comments. BTW: Looking forward to reading the forthcoming book.
* [Collection of PostgreSQL performance tips](http://archives.postgresql.org/pgsql-sql/2002-04/msg00318.php) – a shopping lists of tips (both configuration as well as application design). The posts is a bit old, but many things (ecpesially the more general ones are still very relevant).
* [Performance Tuning PostgreSQL](http://www.revsys.com/writings/postgresql-performance.html) – a decent link, explaining both runtime settings (some of this might be obsolete) and the general concepts: “EXPLAIN“, “ANALYZE“, indices.
* [Postgres 8.x docs](http://developer.postgresql.org/docs/postgres/runtime-config.html) – explains runtime parameters in some detail.