Jul 31, 2009

Visual Studio Tip: Guide Lines for Line Wrapping

Nothing new here, but I was talking about it with a colleague today who wasn’t aware of the feature, so if you haven’t seen it before you might find this useful

Let’s say you want to wrap or break lines in your source code at the 80 column mark or 120 columns (or whatever your team prefers).  How do you do this?  Visual Studio doesn’t include any options in the GUI to enable such functionality.

That said, it is possible, and you may have seen people who have guidelines on their screen that look something like the following:


The way to do it is to simply jump into Regedit and add a value as follows:

Key: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor

String Name: Guides

Value: RGB(128,0,0) 80,120

The 80,120 will actually add two guidelines – one at column 80 and one at column 120.

Hope that helps!

References: Stack Overflow and Sara Ford

NUnit for Team Build Gets an Update

For those of you using NUnit with TFS you may want to go and visit the NUnit4TeamBuild project site on CodePlex and get the latest release.

It fixes some issues with support NUnit 2.5 and test names longer than 255 characters, but most importantly it removes the need to have MSTest available for publishing the results back to the TFS server through the inclusion of a new utility that makes the appropriate WCF calls directly instead of doing so through the MSTest executable.

Many thanks to Kev Watkins for the contribution! I love seeing open source working so well :-)

For more info on how the whole thing works go and see Kev Watkins blog post or visit the project site.

Jul 29, 2009

Have We Named the Slashes Incorrectly?!

What do you call the ‘\’ and ‘/’ symbols?

Do you call the ‘/’ a slash? Do you also use the same name for the ‘\’?  Most people do (even if they think one of them is called the backslash) and they’ll use the names interchangeably, unless of course they have worked for Microsoft for more than 3 months in which case they might be calling one of them a “whack”.

Side note: The first time I heard someone at Microsoft ask me to open up a browser and go to h-t-t-p-whack-whack-somesite-dot-com my response was to crack up laughing!  Seriously?! Whack-Whack?  What are we? The Mafia?! Whack that URL!

It’s even better for the back slash, since it gets called a back-whack. Even more sinister mafia overtones.  I can imagine someone saying in hushed and secretives tones “at the command line go to C-backwhack-windows”. Oooo… so scary!!

That said the redeeming feature of being in the midst of so much violence was that I knew which slash was whacked and which slash wasn’t.  So now, back to the extremely serious matter at hand – how do we resolve the confusion that the naming of these slashes causes? Some people say that one is a forward slash and one is a backwards slash and that it’s blindingly obvious, but try explaining that to your grandmother as she’s trying to login to facebook so she can see what you’ve been up to, or proclaiming the nuances of it to your IT illiterate friend who’s trying to locate a document they’ve lost on their computer.  They just don’t get it because to them a forward slash is one that is drawn from top to bottom in the forward direction! The terminology we use doesn’t gel with the experience the average punter has and it only makes it worse when people shorthand the terminology for the forward or backward slashes to just ‘slash’.  It’s then that you can guarantee that someone will get confused and asks which slash they mean.  It’s then that the kittens start dying!

Try this for yourself.  Go and find one of those antique pen thingies your parents still talk about and try writing the offending symbols on a fragment of dead tree.  Note how you will have drawn the symbols from top to bottom, and that the “forward-slash” is, as suspected, drawn from right to left, while the “back-slash” is drawn from left to right with the hand moving in a forward direction! What does this mean!  Can it be that the computing world has it wrong!  Can we have gotten it round about face!!  Can it really be true that the backslash is the forward slash, and the forward slash is the backslash?!!  Oh the horror!!  The wasted years of our lives!

Even that tome of absolute truth Wikipedia has the backslash and slash wrong!

Just to be clear and in case you missed it, I propose that we rename the symbols with immediate effect to:

Back-Slash: /


Only in this way can the true balance of the world be restored! Only then will peace be restored to the galaxy! Only then will we truly be able to fathom the magnificence and pure awesomeness that is Jar-Jar Binks in Star Wars Episode 1!

