Hard Reset of Career and Life

§ May 26, 2010 00:01 by beefarino |

The best way to predict your future is to create it. -Peter Drucker.

So I've been MIA for a while.  At least here.  I thought it would be best to jot down the happenings of the last 5 months, as things have changed dramatically for me in that time.

In March of 2010, I made the decision to become self-employed.  Well, technically speaking I work for the company I own.  I had lots of reasons for doing this, but it basically boiled down to making a living vs. living my life.  The facts: I was not satisfied with my full-time employment situation and wanted a change; I found myself in a very rare and positive position, with enough freelance work to sustain me and my family for a year; I have some personal projects I want to get up and running that require significant personal investment.  This is something I've wanted to attempt for some time, and I simply could not imagine a better opportunity to do so.  My new venture is Code Owls LLC, website forthcoming.  That's my logo there, thanks to 48hourslogo.com.  And I'm happy to report that after only two months I'm already having to turn away work.

Last Thursday (May 20, 2010) I presented an hour session to the Charlotte ALT.NET group titled "Distributed Version Control using Mercurial".  Reception was good, despite a botched example and the seemingly endless command-line pounding.  I plan to post a summary of the talk as a blog post soon.

I'm also excited about the upcoming CodeStock community event.  There are so many awesome sessions and panels to attend, choosing a schedule will be very difficult.  I'm also presenting two sessions, one on PowerShell as a tools platform, and another on getting started on the Arduino platform.  A big Thank You to everyone who offered their votes to my sessions - I apparantly earned an "Elder Award" by getting both sessions voted into the top 20!

I've also jumped in to a new local community in here in Charlotte, NC: the Charlotte Arduinophiles.  This is a group of local evil and benevolent masterminds that love to hack using the Arduino hardware platform.  Special thanks to Brady on getting this rolling; we are presently getting organized, and at the moment most of our activity is focused at Charduino.org, where we share our hacks and projects and look for feedback.  Rumblings from the current participants seem to point to organized hack sessions and contests; e.g., maze-solving bot design evenings.  If you are interested in joining us, regardless of your experience, drop me a note.

So there you have it.  Big changes but a much happier me.


it's been noticed...

§ October 1, 2009 01:22 by beefarino |

Just ignore this post, I just need to release some steam...

We just had an emergency team meeting.  The topic: it's been noticed by the executives that we're not always around when they are.  Someone needed something and one of us wasn't there to oblige.  That must have really chapped their hide.  

Well, I've noticed some things too.  Here's what I've noticed:

  • I'm VPN'ed into work at midnight fixing the build someone else broke;
  • I'm constantly tweaking our unit tests to keep them working as the rest of the team gets to plod on to greenfield pastures;
  • I'm responding to support emails at 2am;
  • I'm answering the support phone at 4am;
  • I still make the 9:30am scrum;
  • I bust my hump as a principal developer on a project, only to hear the executives single-out my superiors to praise for my work;
  • After four rounds of layoffs, I've taken on so many roles here I've lost track;
  • I haven't dropped the ball on any of my responsibilities (or if I have, no one has let me know about it);
  • I've been willing to drop my life for days at a stretch to make emergency trips to fix client issues;
  • I'm frequently the last one out the door at the end of the day;
  • I see my kids for maybe 90 minutes a day;

... and more thing I noticed: the people I work for only notice me when I'm not around.


when a property should be a method

§ September 29, 2009 13:46 by beefarino |

I posted a quip on twitter this evening:

note to devs: a boolean property that expects to be set to only a false or true value (and throws otherwise) should be a method instead.

Several people prodded me for more an explanation, so here it is.

Say you have a default feature, and you want to offer consumers of an object the ability to disable the feature.  One common practice is to use a boolean property, consumed like so:

// ...
thingWithFeature.DisableFeature = true;
// ... 

It's simple and makes sense.  However, I'm finding a lot of hardware SDKs are throwing exceptions when you try to set such a property to false, in this example indicating that you do not want to disable the feature (forgive the double negative).  In other words, the property is settable to one specific value.  E.g., the SDK implementation looks something like this:

// ...
public bool DisableFeature
            if( ! value )
                throw new ArgumentException();
            // ... disable the feature when the value is false
// ...

As a consumer of this object, there is only one path I can take with the DisableFeature property that will result in a valid operation.  The property syntax goads the consumer into failure by offering up an illusion of functionality that does not exist.  As a developer, I have every reason to assume that a boolean property can be set to true OR false.  If one of those is not appropriate, then the property isn't a property, it's a method:

// ...
public bool DisableFeature()
    // ... disable the feature
// ...

As a method, the one valid path is captured unequivocally, and it's not possible for consumers to assume they can do more than they are allowed by the SDK.

ConvertFrom-PDF PowerShell Cmdlet

§ July 8, 2009 06:14 by beefarino |

I hate PDFs. 

And now I need to search through several hundred of them, ranging from 30 to 300 pages in length, for cross-references and personnel names which ... um ... well, let's just say they no longer apply.  Sure reader has the search feature built-in, so does explorer, but that's so 1980's.  And I sure don't want to do each one manually...

I poked around the 'net for a few minutes to find a way to read PDFs in powershell, but no donut.  So I rolled my own cmdlet around the iTextSharp library and Zollor's PDF to Text converter project.

There isn't much to the cmdlet code, given that all of the hard work of extracting the PDF text is done in the PDFParser class of the converter project:

using System;
using System.IO;
using System.Management.Automation;
namespace PowerShell.PDF
    [Cmdlet( VerbsData.ConvertFrom, "PDF" )]
    public class ConvertFromPDF : Cmdlet
        [Parameter( ValueFromPipeline = true, Mandatory = true )]
        public string PDFFile { get; set; }
        protected override void ProcessRecord()
            var parser = new PDFParser();
            using( Stream s = new MemoryStream() )
                if( ! parser.ExtractText(File.OpenRead(PDFFile), s) )
                        new ErrorRecord(
                            new ApplicationException(),
                            "failed to extract text from pdf",
                s.Position = 0;
                using( StreamReader reader = new StreamReader( s ) )
                    WriteObject( reader.ReadToEnd() );

The code accepts a file path as input; it runs the conversion on the PDF data and writes the text content of the file to the pipeline.  Not pretty, but done.


Here is the simple case of transforming a single file:

> convertfrom-pdf -pdf my.pdf


> my.pdf | convertfrom-pdf 

More complex processing can be accomplished using PowerShell's built-in features; e.g., to convert an entire directory of PDFs to text files:

> dir *.pdf | %{ $_ | convertfrom-pdf | out-file "$_.txt" } 

More relevant to my current situation would be something along these lines:

> dir *.pdf | ?{ ( $_ | convertfrom-pdf ) -match "ex-employee name" } 

Download the source: PowerShell.PDF.zip (1.10 mb)