Wednesday, June 06, 2007

c'mon, it's still the 5th in someone's timezone ;)

With a tip of the hat to the fine people at Make, I present you with...

A solar powered Prius.  Now that is environmental.  White paper here.  Shame it still looks like a Prius.

Wednesday, June 06, 2007 11:08:17 AM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, June 05, 2007
I was just surprised to work out that I have been on Windows Vista for about a year now nbsp; I joined the club with Beta 2 which was released in May '06   I also toyed with an earlier WinHEC Longhorn release but not in any substantial way.

From day one I’ve had UAC on.

Unfortunately one of the last guys to join the compatibility club was Visual Studio 2005 with the Vista Update patch

But just tonight I found the rare case of an MSI from Microsoft that failed with a cryptic message if not run as Admin: The Composite UI Application Block.

So I've put together a little grab bag of Vista UAC links and tips that I'm calling Strategies for life with UAC:

  • First and foremost, know what has changed.  I wasn’t shocked when Buzz, which despite not having a substantial update since whoknowswhen, wouldn’t run out of the box.  The Audio subsystem had a major overhaul in Vista.  AppCompat came to the rescue here.
  • Launch a cmd.exe shell as an admin, then run msiexec, regedit, or whatever from there.  This way you only have to elevate once at the start of your session.
  • Use Compatibility, part I.  Choose XP SP2 from the Compatibility tab of the EXE File Properties page.  Raymond Chen referred to this as a Combo Meal of AppCompat settings.  Various degrees of slight of hand he said. 
  • Use Compatibility, part II. You can also launch the Compatibility wizard from the Use an older program with this version of Windows link inside the Programs group in Control Panel.  This is the same set of options as is on the Properties page, however the UI is more suited to trial and error for troublesome programs, and you have the option to submit your results to Microsoft.
  • Use Compatibility, part III. I am aware that there is an application compatibility toolkit available for ISV's, but haven’t had cause to look too much further.
  • Use Virtualization.  Grab VPC 2007 (freebie)  I use VPC for application and installation testing with the Undo Disks feature, but it would be just as valid to run a VPC of XP or earlier if you had some app that would only run on a specific OS.

Just a note on Virtualization, I have not been able to find an authorative souce on the question of:  If I put Vista on my PC, is it legit to use my old OEM XP CAL in a VPC.  The rumours around the web seem to settle on:  a) depends on your license agreement, but I suspect it is an edge case and they are playing that card close to their chest.

If you can find an authoritive, public link on the above question please post a comment and there will be a prize.  You know I'm good for it people!

A couple of extra resources:

Listening To:  Boards of Canada, Music has the right to children

META | Secutity | Vista
Tuesday, June 05, 2007 10:57:48 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Thursday, May 31, 2007

There are not too many things I hate in the world.  Popcorn is one (no joke) another is the feeling you get when you discover something cool in the .NET Framework or Visual Studio and think: Damn!  Why didn't I find this sooner. I call it the Last one to the party Feeling.

Today, I'm talking about the SuppressMessageAttribute class (MSDN Link).

This attribute can decorate a class where you would like explicitly exclude a module matching a rule in FxCop due to a false positive.  Really it is no different to excluding the message in the FxCop project, but I think this is better because of how visible it is. 

When you exclude a message in the FxCop project it gets sucked into a black hole and you never see them again.  What if they are just a short term exclusion, like the old fav Microsoft.Design.AvoidNamespacesWithFewTypes - which may apply at the start of a project but not once it is off the ground.  Who is going to go and un-Exclude it from the FxCop project?

Also, this attribute takes named parameters, like Justification.  Again, FxCop lets you put a note in when excluding in the FxCop project but it gets lost to all but the most determined eyes.  Having the reason for the exclusion right there in the code means it has a better chance of getting on-going attention as it may not always be as valid as it is today through circumstance or refactoring.

This attribute requires you to define a symbol - CODE_ANALYSIS.  In NAnt you can add define = "CODE_ANALYSIS" on your CSC or VBC Task and/or define the symbol in your Project properties, depending on how you build:

Thursday, May 31, 2007 6:04:38 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, May 29, 2007

I've just got a couple of lessons from the last week to share around developing Office 2003 (and specifically Visio 2003) Add-Ins

