March 25th, 2009: Document Freedom Day

This 25th of March, 2009 is Document Freedom Day. Although it’s not as important as starvation in parts of the world, the economic crisis or the continuous deterioration of our privacy and civil rights (in UK and elsewhere), it’s good to take a break and think about our use of electronic documents in our everyday live. Let me just give you an example …

A few days ago, I was trying to retrieve data from an experiment. As a well-formatted student, I stored my data in a then state-of-the-art, proprietary statistical software my dear statistical professor taught me to use. As long as I had this software, it was fine. Now that my university stopped to pay the license, that I didn’t installed this software on my new computer, I am stuck with a serie of 1, 0 and other delirious characters in that file. Does that mean I lost all my data? Yes.

Fortunately, I thought to save a backup of my data in a simple text file with CSV format. This saved my day because although I don’t have more information in this file, I don’t have less information than in the proprietary format either. And this simple CSV format allows me to enjoy processing my data with any spreadsheet software I want along with some more serious statistical packages like R.

What is open? by Paul Jacobson

If you want to know more about Open Documents (and more broadly about Open Standards), you can start by reading what are Open Standards. Wikipedia has a more technical article about them.

Photo credit: Slide0001 by Paul Jacobson on Flickr (licence by-nc-sa)

Some useful software for programmers stuck on MS-Windows

Sometimes, even if you mainly develop on Unix/Linux boxes, you are stuck with MS-Windows on your desktop. Moreover, although your are a developer (i.e. someone who is supposed to know how to run a computer), you have no administrator rights so you can’t install the right tools that can improve your productivity and enhance your code stability/security. This is for the sad part.

Fortunately, Free Software are there and most of them can even be run without being installed on your machine, just copy the software and use it! Here is a list of some of the software I’m using. Feel free to promote your favourite application in the comments.

  • CamStudio: record video of bugs for support (free to use)
  • Virtual Desktop Manager: many desktops on MS-Windows (free to use)
  • doxygen: automatically generate documentation from your code (Free Software)
  • Eclipse: integrated development environment with support of many languages (including old COBOL!) and version control systems (Free Software)
  • FileZillaPortable: move file to/from servers (Free Software)
  • Firefox: test web application in a popular browser (Free Software)
  • freemind: mind mapping application (Free Software)
  • GIMPPortable: edit screenshots when you encounter a bug (Free Software)
  • htmlhelp: edit help files for end-users (free to use)
  • InkscapePortable: easily draw any scheme (Free Software)
  • j2sdk1.4: support old Java applications (free to use)
  • jdk1.6: develop and run new Java applications (free to use)
  • LaTeX (MiKTeX): write your dev reports (Free Software)
  • Lynx: surf fast without distraction (Free Software)
  • Netbeans: integrated development environment with support of version control systems (Free Software)
  • PuTTY: connect to servers in SSH (Free Software)
  • PuTTY connection manager: regroup PuTTY windows (Free Software)
  • SumatraPDF: free PDF reader (Free Software)
  • TeXnicCenter: LaTeX editor working with MiKTeX (Free Software)
  • tidy.exe: tidy your HTML code (Free Software)
  • todolist: simple todolist (Free Software)
  • TOra: Oracle database front-end (Free Software)
  • VLCPortable: listen to music and watch all movies (Free Software)
  • wget.exe: easily get files without a browser (Free Software)
  • xmlstarlet: check and process XML files (Free Software)

Welcome again!

Hi, and welcome back on my blog.

Following the progressive migration from epot.org to jepoirrier.net, you landed on the new address for my blog: http://www.jepoirrier.net/blog (new RSS feed here).

The migration process was easy, thanks to the WordPress eXtended RSS that contains posts, pages, comments, custom fields, categories, and tags. But there are two things left I wanted to keep: existing users and images which links are hard-coded in various posts.

For the links to images, I just replaced the old URL by the new one in VIM: :%s/old_path/new_path/g and voilà!

For the existing users, I just exported data from tables wp_users and wp_usermeta. So if you had an account on my previous blog (mandatory to post comments), you can use the same login and password! 🙂

Building on the move, I also changed links to more “sexy” permalink and allowed Gravatar for all comments (if you don’t have a gravatar, an identicon will be automatically generated for you).

One more thing to do: an automated redirection from the old pages/RSS to this one. I guess it would take the form of a HTTP 301 Redirection but I have still to automate the transformation of the 272 URLs …

See you here for the next post!

Photo credit: “We’ve moved” by Brian Gurrola on Flickr (CC-by-sa).

Using Mantis with a reduced mail() function

