First week of training

My first week of marathon training has been pretty successful, with two solo ten-milers on Monday and Wednesday mornings, and a strong seven-miler this afternoon with Susi and Jana. I will hopefully be back at the gym next week for some strength training, and maybe some spinning the week after. 3:30 is attainable.

Congrats to Toronto survivors

Congratulations to the folks who survived the blistering wind at the Toronto marathon on Sunday. Unfortunately that wind was to blame for deserved Boston hopefuls not making their times. On the upside (for me, anyway), this may mean I will have company training for Arizona.

Speaking of Arizona, this morning I did my first early morning long run, my first solo long run in quite a while. I went the out-and-back ten miler from the uptown Dowd YMCA, and besides some shoulder discomfort (from slacking at the gym) I felt strong. I need to start about an hour earlier to completely miss traffic, but I’m well on my way; I may repeat on Wednesday morning.

Safer C# String.Format()

Formatting strings using the String.Format method is straightforward and efficient, but there is a loose coupling between the number of replaceable tokens in your string and the number of strings you provide to insert. If you get the count wrong (which can often happen during maintenance cycles as strings change), your code must deal with an exception. This all gets worse when your strings come from localized resources, as this opens the door for many more errors.

Ideally, I’d like to be able to catch all bungled calls in testing. As a rule I don’t like eating exceptions, but as a quicker stop-gap solution I opt to wrap the calls to String.Format with an unhandled try/catch and rovide a hard-coded fall-back string that I know will keep the code from failing.