I'm also trying to saturate this post with links because I have come up with a good size folder in my bookmarks for what started out to be a simple task.

  • Grab the PIA'sAnyone who wants to run the Add-In will need them.  Alternatively they can be installed from the Office Add/Remove/Repair under the guise of .NET Programmability Support, but in reality the user may not have the media or security access to do this.  Do NOT however ship the PIA's in your bits.  Ship the PIA's with your bits:  This means 2x MSI's.
  • Using NAant to automate the build with csc.exe & vbc.exe is suboptimal.  I'm keeping my project to one small assembly that depends on the PIAs, and also depends on another assembly that does the heavy lifting but has no ref to the PIA's.
  • Strong Name everything.  Well, strong name everything anyway, but when trying to pass of managed code as COM it is essential.
  • You cannot load a .NET DLL, even one with the ComVisibleAttribute on the Assembly or Classes, via the Office UI.  You just can't.  KB316723 gives an explanation.  This is because Office will try and register it the old regsvr32 way, which of course won't work.  To get a .NET DLL into the Macros -> Add-Ins list, you must write the registry entry under: HKEY_CURRENT_USER\Software\Microsoft\<office program name>\Addins\
  • This brings me to my next point.  KB316723 hints at it, but your setup must write a HKCU key not a HKLM key.  The Shared Add-In Wizard in Studio is ambiguous when it shows you this choice:

  • I know this may be contentious, but consider using VB.NET over C#.  This depends of course, but some parts of the Office object model make heavy use of Optional Parameters which C# does not support.  It has been noted elsewhere what Type.Missing can do for readability.  Having said that, it does vary greatly depending on where in the Office Object Model you are.
  • Spend some time with the Setup project that the Shared Add-In Wizard makes and test it.  Once you like it, reverse engineer it to a WiX script and feed that to your automated build.  For the record, you do that with:

Dark.exe –x path Debug/msi My.wxs
Candle My.wxs
Light My.Wixobj

  • To extra points when dealing with WiX-ified MSI's
    1. It's useful to note that the extracted (-x) resources take many forms.  DefBannerBitmap.ibd for example is just a bitmap.  I think it is easier to rename it to .bmp & tweak it in Photoshop than to add a new banner in Visual Studio.
    2. The Add-in reg setting mentioned in point #4 above references an assembly version.  Visual Studio tweeks this for you but your WiX script will be frozen at the time your Dark.exe'd it.  So don't auto-increment your assembly version numbers, or tweak you WiX script.  The choice is yours but your MSI must write the version of the Add-In DLL to the target machine's registry.

Listening To: Leftfield, Leftism

Tuesday, May 29, 2007 12:53:56 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Monday, May 21, 2007

I think it is fair to say CruiseControl.NET has become synonymous with Continuous Integration in the .NET space.  In the recent DNR on CI* with Eric Sink and Martin Woodward it was the defacto choice for the discussion and with good reason.  CCNet is a great tool.

I just wanted to give a quick shout-out to Draco.NET which is also a CI server for .NET and while not having the broad featureset of CCNet I recommend it for smaller shops getting their first Continuous/Automated build together.  My two reasons are:

  • Supports Visual Source Safe, which like it or not is the Gateway Drug for source code control.  (To hear what I think of that go grab DNR #221 about 5min16sec in ;)  It also supports PVCS, Subversion and Vault.
  • It is so much easier to configure.  You have no options for reporting or postbuild steps, or overriding the build ID or RSS add-ons for.  CCNetConfig is essential for configuring CruiseControl.NET.  Draco.NET offers a pit of success for the folks new to CI.

The most compelling reason for CCNet over Draco.NET is Everyone else is using CCNet :-)

On the topic of DNR show #238 - Eric talks about Vault, but doesn't mention that you don't need to purchase a license when used for a single developer.  It is licensed by named accounts, so go get it and give it a go all you VSS folks!

*the best bit of the show is 11min45sec in... ;-)

Listening To: Ani Difranco - Revelling and Reckoning

Monday, May 21, 2007 8:06:12 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [2]  | 
 Tuesday, May 08, 2007

I was looking today at options for finishing a build with something other than an MSI or folder full of files:  An ISO file.