Mantis is a free web-based bug tracker. As most web trackers, it uses e-mail to notify testers and developers about the evolutions of issues they have reported or they just follow. For that purpose, Mantis uses Codeworx PHP Mailer class that gives you the opportunity to use the PHP mail() function, sendmail or a SMTP server to send those e-mails.

The use of the PHP mail() function is the default option. Unfortunately, some web hosting companies limits the PHP mail() function by forbidding the use of the 4th and 5th (optional) parameters. The result is that you can’t use the e-mail functionality of PHP mailer / Mantis because they use the 4th parameter.

The solution is to edit the file class.phpmailer.php in the directory mantis-dir/core/phpmailer/. Inside the file, look for the two lines containing the string “@mail” and replace the 4th argument by the e-mail address where the e-mail will be sent from. Example:

   $rt = @mail($to, $this->EncodeHeader($this->Subject), $body,
         "From: \"mybugs - Mantis bug tracker\" <me@domaine.tld>");
}
else
   $rt = @mail($to, $this->EncodeHeader($this->Subject), $body,
         "From: \"mybugs - Mantis bug tracker\" <me@domaine.tld>");

Now you have a fully functional bug tracker 🙂

FOSDEM 2009 and Gemvid 0.6c

This year, I only went for the Saturday afternoon session of FOSDEM 2009, the Free and Open Source software developers’ European Meeting. Two years ago, I mentioned the general trend that more women were interested in free/open source software/movement and this trend continues. But this time, I also noticed some really cute babies … and my son Neel-Alexandre was one of them of course! Although he’s only 7-month-old, he was really interested in the FreeBSD, Linux and Firefox mascots (respectively a red daemon, Tux the penguin and a fox). You are never too young to taste the truth 😉

I also gave a lightning talk about Gemvid, my solution to monitor rats general activity. I tried to explain most biological information needed to understand the principles and I think people were really interested in this software, something with an application a bit different than the previous talks. I updated the Gemvid website and I uploaded the latest revision (0.6c) that was “analysing” the audience from my laptop during the talk. Finally, I also uploaded the presentation (PDF, 1.3Mb) and you can directly see it below.

See you next year, for the next version?

Baby movements during sleep

After a while, here is why I got a TV tuner for my Linux laptop, took screen captures and wrote a script to add a timestamp on pictures … I wanted to know how my (then 5-month-old) son was sleeping (his mom can be reassured: I was not planning to put electrodes on his scalp 😉 ).

Get the Flash Player to see this player.

var s1 = new SWFObject(“../videos/player.swf”,”ply”,”360″,”240″,”9″,”#FFFFFF”);
s1.addParam(“allowfullscreen”,”false”);
s1.addParam(“allowscriptaccess”,”sameDomain”);
s1.addParam(“flashvars”,”file=../videos/081129-night.flv&image=../videos/081129-night.jpg”);
s1.write(“container”);

Following this, I had interesting discussions with my dad about sleep patterns in babies. It could also be interesting to hybridize what we did for Gemvid and this simple solution in order to be able to quantify human/baby movements during sleep. My little knowledge of OpenCV can then come in handy for the motion and pattern detection …

Some additional technical details : Video was made from 321 TV screen captures (1 every 2 minutes) and played back at 1 frame per second. It was converted with FFmpeg (LGPL) and the Flash player is JW FLV Media Player (CC by-nc-sa). Ok: Flash is not free.

Awk oneliner to find a string in text files

If you want to know the name of files containing a special string, grep -c is your friend. But you also get names of files not containing your string (with count = 0). If you only want the names of files containing “mystring”, awk can help you:

grep -c "mystring" * | awk ' !/:0/ '

And if you don’t even want the number of times “mystring” appears (on 1 line):

grep -c "mystring" * | awk ' !/:0/ '| awk '{split($0, a, ":"); print a[1]}'

Any other ideas?

Short script to add a timestamp on pictures

Here is a short script (1.6kb) to add a timestamp on all PNG pictures in a directory. It requires Python and the Python Image Library (PIL). In order to use it, modify some parameters in the beginning to suit your needs (images directory, font file and size, etc.) and launch ./timestampFiles.py. Here is a before/after example (size of pictures is reduced to fit in this blog):

Before/after example of adding a timestamp to a picture

Note 1: the font is not included in the script. Here, I used FreeSans which is a true free font (GNU GPL with font exception). It is available here (local copy, just the FreeSans font, 753kb).

Note 2: I chose to convert PNG images to JPG ones for 2 reasons. First, my capture script gives me PNG images (see previous posts). Second, I want to be able to copy all JPG pictures in a MJPEG movie. It shouldn’t be difficult to change the different file formats to suit your needs (ask me if you can’t do that).

Note 3: I guess this would also have been possible using a bash script and imagemagick, Perl or any other programming language 😉