No more Ads.

July 31, 2010

Apprently, my blog have been sucessful enough for WordPress to spam ads here and there. That’s fair, I suppose, as they have to pay for the infrastructure and all, but nevertheless I bought the No Spam Package to get rid of them. When I’m looking for information there’s not much I hate more than those add-ridden sites that have like, one 15 lines paragraph of text surrounded by 10 of those stupid Evony adds (or worse) with a “next>>” link somewhere in the midle of the junk. I hope you’ll keep envoying my (mostly) add-free blog*.

* Except for my occasionnal Amazon-linked suggested readings, which I find quite whorish already.

Suggested Reading: Patterns for Parallel Programming

July 30, 2010

Timothy G. Mattson, Beverly A. Sanders, Berna L. Massingill — Patterns for Parallel Programming — Addison-Wesley, 2005, 356 pp. ISBN 0-321-22811-1

(Buy at

If the Gang of Four changed the way we discuss about software design by introducing a catalogue of basic software patterns, this books vies to extend it to parallel patterns. But let us be clear, it’s not a book about parallel algorithms; no, it discusses parallelism in very general terms and present the few prototypical application types and how they can be efficiently broken down by data structure, command flow, and synchronisation, while remaining rather high level.

Read the rest of this entry »

Being Shifty

July 27, 2010

Hacks with integer arithmetic are always fun, especially when they’re not too hard to understand (because some are really strange and make you wonder what the author was thinking when he wrote that). One such simple hack is to replace divisions or multiplies by series of shifts and additions.

However, these hacks make a lot of assumptions that aren’t necessarily verified on the target platform. The assumptions are that complex instructions such as mul and div are very slow compared to adds, right shifts or left shifts, that execution time of shifts only depends very loosely on the number of bit shifted, and that the compiler is not smart enough to generate the appropriate code for you.

Read the rest of this entry »

Getting Clip-Art

July 20, 2010

Interoperability of software is still a major issue. Not only closed systems do not play well with others, open systems sometimes—often—have the same problems with exchanging information. One that only plays well with others when forced to is, of course, our good friend Microsoft. Sometimes they pretend to play well, and other software developers must reverse-engineer the file formats to read and write data in a compatible format.

One minor annoyance is Microsoft Office’s clip-art bundle file format that is not supported (at the time of writing, anyway) by Open Office. This means that you can download clip-art for your presentation only to discover that they are perfectly useless. Or, you can take 10 minutes and look at what the bundles actually contains!

Read the rest of this entry »

One Does not Simply Rename Into C++

July 13, 2010

Programming is in many ways more art than science—I do not want to start that debate in this post—in that you need more than mere functionality and correctness to have great code. For code to be great, it has, amongst other things, to be beautiful in that strange, vague, language-specific way.

As you know, this blog is C and C++-centric. Those are the two main languages I use both for personal and for professional projects. I resisted the transition from Pascal to C a long time, for many reasons. One was that at that time C compilers were flimsy, while we had a couple of really great Pascal compiler, such as Turbo Pascal—quite the upgrade from my Apple II’s USCD Pascal. Another was that I found C just ugly, clunky, and primitive; it was terse and inelegant. But over the years, I learnt to like the way C gives you pretty good control on what code is generated—not that you can predict right down to the assembly instructions what the compiler will generate; but you still have a very good idea if you understand even vaguely the underlying machine.

Read the rest of this entry »

Getting Documents Back From JPEG Scans

July 6, 2010

We’re all looking for documentation, books, and papers. Sometimes we’re lucky, we find the pristine PDF, rendered fresh from a text processor or maybe LaTeX. Sometimes we’re not so lucky, the only thing we can find is a collection of JPEG images with high compression ratios.

Scans of text are not always easy to clean up, even when they’re well done to begin with, they may be compressed with JPEG using a (too) high compression ratio, leading to conspicuous artifacts. These artifacts must be cleaned-up before printing or binding together in a PDF.

Read the rest of this entry »