Sunday, December 16, 2007

Why Jon Galloway Is Horribly Wrong About Non-Admin

Jon Galloway and Jeff Atwood have been having a debate. Mostly the debate has been about anti-virus software, which is a topic that I have no strong feelings on one way or the other.

However, talking about anti-virus involves talking about security and risks and inevitably the topic of running as an administrator versus a limited user account gets mentioned.

Jon, though, more than just mentions running as a non-administrative user, he labels it as "just about impossible", and the benefits of living in a non-administrator environment is something I do have a strong opinion about.

I am a .NET developer. I develop console applications, windows services, websites, and smart clients. I do it all, not as an Administrator and not as a Power User, but I do it all as a standard user. I've been doing it this way since March 2006 and have never gone back.

I don't cheat either. Microsoft suggests running Visual Studio 2005 with increased privileges to avoid various issues. Bah! It works fine as non-admin. The only programs I run with increased privileges are installation programs... and they don't come along very often.

I'm not just using Visual Studio either. I sync my iPod with iTunes and keep my GPS up to date with TomTom Home. I use all the Office apps and I mount CD and DVD images with Daemon Tools. I write scripts in PowerShell and I test beta software in Virtual PC. I have a local install of SQL Server too.

It isn't just me either. Within six months, the other two developers I work with had joined my non-admin club after I had demonstrated not only how painless it can be but how it helps to ensure the software we develop will work when deployed to our clients' restrictive domain environments. Most of all I demonstrated how to be part of the solution to break the cycle of software that requires administrator privileges.

Ok, so far all these people I've mentioned who are running as non-admin could be considered very capable computer users and aren't the same as most people. Fair enough but how about the other less computer-savvy people I know who have been educated on how to work as a non-admin. People with jobs like call centre operator, machinist, automotive-electrician, and cook.

These are people running Windows XP to send faxes, play games, and surf the Internet, and most of them still type with one finger. Switching to an administrator account for occasional tasks is just a Fast User Switch away or, on domain-connected PCs, using the simple MakeMeAdmin tool.

Vista users get it even easier when an elevation prompt appears asking for an admin password when they need to install software or change a system control panel setting. I just don't understand why people think it is so difficult. And to be clear, there is no hidden magic here, I'm not touching the default ACLs on my file system or registry either.

To come back to where the debate began, my point is that running as a non-admin is not difficult and does not restrict productivity, but it doesn't necessarily help the anti-virus or malware situation either. Some basic tests do show that it helps in some common infection situations, but I'm confident that I would be able to easily write non-admin compatible malware if needed.

So, Jon, feel free to argue about the effectiveness of anti-virus products or how much being a non-admin protects from malware, but don't tell me non-admin is as usable as unplugging your computer. And Jeff, if you're going to suggest non-admin as a good option, at least lead by example.

By the way, I run 64-bit Windows at work and home too, just to reduce the list of compatible software even further.

 Friday, December 14, 2007

TFS Deployer and TFS 2008

Mitch Denny from Readify made two great tools available for Team Foundation Server last year. TFS Integrator provides Continuous Integration for TFS by registering for check-in events then triggering Team Builds and Dependency Replication. TFS Deployer provides automated deployment for TFS projects by registering for build quality change events then executing associated PowerShell scripts. Both of these tools were developed for TFS 2005.

TFS 2008 has just RTMed and it already includes check-in triggered builds in the box so TFS Integrator is less useful (except maybe the Dependency Replication but this can be done via other methods). TFS Deployer, though, is still very useful in a TFS 2008 environment... assuming you can get it to work.

TFS Deployer was originally developed against the TFS 2005 client libraries and, of course, we've uninstalled VS and TFS 2005 from most of our machines already so Deployer just falls over because it can't find the libraries.

TFS Deployer is not open-source (yet) so I can't fix it myself. However, in a comment Mitch suggests using binding redirects in the TFS Deployer config file to enable TFS 2008 support. Unfortunately he doesn't give specifics.