And with that I now calmly and humbly accept all the accolades, awards and cash donations for making such a stunning breakthrough in the world of typography, human communications and micro-molecular cell bonding that I’m sure you agree is so richly deserved!

Jul 20, 2009

Some TeamBuild Fun and Games

I’ve just spent the morning helping a client with a few team build problems they were having using a newly installed TFS2008 server and a new build server.

Where’s LC.exe?

The first problem they had was that when they were running their build they were getting an error as follows:

Task failed because "LC.exe" was not found, or the .NET Framework SDK v2.0 is not installed.  The task is looking for "LC.exe" in the "bin" subdirectory beneath the location specified in the SDKInstallRootv2.0 value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework.  You may be able to solve the problem by doing one of the following:  1.) Install the .NET Framework SDK v2.0.  2.) Manually set the above registry key to the correct location.  3.) Pass the correct location into the "ToolPath" parameter of the task.

LC.exe is the program the is used to processes the *.licx files when dealing with 3rd party custom controls (they were using Janus controls) and for some reason the file couldn’t be loaded even though the LC.exe file could be found on the disk.

The thing to note for this is that they were using a new build server.  It has TeamBuild 2008 and VS2008 SP1 installed and was successfully building a separate project (that didn’t have licx files).

As it turns out, the problem related to the fact that they were trying to build a VS2005 sln file.  Since the build server didn’t have VS2005 installed on it many of the settings the installer normally creates were present, including the ones that set the paths for the LC.exe.

Instead of mucking around with VS2005 solutions, we simply converted it to a VS2008 solution and the LC.exe problem went away.

As a note we could have installed VS2005 on the build server as well but since the team was moving to VS2008 anyway the solution conversion option was deemed to be the better choice.

However, once we’d done this we ran into another problem.

Strong Naming Shenanigans

The solution being built included a strong named assembly, with the signing processing using a .pfx file instead of the usual .snk file.  When the build ran we saw this error message:

Target ResolveKeySource: 
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1718,7): error MSB4018: The "ResolveKeySource" task failed unexpectedly.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1718,7): error MSB4018: System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1718,7): error MSB4018: at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1718,7): error MSB4018: at System.Windows.Forms.Form.ShowDialog()
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1718,7): error MSB4018: at Microsoft.Build.Tasks.ResolveKeySource.ResolveManifestKey()
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1718,7): error MSB4018: at Microsoft.Build.Tasks.ResolveKeySource.Execute()
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1718,7): error MSB4018: at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound)
Done building target "ResolveKeySource" in project "xxx.yyy" -- FAILED.

Since MSBuild runs non-interactively any time a dialog box appears the build will break (as the dialog box can’t be shown).

So what was actually happening here to cause a dialog to appear?

The eagle eyed amongst you will probably have figured it out already, but for those who couldn’t be bothered thinking too much I’ll tell you.  As it turns out when you do a compile and sign your assemblies with a .pfx file Visual Studio will look in the local certificate store to see if the certificate is already known.  If it’s a certificate that hasn’t been used before then Visual Studio will attempt add it to the local certificate store and in doing so will prompt you to enter the private key as part of the installation process.  This is where a dialog box will appear.

Since this was a new build server the .pfx file obviously hadn’t been seen yet and so Team Build was trying to prompt for the private key so it could install the certificate.

The solution to this was to simply log on to the build server as the build service account, run the build manually via Visual Studio and enter the private key when prompted.

Subsequent builds then worked as expected as the certificate was now loaded in the certificate store.

(Thanks to Ed Blankenship and his blog for the info on this one)

Jul 14, 2009

Our Job As Software Developers…

I’m lucky enough to get to do some public speaking about agile from time to time and a large part of my job involves helping teams improve their agility and one of the things I’ll talk about when introducing people to agile concepts is the role of the software developer.  If you’ve heard me blather on about such things in the past then this might just be a refresher for you. If you’re just following along on the blog then this might be something for you to think about, especially in what it means for how you approach each day.

