Showing archive results for 2004

May 21, 2004
Post comments count0
Post likes count1

Do you know when your destructors run? Part 2.

Raymond Chen

Continuing from yesterday, here's another case where you have to watch your destructors. Yesterday's theme was destructors that run at the wrong time. Today, we're going to see destructors that don't run at all! Assume there's an ObjectLock class which takes a lock in its constructor and releases it in its destructor. Pretty standard stuff. Th...

Code
May 20, 2004
Post comments count0
Post likes count1

Do you know when your destructors run? Part 1.

Raymond Chen

Larry Osterman discussed the importance of knowing when your global destructors run, but this problem is not exclusive to global objects. You need to take care even with local objects. Consider: Easy as pie. And there's a bug here. When does the destructor for that smart-pointer run? Answer: When the object goes out of scope, which is a...

Code
May 19, 2004
Post comments count0
Post likes count1

Beware the hash reset attack

Raymond Chen

There are a variety of message digest algorithms out there, MD5 being a particularly popular one. These generate a "message digest" (essentially, a hash) so you can detect whether somebody has tampered with a file, the theory being that it's hard to tamper with a file without changing its hash. But make sure you record the file size as well as t...

Other
May 19, 2004
Post comments count0
Post likes count0

Letterboxing: Geocaching without the GPS

Raymond Chen

Geocaching is sort of like global hide-and-seek (with hints) for technology geeks. I stumbled upon a non-GPS version of this diversion, known as Letterboxing (not to be confused with letterboxed movies, another subject entirely). By the way, if geocaching isn't enough "fun with a GPS" for you, you can try The Degree Confluence Project. ...

Non-Computer
May 18, 2004
Post comments count0
Post likes count1

String sorting is not done by ASCII code any more.

Raymond Chen

Just because you have the ASCII table memorized doesn't mean you know how sorting works. I remember a bug filed where somebody said that the "sort" command was sorting underscores incorrectly: this was claimed to be wrong "because underscore character follow uppercase letters and precedes lowercase letters". Well perhaps it does if you thi...

Code
May 18, 2004
Post comments count0
Post likes count0

The coolest thing you can do with a Gameboy is not "play a game on it"

Raymond Chen

From Public Radio International, The Next Big Thing covers The Gameboy Music Match. These days, a lot of electronic music is performed directly off of a laptop, which most people complain looks a lot like someone up there on stage checking their email. But Gameboy music isn't just for listening. It's also a performance. Nullsleep pl...

Non-Computer
May 17, 2004
Post comments count0
Post likes count0

Plane-spotters to require government license

Raymond Chen

Plane-spotters to require government license. The article spins it as a "benefit" for ground-based aviation buffs, but this is just one of those "two steps back, one step forwards" things. Plane-spotters were outright banned from airports in the summer of 2003. Now they can go back, but they'll need to shell out £15 for the privileg...

Non-Computer
May 17, 2004
Post comments count0
Post likes count1

When do you put … after a button or menu?

Raymond Chen

When do you put "..." after a button or menu? For example, some menus say "Save as..." and some buttons say "Customize...". What is the rule for dots? Many people believe that the rule for dots is "If it's going to display a dialog, then you need dots." This is a misapprehension. The rules are spelled out in the Windows User Interface D...

Other
May 14, 2004
Post comments count0
Post likes count0

Who'll be where for whom?

Raymond Chen

Mike Pesca undertakes a textual analysis of the Friends theme song.

Non-Computer