April 2007 Archives

Waking up early

| | Comments (1)

I've been trying to wake up at 5:00 every morning. I have a couple early-morning commitments each week and it's been too painful to adjust my schedule just for those days, so I decided to try to standardize on the same time every morning. (Obligatory link on this topic.) Given my low success rate so far, I am not qualified to give advice, but that hasn't stopped me in the past, so here goes.

I have an alarm clock that lets me set two different alarms. I set one for 5:00 and the second for 5:01. I also have the clock on the other side of the room so I have to get up to shut it off. This means that I spend at least 60 seconds standing next to the alarm clock waiting for the second alarm to go off, and as long as I don't talk myself out of waking up and go right back to bed, then I stay up.

Copying MessageBox text

| | Comments (1)

It is a small pet peeve of mine that many people in software development use screenshots to send around reports of errors in Windows applications. The path of least resistance is to press the Print Screen key and paste the resulting BMP in email. These files can be multiple megabytes. Even if you use alt-PrtScn, which copies just the active window, that's typically 350KB. Moreover, it loses critical information: if the recipient actually wants to grep source code for the error message, he or she must retype the string in question.

Instead, try pressing control-C. This copies the text of any standard messagebox (including assertion failure dialogs) into the clipboard.

Example:

---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!

Program: temp_demo_project.exe
File: c:\foo.cpp
Line: 40

Expression: 2 == 1

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

(Press Retry to debug the application)
---------------------------
Abort   Retry   Ignore   
---------------------------

Thanks to Adam Dingle for the tip.