So, here’s my view on what the job for a software developer is all about…

As software developers our job is not to write software, our job is to provide great customer service.

Customer Service?! What the…?!

“Surely not.  Our job is to write software!” you cry.  No, actually, it’s not.  Or, maybe I should say, that’s only a part of what our job is.

A number of years ago now, I read a great book on sales and marketing (its name eludes for now) and in it the author took the position that every single business in this world is a service business.  For some industries, that’s obvious, but what about manufacturing for example?  Well, the author stated that the reason these companies are able to sell their products at all is because the product is the result of a service they are providing.

What service? The satisfaction of their customers needs and desires through a physical item.  I stopped and though about this for a while and realised that this actually makes sense. It explains why me-too businesses can start in competitive industries and thrive and why other business that have good product ideas fail (they’re not meeting a need).  It also changed the way I viewed a lot of what we do as developers.  Software development is in essence the provision of the service to creating software that meets our customers needs.  If a customer doesn’t have a need or desire that they want satisfied through software then there is nothing for us to write.  No software –> no sale –> no money –> no job.  Similarly if someone else can meet the same need but do it with better customer service then they’ll get the sales and we won’t.  Once again: No sales –> no money –> no job.

Now sometimes this customer service mentality can be a little grating.  What if the customer asks for and insists on something we think is stupid and short sighted.  Do we go against them because we know better? I don’t think so. Why? Because we are in no position to tell the customer what they’re needs and wants are. We don’t have their perspective, we don’t have their context, we aren’t them.  In fact, if you put yourself in their position you might come up with the same demands.

The trick for us is in helping our customers decide if they are asking for is really what they want or need.  This is where the 5-whys approach to questioning or proposing alternate ideas comes into play.  However, whilst we can propose your counter-arguments and reasoning as to why “stupid idea A” is a stupid idea, if our customer still disagrees and want that stupid thing provided, then that’s their prerogative.  After all, it’s their dime they’re spending, and they can choose to spend it as they wish.

Customer service will also say that if it’s all going to fall apart then be ready to support your customer in their time of need because it’s very likely that they will be both embarrassed that they ignored our advice and dug themselves a deep hole and at the same time they will be desperate to remedy the situation.  “I told you so” will only serve to impair your relationship, instead of solving the problem.  It might make you feel better, but it won’t make any real difference to what is going on. 

Awkward truth: The customer is always right (even when they’re wrong)

If you don’t like this, well that’s a shame, but you can’t do much about it.  You could consider self-funded retirement or life in a monastery as an option since that’s probably the only chance you have of a life without customers.  Failing that, your stuck with dealing with customers.

Yes, customer service can be a difficult thing at times and at times you may want to chew your arm off in frustration but on the flip side it can also be very rewarding.  There’s a special feeling you get when you see your customers improve because of a service you’ve provided, smiling because of something you’ve done for them or, even better, telling others about you because you’ve given them such great service.

So, stop and think.  If your job is a service job, then what does that change about the way you approach your work?

As a side note, you’ll note I used the word customer throughout this and not “client”. To me “client” infers that the development team are the dominant party in the relationship, whereas “customer” infers the idea that we serve them instead, and I think this can help us keep our attitude right.

Jul 6, 2009

Why Do You Blog?

I’ve been writing this blog for a few years now (since June 2005 in fact) and in that time I’ve been asked this question quite a few times, typically from people who I think like the idea of writing their own blog but get put off by what a lack of confidence and doubt.  Questions like “what would I say?” or downer statements such as “I don’t have anything interesting or original to say” are typically what I hear.

So, if you don’t mind indulging me for a few minutes, let me give you some of the reasons why I blog.  If these reasons help you consider your own blogging or lack thereof afresh then I’d be pleased, but that’s not really the point of this post as you’ll see.

By the way, in case you were wondering, there’s nothing radically new or earth shattering in this post.  Seriously.  It’s all been said before by other people with much more eloquence than I can put together.  In fact, if you want, go and read a few of those posts (just Google for reasons to blog or check Atwood’s or Hanselman’s blogs as they’ll probably have something prosaic and witty to say about it).  So you may ask why would I write this post at all then?  Let me give you the first of my reasons as an answer:

