Couverture du livre «Kleiner Sprachatlas der deutschen Schweiz» avec en fond la carte pour le mot «Gouille»

Le petit atlas des langues de suisse-alémanique

Lorsqu’on vit dans un contexte donné, il est toujours difficile d’apprécier ce qui est normal de ce qui est une bizarrerie locale. Même si le est un sujet de discussion et de rancœur récurrent en Suisse-romande, on insiste peu sur le fait que c’est quelque chose d’assez spécial : il ne s’agit pas d’un dialecte, mais d’un groupe de dialectes assez fortement différenciés, l’usage du dialecte est présent à travers toutes les couches sociales, et les gens qui parlent ses dialectes sont habituées à se comprendre entre-eux.

Le général de Gaulle aurait dit Comment voulez-vous gouverner un pays où il existe plus de 300 sortes de fromage ? En suisse la question à poser serait plutôt : comment voulez-vous diriger un pays où il existe plus de 25 mots pour parler d’un bonbon ? Par bien des aspect la situation est plus exotique que ce décrivent bien des auteurs de Fantasy qu’ils soient anglo-saxons ou français.

Kleiner Sprachatlas der deutschen Schweiz
, ,
Infographie : Manfred Renn
Huber Verlag
ISBN : 978-3-7193-1524-5

Le petit atlas linguistique de la suisse-alémanique (Kleiner Sprachatlas der deutschen Schweiz) est un livre très intéressant qui établit une carte linguistique de la Suisse, pour 120 mots on y trouve la carte de la suisse et les différents mots et prononciations à travers le territoire. En face de la carte se trouve une page d’explications.

J’ai trouvé très intéressant de voir à quelle zone géographique se rattachent les mots que j’utilise. En général il s’agit des mots de la région Zürich-Thurgovie, mais parfois il semblerait que j’utilise des mots de la région bernoise, typiquement quand c’est un mot qui a été importé du français (ce qui est assez commun).

Plus généralement, les cartes révèlent une complexité fascinante, qui ne correspond pas tellement à ce que l’on pourrait attendre si on lit la wikipedia : un certain nombre de dialectes clairement distincts et séparés à cause du cloisonnement social et géographique. Au lieu de cela, chaque mot révèle une carte différente, un peu à l’image de l’histoire suisse : alliés pour un mot, deux régions peuvent se retrouver opposées pour un autre. Au delà des mots, les pages contiennent des explications intéressantes sur les phonèmes, la grammaire.

En bref, un livre intéressant si vous êtes curieux à propos du suisse-allemand et la structure des langues de manière plus générale.

Flattr this!

Squid cache logo

Enabling the Squid Cache Manager

Squid cache logo

I have had a squid proxy running on my NAS for ages, but I was never really able to quantify the effectiveness of the cache. There are a lot of small scripts that parse the squid logs and output some statics, but that is not very satisfactory. Today I realised that Squid offers some kind of web UI to visualise the state of the cache manager.

The squid cache manager is basically two parts, one part that runs on the squid proxy itself, and cgi-bin program that can be run on any web-server. As I did not see the point in starting a web server on my NAS just for that, I decided to run the cgi program on my laptop. Here are the steps to get this running. This assumes you know how to use vi and have ports installed on your Mac.

  1. Connect to your NAS as root
  2. vi /opt/etc/squid/squid.conf
  3. Find the line with this text http_access allow manager localhost and add http_access allow manager localnet just below. This will grant access to the cache-manager to your whole LAN.
  4. Restart Squid: /opt/etc/init.d/S80squid restart.
  5. Logout of your NAS.
  6. On your mac, install Squid sudo port install squid @2.7
  7. Go to your CGI bin directory pushd /Library/WebServer/CGI-Executables
  8. Install the cgi clientsudo ln /opt/local/libexec/squid/cachemgr.cgi ./
  9. Edit the configuration file of said tool sudo vi /opt/local/etc/squid/cachemgr.conf
  10. Replace localhost with the hostname/address of your NAS.
  11. Point a web browser to the address
  12. The web-UI will ask for some name/password pair, give any random thing
  13. You should see a web UI to Squid.

Flattr this!

Lena dithered

Light dithering

As I’m mostly working on back-end and pipelines those days, I don’t do much user facing code. To compensate a bit I have been playing around with Javascript and Html5. While I can’t say that Javascript is elegant, it is very easy to play around with, the modern equivalent of Basic, I suppose.

