While working with a customer to help them diagnose a problem with one of their scripts, one little, tiny, teeny, eeentsy-weentsy, itty-bitty, microscopic modification made a HUGE difference in finding the root cause of their issue.  It was a script that reads a custom formatted input file and runs the data through a bunch of ETL-type processing.

This wind farm isn't in Virginia, and APCo's proposal doesn't include building any new wind. But the cows are cute. Photo credit: NREL

Old rusty decrepit script

$inputdata | 
  foreach-object {
    write-verbose "updating record $($_.name)"

New shiny and sparkling script

$rownum = 1
$inputdata |
  foreach-object {
    write-verbose "[$rownum] updating record $($_.name)"

Notice the difference?  This made it easy to jump directly to the offending line in the input file and inspect for the information causing their script to puke all over the new sofa.  Not a big deal for small input files, but for 10,000+ lines it can help shorten the task of locating a problem.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s