Author: Dave Fancher

Dave Fancher is a Lead Software Engineer at Vibenomics in Fishers, Indiana, a Microsoft MVP Visual Studio & Development Technologies, author of The Book of F# from No Starch Press, and Pluralsight author. He has been building software with the .NET Framework since version 1.1. Dave is active within the Indiana software development community as a member of IndySA, a speaker at user groups throughout the state, and a two-time contributor to Indy GiveCamp. When not writing code he enjoys spending time with his family, watching movies, photography, and gaming on on his Xbox One.

Visual Studio: Platform Based References

I’ve been needing to jump back and forth between 32 and 64 bit builds recently. Unfortunately a few of the 3rd party assemblies my project is using are platform specific so I found myself having to manually swap out the references to prevent BadImageFormatExceptions from popping up.  Since Visual Studio doesn’t provide mechanism for this I started exploring external ways to get the right assembly.

On a previous project we where we had this problem we were building with NAnt. With this configuration it was somewhat straightforward to create a dependencies folder that held and organized the different assembly versions and prior to the build, copy the appropriate ones to a folder referenced by the projects. This ensured that we always built the project with the correct assemblies for the target platform.  On this project though, I’m not using NAnt, I’m using MSBuild and I didn’t want to do a custom build task so I looked for another solution.

A 2 year old post from ryangerard.net provided the answer I was looking for.  The solution involves a simple project file “hack” where under each property group we define a variable whose value is the path to the appropriate assembly.

Note: The element name you use should be meaningful to your project. I’ve used ThirdPartyAssemblyPath for illustration purposes.

<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
  <!-- snipped -->
  <ThirdPartyAssemblyPath>(path to 32-bit assembly)</ThirdPartyAssemblyPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
  <!-- snipped -->
  <ThirdPartyAssemblyPath>(path to 64-bit assembly)</ThirdPartyAssemblyPath>
</PropertyGroup>

We also need to update the actual reference element to use a hint path based on the variable the variable.

<Reference Include="">
  <HintPath>$(ThirdPartyAssemblyPath)</HintPath>
</Reference>

I was able to leverage a single variable for multiple references because I’m using several assemblies from the same vendor. Since they’re pretty well organized in the vendor’s installation folder I only had to define a single variable for the folder and left the .dll names in the reference definitions.

Once you’ve made these edits you can freely switch between target platforms. I’m not sure how sustainable this is in the long term or on larger projects but it’s definitely an option. Just be careful if you ever need to change that reference that you update the variables rather than the reference or you’ll find yourself right back where you started.

Upcoming Talks

If you’re interested in learning about the Fakes framework (formerly Microsoft Moles) that’s included with Visual Studio 2012 you have two opportunities to do so this week.  Those in Fort Wayne, Indiana should attend tomorrow’s (June 12) NUFW meeting.  If Indianapolis is more convenient, feel free to attend Thursday’s IndyNDA meeting instead.  Of course, if you just want to heckle me attending both is also an option!

If either of these events interest you please check the appropriate group’s site for logistics.  I hope to see you there!

Visio Stencil and Template for UML 2.2

Visio 2010 includes software and database diagrams out of the box with the Professional and Premium editions but if you’re using the standard edition, good luck.  Once again I’m a little late to the party on this but I wanted to share a collection of UML stencils and a template I ran across today.

I’m far from a UML expert but from what I can tell, this is a pretty complete package that includes tooltips, multiple connection points, and expandable compartments.

If this is something you’ve been looking for you can grab it from the link below.  The stencils and templates are available for Vision versions all the way back to 4.1.  Be sure to check out the tips and tricks page for descriptions of the more advanced features of this set.

Visio Stencil and Template for UML 2.2.

Cool Swag from Stack Overflow

Stack Overflow Padfolio

This afternoon Esther called me at work to say that I’d received a package from some place called Stack Overflow.  Inside was a nice, branded padfolio, pen, and a few other things.  I was surprised about receiving this but the smart people over there anticipated my reaction and included a cover letter explaining it was a gift for having been an active Careers 2.0 user during my job search.

I was really impressed with the what the site offered.  I especially like how it goes beyond the traditional résumé by including sections for community involvement via avenues like blog posts and open source projects.  Being able to export the profile to PDF for easy submission to potential employers is a welcome feature too.  It was fun when I interviewed at Leaf and one of my interviewers recognized my résumé’s format as the one from the Careers 2.0.

My job search may be over but I’ll still be putting this to good use.  Thanks, Stack Overflow Careers team!

On a related note, I still have a few invitations for Careers 2.0 available.  If you’re interested and serious about using them drop me a note.

IndyNDA – Your Spark Razored my NHaml

When Jay Harris told me at KalamazooX that he was going to be speaking at IndyNDA soon I got really excited. That’s why I’m upset that for the first time in nearly two years I can’t make it!  On the bright side, I’ll be hanging out with my wife in Las Vegas as we celebrate our 10 year anniversary.

This month Jay is going to discuss a few of the ASP.NET MVC view engines, namely Spark, Razor, and NHaml. Jay is a great speaker and an all around good guy so if you can make this event I highly recommend it.