So I wrote a small dithering function, it uses a simpler error distribution matrix than Floyd–Steinberg as it only distributes the error on the pixels to the right and below the one considered. The algorithm also uses some randomisation to avoid patterns.

In order to respect traditions, this one dithers the classical Lenna image. Just click on the button to load the image and the button to dither the image.

Image: Lenna

Flattr this!

chidokai logo


Red circle with 致道館 containing a red disk containing 七い

Besides 合気道 (aikidō), I now have been following some 空手 (karate) classes at work for a few months. The classes are given for free by a colleague and we use either the fitness room or one of large meeting rooms for this. My main motivation for doing karate was to strengthen my posture and get some muscles. While my posture problem is also corrected in aikidō, this is less of an emphasis. As for getting some muscles, given aikidō’s emphasis on not using strength, this is just not happening.

I had done some 少林寺拳法 (shōrinji-kenpō) while I lived in Japan, and the current karate course at work was not the first of its kind. There were previously two courses of 功夫 (kung-fu), which faltered for various administrative reasons. The main advantage of doing sports at work is that it is very close and convenient, I basically just need to go down to floors. The main disadvantage is that it is in the work context, where I already spend plenty of time.

The particular school of karate we are learning in is International 空手連合 (karate rengo), a variant 致道会 (chidōkai), which descends from 松濤館流 (shōtōkan-ryū). As far as I can tell, the logo is “七い” (seven + “i”), with the word 致道館 (chidōkan) written below, but my reading of the symbols in the center don’t make much sense, so I’m probably missing something.

Training is quite different from aikidō: there are no rolls and falls, which is probably a good thing because the rooms we use for training have no mats. There is a heavy emphasis on basic moves and katas, which take up most of the time of lessons. According to the school’s web-site the goal is to not stress beginners:

Les exercices de coups de poings sur place comme les Kara tsuki 1, 2,3 ou sonamba tsuki sont suivies par des déplacements de faible amplitude dans les quatre directions, comme le kihon yondosa, toujours dans le soucis de ne pas brusquer le débutant.

While this fulfils my initial objective, I must say it feels pretty abstract at this stage: I spend most of the time doing empty movements in front of the mirror. One of the first exercices, 空付き (kara-tsuki) means empty punches. The end result feels more like I’m doing ballet than anything else. Kata are a bit troublesome, as I have a horrible memory for sequences and I easily confuse left and right, so I have to spend concentration on the sequence instead of the actual moves. Also the general combat philosophy seems to be to stand ground and do strikes, when you are the shortest guy in the class, this does not sound like such a good strategy.

So my feelings are pretty mixed, I think this practice is very positive for me, but at the same time, training is a bit frustrating, as philosophies are not aligned:

Une fois que la base est solide, les techniques de combat et les katas sont abordés avec beaucoup plus de facilité. Tout cela a pour but d’aider l’entraîneur et l’élève à optimiser le temps consacré à l’entraînement. La structure en est précise et suivie. Il n’y a pas de place à l’improvisation.

Basically, the school’s philosophy is to optimise training time by having very solid basics with a very precise structure. I don’t really care for optimising my training time, I don’t have any particular illusions in reaching a significant level in any martial arts, they are just a mean for me to have better life. On the other hand, I’m a pretty chaotic person, so following a very precise plan is not exactly my forte, it comes as no surprise that my favourite part of aikidō is 乱取り (randori), literally grasping the chaos, which means a lot of improvising…

So I think I’ll keep aikidō as my main martial art, but keep doing the karate training to try to fix my stance and strengthen myself a bit…

Flattr this!

Fake bike with square wheels, broken.


Fake bike with square wheels, broken.

A few days ago, there was a bike with square wheels parked close to this office. This was obviously a part of an advertisement campaign for a cigarette brand. Officially they are advertising for the new shape of their cigarette packs. Of course, a few days later, the bike had been befallen by the same fate as any bike left to long in a city: it was broken.

Cover of a singing book: a tree with below it a lady with a yellow blouse and a brown skirt, reading from a book. She is surrendered by five kids.

There is something fascinating in seeing more and more indirect advertisement (let’s call this Indvertisement), in particular by companies whose core product is problematic. The goal seems to be to do something sufficiently weird to go viral, while at the same time keeping enough distance from the actual product. As people become immune to advertisement, they need to be more subtle, more embedded in everyday lives. Of course, this makes it also easier to create fakes, like Greenpeace’s Let’s go arctic fake Shell campaign.

