Archive for November, 2007

No text when annotating images with ImageMagick

If for some strange reason you don’t see any text, even when applying correct command, then you probably missing required font. To find out this, replace final image with info:.

convert dsc01377.jpg -font Courier -size 20 -draw "gravity south fill black  text 10,12 'text' fill white  text 11,11 'text' " info:

If you’ll see something like:

convert: unable to read font `/usr/share/fonts/type1/gsfonts/n022003l.pfb'.

– go ahead and install missing font.
I wonder why ImageMagick doesn’t dump this warning to stderr.

Monday, November 19th, 2007

Automating script frontend translation.

Common format used by many frameworks (I’m talking about PHP frameworks, as I mostly use PHP) is XLIFF. Actually it’s just XML. As a result, modifying these translation files aren’t very handy. You should care about tags, ids etc.

There is other, more older format for managing translations – po. I find it easier to maintain. Moreover, there are tools which can help you create/update these translation files. I steal this info from symfony website.

First tool – xgettext (Debian package gettext). It allows you to create .po file from your source file. It supports several programming languages. To create new file:

xgettext --language=PHP --output=output.file.po --extract-all --no-location index.php

To update existing .po file:

xgettext --language=PHP --output=existing.file.po --extract-all --no-location --join-existing index.php

New terms will be added to the end of file.

Second tool – po2xliff (Debian package translate-toolkit). Yes, it converts .po to .xliff :)

Friday, November 16th, 2007

403 error after installing Mongrel with Apache2

If you’ve installed Mongrel for your Rails application with Apache2 as a proxy and receive 403-Forbidden error, first look in apache error log. If you have something like

[warn] proxy: No protocol handler was valid for the URL. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

you probably forgot to enable/load all required modules. Make sure you have proxy, proxy_balancer and proxy_http.

Tuesday, November 13th, 2007

Connecting Debian to GPRS via Sony Ericsson

I was connecting mobile through USB cable. A month ago I was trying to connect Siemens mobile through IRDA dongle, but I give it up and made a gateway on Windows machine.

This time I found a solution. kppp didn’t work anyway, but it’s not a problem.

Install wvdial, it will scan your computer for available modems during installation. If you forgot to plug your phone, you can rerun scanning with wvdialconf.

The only thing that I had to modify in generated config was additional initialization string:

Init2 = AT+CGDCONT=1, "IP",""

That’s it. Run wvdial and enjoy. Don’t forget to replace default route.

Tuesday, November 13th, 2007