Sunday, December 31, 2006

BlueTooth under Linux on a Sony Vaio VGN-S5VP/B

I finally took some time and tested bluetooth under GNU/Linux (Debian Testing) on my Sony Vaio VGN-S5VP/B. I had to say that everything went quite smooth, and everything seems to work fine (although I only tested file sending).

This post should be considered complementary to this page, where I described the installation of Debian GNU/Linux on this laptop.

First of all I installed all the necessary software:

apt-get install bluez-utils libbluetooth1 bluez-hcidump bluez-pin

and then I configured and recompiled the kernel (in this case a 2.6.18 installed from the Debian repository, i.e., it's not a vanilla kernel): under Networking enable Bluetooth Subsystem Support, and then, from there enable the options:

and then enable all the options in the bluetooth device drivers.

Once you boot with the new kernel you can check from dmesg the Bluetooth information:
dmesg | grep Bl
Bluetooth: Core ver 2.10
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
Bluetooth: HCI USB driver ver 2.9
Bluetooth: L2CAP ver 2.8
Bluetooth: L2CAP socket layer initialized
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM ver 1.8
Bluetooth: BNEP (Ethernet Emulation) ver 1.2
Bluetooth: BNEP filters: protocol multicast
and you should see the above information.

Now you can use the command hciconfig (which is basically the command that corresponds to ifconfig, but for bluetooth), and you should see something like:
hci0:   Type: USB
BD Address: mac address ACL MTU: 384:8 SCO MTU: 64:8
RX bytes:602 acl:0 sco:0 events:60 errors:0
TX bytes:486 acl:0 sco:0 commands:40 errors:0
where mac address should report the mac address of your bluetooth device.

Moreover, you can scan for bluetooth devices with the following command:
hcitool scan
for instance, you should see your mobile phone mac address (if bluetooth is enabled on the mobile phone).

Now you can go on using your own software for accessing your bluetooth devices (probably described on a next post :-)

Wednesday, December 27, 2006

PhpBibliography 0.4 - web based bibliography system

I've released version 0.4 of PhpBibliography,, a web based bibliography system that allows you to publish your bibliography online (and to edit it via web). It is implemented in Php and uses MySql. This is free software, open source, released under GPL.

There are many new features in this release (I hope you find useful).

First of all, you can also modify a paper by using a bibtex (previously you could only insert a new paper by using a bibtex). For this reason, the bibtexkey field was added to the database (and w.t.r. I added also the function in the admin menu to automatically generate bibtex key for papers which do not have it yet). Furthermore, you can also upload an entire bib file; this will allow you to set up the bibliography site with only one action (of course you'll then be able to modify each inserted paper).

Papers can now be classified according to several criteria (called classifications), not only by using categories. You can add new classifications, and for each classification you'll be able to add values that can be associated to papers. For instance, you can have the classification "keyword", the classification "status" with values "submitted", "to appear", "published", etc. This is very useful also for (virtually) adding a new field to the paper table structure. Classifications can be related to a specific bibtex field, so that they can be retrieved from bibtexs (and also generated in the corresponding field, during the automatic bibtex generation).

A functionality was added (available from the admin menu) that allows you to "merge two authors" that, due to a mistake, represent the same author. (This usually happens when inserting a paper through a bibtex.) For instance you have two authors Foo Bar and Foo T. Bar that represent the same author. With this function, the system will replace the second author with the first author (i.e., the second author will be deleted and all the papers that were associated to the second author will be associated to the first author).

From the paper presentation point of view some customization features were added: you can pass additional parameters in the URL (you can also specify them in the config.php file, but the ones passed on the URL will take the precedence). Here we list these parameters (in the URL they must be passed without the $, using the GET passing method syntax) and their default values:

  • $printfilenames = "1"
    This tells the paper formatter whether to name the link to the paper source using the complete name of the file (e.g., If set to "0", then only the extension of the file will be shown (e.g., ps.gz).
  • $linktodetails = "1"
    The title of the paper will link to a separate page with complete details about that paper. If set to "0", no link will be generated.
  • $noheader = "0"
    If set to "1" the generated page will contain no header information (i.e., it will not even contain the css definitions). This is useful when you want to include the output of phpbibliography into another web page and you want customize it with your own css definitions.
  • $paperorder
    Specify the sorting criteria of the shown papers. For the moment the only possible value for this parameter is title (meaning that papers will be ordered according to their title).
For instance, the following screenshot shows the output where printfilenames is set to "1"
while the next one shows the output where printfilenames is set to "0"
Finally, some bugs were fixed (in particular the authentication problem in php 5, due to the use of wrong variable names, see also this post on this blog).

Hope you enjoy this new version of PhpBibliography (yeah, I know, the logo is not that beauty, but that's just the beginning :-)

Saturday, December 23, 2006

Strpbrk in Php

In Php 5 the string function strpbrk was introduced (quoting from the manual):

string strpbrk ( string haystack, string char_list )

strpbrk() searches the haystack string for a char_list, and returns a string starting from the character found (or FALSE if it is not found).

This is quite useful in many cases, but unfortunately it's not available in Php 4. However, it should be quite straightforward to implement it. Here's how I did:

function my_strpbrk($haystack, $char_list) {
$pos = strcspn($haystack, $char_list);

if ($pos == strlen($haystack))
return FALSE;

return substr($haystack, $pos);

And this is its usage:



$text = 'This is a Simple text.';

// this echoes "is is a Simple text." because 'i' is matched first
echo my_strpbrk($text, 'mi');

// this echoes "Simple text." because chars are case sensitive
echo my_strpbrk($text, 'S');

// returns FALSE
print (!my_strpbrk($text, 'W') ? "FALSE" : "TRUE");

Just my two little cents :-)

Tuesday, December 19, 2006

C/C++ parameters at configure time

If you ever compiled an open source program from sources, you'll surely know the sequence:

make install

In particular, the first command will try to figure out the system you're using for compilation and to set some parameters accordingly (C and C++ compiler, missing features, etc.). This script is usually automatically built using the GNU Autotools, such as autoconf, automake, libtool.

The configure usually assume the following parameters for the C/C++ compiler:

-g -O2

That is, enable debugger information, and perform optimizations and for the end user this might be OK.

However, for the developer, who probably will have to debug the program, having the optimizations enabled might make debugging a nightmare (since some instructions might be rearranged by the optimizer). For this reason, I usually disable optimizations at configuration time simply by using the following configure command line:

./configure CXXFLAGS="-g" CFLAGS="-g"

So that debugging will be much easier!

Tuesday, December 12, 2006

Using Rsync for Remote Backup

I've been using Rsync for a while now for keeping a backup of my stuff on a remote server. Rsync is an open source program for fast incremental file transfer. It can be used to synchronize two remote directories and to synchronize a local folder with a remote folder (which is what I use it for). This also allows me to work on different machines on the same stuff: I download (or update) the stuff from the remote server, work on it, and the commit the changes back on the server.

Notice that rsync can only synchronize in one way (a source with a target, or the other way round, but not in both directions simulataneously); if you need a two way file synchronizer you might want to take a look at Unison.

Anyway, this is how I update my local version of a directory with the version on the server:

rsync -e ssh -avzu --delete -c -C \
--exclude-from=exclude-files \
  • -e ssh instructs rsync to use ssh as a remote shell (thus authentication and transfer will use ssh)
  • -a is archive mode (refer to documentation): basically recurs into directories and keeps permissions
  • -v increments verbosity
  • -z compresses the transferred data (very useful when using slow connections)
  • -u skips files that are newer on the receiver
  • --delete deletes files that are in the local folder but not in the remote folder
  • -c uses checksums to determine which files need to be synchronized
  • -C auto-ignores files in the same way CVS does
  • --exclude-from excludes all the files (using also regular expressions) specified in the file exclude-files.
  • USER is my user name on the REMOTEMACHINE
  • REMOTEDIR is the complete path of the folder on the remote machine and LOCALDIR is the path of the local folder (IMPORTANT: do not append the final slash on these paths otherwise the semantics changes, see the documentation)
Another useful option is -n or --dry-run that only simulates the transfer (so that you can see which files would be transferred).

And exclude files contains these regular expressions:
But of course you can modify it as you see fit.

When I want to commit my local changes to the remote server I basically run the above command inverting source and destination:
rsync -e ssh -avzu --delete -c -C \
--exclude-from=exclude-files \
This is only one use of rsync. I refer to the documentation for more advanced usage. Hope you enjoy rsync as much as I do :-)

Wednesday, November 29, 2006

Cron and MySql Database Backups

This is nothing very special or exciting, it's just a script that I run as a cron job to make the backup of a mysql database. It can be customized according to several parameters. The script is intended to be run once a day, in fact the file name that is created contains the date in the shape of month_day_year. If you need to run this script more than once per day, you need to add also the time in the file name (otherwise the previous backup in the same day gets overwritten).

You can also customize the parameters that you pass to the programs, e.g., mysqldump and gzip. And of course, you need to set the right values for the username, the password and the database name (and also the path where the backup will be save, which, by default it's the backup directory in your home directory, so please make sure this directory exists).

Here's the script, hoping you find it useful somehow :-)


GZIP="/bin/gzip --best"

BACKUP=$PATH/$FILENAME`/bin/date +%m_%d_%y`.sql.gz

echo "backup successful: $BACKUP";
echo "errors during backup";

Monday, November 27, 2006

Problem with PHP $HTTP_POST_VARS

In my program PhpBibliography,, see also the announce on this blog, I've always used the same authentication code that had always worked and I never noticed that it was still using the array $HTTP_POST_VARS, instead of $_POST.

As far as I knew they worked the same... well, a user told me he experienced problems in authenticating, and after some time spent on thinking it was due to sessions and cookies we realized it was due to the fact that the form did not pass anything... the $HTTP_POST_VARS was not defined.

Well, also the documentation of PHP 5.0 says that this array may be disabled. Now everything uses $_POST :-)

Tuesday, November 21, 2006

Linus Torvalds a Hero!

I was really happy when I read in this Time article that Linus Torvalds, also known as the father of Linux, is considered a hero! He really deserves it!

He not only created Linux, which is already a wonderful thing: he also managed to make a huge number of people spread ALL around the world collaborate on it, giving birth to one of the most impressive project in the history of computer science (this is not only my opinion :-)

I started using Linux in 1996 (if I remember well) with a Slackware 1.2.3; the pre-installed kernel did not even support my cdrom, so I had to install the system using 20 floppy disks; then I discovered the magic moment of kernel compilation (in order to make my cdrom work) and it was really emotionally geeky! ;-)

I had already used Xenix few years before so it was like going back home; but there was more: there was that impressive availability of software for free (and of course, open source, and this really matters).

I'm using Linux now most of the time (going back to Windows only to test my software also in that environment, and when I can't use Linux for some hardware or some not working drivers).

It's also a very pleasant and comfortable environment for programmers and nowadays can surely be used for anything... if only people were not too lazy to start using it :-P

Thanks Linus!

Tuesday, November 14, 2006

GNU Gengen (GENerator GENerator)

Gengen has become GNU Gengen! Here's the new link: Gengen (GENerator GENerator) is a tool that, starting from a parameterized text, called template, generates a text generator that can substitute parameters with values.

At the moment Gengen can generate C++ or C code; however other target languages are under development (e.g., Java).

Say you are writing a C/C++ program and at some point your program has to generate the following code:

if (i < 10)
printf("the value of i is %d", i);

It is not so difficult to write this piece of C++ code:

cout << "if (i < 10)" << endl;
cout << " printf(\"the value of i is %d\", i);" << endl;

or the C code:

printf("if (i < 10)\n");
printf(" printf(\"the value of i is %%d\", i);\n");

provided that you remember to escape the " (and in the C code, also the %).

Suppose now that the previous piece of code has to be generated many times by your program, and every time instead of i another symbol has to be generated (decided at run time). In this case, supposing that this value is contained in a variable symb,
the code for generating this code would be a little bit more complex:

cout << "if (" << symb << "< 10)" << endl;
cout << " printf(\"the value of " << symb << " is %d\", "
<< symb << ");" << endl;

And the C version would be even more obfuscated.

Probably you didn't even realize that you forgot to leave a space before the < 10; basically this is due to the fact that this piece of code mixes the code that has to be generated with the code that generates it, and this tends to make this part
of program less easy to maintain. Especially if some day you have to change the code that has to be generated, you'll have to act on this part of the program, and probably you'll have to
execute some tests in order to be sure that you did it right.

If the code that you have to generate is a slightly more complex, the task may easily become a pain in the neck!

Wouldn't it be nice if you could write the code to be generated in a separate file, let's call it template, say test1.cc_skel
this way

if (@i@ < 10)
printf("the value of @i@ is %d", @i@);

and have a tool that generates a generator, that you can instantiate at run-time with the value that has to be substituted to the parameter i? If such a tool existed, and it generated a file test1_c.h with a C struct test1_gen_struct, then you could write simply this code, in another file, say test1_gen_c.c:

#include <stdio.h>

#include "test1_c.h"

struct test1_gen_struct gen_struct;
gen_struct.i = "foo";
generate_test1(stdout, &gen_struct, 0);
gen_struct.i = "bar";
generate_test1(stdout, &gen_struct, 0);

return 0;

Alternatively, if it generated a file test1.h with a C++ class test1_gen_class, then you could write simply this code, in
another file, say

#include <iostream>

using std::cout;
using std::endl;

#include "test1.h"

test1_gen_class gen_class;
cout << endl;
cout << endl;

return 0;

and when you run it you would obtain the expected output:

    if (foo < 10)
printf("the value of foo is %d", foo);
if (bar < 10)
printf("the value of bar is %d", bar);

Well, Gengen does right this! Now the code that has to be generated and the code that generates it are separated and they can be maintained more easily: if you want to change the code that has to be generated you act on the file test1.cc_skel; alternatively, say you need to change the value that will be substituted for i, you just change the file or test1_gen_c.c.

I hope you try gengen, and have fun! :-)

