Monday, August 27, 2007

Amarok can't play mp3 files

My favorite linux player, Amarok, stopped working (playing mp3 files) after an upgrade! It kept on complaining that the xine engine was not able to play mp3 files. I had checked and all the right packages seemed to have been installed.

However, I found the solution here, you need to install libxine1-plugins package (together with its dependences) and everything comes back to life :-)

Eclipse Fonts in Linux (part 2)

In this previous post, I said I had found a way to adjust the eclipse fonts (that are gtk fonts) in KDE. That was a right solution, but unfortunately, it does no survive logouts from KDE. Each time you should re-run the gnome configuration program.

However, that's an even nicer solution: install the package gtk-qt-engine:


The GTK-Qt Theme Engine is a plugin for GTK that allows GTK applications to use Qt widget styles. Aimed primarily at KDE users, this plugin provides a way to unify the look and feel of the Linux desktop.

this will add the additional menu in the KDE Control Center - Appearance and Themes that will do the trick! Now Eclipse, Firefox and Thunderbird look very nice with the same KDE style.

Saturday, August 25, 2007

Eclipse Fonts in Linux

As you might have guessed I'm using Linux most of the times (Windows only seldom), but I noticed that the Eclipse font layout looked better in Windows: actually, the Eclipse font size in Windows permits fitting much more information in a view. This is even more crucial when I'm using my laptop with a resolution of 1280x800.

Of course, I had tried to adjust the font size using the Eclipse Preferences, and actually managed to reduce the size of the editors and view titles (also for dialogs), but not other fonts, such as menu fonts, and, more importantly, the size of tables and trees (e.g., the Java Package Explorer). That's actually due to the fact that under Linux Eclipse relies on Gtk, and thus inherits the preferences of the Gnome Desktop but I'm using KDE :-)

Fortunately, it's quite easy to adjust Gnome font settings even from KDE, by running gnome-control-center from the command line and then set the font size from there. Now, my eclipse shows much more information due to the reduced font size.

And by the way, this reduced the fonts also for other Gtk based applications I'm using, e.g., Thunderbird and Firefox!

Saturday, August 04, 2007

GNU Gengetopt 2.21

It wasn't long ago since I released version 2.20 of GNU Gengetopt, and here's a new version.

First of all, I switched to version 3 of GPL.

Another novelty is that gengetopt generates doxygen comments in the generated header files. This way, if you use doxygen on your sources, you'll find also the documentation of the code generated by gengetopt.

Some build issues were fixed: parallel makes work again, and the make files do not depend on GNU make specific features (such as %. rules which are not standard - I must admit I didn't know this, but the new version of automake I started to use, i.e., version 1.10, reports a warning when you use such rules in your Makefile.am files, so I got to know about the problem).

Furthermore, the signatures of generated parser functions changed in a crucial way (of course, the previous signatures are still available, but they are deprecated and possibly removed in the future). In particular, besides the default parser functions (i.e., with default options), other versions are generated that accept further options, such as, e.g., initialize the argument structure, perform required options checks, etc. In the previous versions, this additional signature, whose name was the same as the main parser function with a 2 in the end, used to accept these options as single boolean (actually, integers) parameters. There's nothing wrong with this approach but it does not scale to future enhancements of the signature. In fact, a user requested another option (see the list of changes below) and adding that parameter to the signature would break existing code when regenerating the parser functions, since the code using those functions must be manually modified in order to use the new signature (in C++ this might be a small problem thanks to default values for parameters, but in C...). For this reason, the options are passed to the parser function in the shape of a structure: adding a field in the structure will not break existing code since the signature of the parser functions does not change. Notice that the structure object for these options should not be manually created and initialized (again, if a new field is added in future versions, that field might stay uninitialized), but it should be created and initialized by calling the dedicated generated init function. Here's a snippet of the generated header file (notice the new structure, the new signature with the _ext at the end, the deprecated old signature, and the init function for options):

/** @brief The additional parameters to pass to parser functions */
struct cmdline_parser_params
{
int override; /**< @brief whether to override possibly already present options (default 0) */
int initialize; /**< @brief whether to initialize the option structure gengetopt_args_info (default 0) */
int check_required; /**< @brief whether to check that all required options were provided (default 0) */
int check_ambiguity; /**< @brief whether to check for options already specified in the option structure gengetopt_args_info (default 0) */
} ;

/**
* The command line parser
* @param argc the number of command line options
* @param argv the command line options
* @param args_info the structure where option information will be stored
* @return 0 if everything went fine, NON 0 if an error took place
*/
int cmdline_parser (int argc, char * const *argv,
struct gengetopt_args_info *args_info);

/**
* The command line parser (version with additional parameters - deprecated)
* @param argc the number of command line options
* @param argv the command line options
* @param args_info the structure where option information will be stored
* @param override whether to override possibly already present options
* @param initialize whether to initialize the option structure my_args_info
* @param check_required whether to check that all required options were provided
* @return 0 if everything went fine, NON 0 if an error took place
* @deprecated use cmdline_parser_ext() instead
*/
int cmdline_parser2 (int argc, char * const *argv,
struct gengetopt_args_info *args_info,
int override, int initialize, int check_required);

/**
* The command line parser (version with additional parameters)
* @param argc the number of command line options
* @param argv the command line options
* @param args_info the structure where option information will be stored
* @param params additional parameters for the parser
* @return 0 if everything went fine, NON 0 if an error took place
*/
int cmdline_parser_ext (int argc, char * const *argv,
struct gengetopt_args_info *args_info,
struct cmdline_parser_params *params);

/**
* Allocates dynamically a cmdline_parser_params structure and initializes
* all its fields to 0
* @return the initialized cmdline_parser_params structure
*/
struct cmdline_parser_params *cmdline_parser_params_init();

Finally, here's the complete list of the new features:

* a structure for parser function parameters (that might be extended
in future versions)
* a parser parameter to check whether an option that is parsed is
already present in the args_info struct (suggested by
Yegor Yefremov)
* the generated files contain doxygen documentation (suggested by
Yegor Yefremov)
* parallel make works
* generated make files should not depend on GNU make
* fixed a bug with multiple options with back slashes (thanks to
Peter Kovacs)
* updated to version 3 of GPL

Friday, August 03, 2007

"Last Modified" in PHP

This is nothing exciting, but I just wanted to share :-)