When I was a child, my mother had a song book entitle Chömed Chinde, mir wänd singe, sponsored by Maggi. The book contained full page colour illustrations, in each of those, the name of the sponsor appeared, in a small and subtle way: a box of condiments on a shelf, a branded toy truck pulled by a small boy. Unlike today, where the name of the sponsor is typically pre-prended to the real name of the thing, the book’s name bore no relationship with Maggi. This was considered advertisement. Maybe we will get back there eventually.

Flattr this!

Floating point considered harmful

bool foo() {
  float a = 0.6;
  float b = 6.0;
  return (a == (b * 0.1));

bool bar(float c) {
  return (c != c);

When I learned coding on the C64, the two main tools where Basic, and direct memory access. Any advanced stuff was done in assembly. So basically, coding involved pretty much only pointer arithmetics and goto statements. Of course this was a long time ago and such constructs are now shunned, and many newer languages even prevent the code from doing such thing, which is probably a change for the better.

Strangely, there is one type of operations that is very dangerous, but which most languages do not restrict: floating point operations. Consider the snippet on the side, will foo return true? Maybe, but there is no guarantee that the bit representations of a and b will be equal. Will bar ever return true? Yes if c is NaN. Generally speaking, comparing bit for bit two floating points is a bad idea, and providing that operation to the programmer is a disservice. Floating point semantics are complicated, and only partially visible in the programming language: rounding, extended precision are typically not accessible.

A lot of the code I have seen just happily assumes that floats basically behave like integers, why would it not? Floating point numbers are the only types which in each and every language are allowed to have the same operators as integer. In most of the cases, using a fixed point (currencies) or fractional representation (computing averages and such) would be more appropriate, but such constructs are typically missing in the language, or are second class citizens – Python for instance only had fractions since version 2.6 and there is no shorthand notation to create them.

The only languages I used which had put some serious thoughts in their numerical representations where Ada and Smalltalk. The others seem to be happy to just clone C operations.

Flattr this!

Thias の blog displayed in NSCA Mosaic 2.0.1


Thias の blog displayed in NSCA Mosaic 2.0.1

Compatibility is a recurring theme in computer science, a myth that would exist if programmers followed the rules. I was playing around with an emulated Mac running system 7.5, and as soon as I had a running TCP/IP stack, I ran an old web browser and pointed it to my blog. The web browser was Mosaic 2.0.1, created in 1995. So there are 17 years separating the client and the server.

The good news is, the page loads. The bad news is, the page content is pretty broken. The HTML language was designed so that the display would gracefully degrade in browsers that do not support all features, but this page involves three incompatible changes:

  • PNG images
  • UTF-8 encoding
  • Javascript

The switch from the GIF to PNG image format was caused by patent issues, not much to say here, excepted that patents are a nuisance. The change of character encoding was necessary because the initial design of HTML was broken, it was largely inspired by the LaΤeχ typesetting and so would represent non ASCII characters as escape sequences (at least in HTML the name-spaces are clearly separated), still this required each and every non-ascii character to be named and escaped, this made a system that was supposed to be human readable unreadable for most languages on the planet.

As people soon figured out that this system would not work, support for the various platform and country specific encodings was added. We have not finished fixing this mess, and I regularly encounter bugs caused by people who still use one of those encodings (usually iso-latin-1). That is really a shame, because the first draft of Unicode was published in 1988.

The last technology is probably the most hated on the web (except for Flash maybe), something that grew out of the need to do form validation and became the universal solution used to fix all problems with web protocols. The irony is that Javascript is not very useful to do form validation, mostly because validating dates, colours and such is much easier to do on the client, which knows the user’s locale, so HTML5 introduces new tags and attributes to do proper form validation (without javascript).

The interesting thing is that while things broke at the display level, at the connection level everything ran fine, Mosaic could even connect to the proxy that runs on my NAS. Does this mean that the low level stuff was better designed that the presentation layer? I’m not really sure. The HTTP 1.1 is a very simple protocol. While simplicity is a nice property in a protocol, if the protocol is simple because all the complexity was pushed to the upper layers, then the protocol is not elegantly simple, it is just not doing its job. Some people call this New Jersey design style.

The HTTP is simple because it is a thin stateless wrapper around TCP/IP. So all the issues that are not handled in the lower layer (where they should be) have to be handled in the application layer: state (cookies), multiplexing (data: protocol), cryptographic exchange (keygen tag, complicated javascript libraries), deferred loading ( XMLHttpRequest), application level routing, etc. The protocol makes it very easy to write a web server is three lines of shell script, and awfully hard to make a scalable web-server.

Recently they have been talks about a new version of the HTTP protocol, and I agree with Poul-Henning Kamp that the current proposal are not very interesting. They fix a few hedge cases and improve performance by just hacking the protocol further. But at least an old web browser will still be able to connect…

Flattr this!

Screen capture of the 'Space Map' application

68K nostalgia

Information Box about my Conversion Program for the old Macintoshes

Ars technica had a nice post about Cracking the Agrippa, an old cryptographic puzzle dating from the classic Mac. The second page includes instructions to set up an emulator running Mac OS 7, and I have recently recovered the binary file of some very old programs I wrote, so I set-up a virtual machine a tried running my old creations.

There were two programs: one that was doing simple date conversion from gregorian year to the system of the elves in the (paper) RPG I friend of mine wrote, Tigres Volants. The second, more ambitious, did a 3D projection of the solar systems in that RPG game setting, using an Elite style display. Unsurprisingly the second program crashes (in those days I was developing on a colour Mac, and never really tested the thing on a black and white Mac), but the first program still runs.

screen capture of 'Conversion de Date' running on a black/white Mac

The date conversion program would be trivial to rewrite in Javascript, and I remember rewriting the map program in Java using AWT. But in those days, writing a GUI was not so easy, as you had to write all the event handling code yourself. On the positive side, binary size was very small: the date conversion binary is 9514 bytes long and includes icons and information text.

I wrote those program while at the university, but probably recompiled them, or at least edited the resources during my PhD at EPFL (hence the e-mail address). I have since then lost of the source code, it might be rotting in the old Jazz cartridges that are rotting away in my cellar, for which I have no working drive anymore.

If you want to play around, I have created a small disk image (64K) that contains both binaries.


The second program is not the 3D map of space, as I had though, instead it generates a color-map of a planet based on the hash of the name and some general data. I work nicely in emulation on a color-mac.

Second Edit:

Now that I have a working emulator, going through the archives is much easier. So I found the binary (and the source code) for the space map application. So I created a second disk image with the application and the data file. Because of the data, the file is much bigger: 680K.

Screen capture of the 'Space Map' application

Flattr this!


Falsehoods programmers believe about geography


Computer science is a unique branch of engineering in the sense that programming by itself is not helping much. To actually to write useful programs, one needs to understand what the programs are about. One of dangers of programming is having an erroneous model, and it is very easy to base a system on falsehoods. There are two very interesting posts about this on this subject on the web:

Here are some falsehoods about geography I found in software, the list is, by far, not exhaustive.

Places have only one official name
Some places have multiple languages, so multiple names, which can be quite different: Genève, Genf, Ginevra.
Places have only one official name per language
That might be true in an ultra-centralized state which never changes its mind. The hill behind my flat has two different names, depending on the maps. On the topographic maps (used by the army) the name is “Äntlisberg”, while on the city map, the name is “Entlisberg”, both are official. In Taipei, the romanized street names used to use different romanisation rules depending on the quarter, so the official street name changes.
Place names follow the character rules of the language
Place names are usually old, often created before the language and their rules have been stabilised, so this does not hold. For instance, the rule says in german the sequence “ue” is equivalent to “ü”. This rule works because the “üe” sound has died out in german. The hill over Zürich is named “Üetliberg” (and pronounced as such).

Place names can be written with the usual character set of a country
One of the Kergelen islands (part of France) is called Île de Croÿ, most french persons have no clue how to type the “ÿ” character.
Place names can be written with the exhaustive character set of a country
That would be true if street where never named after foreigners with strange accents in their names. There is a Béla Bartók square in Paris. The “ó” is not valid in French.
Places have only one official address
There is a dam in Geneva than span the Rhône and therefore the border. The dam has two street addresses, one in Switzerland, one in France.
Countries have capitals
Switzerland does not. The government is currently in Bern, but the city is not the capital.
Buildings do not move
In Zürich, a 6200 ton building was moved by 60 meters to make way for railway tracks
Street adresses contain street names
In many remote places in Europe, the hamlet name is considered a sufficient address.
Language codes will match the country code of the country they are associated with
The country code for Japan is jp, the language code is ja.

Edit: an interesting article about Falsehoods programmers believe about addresses.

Flattr this!