Showing results for January 2012 - Page 2 of 4 - The Old New Thing

Jan 18, 2012
0
0

Don't try to allocate memory until there is only x% free

Raymond Chen
Raymond Chen

I have an ongoing conflict with my in-laws. Their concept of the correct amount of food to have in the refrigerator is "more than will comfortably fit." Whenever they come to visit (which is quite often), they make sure to bring enough food so that my refrigerator bursts at the seams, with vegetables and eggs and other foodstuffs crammed into every...

Code
Jan 17, 2012
0
0

Microspeak: Walls and ladders

Raymond Chen
Raymond Chen

Reader laonianren wanted to know more about this game Walls and Ladders. "Walls and Ladders" is not a game. It's just a metaphor for a conflict in which one side wants to perform some action and the other side wants to prevent it. The defending side builds a wall, and the attacking side builds a taller ladder. In response, the defending side bui...

Non-ComputerMicrospeak
Jan 16, 2012
0
0

Cultural arbitrage: The food-related sucker bet

Raymond Chen
Raymond Chen

While I was at a group dinner at a Chinese restaurant, a whole fish was brought to our table. One of the other people at the table told a story of another time a whole fish was brought to the table. He attended the wedding rehearsal dinner of a family member. The bride is Chinese, but the groom is not. (Or maybe it was the other way around. Doesn'...

Non-Computer
Jan 16, 2012
0
0

Why was there a font just for drawing symbols on buttons?

Raymond Chen
Raymond Chen

Henke37 wonders why the Marlett font was introduced. Why use a font for drawing symbols on window buttons? Using a font was a convenient way to have scalable graphics. It's not like Windows could've used VML or SVG since they hadn't been invented yet. EMFs would have been overkill as well. Fonts were very convenient because the technology to re...

Tips/Support
Jan 13, 2012
0
0

Keys duplicated from photo: Delayed reaction

Raymond Chen
Raymond Chen

There was a report some time ago that researchers have developed a way to duplicate keys given only a photograph. When I read this story, I was reminded of an incident that occurred to a colleague of mine. He accidentally locked his keys in his car and called a locksmith. Frustratingly, the keys were sitting right there on the driver's seat. The ...

Non-Computer
Jan 13, 2012
0
0

How do I print non-error messages during compilation?

Raymond Chen
Raymond Chen

Commenter Worf remarked, "My one wish is that would be supported." I always find it interesting when people say "I wish that Microsoft would stop following standards," since the directive is nonstandard. The Microsoft C/C++ compiler implements the feature in a method compatible with the standard, namely via a directive. If you want ...

Code
Jan 12, 2012
0
0

Puzzling out the upsell-o-meter

Raymond Chen
Raymond Chen

As I noted before, many grocery stores in the United States have a printer next to the cash register which prints out coupons customized to your purchases. Here's a purchase and the accompanying coupon. What is the story behind this pairing? Purchased: Diapers for newborn baby. Coupon: Save 75 cents on ice cream. Bonus chatter: While waiting in ...

Non-Computer
Jan 12, 2012
0
0

Why does CreateEvent fail with ERROR_PATH_NOT_FOUND if I give it a name with a backslash?

Raymond Chen
Raymond Chen

A customer reported that the function was failing with the unusual error code : The customer continued, "The documentation for says that the parameter must not contain the backslash character. Clearly we are in error for having passed an illegal character, but why are we getting the strange error code? There is no file path involved. Right n...

Other
Jan 11, 2012
0
0

What a steal: A house for only ten dollars!

Raymond Chen
Raymond Chen

When I was signing the papers for a house purchase many years ago, I noticed that the deed papers read The Grantor «names of people selling the house» for and in consideration of TEN DOLLARS AND OTHER GOOD AND VALUABLE CONSIDERATION in hand paid, conveys and warrants to «me» the following described real estate... I n...

Non-Computer
Jan 11, 2012
0
0

How can I detect the language a run of text is written in?

Raymond Chen
Raymond Chen

A customer asked, "I have a Unicode string. I want to know what language that string is in. Is there a function that can give me this information? I am most interested in knowing whether it is written in an East Asian language." The problem of determining the language in which a run of text is written is rather difficult. Many languages share the ...

Other