The Old New Thing
Practical development throughout the evolution of Windows.
Latest posts

Given a choice between two options, you influence the result by adding a third, inferior, alternative

Shankar Vedantam wrote a Washington Post article and also appeared on NPR to discuss The Decoy Effect: Given a choice between two options, introducing a third, clearly inferior, option can influence your original decision. You won't pick the third option, but a clever choice of the bad third option can sway the decision toward either of the other two. Rationally, an inferior third option should have no effect on your choice between the two other options, but psychologists (and marketing majors) have discovered that human beings are not rational decision makers. (Anyone who has interacted with a two-year-old ...

Psychic debugging: When reading unfamiliar code, assume it's mostly correct

You may be called in to study a problem in code you've never seen before or be asked to look over a proposed change to some code you've never seen before. When this happens, you have to take shortcuts in your analysis because following every function call to the bottom would not only take far too much time, but also take you so far away from the code in question that you will probably forget what you were looking for in the first place. For example, suppose you're looking at some code that goes like this: You might have some questions about this code. What if is ? Is it legal to pass to ? What if the do...

The wisdom of seventh graders: Designing an elective course

Last month, I spent a few hours reading essays written by seventh graders (ages 12 and 13) on the following subject: Electives are often fun and different from our normal core classes. Imagine you have been chosen to create one new elective for our school. In a multi-paragraph essay, explain what the new elective would be like and what students would learn. (Students were given two hours, plus one additional hour upon request.) Before I present you some of the responses, I'd like to take some time to address the students on the subject of writing. I know they won't read this, but I have to tell someone. W...

The format of bitmap resources

The next entry in the continuing sporadic series on resource formats is the bitmap. You thought accelerator tables were simple; bitmaps are even simpler. A bitmap resource takes the same form as a file, except that there is no . That's all.

Perhaps the movies made too literal a translation

Arabic in the movie True Lies.

Trivia: Pea, marble, dime, nickel, quarter, half dollar, walnut…

Pea, marble, dime, nickel, quarter, half dollar, walnut, golf ball, hen egg, tennis ball, baseball, teacup, grapefruit, softball. What is this a list of? Answer. Note that the list is different in Britain. (Original story that tipped me off to this list.)

Psychic debugging: Why you can't control page navigation when using PSP_DLGINDIRECT

Here's a problem that floated past a few years ago. We switched our wizard from using dialog resource IDs to using because [reasons deleted since they aren't important]. But once we did that, the Next button doesn't work! Anybody have any ideas what's going on? I made things a little easier by deleting the information that isn't relevant to the problem. See if you can solve it before reading further. Here's my reply: My psychic powers tell me that your wizard navigation code is still trying to navigate by ID even though you aren't using IDs any more. The and notifications allow you to control navigation...

No farting please, we're Americans

Apparently, when translating their Pokémon game from Japanese to English, Nintendo changed a question in an in-game personality test that asked you what you would do if you farted. In the English-language version, you merely broke a rotten egg. What, do they think kids in the U.S. don't fart? Or that they don't enjoy fart jokes. Allow me to clear up any confusion: Kids in the United States love fart jokes. Or maybe British kids don't fart. Perhaps that's it. (For those who don't get the subject, it's a snowclone of the form No X please, we're Y. Learn more here.)

The Notepad file encoding problem, redux

About every ten months, somebody new discovers the Notepad file encoding problem. Let's see what else there is to say about it. First of all, can we change Notepad's detection algorithm? The problem is that there are a lot of different text files out there. Let's look just at the ones that Notepad supports. 8-bit ANSI (of which 7-bit ASCII is a subset). These have no BOM; they just dive right in with bytes of text. They are also probably the most common type of text file. UTF-8. These usually begin with a BOM but not always. Unicode big-endian (UTF-16BE). These usually begin with a BOM but not always. Unico...