Showing archive results for 2008

Aug 12, 2008
Post comments count0
Post likes count0

The unwritten rule of riding a Seattle Metro bus

Raymond Chen

The Metro King County transit site has all the facts about how to ride the bus, but there's another rule that is applied by convention rather than by any formal codification: For some reason, and I see this only in Seattle, it is customary to say Thank you to the bus driver as you get off the bus. Tip for new riders: If you aren't familiar w...

Non-Computer
Aug 12, 2008
Post comments count0
Post likes count0

The implementation of iterators in C# and its consequences (part 1)

Raymond Chen

Like anonymous methods, iterators in C# are very complex syntactic sugar. You could do it all yourself (after all, you did have to do it all yourself in earlier versions of C#), but the compiler transformation makes for much greater convenience. The idea behind iterators is that they take a function with yield return statements (and possible s...

Code
Aug 11, 2008
Post comments count0
Post likes count1

Psychic debugging: Why can’t StreamReader read apostrophes from a text file?

Raymond Chen

As is customary, the first day of CLR Week is a warm-up. Actually, today's question is a BCL question, not a CLR question, but only the nitpickers will bother to notice. Can somebody explain why StreamReader can’t read apostrophes? I have a text file, and I read from it the way you would expect: StreamReader sr = new StreamReader("myfil...

Code
Aug 8, 2008
Post comments count0
Post likes count0

Raymond rewrites newspaper headlines

Raymond Chen

Original headline: Monorail out of service this week. Raymond's headline: Monorail out of service this week: 4 people inconvenienced.

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

If you return FALSE from DLL_PROCESS_ATTACH, will you get a DLL_PROCESS_DETACH?

Raymond Chen

If you return from , will you get a ? Yes. No. ... Yes. All three answers are correct, for different formulations of the question. From the kernel's point of view, the answer is a simple Yes. If a DLL's entry point returns to the notification, it will receive a notification. However, most C and C++ programs do not use the ra...

Code
Aug 7, 2008
Post comments count0
Post likes count0

If the law says you can’t file a petition, you might need to file it anyway, in case somebody later says that you should’ve even though the law says you couldn’t

Raymond Chen

It sounds like a scene from the movie Brazil, but in fact it's the law. Let's rewind a bit. The introduction is a bit technical, but I'll try to keep it short. There is a legal filing known as a habeas petition and another known as a petition for review. There are rules regarding what each one covers and the deadlines for filing them. Prior t...

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

For that, you’ll have to call security

Raymond Chen

Yahoo! is notorious for bad parking, but they're not the only ones. Microsoft has recurring parking problems as well, caused by office space shortages that force employees to be crammed into offices at double or even triple the intended density. Since parking lots are sized based on the expected number of cars, overstuffing a building with emplo...

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

The caret serves as the continuation character for batch files

Raymond Chen

We saw earlier that the caret is the escape character for the batch language. In a comment to that article, KJK::Hyperion mentioned that the caret serves as the line continuation character. A useful tip if you still find yourself messing with batch files. Mark Yocum elaborates on this point a bit more.

Code
Aug 6, 2008
Post comments count0
Post likes count1

What’s with this MSH_MOUSEWHEEL message?

Raymond Chen

The hardware folks had this mouse wheel thing they were making, and they needed a way to get applications to support the mouse. Now, one way of doing this was to say, "Well, we'll start selling this wheel mouse, but no applications can use it until the next version of Windows is released, one that supports the wheel." Of course, that would have me...

History