If you want to put in your php web page the well known "Last Modified: " you can simply put this code:

<?php
echo "<b>Last modified:</b> " .
date( "F d, Y. H:i:s a", filemtime("YOUR FILENAME") );
?>

where, of course, you must substitute YOUR FILENAME with the filename of your web page.

That's it!

Tuesday, July 31, 2007

Sony Vaio VGN/S5VP/B and a low cost battery

I have a Sony Vaio VGN-S5VP/B and I hadn't experienced big problems (not even with Linux), so I was pretty happy with it... the only thing that I don't like is that the battery has an autonomy of only 2 hours (trying to save energy with several means, e.g., in Linux with laptop mode did not help). So I wanted to buy an extended battery (4 hours)... 400 euros!!! That's a little bit too much isn't it? So I tried to look for a cheaper one ebay, and found it! With less than 100 euros I bought a VGP-BPL2 battery! I was pretty happy you might guess.

As soon as I received it I put it into charging and noticed that the battery led on the front was flashing continuously (with the original battery it only flashes once a second); well, I thought, it must be because it's an extended one...

Then, after a few hours I tried to turn on the laptop... first bad surprise: the laptop does not turn on: the power led lights but nothing happens. I tried and tried again, but even with the AC connected, the laptop does not power up if the new battery is present.

I then decided to turn on the laptop without the battery (but with the AC) and then I tried to insert the battery: after a few seconds, under Windows XP, a popup shows up saying that my computer was going to sleep because the battery may be incompatible. Second bad surprise. Notice that at that point I could also remove the AC cable and the laptop stayed on with the battery, so the laptop could use the battery after all.

I then found a post on a blog on the net, http://sarabannerman.blogspot.com/2007/04/sony-laptop-battery-mal-ware.html, reporting a similar problem (with a different Sony laptop model). This post says that "Sony laptops are running a little software program called ISBMgr.exe that generates this error when you insert a generic battery. It appears to be the only purpose of the software, and if you disable the software the generic battery works fine." I then disabled that service from MSConfig, and rebooted and found out that the popup message did not come up again!

At this point, I realized that I could actually use the battery, provided I started the computer without the battery on, insert the battery when the computer had started and then remove the AC power (not very comfortable, isn't it? But at lease, I could use the battery). The taskbar battery indicator (both on Linux and Windows) did not show a correct value, but I could stand that, even though that means that I had remember the amount of time I was using the laptop on battery since the system did not sense the correct charge value.

Then, after approximately one hour and half the computer turns off... well, I said, of course, the battery had finished its power, but the system did not realize that... so I put the battery on charge; in the meantime I was checking another post on the net, http://forum.notebookreview.com/showthread.php?t=20440, reporting similar problems and even worse that their battery was not being charged at all... Third bad surprise: I had the problem too... the continuous flashing was actually an error situation, since the battery was not being charged (the hour I was using the computer on battery I was actually using the charge the battery came with).

I then contacted the ebay seller about the problem and he said he would have asked for information about this issue; he then told me that they actually found out that my laptop model was probably having some hardware locks (the software lock consisting of ISBMgr.exe can be disabled as above) and that there was no way the battery could have been used with my laptop. Fourth bad surprise :-(

Fortunately, the seller offered me to take the battery back and to refund me completely.

So with this laptop I can only buy original (very expensive) battery... SHAME ON SONY! That's the last Sony laptop I'll have!

Tuesday, July 24, 2007

Thunderbird 2 Summary Popup

I really like the new version 2 of Thunderbird. It has some nice new features; the ones I like most are those related to copy/move message features, i.e., the "Recent" submenu and in particular the "copy again to" that allows you to copy/move a message to the same folder you copied/moved the last time.

Another nice looking feature is the popup that appears on the right corner on the bottom of your desktop with a summary of the last received messages.

However, I experienced some problems lately that are due to this very popup.

In fact, when I'm using the low 56k modem connection I noticed that the first time in the morning I was reading my email (using my IMAP account, with lots of folders, many filters, and approx 200 messages on the first email check due to all the mailing lists I'm subscribed to) it took up to 10 minutes to be able to open a message in my Inbox, since thunderbird was using a lot of network bandwidth.

When at last I was able to open the message in the Inbox was when the bandwidth usage ceased and at that time also the popup message showed up! So I realized it was all due to that summary since it was inspecting all the folders to build the summary. Notice that this happened even if mail.check_all_imap_folders_for_new was set to false (the default).

Actually, I didn't know how to disable that summary since I could see no such option in the preference dialogs. Then, after asking on the nice MozillaZine forum I tried to disable the mail.biff alert properties (by using Preferences -> Advanced -> Config Editor) and it worked!


The nice popup does not show anymore, but at least I can read my email faster even on a slow modem connection :-)

Then, on the same forum, I was told that there's actually an option in the preference dialog, it's just that I probably haven't noticed... it is in Preferences -> General in the section "When new messages arrive"!