Sponsored By Aspose - File Format APIs for .NET

Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!

Incarceration Log – Day 4

It has been only four days since my self-imposed, month-long incarceration in the prison known as Corporate Calgary, but already the three walls of my cell close in around me. My oppressors continue their assault on my psyche with inhuman tortures such as "Death by 1000 Quick Questions" and "Let’s Talk About Weather" and "We Meet Because We Can".

My jailors mock me with bizarre acronyms and epic tales of projects past. Yesterday, I nearly screamed in terror when I caught myself chuckling knowingly at one such anecdote. During a meeting to review progress of a system I didn’t know existed, let alone used, no less. I fear I may be going insane.

Two things keep me alive. One is the presentation I give next week on ASP.NET MVC to the Calgary .NET User Group on the 29th and the Edmonton .NET User Group on the 31st. During status meetings, I surreptitiously pull up my VM and review my code and notes, ignoring the sidelong glances at my insolent giggles. These presentations are my one tenuous grip on reality and I shall protect them with, well, not *my* life but probably the life of someone close to me.

The second is the one ray of light in my task list: a throwaway application I pull up when I need an extra dose of lucidity. Just this morning, I discovered an error that made me nearly leap for joy for the mere mental exercise, slight as it was:

private void ConvertFile( string converterName, string sourceFile, string destinationFile )
{
    IConverter converter = FindConverter( converterName );
    converter.ItemProcessed += converter_ItemProcessed;
    int recordsProcessed = converter.processFile( sourceFile, destinationFile);
}

This (much simplified) piece of code contained an error. The first time it was called, it ran fine. Each subsequent call appeared to process the file multiple times. I.e. the second time it ran, the file was processed twice, the third time, thrice, the fourth, ummm…quadrice. And so on and so forth.

Alas, the solution presented itself all too quickly. The file was not actually being processed multiple times. Rather, a brand new ItemProcessed event was being appended to the event handler each time through. So the second time the file was processed, the ItemProcessed event was called twice each time an item was processed. The third time, thrice. Etc, etc.

Unfortunately, the fix was trivial:

private void ConvertFile( string converterName, string sourceFile, string destinationFile )
{
    IConverter converter = FindConverter( converterName );
    converter.ItemProcessed += converter_ItemProcessed;
    int recordsProcessed = converter.processFile( sourceFile, destinationFile);
    converter.ItemProcessed -= converter_ItemProcessed;
}

And now I am left to ponder my decision to work onsite for the next month in this soulless place. Left to wonder why I left my safe haven. To toil between a woman whose radio is always slightly off-station and a man with a cruel tendency to squeeze his squeaky, rubber duck at inopportune moments.

Pray for me, readers. Pray. For hope.

Kyle the Indentured

This entry was posted in ASP.NET MVC, Presenting, Sundry. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://kyle.baley.org Kyle Baley

    Hi Greg,

    That’s a consequence of migrating off dasBlog to my own hosted WordPress then to an external hosted WordPress. I found the original post and updated the images. Ping me if you have any trouble. I’ve been out of Livelink for a few years now but I remember your site being pretty valuable while I was learning it. I’ll try to help if I can.

  • Greg

    Images seem to be missing :(

  • Kyle Baley

    @Mrs L: Clearly you are trying to kill me. That is the only reason I can think of for you to suggest that I fatten myself up before my wife arrives in Calgary to accuse me of such gluttony.

  • http://mrsloquacious.blogspot.com Mrs Loquacious

    While you are in exile in the concrete jungles of Calgary, you should check out the Crave cupcake place (near Kensington, I think?). It is the best buttercream goodness in the city, baked fresh daily, and a bit of sweet delight during those dark moments of your day.

  • Kyle Baley

    @Brian: I think I’ve worked there. They do come back, but…different. I think the company was Stepford Inc.

  • http://aspnetresources.com Milan Negovan

    Brian has left the building for typing a comment during “normal business hours.” :)

  • Jim L.

    “a man with a cruel tendency to squeeze his squeaky, rubber duck at inopportune moments.”

    You owe me a keyboard, man. I just spit my water out all over it.. lol :)

  • http://dotnet.kapenilattex.com Jon Limjap

    Next time you do offshore work, do it in a tropical country. 😛

  • Brian

    At least in your cell your allowed the pleasure of working with your own personal agenda’s.

    In our cells we’ve seen people ‘disappear’ without ever coming back for doing such things. We have no idea where they take them, perhaps into the bowels of prison to perform brain washing? But none of dare even check our email for fear of the man coming to take us away.