This month’s meeting will be at:

Wiley Publishing
10475 Crosspoint Blvd
Indianapolis, IN 46256

My Lumia Has Landed

Anyone that knows me personally or has been following this blog for a while knows that I was an early adopter of Windows Phone.  When I first heard about the platform and saw how Microsoft was re-imagining the mobile phone experience I knew which OS my next phone was going to have.  I’ve taken some heat from some friends over my enthusiasm of the fledgling platform but nevertheless I went ahead and got a Samsung Focus the day it was released and haven’t looked back.

Nokia Lumia 900Here we are about a year and a half later and the game has changed.  The highly anticipated (at least among us Windows Phone enthusiasts) Nokia Lumia 900 has been released on AT&T.  Unlike previous Windows Phones though, AT&T seems to be giving this device the respect it deserves with a massive marketing campaign.

Some of the best phones I’ve ever owned have been made by Nokia and being the Windows Phone fanboy that I am, I had to get my hands on one.  Amazingly, I was eligible for an upgrade so I wasn’t going to have to wait very long.  I moseyed over to my favorite AT&T store where Jessica tried to hook me up but they were already SOLD OUT of the cyan model!  She placed an order one for me and a few days later it arrived at my door.  That was about three weeks ago.  So how is it?  How does it compare to the Focus?  Does it live up to the hype?

(more…)

Kalamazoo X in a Nutshell

This past weekend I was fortunate enough to attend my 3rd consecutive Kalamazoo X conference.  This event has gotten better every year thanks to the efforts of Mike, Mike, Matt, and Mark.  I’ve written about the conference recently so I won’t go into detail about what Kalamazoo X is.  Instead I’ll let a quote from the home page do the work for me:

The X Conference is the other half of your career; the half that makes you stand out.

Kalamazoo X has a rich history full of great speakers with interesting topics and this year was definitely no exception.  As with years past I took quite a few notes, the highlights of which I’d like to capture here and share for you to ponder.  As you read through them I think you’ll find some of the recurring themes begin to fall out naturally.

(more…)

String Distances

One of my first projects at Leaf has been trying to match some data read from an OCR solution against what is in the database.  As sophisticated as OCR algorithms have become though it’s still not reliable enough to guarantee 100% accurate results every time due to the number of variations in type faces, artifacts introduced through scanning or faxing the document, or any number of other factors.

Most of the documents I’ve been working with have been pretty clean and I’ve been able to get an exact match automatically.  One of my samples though, has some security features that intentionally obfuscate some of the information I care about.  This naturally makes getting an exact match difficult.  Amazingly though, the OCR result was about 80% accurate so there was still some hope.

One of my coworkers suggested that I look at some of the string distance algorithms to see if any of them could help us get closer to an exact match.  He pointed me at the Levenshtein algorithm so I took a look at that along with the Hamming and Damerau-Levenshtein algorithms.

For the uninitiated (like myself a week ago), these algorithms provide a way to determine the distance between two strings.  The distance is essentially a measurement of string similarity. In other words, they calculate how many steps are required to transform one string into another.

I want to look briefly at each of these and show some examples. Note that each of these algorithms are case sensitive but modifying them to ignore case is trivial.

(more…)

Turning Over A New Leaf

Today is my last day at Aprimo.  The past 6 1/2 years have been full of rewarding experiences.  During my time at Aprimo I’ve learned a lot, worked on some neat projects, and made some very close friends.  At the same time though, I’ve felt like I’ve been in a bit of a rut for some time and needed some change.  After serious consideration I decided that the time to make the change is now.

Next week (April 2) I’ll be starting as a Systems Engineer at Leaf Software Solutions in Carmel, Indiana.  I’m really excited about this opportunity and the new challenges and experiences it will bring.

I’d like to thank Aprimo for its part in shaping me into the person and programmer I am today and for preparing me for this next chapter of my life.  I wish everyone at Aprimo the best wherever life may take you.

Kalamazoo X Conference 2012

I don’t get to as many conferences as I’d like to during the year.  I have yet to go to Code Mash, I missed out on Code PaLOUsa, and I envy everyone tweeting from VSLive (especially since Aria is a great place), but one conference I always make sure to attend is Kalamazoo X.  I’ve attended this conference for the past two years and didn’t hesitate when I was invited to take advantage of early bird registration for this year’s event.  It’s a four-hour drive from Indianapolis but it’s always well worth the trip.

I’ve mentioned this before but Kalamazoo X isn’t like other developer conferences.  Instead of focusing on the latest frameworks and toys, Kalamazoo X looks at things like communication skills, process improvement, and design.  I generally view it as a personal and career development conference for geeks.

The organizers have traditionally done a great job pulling this event together.  With speakers including Leon Gersing, Jeff Blankenburg, Tim Wingfield, and Joe O’Brien this year should be no exception.

Kalamazoo X is on April 21 from 8:00 AM – 5:30 PM at Kalamazoo Valley Community College (check the conference site for full logistics).  If you’re free that day I highly recommend registering.  It’ll likely cost you less than seeing a movie but the lessons will last for years to come.  You won’t be disappointed.