Microblog: A very long article Wikipedia article on the orientation of toilet paper [Jun 7th, 22:52] [R]

Wednesday, August 25th, 2010

QR Code Generator for WiFi Configuration

Categories: [ IT ]

http://zxing.appspot.com/generator/ generates a QR Code that contains SSID, key and encryption type of a WiFi access point. This can be displayed on screen or printed on paper and used for automatically configuring a mobile device for connecting to the wireless network (provided the phone has a camera and can read the barcode).

[ Posted on August 25th, 2010 at 21:59 | 2 comments | ]

Saturday, July 3rd, 2010

Obese Debian Kernel

Categories: [ IT ]

To run the Maemo SDK on a 64-bit computer, you need to enable VDSO compat in the kernel. To do so on Debian Lenny, you need to recompile the kernel. The problem is that when you follow the instructions, you get a 400+ MB package, because the binaries contain all the debugging symbols. After some time spent in search for the solution, I found it: export INSTALL_MOD_STRIP=1 before running make-kpkg. This calls strip on the modules when creating the .deb package.

Here's the procedure:

apt-get install kernel-package ncurses-dev bzip2 module-init-tools initramfs-tools procps fakeroot

apt-get install linux-source-2.6.xx

cp /usr/src/linux-source-2.6.xx.tar.bz2 /some/path/

cd /some/path/

tar jxf linux-source-2.6.xx.tar.bz2

cd linux-source-2.6.xx

cp /boot/config-2.6.xx ./.config

make menuconfig

make-kpkg clean

export CONCURRENCY_LEVEL=2

export INSTALL_MOD_STRIP=1

make-kpkg --rootcmd fakeroot --initrd --revision=custom.001 kernel_image kernel_headers

[ Posted on July 3rd, 2010 at 15:49 | no comment | ]

Tuesday, June 29th, 2010

DICT-NetMOT Gateway Updated

Categories: [ IT ]

The DICT-NetMOT Gateway I wrote some time ago suffered from an annoying bug: when the list of dictionaries at the source website is updated, the gateways uses the wrong dictionary (not-so-long story short: dictionaries are identified by index, and when the indexes change, it looks up in the wrong one). This has happened one time too many it seems, because I decided to fix this and get the gateway to download the list of dictionaries instead of using a hard-coded list. Currently the list is downloaded only on startup, so if it changes, the gateway needs to be restarted. If I am motivated, I may get it to reload automatically after a given timeout. EDIT: I was motivated, I just changed it; it now reloads after 1 day. (2010-06-29).

Short names for dictionaries, used as DICT identifiers, are generated automatically, so this may not work properly for dictionary names I haven't seen yet (there is a risk of short name collision, there is not checking against it).

Dictionaries which should be looked up by default can be specified with a (hard-coded) list of regexps against which the dictionary's long name is matched.

Also, some unidentified time ago, I updated the gateway to use the new NetMOT interface. I noticed that it started to use AJAX to provide the user with a list of suggestions while typing in the query box. I then used this feature to add support for ‘prefix’ and ‘glob’ matching strategies (‘prefix’ is mandatory in the DICT protocol, so before that the implementation was incomplete, but who cares?).

[ Posted on June 29th, 2010 at 08:08 | no comment | ]

Thursday, May 27th, 2010

Xorg intel Driver and Refreshing Graphics

Categories: [ IT ]

The not-so-new-anymore computer at work has an intel graphics card, I therefore use the intel Xorg driver. Since Day One, bitmaps (background images) in Firefox got scrambled when they were being repainted. For example, when the top of the page has a background image, after scrolling down and up again, the image is redisplayed by slices, and each slice was repainted upside down.

I finally found the culprit today, after trillions of CPU cycles used for recompiling various versions of Firefox: if I set the AccelMethod option in xorg.conf to XAA (the default value being EXA), it works properly.

Now I just have to find out why the computer crashes (and shuts down) when I restart xdm.

[ Posted on May 27th, 2010 at 20:02 | no comment | ]

Saturday, May 8th, 2010

N900, xterm, screen and ViM

Categories: [ IT ]

For some reason, the xterm on the Nokia N900 sends KP_Enter instead of simply Enter when pressing the Enter key. The result is that ViM inserts an “M” in addition to starting a new line. Maemo bug #6009 discusses the problem, and thankfully there's a fix (because the problem was identified in December 2009 and nobody is actually taking care of it, so it probably won't be corrected any time soon).

In the .screenrc file, add the line bindkey -a -k fe stuff ˆM. You can also fix a currently running screen by pressing C-a : and typing the same bindkey command.

[ Posted on May 8th, 2010 at 23:47 | 1 comment | ]

Tuesday, May 4th, 2010

Shell Scripts and Large Files

Categories: [ IT | TV/Leffakone ]

