The Old New Thing

Why don't you ever see a rat vomiting?

Okay, maybe you never wondered why you never saw a vomiting rat, but the intrepid researchers at the Annals of Improbable Research have discovered that there's a good reason, and Anne's rat page will explain in more detail than you probably wanted...

Using /LARGEADDRESSAWARE on 64-bit Windows for 32-bit programs

Probably the biggest advantage of 64-bit Windows is not the larger registers but rather the expansive 64-bit address space. Recall that even when the /3GB switch is set, 32-bit programs receive only 2GB of address space unless they indicate their willingness to cope with addresses above 2GB by passing the /LARGEADDRESSAWARE flag. This flag ...

Using modular arithmetic to avoid timing overflow problems

In an earlier article, I presented a simple way of avoiding timing overflows which seemed to create a bit of confusion. The short version: Given a starting time start, an ending time end and an interval interval, the way to check whether the interval has elapsed is to use the expression . The naive expression suffers from integer overflow ...

Shocked (shocked!) that patronage exists in Chicago politics

NPR reported on a startling discovery in Chicago: That government jobs go not to those best qualified to perform them, but rather to those with the best connections. Who'd-a thunk it? Shocked by this discovery, the Daley administration vowed to end it. The City of Chicago's top lawyer Mara Georges told incredulous City Hall reporters ...

You can't simulate keyboard input with PostMessage

Some people attempt to simulate keyboard input to an application by posting keyboard input messages, but this is not reliable for many reasons. First of all, keyboard input is a more complicated matter than those who imprinted on the English keyboard realize. Languages with accent marks have dead keys, Far East languages have a variety of ...

When is x/2 different from x>>1?

Everyone "knows" that the following pairs of expressions are equivalent: Too bad they aren't. In the C language standard, there is no requirement that the internal representation of signed integers be two's complement. All the permissible representations agree for positive numbers, but negative numbers can have different representations. If...

Why does Add or Remove Programs show a large blank space?

Some people have noticed that certain programs cause the Add or Remove Programs control panel to create an enormous amount of blank space. What's going on? These are programs that have bad custom uninstall icon registrations. If you go to the registry key , you'll find a list of programs that have registered for appearing in the Add or ...

The effect of SetCursor lasts only until the next SetCursor

Of course the effect of the function for a thread lasts only until that thread changes the cursor to something else. Any moron knows that, right? The tricky part is that the may come from an unexpected place. THe most common place people run into this is when they do something like this: This puts up the hourglass during the ...

Understanding ternary raster operations

It's perfectly logical, which doesn't mean that it's easy to understand. A ternary raster operation describes how three boolean values should combine to form an output boolean. I was going to write up a description but found that the existing documentation pretty much covers it, so I refer you to that. In particular, look at the table that ...

Boil first, then mash

Last year, British schoolchildren (ages six and seven) went to a farm and were baffled by the long, pointy, orange things. (Those who specialize in plant biology have a special term for these strange objects: carrots.) Their older siblings don't seem to be faring much better. A three-year study revealed that modern Scottish schoolchildren ...