I was trying to connect to a TFS server in another domain, but without success. I could connect to the TFS web services through FireFox after providing the correct credentials, but Visual Studio was simply failing with a TF31002: Unable to connect to this Team foundation Server: tfs.

TF31002

I wasn’t being prompted for alternate credentials when using Visual Studio, only when navigating to the TFS server (http://tfs:8080/services/v1.0/ServerStatus.asmx) through FireFox. Navigating to a network share (\\tfs) also prompted me for credentials and allowed me to see the shares. Only Visual Studio wasn’t prompting for credentials. I decided to try IE7 and received a 502: Bad Gateway error. Ah ha! A lead. Tools… Internet Options… Connections… LAN settings… Uncheck “Automatically detect settings”… OK… OK… Refresh IE and I’m prompted for credentials and can see the server status page. Woohoo! Now let’s try adding the TFS server again in Visual Studio:

AddTfsDialog

Click OK and the moment of truth…

TfsCredentialPrompt

We have a credential prompt!!! Type in correct credentials for the other domain and…

AddRemoveTfsDialog

Houston, the eagle has landed! Looks like automatic proxy detection somehow prevents IE and Visual Studio from connecting to TFS successfully. I would like to point out that “Automatic proxy detection is enabled” was not listed amongst the possible reasons for failure in the TF31002 error. Go figure.

Thanks to everyone for attending Simple Patterns for Simple Problems last week. Source code – before and after – can be found here.* The “after” source is where we left off. The additional Utility methods are left as an exercise for you, dear reader. If you have any suggestions on how to improve this presentation in the future, I would love to hear from you.

* I haven’t included NUnit in the zip file as that would have bloated the download. Once you unzip, simply copy NUnit-Net-2.0 2.2.8\bin to SimplePatternsForSimpleProblems-[Before|After]\tools\NUnit.

After my presentation yesterday on Simple Patterns for Simple Problems, John Bristowe, a fellow plumber (and closet agilist), interviewed me about agile development on the .NET platform. We talked about why developers should be interested in learning more about agile development techniques, including unit testing, TDD, code coverage, continuous integration, and more. Check it out: A Chat with James Kovacs on Agile Development.

UPDATE: One thing I forgot to note was that when I said most agile developers use Visual Studio and ReSharper, I should have qualified that with most agile developers [on the .NET/Windows platform] use Visual Studio and ReSharper, though I’m sure that was obvious. Java and Ruby developers don’t typically use Visual Studio. Tongue out

(via Raymond Chen)

What happens when you pit a Trojan Horse filled with a half-dozen Greek soldiers versus modern security guards? Watch and find out…

Of all the attempts, I found it most amusing that the history department had not learned its lesson from history, but the Turkish embassy didn’t fall for the ploy a second time.

(via Jean-Paul Boodhoo)

Manoj Khanna just created the Calgary Open Source Group specifically to foster the use of open source software in the Calgary market. Here is the group’s mandate:

“Calgary Open Source Group (COSG) is a forum that promotes the spread of Open Source Software and Free Software culture in Calgary. Through lively debate/talks, presentations and interactive network events, COSG aims to showcase the potential of open source software development and the impact it may have on software engineering for companies based in the oil city.”

Given the amount of open source software that I use in my day-to-day development and the fact that I often promote good open source tools in my presentations, I thought it only appropriate to join the group myself. So I’m member #3 right after Manoj and JP. I look forward to contributing to the community by promoting the adoption of open source tools where appropriate. Hopefully we can organize some presentations specifically around high quality open source tools for .NET development, especially for agile development. (Honestly, most of the great agile development tools – minus JetBrains ReSharper – come from the open source community.)

Jean-Paul Boodhoo and I will be presenting Simple Patterns for Simple Problems at the Calgary .NET User Group at noon on Thursday, July 19, 2007. Here’s the abstract:

Everyone has that little (or not so little) class called Utility that holds all kinds of interesting bits of business logic. It is a hodge-podge of code that you’re not sure where to put. This session will examine some common types of methods found in utility classes and how to refactor your design using simple patterns to eliminate these troublesome kitchen-sink classes.

Location:
330 – 5th Avenue SW, T2P 0L4
Calgary AB Canada
Conference Room CP1-1106
(the elevator will be open to the floor between 11:30 and 12:00 so no security pass will be required)

Food and beverages provided by Nexient.

Every time I need to set up a bunch of virtual machines, I have to go back and look up where to find the Sysprep tool and how to use it. Here are the details so I can find it in the future…

In case you haven’t encountered Sysprep before, it is a tool that allows you to create a base OS image (including Windows, Office, Visual Studio, or whatever other applications you want) and then re-package it. You can then create cloned disks (or just copy the whole thing) and when you boot the new disk, it is like booting Windows for the first time, except with all your software installed. You get to choose a new computer name, SIDs are regenerated, etc.

Each version of Windows requires the correct version of Sysprep. Where do you find the correct version of Sysprep? On your install disks in <DVD>:\Support\Tools\Deploy.cab. Although System Preparation tool for Windows Server 2003 Service Pack 2 Deployment claims to install the Sysprep tool, I’ve never been able to make it work on my system. So don’t bother wasting your time. Go to your original install media and grab the file from there.

Creating the Sysprep Image

  1. Open <DVD>:\Support\Tools\Deploy.cab and extract setupcl.exe, setupmgr.exe, and sysprep.exe to C:\Sysprep. (N.B. C: is your system drive. If you installed Windows to another drive letter, use that drive letter rather than C:.)
  2. Run setupmgr.exe from C:\Sysprep.
  3. The Setup Manager wizard starts. Click Next…
  4. Create new… Next…
  5. Select “Sysprep setup”. Next…
  6. Select the correct OS version… Next…
  7. Select “No, do not fully automate the installation”… Next…
  8. Enter Name and Organization, Time Zone, Product Key, and Workgroup or Domain. The other settings can remain defaulted. Note that you don’t want to specify the computer name since you will be creating multiple computers from the base image and you don’t want to specify the admin password, even encrypted. If the sysprep program can extract the password from the answer file, so can any hacker worth their salt. Click Next… through to the end.
  9. Finish… Save to C:\Sysprep\sysprep.inf. OK…
  10. Wait while Setup Manager finishes. Cancel… (Yes, odd way to exit a program that has completed successfully.)
  11. Run sysprep.exe.
  12. Click OK.
  13. Ensure that “Don’t regenerate security identifiers” is UNCHECKED. You want to regenerate the SIDs when each new clone boots.
  14. Click Reseal, OK to confirm that you want to regenerate SIDs, and wait for the system to shut down.

Creating a Cloned Server

  1. If you’re using VMWare Workstation, create a linked clone of your Sysprepped server. (You can also create a new linked disk using VirtualPC using File… Virtual Disk Wizard and then creating a new VM using the linked disk.)
  2. Change any VM settings such as memory. DO NOT change number of processors from 1 to 2 as the HAL (hardware abstraction layer) for uni-processor vs. multi-processor Windows is different. Your system will blue screen if you do this.
  3. Boot the cloned server.
  4. The Windows Setup wizard will appear. Next…
  5. Accept the license agreement. Next…
  6. Enter a new computer name and administrator password. Next…
  7. Windows will boot and you can log in with the administrator password you just entered.
  8. When prompted, click “Yes” to update your product activation.
  9. Select “Yes, let’s activate Windows over the Internet now”. Next…
  10. Select “No, I don’t want to register now; let’s just activate Windows”. Next…
  11. OK…
  12. Update this server… to go to Microsoft Update.
  13. Once you’re ensured that your patches are up-to-date, you can close the browser and click Finish… then Yes… on the dialog to start using Windows.

You should now have a fresh copy of Windows. You can create as many cloned servers as you need for your mini-network.

Alright, I call uncle. Justice tagged me way back on April 17, 2007. I emailed him back saying that my major plan for the summer was to spend more time with my family and overall, I’ve been successful at that. Seems that this answer wasn’t good enough for Justice and took me to task publicly. Look, bud, at least I had the guts to stand up on stage and make a fool of myself. BTW – I haven’t seen a whole lot of publicly-announced progress on that massive book list of yours, Justice!

So now that it’s July, I’m thinking about my professional goals for the remainder of the year… I’ve mentioned before the crazy pace of change in the Microsoft world these days. I’ve dabbled in a lot of different server technologies over the years – SharePoint, BizTalk, CMS, Reporting Services, etc. Looking back, what I’ve always loved is custom software development rather than server technologies. Working in code – not designers – and solving real problems. I love elegant software and design patterns. I love agile development and TDD. These are the things that get me out of bed in the morning. In my opinion, agile development techniques are on the cusp of making as big a splash as object-oriented programming did back in the 90s. So that is where I am focusing my energies over the next 6 months, likely much longer. Let’s take a look at my multifaceted approach…

Books

I’m a voracious reader and prefer books about concepts rather than how-to. Most of these books have to do with agile concepts and/or patterns. Let’s take a look at what I am currently reading:

  • xUnit Test Patterns by Gerard Meszaros
    • This book was just released and I’m already few chapters in. It contains great information on how to get the most value out of your test suite. This book was definitely written with a TDD mindset, but lots of great information on writing effective test code regardless of your development style. Recommended.
  • Enterprise Integration Patterns by Gregor Hohpe and Bobby Woolf
    • This book has been recommended by many colleagues and discusses why messaging systems are important in the enterprise. The book is technology agnostic. Many of the patterns are implemented or can be implemented by commercial EAI products, such as BizTalk, Tibco, and others. Even if you’re not using a commercial EAI product, understanding the patterns can help you build better integration solutions. Definitely an interesting read. As an aside, I had the pleasure of meeting Gregor Hohpe at the Global MVP Summit this year. You’ve never seen such a look of fear and confusion on a ‘softie’s face as when Gregor says, “Hi, my name is Gregor Hohpe. I am a MVP. I work for Google.” Open-mouthed
  • Windows Presentation Foundation Unleashed by Adam Nathan
    • This is honestly a how-to book, but Adam goes into a lot of detail regarding the practical theory. WPF is such a different rendering model than GDI/GDI+ that it’s worth understanding how it works. I expect to see a lot of work around WPF in the next few years since WPF is the foundation for desktop apps going forward as well as Silverlight, Acropolis, and other technologies. The book is a fun read and recommended.

In the chute…

  • Extreme Programming Explained by Kent Beck and Cynthia Andres
    • I’ve read and talk a lot about Extreme Programming these days, but I want read the book that started it all. There are arguments whether the dogmatic 1st edition or the toned-down 2nd edition is better. I’m starting with the 2nd edition.
  • The Pragmatic Programmer by Andrew Hunt and David Thomas
    • Another classic recommended by a wide variety of people.
  • User Stories Applied by Mike Cohn
    • I’m well-versed in use cases. I want to see how user stories compare as they are getting a lot of press these days. I’m also interested in knowing more about techniques like story cards.
  • Agile Estimating and Planning by Mike Cohn
    • I consider myself a competent estimator and have taught teams how to estimate effectively. I’m interested to see what Mike has to say about the subject.

Technologies

  • Dive deeper in Castle Windsor and maybe pick up a little Boo while I’m at it.
  • Use MonoRail on a project.
  • Learn more about Aspect-Oriented Programming (AOP).
  • Although I’m tempted to spend the time learning LISP, F#, or Ruby, I think this is best left until early next year. This year is already busy without trying to learn two new programming languages. (Boo is my first choice, noted above.)

Speaking Engagements

My presentations in the coming months will focus on agile development and related techniques. Jean-Paul Boodhoo and I will be presenting at the Calgary .NET User Group on July 19 at noon on Simple Patterns for Simple Problems. I’m organizing a Western Canada User Group Tour through the MSDN Canada Speakers Bureau. I’ve got an outstanding invitation to speak in Toronto, which will likely happen sometime this fall. I’ll be up to Edmonton to harass Justice and give a talk at the Edmonton Code Camp (and likely the User Group too). I’m also looking into hitting the speaker circuit to talk at some combination of DevTeach, VSLive, and DevConnections. TechEd Barcelona is tempting, but November is already looking too busy.

Teaching

I love teaching. I love seeing the light go on in a student’s head when they “get it”. I truly believe that you cannot become a better developer if you don’t understand the fundamentals. So I am developing a course on object-oriented principles and patterns that I’ll be delivering this fall. Details will be forthcoming in the weeks ahead. Drop me a line if you (or someone you know) would be interested in attending. I’ll be rounding out the course line-up with additional agile-related courses in the future.

Projects

I have a number of pet projects that I would like to release in the coming months.

  • VstsUnit Plugin for ReSharper – I am currently updating the plugin to support ReSharper 3.0.
  • Project Perseus – Top secret project developed test-first. That’s all I’m going to say at the moment.
  • Project Dex – Even more top secret than Project Perseus. I’ve revealed too much already…

Blogging and Casting

I definitely haven’t been blogging as much as I would like to. Blogging takes time. I am not the type of person who can whip off a post in 15 minutes. A good blogpost takes a few hours to write. I have also been meaning to do some screencasts. (I jettisoned my first screencast due to technical difficulties with the recording.) But I am hereby committing to a blogpost or screencast per week. I want to share my knowledge with the community and blogging, podcasting, and screencasting are all effective ways to do it.

Summary

So there you have it. Focus on agile. Engage with the community. Share knowledge. Have fun.

Tag, You’re It

I pass the gauntlet to:

My duties as a TechEd booth babe are now done – at least until next year. It was a fun, but exhausting, week and I was typically running on 3-4 hours sleep per night. It all started Sunday night with Party with Palermo. Jeffrey Palermo threw an awesome party again with 437 geeks in attendance at the Glo Lounge. Every party is bigger than the last. If he keeps this up, he’ll have to rent a conference centre next time!

I spent most of the week answering questions at the TLC Architecture booth with Peter Provost, Jeffrey Palermo, Don Smith, David Schmidt, and many others. There was a huge amount of interest in agile development techniques, including test-driven development (TDD), mocking, pairing, Scrum, Extreme Programming, and more. I also realized how dependent (in a good way) on ReSharper I’ve become. I was demonstrating some design techniques (specifically model-view-presenter) and grew so frustrated with vanilla Visual Studio installed on the kiosk, I grabbed my laptop and got down to some serious coding with the help of ReSharper. (Remember going from Notepad to Visual Studio and finding out how addictive IntelliCrack(TM) can be? Becoming proficient in ReSharper is an equally large step in productivity and going back is just painful.) Thanks to everyone who dropped by the booth to chat!

In addition to my booth babe duties, I led a Birds of a Feather session on Creating Flexible Software: TDD, Mocking, and Dependency Injection. The session was scheduled for 7:45pm Tuesday night, which made me a bit worried that I’d only get half-a-dozen people showing up. As it turned out, approximately 50 people turned up for a very lively discussion. There were many agile practitioners there, who generously shared their knowledge and experience. We had to wrap up the discussion after an hour because another group needed the room. The discussion moved into the hall with about a dozen people talking for another hour about experiences, tools, and techniques. It was great to see such enthusiasm from people about one of my favourite topics.

Next was Speaker Idol on Wednesday. What can I say other than complete flame-out on my part? I’m an experienced speaker and have spoken in front of crowds of 500+. Standing in front of a judging panel made me panic. My 5-minute talk was to explain the TDD-style development. I tried something crazy (a rhyming jingle about software development) to be different, but tripped up midway through and didn’t recover. It also turned into more of a rap than a rhyme, and everyone knows that white men can’t rap. Here is the full version meant to be said in the style Jenga, the 80s commercial:

Traditional Development Jenga

You take an object from the bottom and you put it on top,
You take an object from the middle and you put it on top.
That’s how you build your software; you just don’t stop.
You keep building that software putting objects on top.

It teeters and it totters, but you don’t give up;
it weebles and it wobbles, but you build it on up.
You take an object from the bottom and you put it on top,
you take an object from the middle and you put it on top,
till someone breaks the build, and that’s when you stop,
debug all night until you drop.

I wrapped (rapped) Confused it up with TDD Jenga, which went marginally better, though I rushed it:

TDD Jenga

You write a test and see a red glean,
You write some code and you make it go green,
Refactor that solution, that’s what I mean,
You are a TDD machine.

Commit that source to svn,
Cruise Control.NET kicks in,
Builds that software, tests it too,
You go home early ’cause now you’re through.

Needless to say, I didn’t make it to the finals. There were speakers more deserving than me. That evening, I drowned my sorrows/embarrassment with the judges at the Influencers Party. Hopefully one day I will live down the “Rapping Speaker” appellation that I seem to have earned from Stephen Forte.

On Thursday, Jeffrey and I met up with two members of the Microsoft Data Platform team to discuss the Entity Framework. Between that discussion and the one we had at the MVP Summit, the DP team is getting it. They understand what the “NHibernate Mafia” are trying to do with domain-driven design (DDD) and why EF has to be persistent ignorant (PI) if it is going to be useable for DDD the way that NHibernate is used today. Daniel Simmons, one of the EF architects, had a great post explaining his epiphany regarding our ask for PI in EF. Kudos to Daniel for taking the time to do some reading and understand why true DDD requires a persistence-ignorant object-relational mapper!

It was a busy and tiring week, but I’d do it all again. Feel free to live vicariously by browsing through the TechEd 2007 Flickr Set.

I spent some time troubleshooting a Subversion failure. I created a new repository using CreateSvnRepo.ps1 and successfully fetched the contents using TortoiseSVN. I added some files and then tried to commit the changes, but I got this highly cryptic error message:

Error: Commit failed (details follow): 
Error: Authorization failed 

The causes of this generic error are many and varied. So googling did not pinpoint the problem. I tried turning authorization off in the conf\svnserve.conf. Same result.

Now that was really odd. I turned off authorization, but authorization was still failing for writes. After a bit of head scratching, I noticed this:

SvnServeConfError

Thank you Notepad2! The character encoding was set to Unicode and svnserve.exe was choking silently on the encoding. Without a readable svnserve.conf, it was using defaults, which allow anonymous reads, but not writes. That’s why I was able to fetch the repository, but not write to it. Switching the character encoding to ASCII solved the problem. Here is the offending line in the PowerShell script:

“[general]`r`nanon-access=none`r`npassword-db=../../passwd`r`nrealm=Default`r`n” > $repoConfigFile

Once I updated the command to specify the character encoding, everything was good for creating new repositories too.

“[general]`r`nanon-access=none`r`npassword-db=../../passwd`r`nrealm=Default`r`n” | Out-File -filePath $repoConfigFile -encoding ASCII

You can grab the updated version of CreateSvnRepo.ps1 here.

Let me wrap up by saying that I like Subversion, but its failure modes leave something to be desired. It would have been more helpful to fail with an unreadable svnserve.conf than ignoring the file and using defaults. Even better would be if it understood Unicode configuration files.