The Old New Thing

Excursions in composition: Adding rewind support to a sequential stream

Here's a problem "inspired by actual events": I have a sequential stream that is the response to a request I sent to a web site. The format of the stream is rather messy; it comes with a variable-length header that describes what type of data is being returned. I want to read that header and then hand the stream to an appropriate handler. ...
Comments are closed.0 0
Code

Excursions in composition: Sequential stream concatenation

As we've seen a few times already (when building context menus and exploring fiber-based enumeration), composition is an important concept in object-oriented programming. Today, we're going to compose two sequential streams by concatenation. There really isn't much to it. The idea is to take two streams and start by reading from the first...
Comments are closed.0 0
Code

You don't know what you do until you know what you don't do

Many years ago, I saw a Dilbert cartoon that went roughly like this. Frame 1: Supertitle - "Dogbert's guide to project management." Frame 2: Supertitle - "Not a project." Dilbert answers the phone. "Sure, we do that." Frame 3: Supertitle - "A project." Dilbert answers the phone. "No, we don't do that."† I've seen a lot of software ...

The early stages of Joshua Roman groupie-dom

The first time I saw the Seattle Symphony's new principal cellist Joshua Roman, it was at a subscription performance of Mahler's Seventh Symphony in June 2006, shortly after the then-22-year-old took the principal's seat from the retiring Raymond Davis. We noticed that there was a new face in the orchestra, and wondered afterwards, "Who was ...

I bet somebody is looking to get a really nice bonus for that feature: Uninstall

A customer asked the following question (paraphrased): Does the Windows XP Add/Remove Programs control panel expose a scriptable object model? We want our program to open the Add/Remove Programs control panel and uninstall the programs of our competitors. No, there is no object model for the Add and Remove Programs control panel, and ...

How do the menu functions find items?

Most of the menu item functions such as GetMenuItemInfo allow you specify the menu item either by position or by command. Some of them use the MF_BYPOSITION and MF_BYCOMMAND flags. Others separate the search algorithm into a separate fByPosition flag. Searching for menu items by position is straightforward: The specified position is used as a...
Comments are closed.0 0
Code

Verizon backs down on made-up fees and then adds them anyway

I ranted a few years ago about rate hikes disguised as fees or taxes, but Verizon's unabashed deceptive practices still gets me all worked up. Last year, the FCC decided that Verizon didn't have to pay the Universal Service Fund fee any more, but that didn't stop them from charging for it anyway. What galls me is their explanation of the ...

The format of accelerator table resources

Continuing in the extremely sporadic series on the format of resources, today we'll take a look at accelerator tables. This topic is so simple, I'll cover both 16-bit and 32-bit resources on the same day! In 16-bit Windows, the format of an accelerator table resource was simply an array of ACCEL structures. typedef struct tagACCEL { ...
Comments are closed.0 0
Code

Email tip: Don't forget to ask your question

Sometimes people get so caught up in their problem that they forget to ask a question. My customer has noticed that blah blah blah blah, but if they do blah blah, then they get blah blah blah. This is different from blah blah blah, where blah blah blah. But neither is what the customer is expecting, which is blah blah blah. After installing ...

News flash: Snacks at the theater concession stand are not good for you

"We try to make them as healthy as possible," says Jose Mier. As healthy as sixteen inches of deep-fried dough, covered in sugar, and stuffed with caramel can be. That is to say, not healthy at all. Here are some ideas for making them healthier: Don't coat them in sugar, don't stuff them with Bavarian cream, and don't deep-fry them. Or just...