I use a shell script wrapper around MPlayer for recording TV programs in my Leffakone, the problem being that when TV reception is too bad, MPlayer crashes or freezes, so the wrapper restarts it when needed. Since MPlayer doesn't output anything while recording, I use a loop that checks every second that the recorded file is actually growing. Whem it stops growing (and there is still some recording time left), it means that MPlayer stopped working and that it needs to be restarted. Until now, I did this in a loop like this:
while [ $(stat -c %s $filename) -gt $last_size ]
do
  last_size=$(stat -c %s $filename)
  sleep 1
done

I then noticed that all recordings exceeding one hour (there aren't that many, that's why it took so long to notice it) where cut in two even though the picture doesn't show hints of bad reception. More peculiar, the size of the first part is slightly over 2 GB in size (therefore the problem is not related to a 2 GB size limit, right?). An experiment conducted yesterday show that it actually is: the test program (used here in its |[| form) handling the -gt comparison actually doesn't like values greater that 2ˆ31, which caused the loop to be interrupted and the recording to be split into two parts.

The solution is then (for Bash at least) to use the following syntax:

while [[ `stat -c %s $filename` -gt $last_size ]]
which seems to be working with values greater than 2ˆ31 (and than 2ˆ32, I just checked).

[ Posted on May 4th, 2010 at 08:53 | 1 comment | ]

Thursday, April 22nd, 2010

Amazon Images

Categories: [ IT ]

In Abusing Amazon images you learn how to abuse Amazon images, creating images of an Amazon product with whatever tag overlaid on it (such as a “99% off” bullet).

But the interesting part is that you can get images in any format with the following syntax: http://ecw.images-amazon.com/images/P/ASIN.01.size_info.jpg .

Useful values for size info are:

  • THUMBZZZ for thumbnail
  • TZZZZZZZ for medium-size
  • nothing for default size
  • L, LZ or LZZ for large
  • AAxx, xx is the size of the largest dimension
  • SXxx, xx is the width
  • XYxx, xx is the height
  • SSxx, xx is the size of width and height (image is padded with white)

Plenty of other features are available, I now use SSxx for the blog so that I can add size/height attributes to the IMG elements in the HTML and WAP 2.0 versions.

[ Posted on April 22nd, 2010 at 13:14 | no comment | ]

Tuesday, February 9th, 2010

User Identification through Web Browser User-Agent

Categories: [ IT ]

I found las year that 33 bits are enough to uniquely identify someone.

Now I just read that the browser's User-Agent field provides 5 to 15 bits of identification (10.5 bits on average). If you add zip code, geolocation, it becomes nearly enough to track people perfectly.

With EFF's Panopticlick, I know that my browser provides at least 16.12 bits of identification. The identifying criteria are the User-Agent and HTTP_Accept fields, available plugins, time zone, screen size, system fonts, cookies enabled/disabled and so-called super-cookies. The most scary part of the report is the statement that “Your browser fingerprint appears to be unique among the 71,157 tested so far.”

Without Javascript, my browser still provides 16.13 bits, due to the HTTP_Accept header and User-Agent.

[ Posted on February 9th, 2010 at 12:56 | 1 comment | ]

Monday, February 8th, 2010

The Definite New ADSL Modem

Categories: [ IT ]

End of the new ADSL modem story. I sat on my principles and bought last Saturday an A-Link RR24AP(d) at Gigantti, even though it runs Linux (yes!) without publishing the source code (boo!). It cost me 20 EUR more than what it would have cost at Multitronic.fi, but I guess that's what it cost to get it immediately.

The RR24AP(d) is not perfect either: its DynDNS client is updating its DNS record even though the IP address doesn't change (I got banned temporarily by DynDNS for that; I restarted the DynDNS daemon running on minikone and disabled the one in the router).

Moreover, I wanted to use its telnet/ssh menu-based interface for enabling/disabling the WLAN from the desktop (I wrote a docklet for that with a wrapper script for hiding the protocol stuff), but although enabling works, disabling doesn't work. I had to use the Web interface instead. An additional nice discovery is that although the main menu offers choices numbered 1 to 10, when you choose 0, you get a root shell. I haven't found a way to enable/disable the WLAN from the shell, hence the wrapper script for the Web interface.

[ Posted on February 8th, 2010 at 22:23 | no comment | ]

Friday, February 5th, 2010

More ZyXEL Troubles

Categories: [ IT ]

Part 2 of the new ADSL modem story.

This is how it goes: reboot the modem, connect to its telnet server. The TCP window is 2048 bytes long. Everything works fine. Telnet again: the TCP window is now 1024. Actually, it shrunk to 1024 already on the FIN/ACK packet sent by the router when closing this first telnet session and stays like this for all the subsequent connections. During those connection, each ACK packet it sends is followed by a second ACK where it resets the window size to 1024 bytes. After some time (this is the tricky part, I have no idea how time or idleness affects it), when telneting again, some TCP packets are lost, the client side has to retransmit them. Insist a bit more, and there are more and more packets which don't get acknowledged. Eventually, the telnet server may become non-responsive and the whole device stops responding to pings. Reboot the modem.

