How many poppies on the photograph?

poppy love.... #9 -- I see redMaybe you already have had to count a large number of items on a picture.

I you have, you know it was tedious and needed quite a lot of focus for an apparently basic task.

So, I put online a very basic application to help you doing it. It does exactly this:

  1. Upload your photo
  2. Mark the items you want to count by clicking them

That’s it. The script will count the marks for you.

Additional tips:
You can modify the picture size by drag-dropping the bottom right handle. You can also use the “+” and “-” keys on your keyboard. The “*” key will set the picture to its original (when loaded) size.

I’d rather not have to read over my fellow’s shoulder

don't read over my shoulder
I generally agree with Agile principles. For the most part, I have not had the chance to put them in practice yet but most of them just seem to be the right thing to do.

I must admit I am still very defensive on one Agile engineering practice though: The binomial programming, promoted by the XP method. While I fully understand the big benefits of a code review, I just cannot imagine myself looking over a brother fellow’s shoulder while he is coding.

Being watched, while not very pleasant, is bearable. But the reviewer position just sounds like hell to me. Not only is he not coding, but he cannot control the rhythm of the code that is produced in front of him. Either it is going too slow and he is going to get bored and/or irritated or it is going too fast and he won’t understand and will get bored and/or irritated.

Fortunately, it looks like some alternatives do exist.

How to jump from sudoku to configuring D code-completion in Eclipse

Rocky meets the town musicians of Bremen
Hacker News published today a small code snippet by Donald Knuth who exposed his way of programmatically resolve sudoku grids.

The snippet uses a strange .w extension and its syntax, although being very close to C, showed some strange particularities.

  • Comments seem to be marked using @<…@>=
  • The source code includes a @c declaration
  • Some parts were just strangely full of @:

    @d panic(m) {@+fprintf(stderr,"%s!\n%s",m,buf);@+exit(-1);@+}

From all these elements, I assumed that the code was written in D.

And if D is good enough for Donald Knuth, then I had to give it a try. Actually, I was coincidently looking for an efficient compiled language and D looks like a good candidate.

I love python, I like PHP, I will very soon fancy Ruby, but there are some times where efficiency does matter.
.Net and Mono (now) application run quite fast but sometimes you just want a binary, without having to get a framework installed, e.g. for a cgi script at your hosting partner that did not and will certainly not install mono libraries on his RedHat server.

Why not C/C++?
Sure. I am a bit rusty on C and a bit rustier on C++ but every descent programmer must know them. Period. No excuse.

The only thing is that we are in 2010 now. Knowing a language is nice. Having to work with one that does not include a garbage collector and where you need to explicitly malloc your structures is much less nice on a day-to-day basis.

And C is nice and clean but it is not object-oriented. And I agree with Steve Yegge that “C++ is the dumbest language on earth“.

So, D looks nice. Good performances, object-oriented, a garbage collector, some strings support, even some native unit-testing support. Well, a real language in other words. Further, its affinity with C/C++ tends to make me think that the learning curve may be lower than for other languages.

And so I jumped on Digital Mars website to get some more info.

And it turns out that comments in D, are just exactly the same as C ones: our old good // and /* .. */.

This lead to only one conclusion: Donald Knuth’s code was not written in D.

It turns out that the downloadable programs available on Donald Knuth’s web site are written in CWEB, a language that was invented by.. Knuth. Basically, it is a mix between some TeX and C, meant to write code for machines and human.

CWEB source codes can be parsed to produce some TeX documentation and some workable C code.

But anyway, even if Knuth does not use it (and maybe he does), I still want to give D a try.

I use Eclipse as my main IDE, for PHP and python. I also set CDT up and, even if I do not use it much, find it very good.
My choice of IDE for D was naturally Eclipse too.

There is an Eclipse plugin available to handle D. It is called Descent.

I must admit that it is not as polished as JDT, CDT or PDT or even Pydev can be.
As an example, by default, Descent does not handle code-completion, nor does it define a compilation/debugging environment.

There are some docs available on descent site and on the web but they mostly target either Jaunty or Windows and use an older version of ldc and things slightly differed during the installation/configuration on my Karmic distribution.

Here are the steps I used to configure the code completion:

I have not configured the compiler and debugger in eclipse yet but I am pretty sure it is very easy if you use ldc.

I also installed GDC, which has the big advantage of being part of Ubuntu repositories but I have not yet managed to make it work with tango, although it looks like it is possible.

Looking for a job

As you know if you had a look to my about page, I am looking for a job in Montpellier.

