Showing archive results for 2013

Sep 18, 2013
Post comments count0
Post likes count1

SubtractRect doesn't always give you the exact difference

Raymond Chen

The function takes a source rectangle and subtracts out the portion which intersects a second rectangle, returning the result in a third rectangle. But wait a second, the result of subtracting one rectangle from another need not be another rectangle. It might be an L-shape, or it might be a rectangle with a rectangular hole. How does this map bac...

Code
Sep 17, 2013
Post comments count0
Post likes count1

Facilities jargon: Energize

Raymond Chen

Over in the product engineering groups, we aren't often exposed to the jargon employed by our Facilities group. But once in a while, it leaks through and then we get to puzzle it out. Emergency Electrical Outage and Restoral Due to a transformer failure, power to building NNN was shut down from 6:00am to 6:30am on MMMM-DD. Occupants may need ...

Non-Computer
Sep 16, 2013
Post comments count0
Post likes count1

Entering the world of competitive Ring-Around-the-Rosie

Raymond Chen

I dreamed that a friend and I were in line at some sort of summer camp to get into the cafeteria. We noticed a glass cabinet with food out in the dining area and asked about it. Turns out that it was available for people to eat, as an alternative to standing in line. We decided to go for it. (Another example of how being lucky is observing what yo...

Non-ComputerDream
Sep 16, 2013
Post comments count0
Post likes count1

Forcing a file handle closed when it has been opened remotely

Raymond Chen

Today's Little Program closes a file handle that was opened remotely. It builds on previous discussion on how to use the functions. Forcing a network file handle closed does not actually close the handle. This makes it very different from the various "force handle closed" utilities out there. Rather, forcing a network file handle closed is a...

Code
Sep 13, 2013
Post comments count0
Post likes count1

How does InterlockedIncrement work internally?

Raymond Chen

The Interlocked family of functions perform atomic operations on memory. How do they do it? It depends on the underlying CPU architecture. For some CPUs, it's easy: The x86, for example, has direct support for many interlocked operations by means of the prefix (with the bonus feature that is implied for the opcode.) The ia64 and x64 also ha...

Other
Sep 11, 2013
Post comments count0
Post likes count1

Why does Internet Explorer put tab stops at 8-character intervals instead of 4, like all right-thinking people?

Raymond Chen

When you embed a TAB character (U+0009) in a <PRE> block (or more precisely, an element whose CSS property is computed to be or ), Internet Explorer will move the current position to the next multiple of eight characters. Many people prefer four. (Some insist that only four is the correct value and anybody who disagrees with them is simply ...

Other
Sep 10, 2013
Post comments count0
Post likes count1

Early versions of Aero Peek: Aladdin, Bat Signal, and Squeegee

Raymond Chen

The feature now known as Aero Peek wasn't born that way. It went through several iterations before becoming what eventually shipped in Windows 7. At the MIX09 conference, Stephan Hoefnagels showed some of the precursors to Aero Peek. Here are the highlights, and the corresponding time codes if you want to jump straight to the demos. Thumbn...

History
Sep 9, 2013
Post comments count0
Post likes count1

Mom and dad's event-filled first day of school

Raymond Chen

I dreamed that my wife and I had dropped our daughter off at her new school for the first time, and I made a wrong turn and ended up going the wrong way. We got off at an exit for highway I-5, and the on-ramp turned into a two-lane highway hundreds of feet in the sky. To keep people from going too fast, the road rolled back and forth: First it til...

Non-ComputerDream
Sep 9, 2013
Post comments count0
Post likes count1

Programmatically editing the metadata of an audio file

Raymond Chen

Today's Little Program edits the metadata of an audio file, ostensibly to correct a spelling error, but really just to show how it's done. Today's smart pointer class library is... (rolls dice)... CComPtr! We open with two helper functions which encapsulate the patterns Get property from property store Call Convert into desire...

Other