Showing results for August 2013 - Page 2 of 3 - The Old New Thing

Aug 19, 2013
0
0

A dream about forgetting to deploy the backup brake pads

Raymond Chen
Raymond Chen

I dreamed that that I was driving through a parking garage when my brakes suddenly failed. I tried executing turns to bleed off speed, but it was largely ineffective. I managed to avoid hitting a parked police car (which had arrived to investigate some other accident), but was unable to avoid another parked car. An insurance adjuster who was on th...

Non-ComputerDream
Aug 19, 2013
0
0

The tiny table sorter – or – you can write LINQ in JavaScript

Raymond Chen
Raymond Chen

I had a little side project that displayed status information in a table, and I figured, hey, let me add sorting. And it was a lot easier than I thought. I just put the header row in the and the table contents in the , then I could use this code to sort the table: Each cell can have an optional custom attribute which specifies how the item sh...

Code
Aug 16, 2013
0
0

If I signal an auto-reset event and there is a thread waiting on it, is it guaranteed that the event will be reset and the waiting thread released before SetEvent returns?

Raymond Chen
Raymond Chen

Let's go straight to the question: I have two programs that take turns doing something. Right now, I manage the hand-off with two auto-reset events. In Thread A, after it finishes doing some work, it signals Event B and then immediately waits on Event A. Thread B does the converse: When its wait on Event B completes, it...

Code
Aug 15, 2013
0
0

How do I control the order of the pages in property sheets from my shell extension?

Raymond Chen
Raymond Chen

A customer wanted to know whether a shell extension can control the order of the property sheet pages in a property sheet. The interface lets you add pages and replace pages, but nothing about rearranging them. Naturally a shell extension can control the relative order of its own pages (by changing in the order in which it calls ) but how can it...

Code
Aug 14, 2013
0
0

What's the point of letting you change the GCL_CBCLSEXTRA if it has no effect?

Raymond Chen
Raymond Chen

The documentation for the function mentions GCL_CB­CLS­EXTRA: Sets the size, in bytes, of the extra memory associated with the class. Setting this value does not change the number of extra bytes already allocated. What's the point of letting the application change a value if it has no effect? The class long grants access to the v...

Code
Aug 12, 2013
0
0

Please don't wade across the Strait of Juan de Fuca

Raymond Chen
Raymond Chen

I dreamed that I was visiting a scenic location near the Canadian border. A central large body of water had the mainland to the south and east. A river ran southeast, spanned by a footbridge. To the northwest was another land mass, which had gained the nickname "Alaska" even though we were nowhere near Alaska. There was a gift shop on "Alaska", and...

Non-ComputerDream
Aug 12, 2013
0
0

How do I convert a synchronous file handle into an asynchronous one?

Raymond Chen
Raymond Chen

Say you opened a file in synchronous mode, and then you realize that you want to issue asynchronous I/O on it, too. One way to do this is to call a second time with the , but this requires you to know the file name, and the file name may not be readily available to the function that wants to do the conversion, or it may not even be valid any long...

Code
Aug 9, 2013
0
0

Each time I move, my mailbox moves further away

Raymond Chen
Raymond Chen

When I was growing up, the mailman letter carrier came right to our front door. The mailbox was mounted on the front of the house right next to the front door. You could check the mail without even getting dressed; just open the door a crack and stick out your hand. Approximate distance from front door to mailbox: less than 1 foot. In the nex...

Non-Computer