The reason I want to leave my Anjou is that:

  1. I am currently working for acer, who bought Packard Bell. It is no secret that there is no future for a former Packard Bell employee in this company.
  2. My girlfriend is in Montpellier since September 2009. I am really looking forward to share the same location as her back again.

Anyway, in addition the Resume that is published here and there, I just publisehd a new one on

It is good to laugh sometimes

(hip hip array!)

From Stack Overflow

Mysqldump options

It is always a hassle to remind the proper options to use with mysqldump for me. My users are usually not granded to perform some locks and the default options are bad (who wants a dump in memory Oo?).

Here is one call that seems to work fine and pretty fast:

mysqldump -uuser -ppass -h host --skip-opt -q -e -Q --add-drop-table --create-options db [tables] > output.sql

When you start remembering names

When I was a child and started to listening to music, I had a little monophonic outdated set.

At the time, I remember that the sound that was coming out of the box was a quite indistinct continuous stream. I could make the distinction between two stations but could not name the song or the bands that were playing on. It was just “music”.

Very soon, I learned that I liked one song more than another. In order to be able to exchange with my friends at school, I started focusing on the band names and then I knew I definitely like The Cure‘s music far more than Samantha Fox‘s one.

Because I now knew the names, I could find the records at the media library, exchange with some friends, who suggested me new bands. I could read some music magazines to learn things about Joy Division and Tony Wilson. And because I then knew who Tony Wilson was, I could soon discover the other bands that used to play in the Haçienda in Manchester.

I was learning faster and better.

Naming things is a first step to think about them.

This can seem very obvious but it is actually quite common not to know names.
I do not know one single name of an American Football player. This is because I do not actually really care about American football. And that’s OK. You cannot be interested in everything. You cannot know everything either.

But if you are interested in a domain, I would suggest you try to remember its actors name. And this is also valid for code and IT.

It is very easy to embrace code by just doing it and keep avoiding to think about it. There is too much work, too much to learn already. Why would I bother learning who is doing or did things around?

Because it helps to think.

As an example, how to answer a common question like “should I use unit tests”?

If you don’t use unit tests already, you will jump on the first article that states they are not that useful and that in real life, it is OK to skip them.
You will because the normal human behaviour is to

  • fear change
  • be lazy

And you are human.

But if you know that Joel Spolsky, despite being an excellent writer and being a guru in software management, is also quite out of the code now and more, is also tempted to take the controversial side of things, you might reconsider your position and instead take advice from real coders.

And if you do, you will write unit tests.

I, personally, still am at the very beginning of this process. I still have a LOT of names to learn, relations to build and of course even more things to learn.

Python rocks

Lately, I was complaining I could not find any class-oriented language supporting some kind of inheritance for static properties.

Well, I found one. This is a little embarrassing as I was considering myself as having had a good-enough look at python. I was wrong. I had missed this, among a lot of other things. Reading the official doc and writing one or two “Hello world” projects is definitely not enough to judge a language. You just cannot know what it is till you haven’t started to actually work with it.

Anyway, look at the code:

# module test
class A(object):
    def methodA(cls):
        print "I am method A, called from %s" % cls
class B(A):
# from python shell
>>> from test import A, B
>>> A.methodA()
I am method A, called from <class 'A'>
>>> B.methodA()
I am method A, called from <class 'B'>

The way it is implemented looks a bit funny at first but makes sense if you think about it and consider its history (in python 2.2, you had to write method = classmethod(method) ).

Python also allows you to define “classic” static methods as well, using the @staticmethod decorator.

No Javascript for OpenOffice macro

I updated my work system to the Karmic Koala version of Ubuntu and had to reinstall a couple of things (everything actually as the ugrade script did not run that well and that I had to format everything but that was a nice occasion to clean up some mess).

Anyway, when I opened my OpenOffice and wanted to fire my Javascript macros I had written a while ago, they had vanished! More: It was not even possible to create a Javascript macro ; the option was greyed out.

Simply, an

sudo apt-get install

did the trick.

NB: You might also check that a JRE is properly set up in Open Office (Tools > Options > Java)

Search in your Gmail with Ubiquity

First, you will need Ubiquity installed.
If you do not know ubiquity, rush to the url above. It is a really great extension for firefox that will definitely make your life easier.

I often need to search my gmail but do not like to keep it opened as its extensive ajax usage makes my firefox really slow after some time. To my surprise, I did not find an existing ubiquity command for this and the create-search-command did not work for me.

So I just wrote the command by hand. If you are interrested in it too, here you have: