Showing archive results for 2008

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 5, 2008
Post comments count0
Post likes count1

Tales from the interview: Anticipating your own incompetence is not a good interview strategy

Raymond Chen

Some years ago, there was a candidate who was interviewing for a programming position in my group. The first interviewer asked the candidate about career plans with that old standby, "Where do you see yourself in five years?" — In five years, I see myself in program management. This is a fair answer. Many people see programming as a step...

Non-Computer
Sep 4, 2008
Post comments count0
Post likes count1

Tales from the interview: Lunch is not a competition, episode 2

Raymond Chen

Last time, we saw the consequences of failing to recognize that lunch is not a competition. Today we'll see an even more unfortunate result. One candidate went to lunch with my colleague the economist. (Claim to fame: "Jenna von Oÿ is my cousin!") They went to a local Thai restaurant, Thai being a very popular cuisine here in the Seattle a...

Non-Computer
Sep 3, 2008
Post comments count0
Post likes count1

Tales from the interview: Lunch is not a competition

Raymond Chen

One thing that many interview candidates fail to comprehend is that lunch is not a competition. You're not auditioning for Fear Factor. No matter how many times we explain this, candidates don't believe it. One of my colleagues took a candidate to lunch. As is typical, the candidate is asked whether there was any particular preference or phobia,...

Non-Computer
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
Sep 1, 2008
Post comments count0
Post likes count0

It helps if you write a cover letter and remember the name of your interviewer

Raymond Chen

It's not a big thing, but it shows that you have your act together and does a lot towards distinguishing you from everybody else. A story of the importance of writing a cover letter and remembering the name of your interviewer. (Then again, what do I know. JobsBlog probably is a better source for this type of info. Earlier this year, Angela McL...

Non-Computer
Sep 1, 2008
Post comments count0
Post likes count1

How do I convert an error code to text when FORMAT_MESSAGE_FROM_SYSTEM doesn’t work?

Raymond Chen

For the same reason that not all error codes are defined in , not all error strings are defined in the system message table. If you've ever played with the message compiler, you'd quickly have recognized the file as the header file associated with a message resource. In other words, there's a file that gets processed by the message compiler, an...

Code
Aug 29, 2008
Post comments count0
Post likes count1

What possible use are those extra bits in kernel handles? Part 3: New object types

Raymond Chen

Last time, we saw how those extra bits can be used to multiplex HANDLE with other values. That was a specific case of a more general scenario: Expanding the handle namespace to include things that aren't handles. (You can also view today's example as a generalization of the sentinel value problem, where we need to generate an arbitrary number of...

Code
Aug 28, 2008
Post comments count0
Post likes count1

The stroke-count-based sort isn’t random, although it looks that way if you only see it in translation

Raymond Chen

During the NBC coverage of the opening ceremony of the Beijing Olympics, the announcers more than once said that the teams will not be entering in the normal order, but rather in a random order based on the number of strokes in the team's name as translated into Chinese. This is an odd use of the word random. You might say that at the Athens Olym...

Non-Computer
Aug 28, 2008
Post comments count0
Post likes count1

What possible use are those extra bits in kernel handles? Part 2: Overcoming limited expressiveness

Raymond Chen

Last time, we saw how those extra bits can be used to develop safe sentinel values. That is a special case of a more general problem: How do you pack 33 bits of information into a 32-bit value? Whereas last time, we weren't forced into the use of a sentinel value because we could develop a (cumbersome) helper class and switch people over to ...

Code