Monthly Archives: April 2011

Reiser and Run

While working through today’s code and test to-do list, I ran out of space on a required SLES 10 file system.   Fortunately, it was LVM-managed, and there was plenty of room in the volume group to stretch this thing.  I vaguely recalled just enough LVM command names (lvdisplay, lvresize) to look up the process.

Extending the logical volume was super-fast, but resize2fs failed with “can’t resize a mounted filesystem!” No way!  This was a 2.6.16 kernel: not exactly hip, but current enough to allow online resizing.

I checked mount points and saw that this was a reiserfs file system.  ReiserFS?!  Sure, that was once the SLES way, but I thought it had been deprecated since the arrest, if not for murder-related reasons, then for security and/or functional ones.  Fortunately, the LVM HOWTO rescued me: it told me to use resize_reiserfs instead, and that worked like a charm.

I’ll try to remember this in case there’s a next time.  If not, this blog post will remind me. 🙂

Find a Bug, Code an xUnit

In today’s travels, I ran into an important bug in a new feature that had been missed in test.  One reason for the late discovery was that setting up and re-creating the problem in “black box” mode was time-consuming: change profiles, load and decision new work, complete a full processing cycle, create end of day files, and so on.  Yet at its core, it boiled down to only four possible permutations of inputs through a single business object method, and one of these four behaved badly.

This was, of course, the perfect opportunity for an xUnit: a short method could test all four permutations and prove the bug.  So, in classic TDD fashion, I coded the test case first and then fixed the business object to turn yellow to green.  This bug had escaped not because creating a SUnit was difficult, but because it had been overlooked.

In any system, there are lots of test scenarios (such as deep integration) that cannot be approached by xUnits.  But there are usually many more valuable xUnits that could be written than actually are.  Like refactoring, there’s never time to go back and add xUnits to old code just to do it.  But bug discovery is the perfect opportunity, and xUnits here are not only good policy, they help with coding and verifying the fix.  So, find a bug, code an xUnit.

In Words of One Syllable

The Windows CMD shell is a primitive language, particularly when compared to unix scripts or even PowerShell.  But it’s still the only guaranteed-available common denominator for Windows servers (no, WSH doesn’t count), so I have to target it for setup scripts delivered to customers.  When it comes to database activities, I limit this as much as possible by writing portable DB2 CLP SQL files, but that runs out of steam when I need loops, parameters, etc.  So I found myself this morning once again bumping up against CMD’s limited vocabulary.

In this case, I needed a multi-line block of SQLs to run in a loop.  The begin-end construct for CMD scripts is a pair of parentheses.  But my SQLs themselves needed parentheses (as SQLs often do), and I found that Windows doesn’t support nesting them; it failed with a the error message: <statement> was unexpected at this time.  No nested parens: just wow.  At least the workaround was simple – just move these commands into a sub-script and call it, like so:

   for /l %%i in (1,1,9) do (
      echo.  ==Pass %%i >> %OutputFilename%
      call ReplicatePass.cmd %%i >>%OutputFilename%
      if errorlevel 1 goto failure

I look forward to the day when I can count on PowerShell or a similar robust scripting environment to be available on all Windows platforms I target.  Perhaps attrition alone will accomplish this; after all, it has only taken three decades.  Until then, I’ll speak slowly to Windows, in words of one syllable.

Run at the Mill

Racing today was an easy decision, with a rare Saturday off from coaching (compliments of spring break), a race just 4 miles from my dad’s house, and cool half marathon medals with Hebrews 12:1 on the back.  And the first annual Run at the Mill (part of the Run for God series) was a winner!

Lydia and I rode up together the night before and spent the evening at my dad’s home.  We made a Pizza Hut stop on the way: “carb loading,” we said, but any excuse would do.  After arriving, we enjoyed a nice evening just chatting and hanging out.

My half marathon start time was 90 minutes before Lydia’s 5K start, so Dad was gracious enough to shuttle Lydia over, dropping her off just before her race, and even bringing over my dropped race bib earlier.  Did I mention how nice it was to be only 4 miles away?  It was so humid I had to use the car wipers while driving, but at least the temps were in the low 60s.  Pollen counts were off the scale, but that’s a small price to pay for a very beautiful wooded setting.

Combination race, ministry, and country fair

Prater’s Mill is out of the way, but I can hardly imagine a better place to hold a half marathon.  The course was scenic, along country roads past pastures, homesteads, and rocky streams.  Since this is a mountainous area (north of Dalton and very near the Tennessee line), I expected many steep climbs, but it was actually quite flat: mostly gently rolling hills with just a couple of long uphills.  This run in the country was so pleasant that I spent the first several miles with the MP3 player off, listening to singing birds and other morning sounds.

At 9:46, the first mile was my slowest, as I navigated through running traffic.  I kept thinking I should have started closer to the front, but at least it forced me to start at a measured pace.  In the end, I definitely negative-split this thing.

T-shirt, 1/2 marathon medal, and bib

Miles 1-3 took us up some of the longer climbs and past the aptly-named Strain Road.  Around mile 4, the fog began lifting, leaving very low clouds with sunlight streaming through, painting the countryside in bright gold.  If only Tina could have been there with her camera!  Shortly afterward, we were chased by some yap dogs, but they were all bark and no bite, succeeding only in adding humor and speed motivation.

After about the 10K mark, we were treated to some nice downhills, and then mostly level territory until about mile 11.  Mile 8 was a turnaround: not my favorite, but it offered the chance to see where I stood against other runners.

I had recently recalibrated my Nike+ on a flat course, which left it confused on these hills.  On average, it reported nearly 10% too much distance, since it did not account for my shorter uphill strides.  But the course’s consistent, well-marked milestones helped me adjust.

Lydia finished first in her age group

After mile 11, we hit another uphill stretch, which troubled my left knee.  So once I cleared mile 12, I checked my time and, seeing I was in great shape to finish at my sub-2 goal, dropped my pace significantly, perhaps a little too much.  As I approached the final tenth, I could see the race clock and hear a volunteer shout, “hurry and you’ll beat 2 hours!”  So I kicked into a final dash (a sub-6:00 pace) and finished at 1:59:50.  Lydia had just finished her 5K and met me at the finish line.

Looking around, I could see the post-race activities in full swing.  The grounds around the river and historic buildings were filled with bounce houses, booths, concessions, and a talented praise band playing in the pavilion.  Joining the racers were many families and other visitors, giving the place the feel of a combination race, ministry, and country fair.

Cornbread: another reason to recycle

Lydia was excited about her strong running, so we checked and found she ran the 5K in 25:57, finishing first in her age group!  She received a very nice award for that.

Lydia takes on the 5K

Overall, this race had a lot going for it: scenic course, nice venue, valuable ministry, abundant post-race activities, small town hospitality, plenty of helpful volunteers, top-notch timing system, and great execution.

For all the promotion and activities, this was still a small race: just over 600 runners.  I would like to see it grow, and I have a feeling that once the word gets out, it will.  There was a registration cap for this first annual race; I hope they can expand and accommodate a larger group next year.