Michal Čihař - Blog Archives for English

What am I doing wrong?

What the hell am I doing wrong that I can not send mail to any @debian.org address?

SMTP error from remote mail server after end of data:
host master.debian.org [70.103.162.30]: 550 Administrative prohibition

None of SMTP servers I used is blacklisted and I haven't seen problem with any other recipient than master.debian.org. Anyway it would be great if I would know what this Administrative prohibition means. After googling I found out that it might be something bad in my headers, but nothing what would tell me how to fix it...

New themes in demo

As Marc has recently commited some new themes into CVS, I finally forced myself to make automatic inclusion of new themes in demos (and snapshots). So now you can try all three new themes which has been added to CVS (Grid, Very small and Graphivore).

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.

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).