I decided to drop the TFS Deployer assemblies into Reflector and find the list of TFS libraries it uses so I could write the redirects. I updated the .config file and changed the build quality on some existing builds and happily discovered that it works. If you want to use TFS Deployer with TFS 2008, here is the section to add to the TfsDeployer.exe.config file:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.TeamFoundation.VersionControl.Client" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
      <bindingRedirect oldVersion="8.0.0.0" newVersion="9.0.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.TeamFoundation.VersionControl.Common.Integration" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
      <bindingRedirect oldVersion="8.0.0.0" newVersion="9.0.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.TeamFoundation.Build.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
      <bindingRedirect oldVersion="8.0.0.0" newVersion="9.0.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.TeamFoundation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
      <bindingRedirect oldVersion="8.0.0.0" newVersion="9.0.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.TeamFoundation.Client" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
      <bindingRedirect oldVersion="8.0.0.0" newVersion="9.0.0.0"/>
    </dependentAssembly>
  </assemblyBinding>
</runtime>

 Wednesday, December 12, 2007

Planning Adelaide Geek Dinner Round 2

My first attempt to organise a dinner for developers in Adelaide exceeded my expectations. Everyone seemed to have a good time and expressed an interest to do it again... we tentatively agreed on January.

This time, I'd like to re-invite some of the guests who were unable to attend in November, and try to schedule an available time for everyone. I'd also like to get feedback on the choice of venue.

Last time I chose Cafe Buongiorno because it is located centrally in the CBD, offers separate accounts to avoid table-banking, and has convenient parking and public transport. Most people like pizza and pasta too. I don't want to bore people with the same restaurant every time so I'd like to hear suggestions for alternatives, but if you all like the cafe it can stay.

Also, I chose a Saturday evening last time so people didn't have to rush from work to get to the dinner but if Sunday or a weekday would be better, or perhaps a lunch-time event interests you, pass on your comments.

Finally, if you know any other developers who may be interested in attending, put them in touch with me and I'll ensure they get invited.

MSBuildTasks, TfsVersion and TFS 2008

Jeremy Miller says it best:

"NEVER build and deploy from a developer environment"

In his article, Jeremy puts into concrete words all the reasons why I felt deploying from the workstation was a bad idea.

In my current project at work I had an opportunity to setup continuous integration and a good developer workflow from the beginning and I already had building, testing, and deploying automated on the build server. But, in the same article Jeremy shows an example for using source control version labels for .NET assembly version numbers.

Until now we were just using the default compiler generated build and revision numbers, which are days since January 1st 2000 and seconds since midnight respectively if I remember correctly. Unfortunately, while this ensures increasing and unique version numbers, it doesn't help map a deployed assembly back to it's source version.

I decided to find an alternative to Jeremy's CC.NET+NAnt build script to suite our TFS2008+MSBuild environment. I knew replacing the version numbers in the AssemblyInfo.* files would be trivial but I needed to get the TFS changeset from somewhere.

The popular open-source MSBuild Community Tasks Project already includes a TfsVersion task to grab various TFS property values and make them available to the script. However, I quickly discovered that the TfsVersion task expects the 2005 version of the TFS client libraries.

Although documentation is slim, all the MSBuildTasks source code is available online in a Subversion repository and I was able to download the code and work on porting it to TFS 2008.

Thankfully I didn't have to. All the TFS related code in MSBuildTasks is done via late-bound proxies and there is a TfsLibraryLocation property on the TfsVersion task that can be pointed to the "...\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\" folder.

I also found Richard Banks' post on Versioning Builds with TFS and MSBuild to be very helpful for getting the build targets right.

 Monday, December 10, 2007

AusGPS.com - Australia's new online navigation community

Back in July, after watching my good friend Lewis enjoy the benefits of in-car satellite navigation for a some time, I decided to buy a TomTom One XL for myself.

Since then, Lewis and I have had our fair share of both good and bad experiences with our chosen GPS devices and their respective feature support in Australia. While the devices sold locally are much the same, if not identical, to those sold worldwide, the quality of the maps and the availability of real-time data suffers in our sparsely populated nation.

In order to bring together the GPS users of Australia to share our experiences, our combined knowledge, and a form a central voice to the organisations responsible for improving our overall sat-nav situation, Lewis has started a new website just for us.

