Showing tag results for Other

Sep 8, 2008
Post comments count0
Post likes count1

QueryPerformanceCounter counts elapsed time, not CPU cycles

Raymond Chen

An anonymous coward asks whether the function counts elapsed time or CPU cycles. It counts elapsed time. It has to, since its value is governed by the function, which returns a number specifying the number of units per second, and the frequency is spec'd as not changing while the system is running. For CPUs that can run at variable speed, t...

Other
Sep 2, 2008
Post comments count0
Post likes count1

Tales from the interview: Can you rotate this two-dimensional array?

Raymond Chen

My colleague jeffdav told me about one job interview with a graduating college senior that didn't go well because the candidate simply gave up. He offered a simple programming task: Write a function that takes a 4×4 two-dimensional array and rotates it clockwise by 90 degrees. For example, the entry in the upper left corner of the ar...

Other
Aug 22, 2008
Post comments count0
Post likes count1

Destroying the module and resource information associated with an icon

Raymond Chen

We've seen that icons and cursors know where they came from, and the window manager uses this information when you ask it to change the size of an icon. But not all icons carry this information, only icons created by passing a HINSTANCE and a resource name. You can use this to your advantage if you want to destroy the module and resource inform...

Other
Aug 21, 2008
Post comments count0
Post likes count1

Why does Explorer generate a page fault every two seconds?

Raymond Chen

If you fire up Task Manager and look at the page fault count, you'll see that even when nothing is going on, Explorer takes a page fault every two seconds. Isn't this bad? I though you weren't supposed to poll. Here's an interesting experiment: Change your update speed to High. Wow, the page fault rate quadruples to a page fault every half second...

Other
Aug 20, 2008
Post comments count0
Post likes count1

Icons and cursors know where they came from

Raymond Chen

If you create an icon by calling , the window manager loads the specified icon from the module you specified, but it also remembers where the icon came from. (This discussion also applies, mutatis mutandis to cursors, but I will just talk about icons to avoid awkardness.) When you pass the flag to the function, the window manager goes back to the...

Other
Aug 19, 2008
Post comments count0
Post likes count0

It’s not Christmas: Nobody enjoys unwrapping your present

Raymond Chen

I don't know why it happens, but it happens with disturbing frequency. A customer wants to report a problem, and then illustrate it with a screenshot or two, but instead of attaching the screenshots, they paste the screenshots inside a Word document (and for some reason it's always Word) and then attach the Word document. It's not a Christmas pre...

Otheremail
Aug 5, 2008
Post comments count0
Post likes count2

Microspeak: The long pole

Raymond Chen

The long pole is the part of the project that is on the critical path due to its length. For example, if you have a project that consists of three independent sub-projects, then the sub-project with the longest completion date is the long pole. The etymology of this term is simultaneously obvious yet hard to pin down. Intuitively, the long pole i...

OtherMicrospeak
Jul 31, 2008
Post comments count0
Post likes count1

Don’t be helpless: You can put things together, it doesn’t have to be a single command

Raymond Chen

Humans are distinguished among all animal species by their advanced development of and heavy reliance on tools. Don't betray your ancestors. Use those tools you have. For example, during the debugging of a thread pool problem, it looked like somebody did a PostThreadMessage to a thread pool thread and left the message unprocessed after the threa...

Other
Jul 29, 2008
Post comments count0
Post likes count1

Be careful what you name your mailing list

Raymond Chen

Some time ago, I recommended exercising caution when choosing the name for your product group. The same caution applies to the name of your mailing list. Thanks to the large number of spammers out there, creating a mailling list whose account name is a word from the dictionary is just asking for trouble. When you create a new mailing list at Mic...

Other
Jul 28, 2008
Post comments count0
Post likes count1

How can SIGINT be safely delivered on the main thread?

Raymond Chen

Commenter AnotherMatt wonders why Win32 console programs deliver console notifications on a different thread. Why doesn't it deliver them on the main thread? Actually, my question is the reverse. Why does unix deliver it on the main thread? It makes it nearly impossible to do anything of consequence inside the signal handler. The main thread m...

Other