I am a fan of DaemonTools and associated add-ons.  Even if you're not planning to burn to disc, an ISO file can be a useful way of getting a bunch of files around the place.

First step was to grab a Windows binary of mkisofs from one of the various sources of cdrtools on the webNB:  It comes linked with Cygwin binaries.

This is a util that has its roots in the Linux/Unix world, so be prepared to scratch your head a bit if you are not familiar with the world of Linux/Unix command line tools.  Also if you are, don't be fooled by mkisofs following the naming convention of the other mk*fs tools.  It is really quite different.

In the *nix world, the online help is by the man ("manual") page system.  Basically, at your prompt you type man mkisofs for help with mkisofs.   This works in Google too!  The man page will be a useful reference, as will the less informative usage info you can get from mkisofs.exe -help

Having said all that, the following options are a really good place to start: 

Option Note
-J Enable Joilet (you want this)
-R Enable Rock Ridge (you want this)
-V diskname Set a volume label
-o filename.iso Set the output ISO file name
-graft-points allows "=" syntax in pathspec.  More on this below...
-m "*.tmp" Exclude files from the image by pattern

mkisofs takes paths to add to the ISO file as parameters, and by default all these are stacked under the root of the disk image.  If this is not what you want then you should enable graft points.  This option will allow you to make folders in your ISO image for each of the folders you are adding to the disk.

For example, the following pathspec will create two folders on the CD, one called Windows for the contents of the bin folder, and one called Documentation for the contents of the doco folder:

Windows=D:\build\windows\bin\ Documentation=D:\build\doco\

So the complete command line for mkisofs will be something like:

"C:\Program Files\cdrtools-latest\mkisofs.exe" -J -R -graft-points -quiet -o f:\backup.iso -V backup -m "*.tmp" Windows=D:\build\windows\bin\ Documentation=D:\build\doco\

For extra points, you can automatically burn the ISO to a disk using the cdburn / dvdburn tool that ships with the Windows Server 2003 Resource Kit Tools.

A couple of reasons I'll suggest using this over using cdrecord.exe that comes with the cdrtools package:

  • The cygwin-based tools don't work as well with later Win32 like Windows Server 2003, they seem to not deal with the tighter security well.
  • The syntax of cdburn/dvdburn is much much easier!

An example of the syntax to burn f:\backup.iso to the blank disc in the burner g:\ is:

C:\Program Files\Windows Resource Kits\Tools>cdburn.exe g: f:\backup.iso -speed max

Also note that the cdburn will eject the disk once it has been burnt!  Keep that in mind if your CD drive is normally behind a door or cage or something!

UPDATE:  This technique is also has some utility for backup-to-disk scenarios.  For example a backup batch file that made an ISO then burnt it to disk.

Listening to: Bend to Squares by Death Cab for Cutie

Tuesday, May 08, 2007 2:53:13 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [2]  | 
 Friday, April 20, 2007

Every so often I check that web service, just to see what it comes back with.... nothing yet ;-)

Nice to see it is still in Vista, my little magic 8-ball dialogue! 

I just wish I could control the default.

Friday, April 20, 2007 5:04:46 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  | 
 Monday, April 16, 2007

One of those things that makes sense, but you may have assumed otherwise if not had cause to ponder it.  I'm talking about literary translation, and the liberties that the translator and their editor have to take while translating books from foreign languages to English and vice versa.

In Other Words, is a three part series from Canada's CBC, available on their podcast where by some highly regarded literary translators discuss their trade.  They all take the topic of these liberties very seriously, and feel that at times being faithful to the original means straying from it.

In the second episode, one of the guest translators recounts a cartoon to illustrate the point, in which the translator asks the author of the original work: Do you not be happy with me as the translator of the books of you? 

The series examines the question that you may assume we are reading a fidelity reproduction of Don Quixote or Dostoyevsky, until you read a second translation and examine the differences.  How is the difference explained if both are correct?

The third and final part of the series is due to appear on the podcast feed tonight, and makes for very interesting listening.

Monday, April 16, 2007 1:59:50 PM (AUS Eastern Standard Time, UTC+10:00)  #    Disclaimer  |  Comments [0]  |