AusGPS.com is live now and currently consists of a forum and a review of the popular current-model TomTom ONE v3. As the community grows the website will offer regular GPS-relevant news updates, more reviews on other devices and services available to Australians, and even a central download location for popular GPS accessories.

If you currently own a navigation device, or are thinking of purchasing one, check out Lewis' new site, register on the forum and say hello.

 Thursday, November 29, 2007

Upgrading to Team Foundation Server 2008 Workgroup Edition

This week I took upon myself the challenge to upgrade our TFS 2005 SP1 single-server installation to the newly released 2008 version. When I was first introduced to our Team Foundation server it was running Beta 3 of TFS 2005. Since then it has mysteriously become my duty to upgrade to 2005 RTM, 2005 SP1, and now 2008 RTM.

I have gathered much needed experience on my previous upgrades to know how hard it would probably be. Beta 3 was originally running on SQL Server 2005 Developer Edition and the TFS beta wasn't the Workgroup Edition. Needing to upgrade the beta database structures, switch the edition of SQL Server, and even migrate the whole lot to another physical machine has given me the confidence to deal with any TFS install.

I prepared for the 2008 upgrade by backing everything up, running the Best Practices Analyzer, then following the pre-upgrade checklist to the letter. So far everything is great. I inserted the TFS 2008 media, and began the setup. The setup prescan said everything was ok. It detected the existing installation, asked me for a few more settings (account passwords and mail server) then performed the upgrade.

Smooth. No errors. Database schema upgrade succeeded. And it was quick too. Again, I followed all the post-upgrade checklist items one-by-one and I was almost giddy at how easy it all was. I went back to my developer workstation and played around with work items and checked out and in some files. Perfect! I was so happy I went and upgraded our build servers too.

The next day my work colleague tried to undo a pending change and received a nasty error. The undo was failing and crashing the version control component on the server. I chased it down to the prc_iiUndoPendingChanges stored procedure experiencing a collation mismatch. The proc is encrypted but with SQL Profiler I was able to verify that it was a clashing collation between the TfsVersionControl database and SQL's tempdb database.

How do you change the collation on the tempdb database to match the others? You don't... you change the collation on the master database. How do you change the collation on the master database? You drop all your databases, rebuild the master using setup.exe on the SQL install media, then put all your databases back.

Still not that easy though. TFS 2008 requires SQL Server SP1. If you rebuild the master database with the RTM media you get an RTM master database. You can't get or make SP1 slipstreamed install media and you can't reapply SP1 after rebuilding master because all the other parts of SQL are already patched.

So, in the end you backup all your databases, uninstall all of SQL Server, reinstall it with the right collation, reapply the service pack, restore all your databases, rebuild the data warehouse and generally do all the rest of the necessary steps.

It was almost the perfect upgrade. Unfortunately collation settings were missed by the TFS team on one of their temp table definitions, it wasn't picked up by testing, dogfooding, or the beta program, and I get all this hassle.

Still, all the new features in TFS 2008 make it worth it and I'd do it again. And will probably have to.

 Sunday, November 18, 2007

Organising the dinner with Preparty

In October I started thinking about organising a dinner to bring Adelaide's .NET developers together. I'd never done something like that before and I wasn't sure about the best way to manage it.

Luckily, I remembered meeting Jonathon Kresner at the Wagga Wagga Code Camp in March. Jon had told me he was developing a website in .NET to organise parties. I decided to send him an email and ask how it was going.

Coincidentally, Jon had reached the final beta testing stages of his website, Preparty.com, and when I explained that I was interested in organising a dinner for .NET developers, he was kind enough to grant me a login if I don't mind assisting with the testing.

Preparty.com basically provides you with everything you need to organise a party of any kind (dinner, music gig, or wedding reception) from beginning to end with a smooth user experience.

You start by finding an appropriate venue by choosing from many popular places already registered on Preparty, or by entering details of your own. You then enter the names and email addresses of all your guests and complete the details of your event such as date and time, theme, and other relevant information.

