More Bit-twiddling

January 27, 2009

This week, two “quickies”: rounding up and down to the next power of two, and converting efficiently a value to exactly 0 or 1.

Read the rest of this entry »

Suggested Reading: Zen Cat

January 24, 2009

Judith Adler, Paul Coughlin —Zen Cat— Rodale, 2003, 112 pp. ISBN 0-8759-6923-2

(Buy at

(Buy at

I love all solitary places, where we taste the pleasure of believing what we see is boundless, as we wish our souls to be.

— Percy Bysshe Shelly

The longer I live, the more beautiful life becomes

— Frank Lloyd Wright

This short book cointains about sixty short proverbs, quotations, sayings and poems, each accompagnied by an à propos picture of a cat. As many poetry books, to be read in a meditative mood.

Suggested Reading: Google’s PageRank and Beyond: The Science of Search Engine Rankings

January 24, 2009

Amy N. Langville, Carl D. Meyer —Google’s PageRank and Beyond: The Science of Search Engine Rankings— Princeton University Press, 2006, 224 pp. ISBN 0-691-12202-4.

Page Rank And Beyond

(Buy at

Langville and Meyer presents us the mathematics behind Page Rank, Google’s method of rank prioritization as well as other similar methods. If the first few chapters are concerned with the history of search engines and search methods, the remainder of the text is clearly mathematical in nature.

Read the rest of this entry »

Throwing in More Hardware?

January 20, 2009

In a recent blog entry, Jeff Atwood makes the case that “hardware is Cheap, Programmers are Expensive”, basically arguing that in a lot of cases, it’s cost-efficient to add cheap, faster, hardware to a performance problem rather than investing time to actually enhance the code at the algorithmic and implementation level.

I do, however, disagree with him on many points.

Read the rest of this entry »

Honni soit le Hongrois

January 13, 2009

The original Hungarian notation is due to Charles Simonyi who invented it sometimes while he was working at Xerox Palo Alto Research Center—the Xerox PARC that gave us the mouse and the first graphical user interfaces. The basic principle of Hungarian naming convention is to prefix the variables with one or many particles, encoding alternatively its type or its intend. This lets programmer write prgszNames as a variable name, which is perfectly legible to one well versed in Hungarian; however, but looks mostly like gibberish to just anyone else.

I recently changed my mind about the Hungarian naming convention. I don’t think it’s that stupid anymore.

Read the rest of this entry »

The Zunes Freezes: Update!

January 5, 2009

The faulty code was leaked some time last week, and I’ve looked at it, and, well, it’s surprisingly clean (despite the obvious defect and how they should’ve found it before releasing it (see here)).

Have a look at the ConvertDays routine.

Read the rest of this entry »

Cleaning LCD screens

January 5, 2009

I’m sure that, like me, you’ve tried all kinds of chemical cleaners to clean LCDs. But, like me, also, you’ve noticed most of them leave smudges that you can’t get rid of. Window Cleaners are also rather bad at this, and they may be too rough for the coating of your LCD screens.

However, I think I finaly found what it takes: 50% isopropyl alcohol. That’s right, common rubbing alcohol you can get for 3$ at your local drugstore. Even better, they sell it with a spray cap, for your convenience. Just spray alcohol on a clean, soft, non-linting rag (like a paper towel) and clean your screen gently. Do not spray at the screen directly, because it may cause some of it to leak into the electronics and cause much mayhem. It may take a few application to remove all of the previous chemical cleaner’s residues… but I haven’t seen my screens that clean in a long time.