Wed, 31 Aug 2005
DBI::Shell in UTF-8
So, it seems that I can now work with our Oracle database entirely in UTF-8. The last problem remained in dbish, where it was not possible to input non-ASCII characters with UTF-8 locale. It turned out that the fix is quite straightforward: use Term::ReadLine::Gnu instead of plain Term::ReadLine.
dbish> select * from b_kas_pokus/ TXT "z dbh->do: Maličký ježeček" "z dbh->execute: Maličký ježeček" "Ayanami Rei in Kanji: 綾波 レイ" "Ayanami Rei in Hiragana: あやなみ れい" [4 rows of 1 fields returned] dbish>
Pretty cool, ins't it? Now I can insert even Ayanami Rei's name in Kanji or Hiragana to the database :-).
Note: You may not see the Kanji or Hiragana in the above text correctly. It is because our HTTP server has a super-intelligent module, which tries to recode the WWW pages according to your browser's preferences. So if your browser says that it prefers US-ASCII or ISO-8859-n, you will not be able to see the characters which cannot be represented in the requested encoding. Set your browser to request UTF-8 by default (in Galeon, this can be done in Edit -> Preferences -> Language -> Encodings -> Default, and set UTF-8 to be the default).
RSS texts shortened
I have changed my RSS feed to include the first paragraph of the story only - Vlasta said that some RSS reader for PalmOS can handle feeds up to 64 KB only. So I hope this change helps him and other readers as well.
Tue, 30 Aug 2005
Maintaining multiple installations of software
I have taken over a maintainance of a set of computers, which run an in-house developed software for chip card access terminals. The software runs on about a dozen computers all over Brno, and handles things like loading the database of valid cards, mapping valid users to the access terminals, and uploading log data to the central system. However, almost every installation has something special - some of them run a local card cache in a MySQL database, because they handle bigger number of cards than the hardware itself can store, one has a time-based constraint (the electronic door lock should be open during prime time, and closed with access with valid card only otherwise), etc. So the code base of the software is in fact not unified, with local specialities scattered all over the code base. Now the question is how to maintain this software, and how to roll out some bigger changes like a code refactoring.
The first idea about how to maintain those slightly different versions of software is to use a version control system (such as Subversion or GIT). However, this approach have some drawbacks: It does not in fact solve the problem of different versions of software, and any change in the "main" (or any other) tree should be merged to all other branches by hand, with a risc of forgetting to merge something and further code divergence. Another problem is that - when making a decision to change some code - it would be nice to know that "this area of the source code is the same on all installations", or that "this area is slightly different on that particular installation, so any changes should bear in ind this difference". In other words, this approach is error-prone and needs lots of manual work.
Another approach can consist of the refactoring of the code, and make the local specialities present on all installation, and switch them on or off in the configuration file. However, this would require lots of work, and it is not suitable for an incremental work - in that case I should restructure the code, and in one "big bang" install it everywhere. Not nice, and it brings a lot of stress in case something goes wrong.
The problem of its own is how to do a configuration of this software: on some machines there are several independent copies of this software, every one of them driving its own ring of card readers and door locks. Should I make them to use a common code directory and different config files only? And if so, how should I tell the program which config file to use? The system consists of several scripts, so I would have to be careful to pass the correct argument to all of them. At present every copy has its own directory with configuration and all scripts copied. Should I decide to use a version control system, how to structure the repository, so that both the software and the particular configuration file can be checked out on the destination host?
You can make a wild, uneducated suggestion in the comments section, but do not expect it to be meaningful, unless you have maintained a similar software with local differences. For now I think I will continue to make changes locally and an occasional manual backup - I need to make changes now, unfortunately. The main database of our system has been converted to use the UTF-8 internal encoding, and older Oracle clients (pre-9.2.0) stopped talking to the database, so I need to fix this up fast. Sigh.
Mon, 29 Aug 2005
The tyres on my car are really worn out (and one of them is of a different type, which is probably illegal here), so I have decided to buy a new set of tyres.
Choosing the tyres is more difficult than I could imagine - even if some parameters (such as dimensions, speed and weight index) are fixed, there still remains a wide variety of tyres to choose from (one e-shop had about 35 different types of tyres which still matched my car specifications). So, which parameters are important, and which are not? I have not found any non-biased test or recommendation with exact measured numbers.
Usually the tyre manufacturers state something like that their high-end tyres generate less noise, which results in lower fuel consumption, etc. However, this can be only a marketing speak (read: a lie), or the difference can be too low to justify a higher price. For example - if a set of tyres lasts 50,000 kilometers, with 8 litres per 100 km and a price of 25 CZK per litre (too low, I know) the gas costs about 100,000 CZK, which means that a set of tyres that is 4,000 CZK more expensive should save at least 4% of the total fuel consumption to justify its higher price. Or, would the twice-as-expensive tyre last twice longer than a "normal" tyre?
And then there are purely emotional parameters, such as "this tyre allows you to brake 10% more efficiently in 11mm deep water". Would I ever be in a situation, where this 10% saves me (as in: would I ever drive 0% to 10% over the limit of a "normal" tyre)? And what about 10mm or 12mm deep water? Is this tyre also 10% more efficient than other tyres in 10mm or 12mm of water?
By the way - what is a "normal" tyre? The manufacturers usually compare their products either to their own low-end products (which they obviously can design as badly as they see fit), or to their older products. But what about comparing the products of different manufacturers?
Another factor is a word-of-mouth, and previous experience. One of my relatives had a bad experience with Barum tyres - they worn out to a saw-like pattern which led to higher noise levels. But does this mean all current (or even future) Barum tyres are this bad? And, on the opposite side, does buying the expensive product of a well-known brand mean that my money will not go to the further marketing and advertisement instead of developing better products?
At last I have decided to buy the Dunlop SP 01, because I guess directional or asymmetric tyres can be made better than symmetric and bidirectional tyres. And I got them dirt cheap (even cheaper than Barums are in many shops).
Thu, 25 Aug 2005
Your tea is ready!
When I prepare a tea at work, I usually forget when the tea is ready, which frequently leads to a dark, over-infused liquid, which is not suitable for drinking :-) I wondered whether there is an application which can remind me when the time is ready. Well, there is. I have found a teatime_applet for GNOME, which does just this - reminds me when the tea is ready. I have packaged it as a RPM(?), you can download the packages for Fedora Core 4 from my FTP directory (packages are signed by my RPM-signing GPG key).
The only problem is that the teatime applet depends on the gstreamer-gconf library to select a correct sound output device, and this library is not in Fedora Core 4 (nor in the FC4 Extras). So I have added an ugly patch to remove this dependency. If you know about the gstreamer-gconf packages for Fedora, or if you know about better way of removing this dependency, let me know.
Wed, 24 Aug 2005
Do you have a valid RSS?
I was trying to view my blog as RSS feed in various web-based RSS readers. Some of them displayed my texts differently from my expectations, so I started to wonder what exactly is a correct RSS. I knew that RSS file is a XML document, so it has to be well-formed, but nothing more.
I have found a RSS specification, and even a RSS feed validator. The problem is that the contents (body) of the message should be a plain text, without any XML markup. And when you want to include HTML tags in the story body, you need to quote <, >, and & as HTML entities (<, >, and &, respectively).
As a quick hack to Blosxom I wrote a simple plugin "zap_markup", which can quote the required characters for some flavours (usualy the "rss" flavour). I have added an option to keep the first paragraph only (the RSS specs suggest a maximum length of 500 bytes per story (item) body).
Tue, 23 Aug 2005
Removing photo noise
Jimmac has a nice blog post about problems of the noise in digital photography. It seems that my camera does not have such a big RGB noise problem as his test photos - it has some noise, but it does not have such a wide variance between the noise levels of different color channels. I had to look really hard to find a photo with noise high enough to be anoying (but I usually set it to ISO 100 manually, and my camera tends to over-expose slightly - the noise is usually in the lower-exposed areas). I will make tests at higher ISO values tomorrow.
Anyway, Jimmac points to the DCam Noise filter for Gimp, which looks really nice! And since I rarely do a batch editing of photos, the speed is not such a big issue for me.
Mon, 22 Aug 2005
Fumoffu? Not really a Full Metal Panic!
Full Metal Panic? Fumoffu! is a school-life comedy with bits of action and even bits of ecchi here and there. The main character is sgt. Sousuke Sagara, 17 years old highly experienced soldier, and member of a secretive anti-terrorist organization Mithril. His job is to protect Chidori Kaname, a girl with unspecified special abilities (explained further in the original Full Metal Panic series). The series consists of episodes of Chidori and Sagara's school life, which is full of Sousuke's misunderstandings of the real life.
This series won the Anime Reactor Community Award as a best comedy anime of the year 2003. This fact should send a clear message to those looking for something similar to the original FMP series.
FMP:Fumoffu has the same nice animation and sound as its prequel. I liked the opening and ending songs, and the ending animation was nice and well suited for the series. The story and character development? Well, there are none. Fumoffu is just a bunch of episodes from Sagara's school life, and can be seen as a side story to the FMP series. I am not saying that every anime should have a sophisticated story, but those who haven't should be interesting in some other aspect. A nice example is Azumanga Daioh - it has no story as well (the whole Azumanga series are based on three-panel manga strips), but the series have quite intelligent humor and a nice peaceful atmosphere. Fumoffu also has no story, but then nothing special either. It is just another school-life comedy.
If you like long-blue-haired hyperactive girls, and if you do not expect much more, give Fumoffu a try. It is funny, after all. And both Chidori Kaname and Sousuke Sagara won the ARC awards for the best female and male character of the year 2003. If you are a fan of the original FMP looking for a sequel, you can easily skip Fumoffu, as it is something completely different: no mecha, less action, more comedy/parody, and my favourite character from the FMP series - captain Testarossa - appears in two episodes of Fumoffu only. FMP fans, watch FMP: The Second Raid instead (the first five episodes are available on fansub, and so far it looks very well).
Thu, 18 Aug 2005
The best cuisine in Šumava
This week we are spending our holidays in Šumava. If you happen to be in Šumava looking for a good meal, try "Lovecká krčma" (Hunters' Inn) in Františkov. It is the best cuisine in Šumava. They offer fish and game mostly, and while their prices are not low, they are still comparable to many restaurants in this area, and their meals are simply excellent. They even grow their own herbs and spices, so expect something unusual. I have not eaten such a good meal for a long time. Františkov is located halfway between Kvilda and Borová Lada, so if you happen to be there, give it a try!
Fri, 12 Aug 2005
Migrating to mod_perl2
We are migrating our system (currently running on Apache-1.3 and mod_perl-1.0) to Apache-2.0 and mod_perl-2.0. It is a bit trickier than one can expect - problematic parts include (but not limited to):
- The Apache::Request object is not available during server startup
- The %ENV variable is not tied to the process' environment (which makes running external programs a bit tricky)
- STDIN/STDOUT of external programs is closed (used to be redirected to /dev/null) - the zip(1) is not able to run with STDOUT closed, for example.
- Last, but not least - the complete API rename which took part just before mod_perl-2.0 was released.
And despite such problems (which are rarely documented anywhere - the %ENV issue is documented in the "troubleshooting" section only) the title of many manpages of mod_perl modules boldly claims something like:
ModPerl::PerlRun - Run unaltered CGI scripts under mod_perl
Mod_perl is a decent piece of software for new programs (and for many legacy apps too), but the docs are still quite incomplete, and bragging about backwards compatibility as quoted above really annoys me. However, I think the migration is finished now, and we will try it in next few days on a live system.
Wed, 10 Aug 2005
A new "community-based" version of SUSE Linux - openSUSE has been lauched. From the outside view it seems they are doing the same step Red Hat did three years ago, when they started the Red Hat Linux Project, now called the Fedora Project. I appreciate this move (I've even set up an openSUSE mirror), but they should refrain from insulting the Fedora Project in their FAQ: The last entry of their FAQ consists of two paragraphs of vague marketing-speak and buzzwords, and the last paragraph is a pure FUD(?):
When compared specifically to Fedora, the openSUSE project embraces and develops several additional important open standards not included in Fedora, such as CIM (the Common Information Model), and YaST (a standard, open source configuration and management suite for Linux). Plus, the openSUSE project has a large desktop and usability effort, strengthened by many of the top open source GUI designers in the world.
Well, CIM is currently vaporware without any working implementation, and YaST is not a standard in any meaning of this word I am aware of (YaST is a proprietary administrative interface for SUSE Linux, used by nobody outside SUSE userbase - and even some of SUSE users think it is a piece of crap).
Fedora has of course some of well-known desktop and usability people as well (Havoc Pennington comes to mind), as well as GUI designers. Nothing special for openSUSE here. So, their last FAQ entry in fact have not answered the question, it is just spreading the FUD. I think people at SUSE should be grown enough by now to avoid such insults of the neighbour project :-(
"Demystifying depression" translated
For a friend of mine who doesn't speak English I have translated a pair of articles about clinical depression to Czech (part 1, part 2). Both articles were written by Name_of_feather and published on Kuro5hin (part 1, part 2).
Tue, 09 Aug 2005
I think every student of our faculty or every wannabe programmer needs to read this book, or some other good coding style description (such as Linux kernel coding style for the C language). It is awful to see what ugly pieces of code some students can write.
Mon, 08 Aug 2005
Shovel. Stir. Water!
Yesterday we went with Iva to a boat cruise on the Brno reservoir. We have announced to her in advance that she would see boats, water, and so on. When we were driving by car to the reservoir, she suddenly said: "Shovel!". "What shovel?", I replied. "Shovel. Stir!". "What? Does she want to play with sand?", I asked my wife. "Stir. Water!" replied Iva. "Why does she want to stir water with shovel?", I thought.
It turned out that she remembered that a month ago she was riding a canoe with Pavlina, and she thought that the paddle is something like a big shovel, which is used to stir the water. It is interesting to see the way babies think.
Storage array failure
We had a pretty bizzare disk array failure on Friday afternoon. We had ordered three new disks to this array in order to make a new volume for backups. When we put the disks to the array, it started to act funny - one of our RAID-1 volumes stopped responding to OS requests. It turned out that one of the new disks was not clean, and in fact it contained metadata from the same type of storage array. So our array happily read a metadata from the new disk, and started to think it has a new RAID-5 volume, with all-but-one disks missing, and with the same LUN as one of pre-existing volumes. Moreover, removing the disk in question did not help anything, because the array controller already had the metadata cached in its database.
To make a long story short, 3.5 hours of downtime later, after numerous removing and inserting drives, and clicking to the storage array manager, we had our storage back and working. The last few configuration steps had to be done in the storage manager from another vendor, as the original one stopped talking to the array saying "Cannot read configuration" (we have two almost identical disk arrays from two well-known vendors, but both are in fact manufactured by LSILogic and branded by Big UNIX Vendors, so both can be more-or-less correctly configured with the other vendor's application).
Why we got an already-used disk, and why the array blindly reads the metadata from a newly-inserted disk, even though it disrupts working of existing volumes, remains beyond my comprehension. Anyway, another not-so-well spent Friday afternoon.
Fri, 05 Aug 2005
Spam of the day
I received an interesting spam: It had subject "yenya.com", and this body:
I am writing to inform you that yenya.COM has expired and will be released to the public within the next few days.
There is a good chance that there will be several interested parties attempting to capture this domain when it is released, these will vary from parties with a genuine interest to domain name speculators otherwise known as cyber squatters who often put large price tags on such domains.
We are domain acquisition specialists and I felt that as the owner of yenya.net, you would have a much more genuine interest in acquiring yenya.COM.
If you would like us to try and acquire this domain on your behalf then please let me know as soon as possible preferably within the next 4 days as any later and it may be too late.[...]
I of course have no interest in buying another domain, nor I want to buy a domain from cyber squatters (such as previous owner of this domain probably was), or spammers and maybe cyber squatters too (the sender of the above mail). But it is interesting to see the variety of means people use to achieve the "3. Profit!" phase.
Wed, 03 Aug 2005
First post! (praising simple programs)
I've been thinking about making my own blog for some time now. I just haven't been sure about which software should I use. I wanted something simple, without the need for a heavy database back-end. I am playing with blosxom, and it looks like the blogging software. It is a simple 150-line CGI in Perl, not dependent on anything else, and it is possible to create entries using my favourite text editor. Simple, nice, extensible, and bloatless! I've found about blosxom by reading DaveM's blog. It is a pleasure to find such a simple, yet useful, software. Another example of this kind of programs is abcde - a CD encoding/ripping utility.
So, welcome to my blog! I hope I will get enough time to make it interesting (even though I write this primarily for myself).