Preparty then handles the creation and sending of e-Invitations with all the details and even a map of the venue location and follows up with a place to track RSVPs, You can even organise entertainment via Preparty and send SMS reminders to your guests as the event draws near. And when it's all over you can invite guests to upload photos from the event to create a slideshow.

I exercised almost all the features of the Preparty website and only found a couple of usability issues that Jon corrected very quickly. For a website supposedly in beta testing, it was very stable.

Preparty is free to register but charges a very affordable rate to purchase email and sms credits. I know now that the website is out of beta and has been released to the public I'll be looking to Preparty.com to organise all my future events and I recommend you take a look too.

Inaugural Adelaide Geek Dinner Success

Tonight saw the first (to my knowledge) of hopefully many more evenings with some of Adelaide's top .NET software developers.

While others were invited but were unfortunately unable to attend, a very friendly and interesting eight people ultimately arrived. In no particular order:

The evening started at 6:30pm (for most of us ;) and eventually came to a close at around 10:30pm after everyone was quite full from a delicious dinner and meaty conversation. I've uploaded a couple of photos to my Flickr account here.

I was originally uncertain about trying to organise such an event especially as I had only briefly met some of the guys before and some not at all. I am very glad I did though because I learned a lot, had some good laughs, and made some new friends too.

The response was so good that I plan to arrange another dinner, with a few more people who couldn't make it this time (eg Candy ;). An evening in January 2008 is my goal but this time I'll invite suggestions for venue, date, and anything else that you think might be a good idea.

Watch this blog for more information on the next dinner as it becomes available and if you'd like to be invited, just send me an email or leave a comment here on the blog.

 Wednesday, October 17, 2007

Adelaide Geek Dinner Approaches

I announced earlier that I was planning a dinner get-together for developers in Adelaide. I have since finalised the time and venue and have established an initial guest list.

The dinner will be held on Saturday November 17th starting 6:30pm at Cafe Buongiorno in the city. The cafe is at 187 Rundle Street, near the corner of Pulteney Street and the entrance to U-Park (for convenient parking). They serve familiar Italian meals - pizza and pasta starting at around $15.

I have found and contacted several local developer-bloggers and asked them to attend, some have committed, some have tentatively accepted but the response has been positive. If you are, or know, a local developer-blogger who hasn't been personally invited, send me an email and I'll add you to the guest list and ensure I book a large enough table at the cafe.

I look forward to seeing you there.

 Tuesday, October 16, 2007

PowerShell Resources

Ever since I heard of the concept of PowerShell (or Monad as it was known then) I was excited. Now that is been RTM for some time and I have had an opportunity to work with it in a production environment I love it even more.

While PowerShell could be summarised as a cross between a *nix shell and the .NET Framework there is still a lot unique to PowerShell alone and learning how it works and finding efficient tools to work with it is still necessary to make the most of PowerShell.

To learn PowerShell I purchased Bruce Payette's book Windows PowerShell In Action. It is a good-size detailed book at over 500 pages and receiving both the soft-cover book and the searchable PDF was excellent value. Pretty much every aspect of PowerShell is described including why certain design decisions were made. My only issue with the book, and it's not a big issue, is that I was itching to write some PowerShell scripts but script files aren't explained until Chapter 8 and security for script files isn't fully explained until Chapter 13 (the last chapter).

When I started to write my scripts I had the PowerShell console open on one monitor and Notepad open on the other. I would try certain commands in the console window and when they worked and gave the results I wanted I would copy them to the script in Notepad, save, and switch back to the console window to test the script. I still pretty much work like this today but I've replaced Notepad.

Considering I spend most of my time in Visual Studio I really wanted the same Intellisense and Syntax Highlighting experience when writing PowerShell scripts. The first PowerShell "IDE" I encountered was PowerShell Analyzer but I felt overwhelmed by the UI given that all I wanted was to edit .ps1 files. It seems very capable but just didn't feel right. More recently I have tried PowerGUI and it is very close to "Notepad for PowerShell". I have used it to develop the scripts for the last two PowerShell posts and I recommend it.

Do you have any resources you feel have been invaluable for getting the most out of PowerShell?