To Clarify My Thinking

Shock. Gasp. Awe. Yawn. Told you it wasn’t earth shatteringly original :-)  I sometimes write blog posts as a way of helping me get my view on things straight and clearing up my understanding.  The simple act of writing something down and trying to do so in a lucid, structured and clear manner instead of resorting to “grawk, nhhh, brrrp” explanations combined with hand movements and dance simply helps me get things straight in my head.  This particular post is to remind myself why I blog and why after a lengthy break (due to major household renovations) it’s worth getting back into.  When I write clarity posts I’ll normally publish them but sometimes I don’t, especially if I think it’s worthless drivel, but even so, the mere act of writing something down helps me understand where I’m at.  If I realise I’m still not clear on a subject it’ll usually just save it as a draft until clarity comes.

OK, With that out of the way here’s a few more reasons…

It Helps Me Improve

Yep.  Putting something on screen and posting it on the internet for any and everyone to see can be a bit scary at times, but that in itself is a challenge to help me improve not only my understanding of a subject but also my ability to explain concepts and techniques.

Sometimes it works, sometimes it doesn’t, but regardless it helps me improve, little by little, and for someone who blathers on about continual improvement this is just one of many mechanisms for doing it.

I Enjoy Teaching and Helping

I actually enjoy helping people understand something they didn’t before.  Now this is where most people start in with the “nothing original” excuse.  My response?  “Yeah, so?”.  Big deal if someone has written about it before.  Who cares if it’s something ScottGu or DHH has blogged about.  If someone’s reading a blog post of yours then it’s probably because they’re either interested in you as a person and want to hear what you have to say or because they found it via a search engine.  If it’s the latter, then you’ve probably written something from a slightly different angle than others and that’s something that’s going to help them.  That’s a good thing.

For The Fame and the Money!

Of course!  Well, maybe not.  Yes I’ve got some ads on the blog and feed (please click them and help me feed my starving children!!) but the amount of cash they bring in is only enough to cover a coffee once a week (if that).  And if I was doing it for the fame then I’d be delusional.  I’m glad you’re reading this post, seriously I am, but with my visitors a month count being in the 3,000-4,000 range and with the regular readers who follow via the feeds being in the hundreds I’d be considered extremely lucky to rate a mention globally.  If I wanted to get lots of hits then I’d have to blog about trendy subjects and unless I have an interest in it myself, then why would I? A blog should be about you and what interests you.  Of course I could write a killer app and be famous the world over, but that flash of inspiration still hasn’t hit :-P

Before I move on, I’ll be honest with you, a well received blog post does help scratch the ego and I like to get positive feedback, but if that was the main reason for me doing it, it would be a pretty crappy reason.  I can get my ego scratched much better by just visiting http://ourstereo.com/compliment/ and clicking refresh a few times.  Or playing a game with my kids who adore me.  Or, heck, I could just go look in the mirror… LOL. Yeah, okay.  Reality check!  I can proceed.

It’s a Record of What I Learn

Yep. Boring.  Move along.  Actually, I should just say that I often hit my blog and search for things I’ve written about a while back and where I’ve either forgotten the details or don’t have them handy.  Being able to quickly look up some info from the blog has helped me many, many times.

Finally, It’s A Way To Connect

This one is probably the least thought about, but to me it’s still something that’s quite important.  Blogging helps me connect with people, just like twitter and IM can, but instead of it being a social connection with people typically know me personally or are one or two connections removed, it’s more a connection around common interests and whatever my blog posts have been about.  Through some of my posts I’ve made connections with people I admire from around the globe that I would never have met in person, and who would never have encountered me via social networking alone.  Even though the connections are typically loose and short lived I think they’re still invaluable, and who knows, some of those connections have a tendency to stick and can become people you connect with over the long term.  How good it that!


So that’s enough reasons for me.  What about you?