Friday, November 03, 2006

KLcdDimmer: A KDE Applet to adjust LCD brightness

KlcdDimmer is a small KDE panel applet to adjust the LCD brightness; I built it for my laptop, a Sony Vaio, because I still haven't succeeded in making the Fn keys work.

I also built it as an exercise in KDE programming. Actually KDE programming (and especially Qt Programming) is really cool and funny. The Qt libraries are really well done and their mechanism of signal and slots makes programming with events a pleasure (I cannot say the same about Java events, but that's another story ;-) I only wish there could be some more documentation about KDE applet programming...

Notice that this applet relies on an external program to get/set the brightness. For instance, I've used


but it is supposed to work also with others, since you can configure the applet.

The home page of this applet is In case you use it, I hope you like it! KDE rocks!!! :-D

Thursday, November 02, 2006

IMP, Horde and UW-IMAP

IMP is a very nice software that provides a webmail access to IMAP and POP3 servers. It is based on the framework Horde. I've been using for some time now and it always worked fine. Then, one day, after an apt-get upgrade, IMP is updated to a new version and it stopped working. In particular, I wasn't able to login (and the password was reported correctly in the system log): after a long timeout, I received as response the empty file redirect.php.

I decided to reinstall everything from scratch (Horde and IMP). Unfortunately I soon experienced problems with Horde itself, due to the default cookie directory which was '/horde', but, following the installation path, it must be '/horde3', see also this bug: But this was solved.

The problem with IMP was still there, though! After struggling with it a whole afternoon, I came through this nice wiki, and in particular with this page, which sounded really related to my case (since I'm using UW-IMAP server). Well the problem was really that!!!

As a solution, I chose this one (which is not supported by IMP developers, but it works):

'imap_config' => array(
'children' => false,
'namespace' => array(
'main/' => array(
'name' => 'mail/',
'delimiter' => '/',
'type' => 'personal',
'hidden' => false,
'search_charset' => array(
'UTF-8' => true

It looks the problem is only due to this particular IMAP server...

I also updated a related bug report:

Tuesday, October 31, 2006

Featherweight Wrap Java

Hurray! They accepted our paper "Featherweight Wrap Java" at SAC (The 22nd Annual ACM Symposium on Applied Computing), Special Track on Object-Oriented Programming Languages and Systems (OOPS), it will then appear on the proceedings of the conference (published by ACM press):

Featherweight Wrap Java
Lorenzo Bettini, Sara Capecchi, Elena Giachino.
Proc. of SAC (The 22nd Annual ACM Symposium on Applied Computing), Special Track on Object-Oriented Programming Languages and Systems (OOPS). ACM Press. 2007. To appear. abstract wrapjava.pdf bibtex

We present an extension for a Java like language with a mechanism
for dynamically extending object behaviors. Our approach consists
in moving the addition of new features from class (static) level
to object (dynamic) level: the basic features of entities (representing
their structure) are separated from the additional ones (wrapper
classes whose instances represent run-time added behaviors). At
run-time, these entities can be dynamically composed by instantiating
wrapper objects which are attached to basic entities. We
formalize our extension by adding the new constructs to Featherweight
Java; the core language so extended (Featherweight Wrap
Java) is type safe.

Hopefully, this will become a Java extension (in the shape of a preprocessor) in order to have this "delegation-like" feature. The basic idea is to be able to extend object behaviors (methods) dynamically by wrapping objects. This reminds the Decorator pattern, and indeed this pattern was our main inspiration. (See the image representing the Decorator class diagram).

This way, you won't have to implement the pattern manually: you will simply use our proposed language extension.

Actually the language extension we propose is more powerful than what you get with decorator patterns, since it implements both consultation mechanisms and delegation mechanisms.

The theory of this extension is based on Featherweight Java.

Wednesday, October 25, 2006

I love Static Typing

I know it's a great debate: static typing vs dynamic typing. I definitely prefer statically typed languages. Lots of type errors in programs are detected during the compilation and not during the execution of programs. I think this way programs are far more reliable. It might be tedious to declare variables before using them, and specify their types, but the time you "waste" in this operation is surely repaid when you won't have to test your program thoroughly just to be sure that there are no situation where your program goes wrong because it misuses a variable. Even worse when the program silently uses a variable that is not defined.

Although I like PHP very much, I find it really irritating when your browser shows an error in your dynamic web site because you used a function that is not defined (probably just because you misspelled its name). Not to mention when your program silently misbehaves (without no sign of error) just because you used a variable that is not defined (and in that case it simply instantiates a variable with an empty value).

If a program is type-checked at compile time, it won't have to be re-checked (or at lease, completely rechecked) at each execution time (and I think you gain a lot in efficiency).

When I have to test my programs, I prefer to concentrate on the right implementation of the program logic, rather than to check whether I used the right types. That should be compiler's work.

Of course, dynamic typing is good under certain circumstances (dynamic loading of code); but for the other situations, I feel more comfortable and safe with static typing.

As you might have guessed, this post comes after some time spent on debugging a program that misbehaved just for this reason :-)

Just my opinion :-)

Friday, October 20, 2006

Eclipse & LaTeX: TeXlipse

I've been using this plugin, TeXlipse,, for few days and already love it! It's a plugin that adds Latex support to the Eclipse IDE. It is not a WYSIWG editor (which somehow is in contrast with the pilosophy of LaTeX, I think); however it has many great features that help you a lot when writing latex documents, e.g., syntax highlighting, code completion (especially for macros and bibtex, which is great!) and also shows the dvi with xdvi highlighting the part of the document where you're at in the sources. Give it a try! :-)

Thursday, October 12, 2006

Code2blog: Source-highlight frontend

Jim Storch,, wrote a frontend for Source-highlight, that can be used to highlight on-the-fly a program so that the formatted form (HTML) can be easily copied and then pasted in your blog. This frontend is written using Python (version 4) and pyGTK.

You can find it here

I started to use it and like it very much!
Well done Jim! :-)

Monday, October 09, 2006

GNU Source-highlight 2.5

I've recently released the new version of GNU Source-highlight,, which, given a source file, produces a document with syntax highlighting.

Source-highlight reads source language specifications
dynamically, thus it can be easily extended (without recompiling
the sources) for handling new languages.
It also reads output format specifications dynamically, and
thus it can be easily extended (without recompiling
the sources) for handling new output formats.
The syntax for these specifications is quite easy (take a look at the manual).

This way, instead of the colorless listings such as
A simple hello program,

#include <iostream>

using namespace std;

int main()
cout << "Hello Blog!\n" << endl;
return 0;

You'll get the more nice looking one:
A simple hello program,

#include <iostream>

using namespace std;

int main()
cout << "Hello Blog!\n" << endl;
return 0;

Notice that source-highlight can also be used as a formatter (i.e.,
without highlighting): you can, for instance, format a txt file in HTML (and it will take care of translating special characters, such as, <, >, &). In particular, the first (non colored) listing in this article was formatted with source-highlight without any highlighting but with the transformation of special characters.

Since version 2.2, source-highlight can also generate cross references; in order to do this it relies on
GNU Ctags,

These are the output formats already supported:
  • HTML
  • ANSI color escape sequences (you can use this feature with less)
  • DocBook
These are the input languages (or input formats) already supported (in alphabetical order): C/C++, C#, Bib, Bison, Caml, Changelog, Diff, Flex, Fortran, Html, Java, Javascript, Latex, Logtalk, Log files, Lua, ML, Pascal, Perl, PHP, Postscript, Prolog, Python, Ruby, Shell, Sql, Tcl, XML.

Happy Highlighting! :-)

Thursday, October 05, 2006

PhpBibliography 0.3 - web based bibliography system

I've released version 0.3 of PhpBibliography,, a web based bibliography system.

PhpBibliography allows you to publish your bibliography online (and to edit it via web). It is implemented in Php and uses MySql. This is free software, open source, released under GPL.

The main features of the system are:

  • stores all papers details in a SQL database
  • handles uploads of files (e.g., .pdf of papers)
  • automatically generate bibitems
  • supports insertion of papers through existing bibitems
  • allows paper search and filter (e.g., authors, title, keywords, etc.) mechanisms
Papers are publicly visible but can be modified only via an authentication mechanism (based on users and passwords).

Papers are all stored in a common database, and can then later be filtered according to a specific authors so that each author can show his/her own papers in his/her own page (for instance at the papers shown are collected from two different phpbibliography installations; the papers are included in this webpage by using a remote URL inclusion mechanism by specifying, in URL the filter criteria -- in this case, the filter is to show only my papers).

Wednesday, October 04, 2006

Gentoo, Cups & Foomatic (stopped with status 22)

I've been using the Linux distribution Gentoo for a long while now and I've always enjoyed (and in spite of what I read on some web sites, I found it the most performant distribution). Packages are installed by compiling sources and thus it might take quite a long time to set up or upgrade a system, but then it's quite easy to maintain.

For some days I've been struggling with Cups when I was trying to install a Xerox printer, a Phaser 4500 DT (by using the drivers found on their website): everything is installed fine but when I tried to print something, nothing happened :-(

By taking a look at the log /var/log/cups/error_log, I found this line:

PID 7265 stopped with status 22
By searching on Google I didn't find much, but someone mentioned a similar problem due to missing footmatic packages...

Well, installing foomatic with
emerge foomatic
solved everything :-)

I hope this avoids some headache to other facing the same problem!

Monday, October 02, 2006

Compiling KDevelop from sources

Kdevelop is an IDE for KDE for various programming languages. I use it primarily for C++. It's very pleasant to use and it's also integrated with QDesigner for visually build graphical user interfaces.

Since I like to use the new features, I don't rely on the pre-built packages: I compile it from the svn sources, and in particular I'm using the currently developed 3.4 release. However, I also keep a working copy of the currently stable version 3.3.4; for this reason I install the version taken from svn in a different directory.

At first I had some problems in this process, so I report here my experience in successfully build and install kdevelop in a different directory. In particular, the following instructions assume that you want to install the compiled version in $HOME/usr/local. In case you want to install it in a different directory, all you need to change is this value.

First of all, I followed the instructions found at the web site (for downloading the sources from svn).

Then I run configure as follows (for $KDEDIR/share/doc/kde/HTML/en/kdelibs-apidocs/, please see the
instructions in the above web page):

./configure LD_LIBRARY_PATH=$HOME/usr/local/lib:$LD_LIBRARY_PATH
LIBRARY_PATH=$HOME/usr/local/lib:$LIBRARY_PATH --prefix=$HOME/usr/local
--disable-ada --disable-bash --disable-fortran --disable-haskell
--disable-java --disable-pascal --disable-perl

Of course, you can choose all the --disable options you like.

Then you can run make to compile the sources, and finally make install to install the compiled version (of course if you're installing in a system directory, then you might need to have the required privileges).

When you want to run this version of kdevelop you must use some environment variables. Here's how I run it (of course you can put this command line in a shell script):


Now you should be able to enjoy all the nice features of kdevelop :-)

Saturday, September 30, 2006

Eclipse & Php: Php Ide

Eclipse is a wonderful IDE for programmers (extensible with plugins and for new programming languages) and I really enjoy using it! A sort of the Emacs of the new millennium (I'll keep on using Emacs too, though :-)

The Zend plugin for programming in Php with Eclipse, Php Ide also looks very promising! I started using it few weeks ago and found really helpful and powerful. It features syntax completion and an easy to use debugger (although I still haven't succeeded in debugging php programs as web servers).

Here's a screenshot during debugging:

I found it very productive and it is always kept upgraded (the version I'm trying is 0.2.4).

One of the problems I had was due to the use of MySql: when I run a php application I used to get this error:

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in...
This was due to the fact that the configuration of php used by php ide expects the socket for connecting to MySql server in /tmp/mysql.sock, but the Debian system I'm using is configured so that the mysql socket is actually in /var/run/mysqld/mysqld.sock.

Since I didn't find a way to configure this option in the php used by php ide, I simply create a symbolic link before starting php ide:

ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

With this "hack" I have no problem at all :-)

Friday, September 29, 2006

GNU Gengetopt 2.18

I released few days ago the new version of GNU Gengetopt,, a GNU program I'm the maintainer of.

Gengetopt is a generator of parsers of command line options.

It generates a C function that uses getopt_long function to parse the command line options, to validate them and fills a struct. Thus your program can handle options such as:

myprog --input foo.c -o foo.o --no-tabs -i 100 *.class
And both long options (those that start with --) and short options (start with - and consist of only one character) can be handled. For standards about short and long options you may want to take a look at the GNU Coding Standards.

Command line options are an important feature of every non trivial programs. The getopt functions already do a good job in parsing them, but a lot of programming is still require... Gengetopt will do this additional programming for you, and you simply have to provide a file with the specification of the options your program accepts.

I refer the interested programmers to gengetopt's documentation.


Hi! I finally took a moment and published my first Blog!
Here I'll post stuff, ideas, news, tips about Computer Programming and Computers in general!

If you see the URL, tronprog, and wonder whether this has something to do with the movie Tron, well... YES! :-)
It's one of my favorite movies ever, and it will always be a cult movie!
I saw it when I was a child at a local cinema. I was already fond of computers, but that movie enhanced my passion even more.

I chose this name, even because TRON was a debugging command in the BASIC programming language; it stands for TRace ON, and it was basically used to start the tracing of a program. Since programming is one of my main passions, and debugging is unavoidable in programming... well... I thought that using tron in the URL was a good idea!

Happy Hacking! :-D