Whether using the forwarded port from the WAN to the client machine on the LAN is involved or not in prooking this behaviour is not known, more investigation needs to be done.

I contacted ZyXEL, they asked me to return the device. Let's see if they are able to reproduce the problem.

[ Posted on February 5th, 2010 at 17:31 | 1 comment | ]

Thursday, February 4th, 2010

New ADSL Modem

Categories: [ IT ]

The old A-Link RR64, Linux 2.4-based ADSL modem and router has been dying slowly for the past eight months or so, and when the “alarm” LED went suddenly on, I decided it was time to get a new piece of hardware before that one broke down completely. Since it had a hard time booting up after the power had been down, it was a good idea anyway.

After long discussions with my colleagues, I decided to buy a ZyXEL Prestige 660WP-D1, with an integrated WLAN base station. It's not based on free software, but the equivalent linux-based model by A-Link doesn't respect the GPL regarding the distributon of the source code (it actually doesn't even mention it's based on Linux), so I wasn't going to give my money to those people anymore.

I spent the whole evening and half the night yesterday trying to set it up so that it replaces the old device in the network. First thing, the ZyXEL does't have a DNS server for the local network, so I had to setup one on the server there using dnsmasq (merci tontonth :) ). This means I cannot get the outside DNS server's address from the ISP anymore (the router is unwilling to serve as a DNS proxy while at the same time propagating the dnsmasq's address through the DHCP configuration) but I have to set it up statically in dnsmasq. I hope it doesn't change its address every two weeks…

The second problem was that the NAS I use for backups is unable to get its IP address from the ZyXEL, so I had to set a static one.

But the weirdest of the weirdest, is that the machines connected through the WLAN were not able to connect to the ones on the LAN, which is a bit of a problem since the dnsmasq is on the LAN. After a long time reading the docs, I found in the latest firmware's changelog that the following bug had been fixed: 22. WLAN and LAN can not communicate with each other when the admin password is changed in the GUI. The new firmware indeed fixed the problem, but what screwy software design makes the bridging between two networks dependent on the admin's password and the GUI? This is bound to be a problem for any user who knows that default passwords must be changed, since the first time you connect to the Web interface as admin, it forces you to change the password.

Well, it seems to be working now. Let's cross fingers.

[ Posted on February 4th, 2010 at 12:21 | 1 comment | ]

Wednesday, January 27th, 2010

LPRng and Windows LPD Server

Categories: [ IT ]

We have two kinds of printers at work: old HP LaserJets and newer Ricoh multifunction photocopiers connected to the same Windows-based print server (accepting the LPD protocol).

While no particular option in /etc/printcap is required to print with LPRng on the HP printers, the bq_format=l option is needed for printing to the Ricoh ones. This tells Windows that the data must be printed as is, as explained on the LPRng mailing list. But why does it work without this option on the HP printers then?

[ Posted on January 27th, 2010 at 14:36 | no comment | ]

Tuesday, October 27th, 2009

Transcend 1 – Kingston 0

Translation: [ Google | Babelfish ]

Categories: [ IT ]

J'ai acheté il y a un an et demin un lecteur de cartes mémoires SD Kingston MobileLite. Il fonctionnait correctement sur ma vieille Debian Etch (avec un noyau 2.6.18), mais après l'avoir mise à jour en Lenny (noyau 2.6.26), le lecteur à cessé de fonctionner. Je l'ai renvoyé en garantie, on me l'a échangé contre un neuf, qui ne fonctionne pas mieux. Après un certain temps passer à fouiner sur le web, j'ai appris que quelque part entre le 2.6.18 et le 2.6.26 un certain nombre de contournements de bugs on été ajoutés au noyau afin de faire fonctionner des lecteurs de cartes SD plus ou moins mal foutus. Le résultat, c'est que le Kingston, qui est lui aussi mal foutu, mais différemment, ne fonctionne plus. La raison profonde, c'est que Linux tente de lire le dernier secteur de la carte (pour en déterminer la taille ?) et que lors d'une lecture par blocs, si le bloc contient le dernier secteur, le firmware du lecteur plante. Et s'il contient l'avant dernier secteur, il plante aussi. Le noyau 2.6.30 souffre également de ce bug, donc le problème n'a pas été corrigé depuis le 2.6.26. Et comme le lecteur ne fonctionne qu'une fois sur deux avec Leffakone (noyau 2.4.22), j'ai donc décidé de changer de crèmerie : j'ai acheté un lecteur Transcend P5, au nom nettement moins marketing, mais qui au moins fonctionne du premier coup. Transcend roulaize (pour le moment), Kingston pas.

[ Posted on October 27th, 2009 at 20:55 | 2 comments | ]

Tuesday, October 20th, 2009

Reverse Engineering the param.cfg file of Cowon's iAudio 7 player

Categories: [ IT ]

While I'm eating at work, I like to listen to the same podcast I was listening while commuting. But I don't want to search manually which file I was listening to, and at what point in the podcast I shut the player down. Since this information is probably in the player's system files somewhere, I just had to hack a bit and see if I could extract it.

The relevant file is system/param.cfg. At offset 0x0F, one can read a big-endian 16-bit number which is the offset in seconds from the beginning of the file where playing was stopped. That part was easy.

Now for the actual file. At offset 0x879, one can read a big-endian 32-bit number which is the first File Allocation Table entry of the file. And somehow, this wasn't difficult to guess, I probably would have designed it that way myself… Thankfully, the Mtools package in GNU offers a tool called mshowfat which takes a DOS path as an argument and returns the FAT range occupied by that file.

And Bob's your uncle.

[ Posted on October 20th, 2009 at 12:23 | no comment | ]

Friday, July 24th, 2009

Typematrix

Categories: [ IT ]

In linux/Xorg, use inet(dtk2000) in xorg.conf's XkbLayout option (in addition to whatever basic layout you are already using) to be able to use the navigation and multimedia keys in the Typematrix EZReach 2030 USB keyboard. Only the eject key is not working. After that, it's up to the applications or window manager to make use of them, this config option only associates X11 symbols to the keys. I hadn't found this information anywhere on the web, I hope it will be useful to someone.

[ Posted on July 24th, 2009 at 11:40 | no comment | ]

Tuesday, July 7th, 2009

Printing with LPR in Firefox

Categories: [ IT ]

Firefox didn't allow me to print by default. Printing to a file was the only proposed option. The culprit here is not even Firefox but GTK, which needs to be told that there is life beyond printing to a file. I put to my $HOME/.gtkrc-2.0 file the following line: gtk-print-backends="pdf,cups,lpr,file", and I could finally print to lpr.

[ Posted on July 7th, 2009 at 18:38 | no comment | ]

nohz=off is the Way to Go

Categories: [ IT ]

Debian Lenny's default kernel is tickless, meaning that there is no periodic tick anymore. As a result, it seems that some applications that use periodically short sleeps (as in while(1) { // do possibly something; usleep(250); }) are scheduled far too often and the CPU is running more than in should while the system is seemingly idle. Passing the option nohz=off to the kernel seems to have fixed that problem.

[ Posted on July 7th, 2009 at 18:34 | no comment | ]

Hello, Helvetica!

Translation: [ Google | Babelfish ]

Categories: [ IT ]

I didn't need to say bye bye to Helvetica after all. The least bad compromise seems to be using the bitmap Helvetica font for GUI anyway, and set Firefox to use DejaVu fonts without allowing web sites to decide what font to use (I don't have anything besides DejaVu anyway, so I won't miss anything by doing so).

[ Posted on July 7th, 2009 at 18:29 | no comment | ]

Bye bye, Helvetica

Categories: [ IT ]

I have used Helvetica as the sole font in WindowMaker for the past 12 years (AFAICR). I recently upgraded to Debian Lenny and switched from Mozilla 1.7 to Firefox 3.5 (at last!) I managed to setup my system to use the Helvetica bitmap font, which looks much nicer than Nimbus Sans (the Type 1 equivalent) in WindoMaker, and I was happy. But I discovered that Firefox now (AFAICT) prints Helvetica text using the Helvetica bitmap font, which produces very ugly documents. Mozilla was somehow smart enough to use vector fonts for that, but not Firefox. Helvetica seems to be something of the past :(

So I switched to DejaVu fonts for WindowMaker and Nimbus for GTK applications and Firefox. It's so sad.

[ Posted on July 7th, 2009 at 12:00 | 1 comment | ]

Monday, June 15th, 2009

Free est plus fort que moi

Translation: [ Google | Babelfish ]

Categories: [ IT ]

Il y a exactement 7 jours, la freeboite de mes parents est tombée en rade. Un coup de voltmètre sur l'alim montre qu'elle délivre toujours 12 volts, j'en conclue que la boite est morte. Après un certain temps passé à configurer XP pour qu'il utilise le modem 56k et connection au chat de la hotline de Free, je finis par obtenir un contact. Il me dit que le coup du voltmètre ne suffit pas pour conclure au mauvais fonctionnement de la boite, il va donc envoyer une nouvelle alim. Elle est arrivée cet après-midi. N'y croyant pas du tout, je la branche, et… Ô miracle, ça marche. Free a mauvaise réputation concernant le service client, mais là, ils ont été plus forts que moi.

[ Posted on June 15th, 2009 at 20:48 | no comment | ]

Saturday, March 21st, 2009

No for, no if

Categories: [ IT ]

The mission: write a program that iterates over a list and asks the user, on every item, if he wants to change the current number, or quit (and keep the rest of the list unchanged).

Here's a possible python implementation.

def loop(data, index):
  return decide(index == len(data) - 1, 
                lambda: quit(data), 
                lambda: run(data, index+1)
               )
 
def decide(condition, iftrue, iffalse):
  return (iffalse, iftrue)[condition]()
 
def choose(selector, choices, default):
  return choices.get(selector, default)()
 
def change(data, index, new_value):
  data[index] = new_value
  return loop(data, index)
 
def run(data, index):
  print data[index]," Change? [n/q/]",
  reply = raw_input()
  return choose(reply.lower(),
                { 
                  "n": lambda: loop(data, index),
                  "q": lambda: quit(data)
                },
                lambda: decide(reply.isdigit(),
                               lambda: change(data, index, int(reply)),
                               lambda: run(data, index)
                              )
               )
 
def quit(data):
  return data
 
data = range(10)
print run(data, 0)

[ Posted on March 21st, 2009 at 18:09 | 2 comments | ]

Wednesday, March 4th, 2009

Last.fm Datamining

Categories: [ IT ]

Interesting article about how personal profiles on different systems can be linked together by datamining:

“If your username isn't your real name, your Last.fm account may seem to be anonymous, but the facts it contains probably tell the world who you are.”

“even a small amount of information about other pseudonyms you've friended on Last.fm has a high probability of allowing a data miner to match you based on the friendship graphs from other sites”

“There are only 7 billion people on the planet, and only about a billion on the Internet. Every fact about a person (are they male or female? Where they live? Do they listen to Brian Eno?) slices that number down by a significant fraction. If you have enough facts about a person, (33 bits of independent facts, it turns out, because log2 7,000,000,000 = 32.7) you can determine who they are.”

[ Posted on March 4th, 2009 at 14:05 | 2 comments | ]

Friday, February 20th, 2009

Ricoh Aficio MP 4500: Taming the Beast

Categories: [ IT ]

I tried to use one of these wild devices to print a Letter landscape document on microperforated Letter sheets… in an A4 world.

When the printer is set to use A4 paper, it won't pay attention to the PostScript file telling it that the paper format is Letter. The result is that the print would be correctly positioned on an A4 sheet, but is shifted up the actual Letter sheet, because the letter sheet is aligned with the bottom of the would-be A4 sheet.

The solution is to feed the beast only portrait documents, centered on an A4 page, then shift the document 2.5mm to the left to compensate for the fact that it aligns the page's right border with the sheet's right border. This gets it really centered on the Letter sheet (it should be 3mm to account for the width difference between Letter and A4, but even A4 pages are shifted by 0.5mm; it would be too easy otherwise).

Finally, the bottom edge of the printed document is on the side of the back of the beast (the one that is against the wall, opposite of the control panel). This is important for the microperforated paper which has a smaller bottom margin than the top margin.

[ Posted on February 20th, 2009 at 17:04 | 4 comments | ]

Tuesday, November 11th, 2008

Automatic X Screen Saver -based Autoaway for Irssi

Categories: [ IT ]

I fixed a bug in xautoaway (actually, in X11::Protocol). The new version is available.

[ Posted on November 11th, 2008 at 23:46 | no comment | ]

Wednesday, November 5th, 2008

Automatic X Screen Saver -based Autoaway for Irssi

Categories: [ IT ]

xautoaway.pl is an autoaway script for Irssi that allows Irssi to go away automatically when your X Window session has been idle for some time. Additionaly, it supports Irssi running in a GNU screen, being detached from an xterm in one display and reattached to another xterm on another display. Distributed as-is, under “it-works-for-me” pseudo-license (and under GNU GPLv3 real license).

It requires the X11::Protocol module and some additional setup (the provided, incomplete extension to X11::Protocol to support MIT-SCREEN-SAVER and the screen wrapper to be run instead of GNU screen).

[ Posted on November 5th, 2008 at 23:40 | no comment | ]

Tuesday, November 4th, 2008

DICT-NetMOT Gateway

Categories: [ IT ]

I just finished motdictd.pl a gateway between the DICT protocol and the MOT online (not free at all) dictionary collection accessible to the University of Jyväskylä. It runs as a local DICT server, started from the command line by any user (preferably not root) and listens to 127.0.0.1 on port 2628. DICT queries are turned into HTTP requests to NetMOT, the resulting HTML code is cleaned up and returned as pure text to the DICT client. The CLI DICT client doesn't support multiple servers, so it accessing the gateway requires to call dict -h localhost if the default server is dict.org.

[ Posted on November 4th, 2008 at 11:09 | 1 comment | ]

Monday, October 27th, 2008

Synergy

Categories: [ IT ]

I just tested Synergy. This little tool allows to share one keyboard and mouse between several computers sitting next to each other (that is, each computer needs to have its own display) over the network. When the mouse cursor reaches the edge of the screen, it moves to the screen of the computer next to that edge (and the keyboard's focus too, of course). The great thing is that it works in Linux (and other Unices), in MacOS X and in Windows. So it's perfectly possible to have a mix of all these types of systems, and it woks seamlessly, without any extra hardware.

[ Posted on October 27th, 2008 at 22:47 | no comment | ]

Wednesday, October 22nd, 2008

Just for Fun

Categories: [ IT ]

This is the follow-up to the previous episode.

Today's discussion with Ville was concluded more or less like that: he claimed that having access to the source code is of no use for him although he can code, because he has never been able to gather the necessary energy to start hacking an existing software. Well, that's his problem, isn't it? I devote some of my free time to hack software (in a very insignificant way, I'm sure) to adapt it to my needs, he devotes his to something else. And I enjoy my small software hacks. I'm proud of myself when I manage to understand MPlayer's subtitles code and add support for DVB subtitles, or when I add support for X11's screensaver protocol to perl's X11::Protocol module. And let's be honest: LATEX is ridiculously complicated, but I enjoy fighting the beast and bending it to my will.

I have loads of fun doing things myself. I make my own pizzas from scratch (dough and tomato sauce, altough I don't grow the tomatoes, olives and wheat, nor do I breed pigs or milk cows), I make my own ice-cream, my own Home Theater PC, my own blog engine, my own Carcassonne meeples. Buying something ready-made feels like a waste of money if I can do it myself for a reasonnable cost in time. I'm not going to devote large amounts of time on large projects such as writing my own operating sytem, word processor or image manipulation software, mainly because the time it would cost me compared to the benefit I would get out of it compared to using the existing tools is not worth it. Hacking oversized projects don't really interest me, even if they have bugs and I'd like to fix them. But I very much appreciate that small, one-person -sized softwares are free for me to hack when I set my mind to it.

The ones who consider the freedom given by free software to be useless are the ones who are too busy/lazy to take advantage of it and have more money at hand than time.

[ Posted on October 22nd, 2008 at 23:41 | 9 comments | ]

Is Free Software Always Better?

Categories: [ IT ]

This is the follow-up to the previous episode.

So, is free software always better than the other kind? Jonne claimed that the “freedom” aspect of free software isn't an advantage for him, because free software is hard to change, and it takes a long time to implement the new feature you would like to add to it. The alternative would be to send a bug report or feature request to the developers. But both in free project and proprietary ones you may reach grumpy developers, who will consider your request as low priority.

Now the real difference between free and proprietary is that in the case of free software, you have the right to do it yourself. It may be difficult and take an enourmous amount of time (such as integrating CMYK in GIMP, which was not designed orginally to handle anything else than RGB), but it is possible if you are willing to devote resources (time and/or money) to it. With a proprietary software, if the developers don't want to implement your feature, there is no appeal. Jonne's argument was that you can always find a software (free or not) that does what you want. I claim that this is not always true.

The first example is that when I built my leffakone five years ago, there was no software running on Linux that supported DVB subtitles and automatic TV commercial removal. Actually, there was no software that was supporting these two features at all. So I took the time to implement them myself (and yes, MPlayer's subtitle code is an horrible mess). The second example is a recent problem with Python's X11::Protocol module. It had a bug that I managed to identify thanks to the source code, and I found a way to go around it. I submitted a bug report, but to this day (over a month later) it has still not been answered. X11::Protocol was exactly what I needed, but had it been proprietary, I wouldn't have been able to find a workaround, and would have needed to settle with a sub-optimal solution, which would not have been doing exactly what I want.

Jonne also claimed that developers don't need the source code of a software, but the software should be designed so that it can be extended. Firefox is a good example: a lot of features can be added as “extensions” and the developers don't need to access Firefox's source code. But not all software is designed to be extensible, especially if it is in the (financial) interest of the publisher to prevent anyone to develop an extension without its blessing. This means that if the extension you want to develop doesn't follow the publisher's commercial strategy, you won't be allowed to do it. And again there will be no appeal. An no, you don't always find another software that does the same thing and would allow you to develop your extension.

And guess what? Most of the software available nowadays is not extensible. That is, it's not meant to be easy to extend. If you want to change its behavior or fix a bug, you have no choice but to dig into the source code. And even if the software has been designed with extensibility in mind, it doesn't mean that the data it exports through its extension API contains all the information you need for your purposes. A good example of this if my blog engine, Bloxsom. It was designed to be extensible, most of the work is done by extensions rather than by the software's core. But for implementing features such as multiple languages and multiple categories, I had to change the core, because the extension API was not enough. And I don't know any other blog engine that fits my requirements. But hey, I don't know all the blog engines in the world, so I may be wrong.

To be continued.

[ Posted on October 22nd, 2008 at 23:14 | no comment | ]

Free Software is a Fad

Categories: [ IT ]

I started to use free software in 1996 (or was it 97?), with Slackware 3.0. The first reason why I decided to learn Linux is because Unix systems were the ones used by real coders. Windows already looked too much like a toy, had the bad reputation of a shaky house built over the sand of MS-DOS. And also because it was cool (from a geek's perspective, of course). The reason why I continued to use free software was that even though free software is free as in “free speech”, it is also free as in “free beer”. There were software filling my needs, and I adapted the topic of my free-time projects to what was available on Linux. For example, I could have continued to play aimlessly with SoundForge in Windows, but coding an IRC bot in Perl on Linux was more appealing. It was a creative process, the creation of somethat that acts (if only by reflex), on the contrary of something you contemplate with more or less awe (like music or a painting). And also, the IRC bot was working on my behalf, providing a service.

I had a long discussion with two colleagues the other morning, who claimed that Free Software is a fad. I didn't agree with them at first, thinking about the origins of the free software movement, but after reflection I have to admit that in the last five years it actually has turned into a fad. Not a passing fad like clothing fashion (although the pointy shoe fashion could have changed more quickly for my taste), but in the sense of something that a lot of people use, and who use it because everybody else is also using it. The reason for this is that free software is free (as in “free beer”) and people are more often than not choosing something free over something they have to pay for. The average software user doesn't care whether he has the right to modify software or not. He's a user, not a developer, and he doesn't know how to use this right. I guess plenty of users still use warez software or free (as in “beer”) proprietary software instead of free software, because warez doesn't cost more than free software (at lease from the point of view of money). In some cases, one free (as in “speech”) software can drive the fad. This is the case of Firefox I guess, which was in its time technically superior to Internet Explorer (it respected the standards of the Web and had popup and ad blockers). And I wouldn't be surprised that Firefox has been the main driving force behind the free software fad.

To be continued.

[ Posted on October 22nd, 2008 at 22:32 | no comment | ]

Wednesday, October 15th, 2008

FOAF

Categories: [ IT ]

FOAF means Friend of a Friend. It's an RDF vocabulary that allows to describe oneself and link to people one knows. In other words, it forms a distributed social network, independant from any service provider such as Facebook, LinkedIn, Orkut and so on. It doesn't allow you to send messages to other people in your network, or any of the activities that are often associated with social networks, it only describes you and your relations to the people you know.

Here's my FOAF descriptor, that you can also view through FOAFer. There's also FOAF-a-Matic, a simple web tool that creates a basic FOAF descriptor for you (a more advanced descriptor will required to write RDF by hand, though). Finally, there is also a FOAF Generator that creates a FOAF descriptor based on your Facebook profile.

So if you feel geeky enough to get your own FOAF descriptor and if you know me, let me know about it :)

[ Posted on October 15th, 2008 at 15:43 | no comment | ]

Thursday, August 28th, 2008

Patches for Snownews

Categories: [ IT ]

I wrote yesterday two small patches for Snownews 1.5.7. The first one adds support for the <content:encoded> tag (if such an element is present in the feed, it supersedes the <description> element). The second one fixes a bug that replaces <br> and <p> in the wrong place. Additionaly, it also inserts a newline when a <div> is found.

[ Posted on August 28th, 2008 at 00:05 | no comment | ]

Word Scrambler, Write-Only Version

Categories: [ IT ]

Here's a more compact, less readable version of the scramble function:

sub scramble {
  return $_[0] if $_[0] =˜ /ˆ[A-Z]/;
  my @l = split //,$_[0];
  @l[1..$#l-1] =
     sort { rand(1) < 0.5 ? -1 : 1 } @l[1..$#l-1];
  return join("", @l);
}

[ Posted on August 28th, 2008 at 00:05 | no comment | ]

« Vers le haut de votre âne » ou « les acronymes sont frais »

Translation: [ Google | Babelfish ]

Categories: [ IT ]

J'ai ajouté aujourd'hui des liens automatiques vers Google Translation afin que les lecteurs qui ne maîtrisent pas la langue de Shakesière (ou Molipeare, c'est selon) puissent avoir une idée de quoi je parle. J'en suis très fier, car chacun de ces liens offre une source quasi-inépuisable de fou-rire. Voici en particulier celui qui vient de me faire hurler de rire.

La traduction automatique est vraiment un outil formidable, on ne s'en lasse jamais.

[ Posted on August 28th, 2008 at 00:05 | no comment | ]

Editing MPEG TS Streams

Categories: [ IT ]

When I record a TV show on Finnish DigiTV, I get an MPEG TS file containing interleaved audio and video streams (as well as a subtitle stream if the TV channel uses them). Removing the commercials or even simply the five minutes padding at the beginning and the end is not completely straightforward, but can be done quickly with some simple tools.

editmpegts is a command line tool I wrote that takes an MPEG TS stream and an edit list (in MPlayer's EDL format), specifying the time positions of commercial breaks and cuts the MPEG TS into slices to keep only the interesting part of the recording. I then transcode the slices individually, and contatenate them with avimerge.

There are however a couple of pitfalls if you want to use mencoder to transcode the slices into e.g., XviD+MP3, since the MPEG 2 video decoder resets every time the aspect ratio of the video changes. When doing 2-pass encoding, this means that the stats gathered before the change of aspect ratio will be lost, resulting in miscalculated bitrate and far too big output files (at least in the old, overpatched version of MPlayer I'm using).

mencoder reacts on two things: the change of the value in the aspect ratio field in the MPEG sequence header, and the presence of an “End of Sequence Marker”. editmpegts forces all the aspect ratio flags to the same value, and simply suppresses the marker by overwriting it with the data that precedes in within one TS packet. It is all done in one pass, no need to demultiplex and remultiplex the stream (but it does copy the data into a new output file, it doesn't therefore modify the input file).

The MPEG TS streams broadcast by SubTV contain loads of sequence headers but very few end of sequence markers. My understanding is that every sequence (starting with a sequence header) should end with an end of sequence marker, so SubTV's streams are illegal. But I may be wrong. Anyway, it works fine with MPlayer (and now with mencoder too), so who cares?

[ Posted on August 28th, 2008 at 00:05 | no comment | ]

Monday, October 1st, 2007

More Dirty Things to do in Perl: Unsorting

Categories: [ IT ]

I discussed today with Matthieu Fritz about how the act of reading was processed in the brain, and he reminded me of a chain e-mail containing text where the letters of the words were scrambled, except the first one and the last one, and which was still surprisingly readable. He wondered if it worked with any text, or if the text in the e-mail was carefully composed. I quickly hacked a Perl script doing the job, and in the middle of writing it, I was wondering how I could scramble the letters of a word without writing too much code. The the solution popped into my mind: use sort, unsing rand instead of a comparison function. Here's the resulting script:

sub scramble {
  my $s = shift @_;
  my @letters = split //,$s;
  my $first = shift @letters;
  # Do not scramble words starting with an uppercase letter
  return $s if $first =˜ /[A-Z]/;
  my $last = pop @letters;
  my $rand = int(rand(2));
  # $rand == 0 means that the letters won't be exchanged, but we want as much
  # scrambling as possible, therefore we discard the use of 0
  $rand = -1 if $rand == 0;
  my @l = sort { $rand } @letters;
  return "$first".join("", @l)."$last";
}
 
while (<>) {
  # Scramble the words composed of lowercase letters and accentuated
  # characters
  s/([a-z\xa0-\xff]+)/&scramble($1)/ge;
  print;
}

Verdict: it works with short and common words, but not with longer or rarers ones.

[ Posted on October 1st, 2007 at 20:39 | no comment | ]

Saturday, June 30th, 2007

Elisa/Kolumbus webmail virhekorjaus

Translation: [ Google ]

Categories: [ IT ]

Mozillalla (ja ehkä myös Firefoxilla) Elisan/Kolumbuksen webmail ei toimi hyvin, koska viestin otsake ei näy. Tässä on helppo korjaus:

userContent.css-tiedostoon, lisätään

div#mail-header, .content-functions, div#mail-steps, div#contact-cards, div#contacts-header, div#view, form.search, div#mail-header p, .splitted, form.search p, .action-info, p.go-oma-elisa, .prompt-controls, form#login p, .new-features { height:auto ! important; }

userContent.css:n paikka rippuu siitä, mitä käyttöjärjestelmä on käytössä. Tämä sivu selittää mistä se löytyy Firefoxilla (englanniksi).

[ Posted on June 30th, 2007 at 19:22 | no comment | ]

Tuesday, April 24th, 2007

Firefox Vs. Mozilla

Categories: [ IT ]

I installed yesterday Firefox 2.0.0 on my desktop computer, which is a silent, low consumption computer based on a Via C3 processor (1GHz, 256 MB RAM). Guess what? When scrolling down a long page (the main page of this blog), Firefox was slower than Mozilla 1.7.5 which I have used for years. Mozilla was scrolling down more or less smoothly, using up to 70% of the CPU time, whereas Firefox was not smooth at all, using 100% of the CPU most of the time. Firefox maybe an advanced browser, but definitely not a lightweight one whatever some people may claim. I think I'll stick to plain old Mozilla for still some time.

[ Posted on April 24th, 2007 at 22:01 | no comment | ]

Tuesday, March 27th, 2007

Nerd Score

Categories: [ IT ]

I found a nerd test on Tinou's blog, so of course, I had to take it. Looks like I'm quite a nerd…

I am nerdier than 93% of all people.

[ Posted on March 27th, 2007 at 15:28 | 3 comments | ]

Geek Score

Categories: [ IT ]

Damn, they had a geek test on the same page, so of course, I had to take it too.

My computer geek score is greater than 100% of all people in the world

[ Posted on March 27th, 2007 at 15:28 | 1 comment | ]