Michal Čihař - Blog Archives for English

Notebook disk dying?

My notebook started to behave quite strangely, yesterday I ended without root filesystem, because kernel detected error while reading disk and shut it down. I expect disk to definitely die in next days, so I'm going to buy new one next week, but until that I'm affraid of doing much work on it. XFS survived all those failures good so far, but I allways affraid a bit of data loss. Well everything is backed up, but I hate installing new system, it takes quite long time till I have everything I need. The good side of this is that I will get faster and larger disk and system clean of all historic stuff that I don't use anymore :-).

Nanoblogger in Debian

When I thought about blog engine to use for this blog, I primarily searched in Debian archives, so that I don't have to maintain own copy of that system. At the end I anyway chosen nanoblogger, which was not (and still is not) in perfect state in Debian package and I used CVS version at the end anyway.

I just noticed that nanoblogger package has been orphaned yesterday. After ensuring that I won't have problems with finding sponsor, I decided to addopt it and bring it back to usable state. As I will me mostly offline during weekend (or busy with new Wammu release), I will try make new upload within next week.

New python-gammu user

As it already appeared on Gammu wiki, I consider it official. I'm happy to announce that there is another python-gammu based open source application to manipulate your phone. It is called gMobileMedia and it is focused on multimedia data stored in phones.

It's nice to see that somebody else is actually using my Python bindings :-).

Too slow coder

Okay the release I promised will be delayed as I didn't manage to rewrite editor widget fast enough. Right now I have the editor itself working, it only needs some code cleanup and implement returning of value. After this "minor" thing will be implemented, you can expect new version, what will hopefully happen this week.

Multi language site with PHP and gettext

As announced yesterday, I started to translate my website to Czech. I take it mostly as experiment how to do such thing easily. I don't want ot maintain different pages for each language, so the logical step seemed to use gettext which I know for translating regullar applications.

Using gettext from PHP is quite easy. You can just follow documentation and you will get basic idea. Only tricky part was to set encoding so that messages are displayed correctly.

The whole magic that selects translation based on host name is few lines of PHP code:

$lang = 'en';
if (substr($_SERVER['HTTP_HOST'], 0, 3) == 'cz.') {
    $lang = 'cz';

    setlocale(LC_MESSAGES, 'cs_CZ.UTF-8');
    setlocale(LC_ALL, 'cs_CZ.UTF-8');
    bindtextdomain('website', 'locale');
    bind_textdomain_codeset('website', 'utf-8');
    textdomain('website');
    $_SERVER['HTTP_HOST'] = substr($_SERVER['HTTP_HOST'], 3);
}

You can see that is't just locales and gettext initialisation and cutting host name so that rest of code doesn't have to deal both possibilities.

The hardest work is to make all PHP pages use gettext instead of plain text constants and translate them. I will probably never convert whole site, but it is not needed and only parts can be translated using this approach without any additional effort.

Browser incompatibilities

Today I looked at menu on top of Wammu pages in MSIE and it was displayed completely differently than in Firefox. So another CSS hacking session had to begin to fix the menu look.

Fortunately I found ies4linux which easilly installed MSIE on my Linux computer so that I can test the beast without searching for some Windows installation.

Anyway now it looks almost same in both browsers (there are some minor glitches in MSIE which I'm going to ignore).

Started Czech translation of website

Today I finally setup gettext and started to convert some page to make use of it. Currently only Wammu page contains translated parts, but I will try to improve it in future as time permits.

Translation will only affect content of main domain, other subdomains as this blog or phpMyAdmin demo will remain in English.

Ready for new release?

I'm going to fix last remaining bug marked for fixing this evening and release Wammu 0.16 after it. So if you have any problem with Wammu and want to have it fixed in next release, it's best time to report it.

Wammu site split

I decided to split Wammu site to several pages. The one page seemed too large so this was logical step which I wanted to do for a long time. I hope there are no broken links or any other broken stuff.