Wednesday, 31 December 2008

ComponentActivatorException

This has caught me out a couple of times now. I was getting this exception: Castle.MicroKernel.ComponentActivator.ComponentActivatorException: ComponentActivator: could not instantiate MyNameSpace.ClassName ---> System.ArgumentNullException: Value cannot be null.
Parameter name: types
at System.Type.GetConstructor(BindingFlags bindingAttr, Binder binder, Type[] types, ParameterModifier[] modifiers)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.FastCreateInstance(Type implType, Object[] arguments, Type[] s
The exception could be a bit more informative - it turns out this is caused by not providing a public constructor on the class (it was accidentally set to 'protected').

Tuesday, 30 December 2008

RAA Rounding Error

I went to renew our RAA membership this morning. The paper bill said we owe $170.

I went to the web site to pay online, but was greeted by this:

TOTAL (including GST) $170.01

Yes, they’re overcharging me by 1c.

I rang them up to let them know (and also paid the correct amount while I was at it).

Could this be salami slicing, or more likely someone’s made a silly rounding error. Can’t those IT people ever get it right?

:-)

Monday, 29 December 2008

A furry visitor

"I'm sure there was a tree around here last time"
Posted by Picasa

Wednesday, 17 December 2008

Fast hard disks

So exactly how much faster are the latest hard disks? A number of people commented that using the old IDE disk on my Dad’s new Vista 64bit box wasn’t the best idea. I grabbed a copy of HD Tune to get some benchmarks of each of the 4 disks in the system to get an idea of how the drives compared.

Here’s what I found:

Measurement IDE Disk 1 IDE Disk 2 WD2000JD WD10EACS
Transfer Rate Minimum (MB/sec) 1.1 7.6 32.1 37.2
Transfer Rate Maximum (MB/sec) 43.5 45.1 55.1 90.5
Transfer Rate Average (MB/sec) 28.8 33.8 48 68.3
Access Time (ms) 14.5 14.3 20.5 15.5
Burst Rate (MB/sec) 53.3 49.8 91.9 124.6

 

Graph showing relative speeds of 4 hard drives

So that 1Tb drive really is quite a bit faster than the other drives after all.

I’ve since re-configured the new Vista box to use the fast drive for the operating system, and left the other drives in for video files (but with the knowledge that it will be a simple upgrade path to swap them out for additional SATA drives as required).

Monday, 15 December 2008

CAT.NET and Xss

Microsoft Code Analysis Tool .NET is a new tool to detect certain vulnerabilities in your code – including Cross Site Scripting, SQL Injection, Process Command Injection, File Canonicalization, Exception Information, LDAP Injection, XPATH Injection and Redirection to User Controlled Site.

Also there’s a beta release of version 3 of the AntiXSS library which can help reduce the chance of cross-site scripting vulnerabilities in your ASP.NET application.

Friday, 5 December 2008

The 3 Ps of successful application deployment

  1. Planning
  2. Preparation
  3. Proximity to a bakery

Have I missed any others?

Tuesday, 2 December 2008

Google Transit for Adelaide

I saw this mentioned on Australian IT today – if you open up Adelaide in Google Maps, you now get the option of listing directions by “public transit”.

So for example, if I wanted to get from “Westbourne Park to Glenelg”, just enter exactly that phrase and search, then click on the ‘public transit’ link


View Larger Map

As you can see from the map, it indicates the bus route (216), then you change to a tram (), then finally you walk (). The directions panel contains bus stop details and the service times.

Ever since I owned an Apple Newton MessagePad and more recently a few Windows Mobile devices I’ve had an idea for an application that would allow you to interactively find out when the next bus was, and tell me what time I would arrive home – taking into account that I used to catch two buses and a train to get home. Well it looks like Google has pretty much implemented that idea for me!

Monday, 1 December 2008

Useful PowerShell snippets (part 1)

Some things I’m finding useful:

Processes running on a machine

Get-WmiObject Win32_Process -ComputerName mymachine | Select { $_.Name }

Currently logged in user on a machine

Get-WmiObject Win32_ComputerSystem -ComputerName MyMachine | Select { $_.UserName }

Does a machine have .NET 3.5 SP1 installed

function Get-Net35SP1([string] $machineName)
{
    $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $machineName)
    $regKey= $reg.OpenSubKey("SOFTWARE\Microsoft\NET Framework Setup\NDP\v3.5" )
    if ($regKey -ne $null) {
        Write-Output $regKey.GetValue("SP", 0)
        $regKey.Close()
    } else {
        Write-Output "Doesn't have .NET 3.5"
    }
    $reg.Close()
}

Monday, 24 November 2008

Log4net’s SmtpAppender with multiple email addresses

Log4net is a popular logging framework, and amongst the various logging “appenders” it includes one for sending emails – the SmtpAppender. The documentation for the SmtpAppender’s To property says it contains a semicolon-delimited list of email addresses.

However if you try to do that, you won’t see any emails being sent. Add the following to your app.config file to enable log4net’s debug logging:

  <appSettings>
    <add key="log4net.Internal.Debug" value="true" />
  </appSettings>
  
 <system.diagnostics>
  <trace autoflush="true">
   <listeners>
    <add name="textWriterTraceListener" 
     type="System.Diagnostics.TextWriterTraceListener"
     initializeData="C:\\tmp\\log4net.txt" />
    </listeners>
   </trace>
 </system.diagnostics>

You’ll then see this internal error message in the log4net.txt file:

System.FormatException: The specified string is not in the form required for an e-mail address.
   at System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName)
   at System.Net.Mail.MailAddressCollection.ParseValue(String addresses)
   at log4net.Appender.SmtpAppender.SendEmail(String messageBody)
   at log4net.Appender.SmtpAppender.SendBuffer(LoggingEvent[] events)

This shows that the SmtpAppender is leveraging the .NET Framework’s System.Net.Mail.MailAddressCollection class. The ParseValue method is not public, but Add(string) is, and if you scroll down to the remarks, you’ll see the following text:

If multiple e-mail addresses separated with a semicolon character (";") are passed in the addresses parameter. a FormatException exception is raised.

So it turns out log4net’s documentation is misleading, or at least out of date. Change your email addresses to use the comma and everything comes good again.

Thursday, 13 November 2008

Drought breaks..

I’m pleased to report that it appears the biscuit drought has broken. We’re seeing good falls of assorted creams as well as the good old family assorted again.

That is a relief!

One of the nice things about my current workplace – they provide tea, coffee, Milo (but not Bonox!) and usually once a week if you’re lucky you’ll find some bickies in the kitchen, presumably left by the biscuit fairy.

Wednesday, 12 November 2008

Death March by Edward Yourdon

Death March (2nd Edition) (Yourdon Press Series) - published by Prentice Hall, 1997

When I first began reading this book, I thought it would be all about the team that came before us… the one that spent a lot of time delivering something that didn’t work. But the more I read, the more I found myself identifying our current team with the descriptions in each chapter. Curious as the title doesn’t sound that positive! As Wikipedia defines it, a death march project is one that is destined to fail.

One point that comes out repeatedly is that while in some ways “Death March” projects are not intended to be the norm, more often than not they end up being the de facto way that many IT projects are run.

In Ch. 1, characteristics of a “Death March” project are listed as including:

  • Tight schedules
  • Small team
  • Limited budget
  • More features
  • Smaller scale

Hmm.. that sounds familiar!

In subsequent chapters he goes on to cover topics such as Politics, Negotiations, People, Processes, Tools & Technologies and finally the idea of “Death March” projects as a way of life.

In Ch. 3, the topic of Estimation is examined, and the value of having an experienced project manager who can estimate slightly better than just “gut feeling”, and that there are software estimation tools that can improve forecasting accuracy. I reckon Steve McConnell’s Software Estimation: Demystifying the Black Art (Best Practices (Microsoft)) could be worth a read to learn a bit more about this topic. I’ll add that to my wish list!

People can make all the difference, and our team certainly bears this out. I can’t agree with the comment that 80 hours a week is ok though.

Yourdon also espouses the importance of good workplace conditions – in particular quietness and privacy (eg. separate offices). There’s certainly empirical evidence to reinforce the productivity benefits, which flies in the face of the current trend of “open” office space, cramming as many people into tiny cubicles as possible.

Triaging tasks/bugs are critical, and allows you to prioritise what is important.

When this book was first published, there wasn’t much in the way of “Agile” development practises, but I think Yourdon is alluding to this when he makes mention of using RAD tools (refactoring), mini-milestones (iterations) and daily builds (continuous integration).

One thing I did find annoying was Yourdon’s use of a monospace font when listing the emails in each chapter’s list of references. This made them very hard to read and I mostly ended up skipping over them as a result.

Overall I came away inspired by this book. Yourdon highlighted the many pitfalls that await a team who are engaged in a “Death March” project, but does offer hope that under the right conditions, you can achieve success.

Tuesday, 11 November 2008

sevenfold – Yeehaa!

We had a blast last night. It was great fun. We ended up performing about 10.40pm, and seemed to be well received. The stage was a little small but we managed to fit all 7 of us there (and Billy-Bob said they once had 14 so we’re not the largest group to play there).

The quality of the other bands playing was very good, but I think we held our own. No word from any record companies wanting to sign us up yet.

We all got a free drink voucher, but curiously they insisted the voucher was good only for a schooner of beer, even though all I wanted was a “raspberry” (surely soft drinks cost less than beer?). I bought one instead, but had to tell the girl how to make it - “just raspberry cordial and lemonade”. Yum.

On an final note, I also discovered that “pub rules” for playing pool do exist – fortunately I wasn’t the one who failed to pot any balls :-)

Saturday, 1 November 2008

Looking for a new printer

I’ve decided we need to get a new printer for home/home office use. The main requirements are for black & white, with some colour printing (but not necessarily photo-quality). We’re happy to continue to get our digital photos processed commercially (eg. when Harvey Norman has a special!)

We’ve previously had a old Canon BJC-2100SP, which was never that impressive. More recently Gary gave me a second-hand HP LaserJet 2100, which does a very nice job except when it jams (which is becoming all too frequent).

One thought was to get two printers – a B&W laser and a cheapish inkjet colour printer, but talking to the guys at work yesterday, Timothy pointed out that if you don’t use the colour regularly then it can dry out. So maybe a colour laser printer might be a good option. The idea of having a network-enabled printer is attractive, though obviously you do pay more for that feature.

Here’s a few of the models I’ve been considering, and a rough calculation of the cost per page for black and white printing.

Model Toner Toner Cost Pages Per page Printer Cost Retailer
Samsung CLP-300N Black $89 2000 0.04 $179 MSY
Epson C1100N Black $115 4000 0.03 $579 MATS
Canon 5200 Black $133 5000 0.03 $376 MSY
Canon 5050N Black $88 2300 0.04 $389 TechBuy

Maybe the network option isn’t really necessary. Going on the figures above, the Canon 5200 does look like a good compromise between upfront and ongoing consumable costs.

Any other suggestions?

Friday, 31 October 2008

Goodbye Domain Central, Hello GoDaddy

The domain I registered for our band SevenFold is up for renewal in a couple of weeks. I’d received a few reminder emails from Domain Central and as it was getting close I decided today to get around to paying the money.

First stop, I went to their website, but was surprised to see that their online price was now $AU17.95 for .com domains. That’s a fair bit more than the $AU12.50 they’d listed on the tax invoice they mailed me.

Not wanting to pay more than I had to, I then rang them up and tried to pay over the phone. All was fine until they repeated the amount – “Hang on, my bill here says $12.50!”.

“Sorry, our costs have increased so we increased our prices just over a week ago”.

So they refused to let me pay the tax invoice they sent to me, and insisted that it was a “mistake” – even though the invoice wasn’t due until 1st November (and today is the 31st October).

I rang the Office of Consumer and Business Affairs and they confirmed that I should be able to pay the bill I had received for the amounted printed on the bill.

Figuring that I’m not likely to have any more success ringing Domain Central back, I’ve decided instead to take my business elsewhere.

Sunday, 26 October 2008

It was 20 years ago today..

That I was in year 12 at Blackwood High School. So last night we had our 20 year reunion at the Duke of Edinburgh Hotel in Lower Mitcham. It was a very warm evening, otherwise I might have worn my old year 12 top (I’ve managed to keep it and it hasn’t faded too much. And yes, it is blue) -

Front of Blackwood High Year 12 jumper from 1988

In many ways, 1988 doesn’t seem that long ago, and looking around at the many people who turned up, it was interesting to see some faces that had hardly aged a year, and others I completely did not recognise at all. That’s not completely surprising though – there were originally about 245 of us!

I find it is an occasion to reflect on your life – the choices and decisions you’ve made that have led you to where you are today. Remembering those days leaving High School, wondering how things would turn out. Would I ever have a girlfriend, get married, have kids? “Yes”, “yes” and “yes” in that order as it happens!

It’s interesting that out of all those people, there’s probably only a small handful that I have maintained contact. Having said that, it was really nice to catch up with a few old faces that I wouldn’t have seen since school days.

Thanks to Anita, Kendall and Louise for organising the event.

And if that’s got you in an 80’s reminiscing mood, why not listen to a bit of SKY.fm’s Best of the 80s streaming radio.. ah so many memories, so little time :-)

Sunday, 19 October 2008

Building a new Vista 64bit machine

I’m in the process of upgrading my Dad’s PC. He does a bit of video editing, and had noticed his machine was getting slower and slower, combined with the increased minimum requirements of the latest version of Pinnacle Studio.

The existing components that we wanted to reuse include:

Because his machine was a few years old, buying some extra RAM was going to be relatively expensive, so I suggested maybe he do a complete upgrade. Hoping to reuse the old case and drives, I selected the following components:

One thing I realised (from previous experience) was to make sure that there was enough room for the CPU fan. The old case was one of those compact upright boxes, and from examining the old motherboard it became obvious that the location of the existing PSU would prevent anything larger than ~5cm. All was not lost, as I just happened to have another case around that was slightly taller and allowed the PSU to sit alongside rather than over the top of the motherboard.

The GA-MA770-S3 comes with lots of SATA connectors, but only one IDE connector. As we wanted to make use of two existing IDE hard disk as well as the old IDE DVD drive, I bought the extra ATA controller that plugs into the PCI slot. The only downside to this appears to be that you can’t boot off of a drive connected to the PCI card.

Newer motherboards require a 24 pin power connector, hence the new PSU. The Vantec was not my first choice (I had chosen a Cooler Master eXtreme Power 500W but MSY didn’t have that in stock), but it seems a capable unit. I particularly like how all the cords are wrapped in blue mesh to keep things tidy.

I’d decided that I’d use the 80Gb drive as the system drive (apparently it has an 8Mb buffer compared to the 60Gb’s 2Mb so it should be a bit faster).

After connecting all the bits and pieces together, I booted up the Vista 64bit DVD and got as far as installing it onto the correct drive. It then rebooted and I saw the following unhelpful message:

“The computer has restarted unexpectedly or encountered an
unexpected error. Windows installation cannot proceed..”

I found a post to the Microsoft newsgroups by Richard Urban which lists some conditions which can cause this problem (and sure enough they matched my hardware).

Following his advice, I disconnected all the drives except the 80Gb drive and the DVD, which were both attached to the motherboard’s IDE slot. The Vista installation proceeded as normal.

(If the DVD drive ever gets upgraded in the future for a SATA model, this problem would be avoided)

Following the successful restart, I then reconnected all the other drives and put the DVD back on the PCI card. Everything then came up fine, however the DVD wasn’t anywhere to be seen. Vista identified the card as an Integrated Technology Express IT8212F. In the FAQ for this card, it mentions that there are two BIOSes available – a RAID BIOS which only works with hard disks, and “pure” IDE BIOS which also supports ATAPI devices (eg. CD/DVDs). There’s a BIOS upgrade application, but it only works in DOS mode, which won’t work in Vista 64bit.

I tried the BIOS upgrade (on three different machines) but with no success. I was about to give up when I figured out that I could host the two IDE drives (including the Vista system drive) on the PCI adapter as long as the system drive was configured as the first drive. This then allowed the drive to be listed in the main motherboard BIOS’s list of bootable drives.

Now everything is working well. The only outstanding issue is to check whether the Epson Perfection 2400 PHOTO scanner can work properly with Vista 64bit. There are Vista drivers but it appears the Epson Smart Panel software requires a non-free upgrade to a compatible version.

Thursday, 16 October 2008

Major upgrades with WiX

I thought I was going crazy.. I’d built an installer using WiX and set the product version to 1.0.0.1. The plan was that installing a new version would automatically uninstall any old versions.

I then updated the version to 1.0.0.2 and installed the new version, only to end up with two installations.

Turns out that Windows Installer only looks at the first 3 digits of the ProductVersion (as the first Note mentions in the Windows Installer documentation on Major Upgrades) – so twiddling that 4th digit is not going to have any effect.

Here’s a sample .wxs file that works for me:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
  <?define version = "1.1.3.11" ?>
  
  <Product Id="*" Name="WixUpgrading $(var.version)" Language="1033" Version="$(var.version)" Manufacturer="WixUpgrading" 
           UpgradeCode="630aaa2d-a583-46db-85c4-eaf237590c61">
		<Package InstallerVersion="200" Compressed="yes" />
		<Media Id="1" Cabinet="WixUpgrading.cab" EmbedCab="yes" />
		<Directory Id="TARGETDIR" Name="SourceDir">
			<Directory Id="ProgramFilesFolder">
				<Directory Id="INSTALLLOCATION" Name="WixUpgrading">
					 <Component Id="ProductComponent" Guid="c768bc29-e2d6-4f1c-b711-2dcf91641fab">
             <File Id="TextFile1.txt" Name="TextFile1.txt" KeyPath="yes" Source="TextFile1.txt" />
           </Component> 
				</Directory>
			</Directory>
		</Directory>
		<Feature Id="ProductFeature" Title="WixUpgrading" Level="1">
			<ComponentRef Id="ProductComponent" />
		</Feature>
    <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" />
    <Property Id="ALLUSERS" Value="1" />
    <Upgrade Id="630aaa2d-a583-46db-85c4-eaf237590c61">
      <UpgradeVersion Property='PREVIOUSVERSIONSINSTALLED' OnlyDetect="no" IncludeMinimum='yes' Minimum='0.0.0' IncludeMaximum='no' Maximum='$(var.version)' />
      <UpgradeVersion Minimum="$(var.version)" IncludeMinimum="no" OnlyDetect="yes" Language="1033" Property="NEWERPRODUCTFOUND" />
    </Upgrade>
    <InstallExecuteSequence>
      <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWERPRODUCTFOUND AND NOT Installed</Custom>
      <RemoveExistingProducts Before='InstallInitialize' />
    </InstallExecuteSequence>
    <CustomAction Id="PreventDowngrading" Error="Newer version already installed." />
    <CustomAction Id="UIandAdvertised" Error="Something about the UI."/>
    <InstallUISequence>
      <Custom Action="UIandAdvertised" Sequence="3">ProductState=1</Custom>
    </InstallUISequence>
  </Product>
</Wix>

Wednesday, 8 October 2008

Using SQL Server 2008 for Enterprise Applications

Timothy Walters, Ben Laan and I will be the speakers at tomorrow’s Adelaide SQL User Group meeting.

We’ll be sharing some of our experiences using SQL Server 2008, including:

  • Change Tracking
  • Replication
  • Synchronisation
  • Integrating with legacy SQL 2000 databases that have no referential integrity worth speaking of

Register if you’d like to come along – hope to see you there!

Tuesday, 7 October 2008

A new TV

I finally decided on a new TV for the home theatre, after my attempts at getting the 1970’s era CRT to work failed.

I chose a Kogan 1080P-32 – a Full-HD LCD TV. Importantly, it supports HDMI input and as the name suggests can display full high definition – 1080 Progressive. Kogan are an online store, so it did mean that I had to order something sight-unseen – a bit scary when you’re spending a reasonable amount of money. Happily, the TV was couriered quickly and safely and I haven’t had any problems with stuck pixels.

I then had to connect the screen to the home theatre box. Some retails sell HDMI cables for more than $100, but instead I bought a 5m cable from MSY for $10.

It seems to work quite well with Media Center. The only issue I’ve had is that when you close Media Center and do other stuff in Vista, the display is a bit blurry. I’m not sure if that’s a problem with the graphics card or something else. Not a huge problem but it would be nice to sort it out.

I then hired a Blu-Ray DVD to try out. This also worked ok, once I realised I hadn’t installed all the PowerDVD bits. For some reason, PowerDVD doesn’t integrate with Media Center, so you either have to manually swap over to PowerDVD, or install another player like ArcSoft's TotalMedia Theatre. This is a bit better, though it still isn’t completely integrated as the stop/play buttons on the remote control didn’t work properly.

The net result is that everything is working well. The monitor that we were using for the TV is now back on my home computer, and we’re now looking around furniture shops for a nice home entertainment unit to put it all in.

One sad note – A couple of weeks ago we were watching TV when the machine started locking up (always in the most crucial part of the TV program!). I eventually discovered that my 1Tb WD disk had developed a bad case of badsectoritis. It was just over 1/2 full and had been fine up until now, so I can only guess that maybe there were a bunch of bad sectors in the second half of the disk that we started to hit, or some kind of electronic malfunction. In any case it will need to be sent back under warranty to get sorted out. In the meantime we can survive on the other disk.

Friday, 26 September 2008

Composite Application Guidance for WPF

For those who like to read in a more linear fashion, the PDF of the June 2008 release of Composite Application Guidance for WPF is now available.

Tuesday, 23 September 2008

Programmatically setting a connectionString property

The application we are developing will be installed at different locations and consequently will need to connect to a local SQL Server instance.

Rather than build separate configurations and installers for every site, we’re planning to store this information centrally. The application then uses a web service to retrieve the appropriate configuration information for its site.

As we are using NHibernate/ActiveRecord with the database configuration being loaded though the Castle ActiveRecord Integration Facility, the database name is indicated through naming a connection string (by specifying the config key ‘hibernate.connection.connection_string_name’). The difficulty is that this appears to be loaded the first time Windsor loads the config file. What we need is a way of replacing the connection string that was read from the app.config file with one that we’ve retrieved from the web service.

The main problem that needed to be overcome is that .NET doesn’t allow you to change the connection strings after they are read from the app.config file. If you try to do it, it will throw a ConfigurationErrorsException with the message “The configuration is read only”. The following code illustrates this:

var settings = ConfigurationManager.ConnectionStrings[0];
settings.ConnectionString = "blah";

Steve Michelotti describes how you can override ConnectionStringsSection’s IsReadOnly method, which would be fine for custom configuration sections but doesn’t work in this case as the class is sealed.

Dmitry suggests another approach, though at the time it was just an untested idea. ConnectionStringSection inherits from the abstract class ConfigurationElement. Using Reflector you can see that the default implementation of IsReadOnly just returns the value of a private field _bReadOnly, which is set to true.

We use reflection to locate the private field _bReadOnly and then force it to be false. eg.

var settings = ConfigurationManager.ConnectionStrings[ 0 ];
var fi = typeof( ConfigurationElement ).GetField( "_bReadOnly", BindingFlags.Instance | BindingFlags.NonPublic );
fi.SetValue(settings, false);
settings.ConnectionString = "Data Source=Something";

This is a bit of a hack and obviously would fail should Microsoft choose to change the name of this private field in the future, but as long as we do this before the container loads the configuration, it means that in the example above, any reference to the first connection string will return our new value.

An alternate approach might be to implement a custom NHibernate configuration provider, but I’ll leave that exercise to the reader :-)

Thursday, 18 September 2008

Running WiX on Windows Server 2008

Our CruiseControl.NET build server is running Windows 2008. Today I added a WiX project to generate an MSI for one of the projects. This ran fine on my local machine.

I followed the instructions from the WiX 3.0 help file on “Integrating WiX Projects Into Daily Builds” with one exception - Step 2 adds a new section to the .wixproj file, but I had to remove the $(WixToolPath) prefix from the WixTasksPath element. eg.

  <PropertyGroup>
    <WixToolPath>..\Tools\Wix\</WixToolPath>
    <WixTargetsPath>$(WixToolPath)Wix.targets</WixTargetsPath>
    <WixTasksPath>wixtasks.dll</WixTasksPath>
  </PropertyGroup>

I then checked this in and watched the build die with the following error:

light.exe (,): errorLGHT0217: Error executing ICE action 'ICE01'. The most common cause of this kind of ICE failure is an incorrectly registered scripting engine. See http://wix.sourceforge.net/faq.html#Error217 for details and how to solve this problem. The following string format was not expected by the external UI message logger: "The Windows Installer Service could not be accessed. This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.".

Others have had similar problems, and the solution seems to be to make sure that the account the build process runs as is a member of the local Administrators group.

Wednesday, 10 September 2008

Deleting the “Program Files” directory

No, don’t worry I’m not that crazy. On the HTPC, I initially installed Vista on the 1Tb disk. When the replacement system drive arrived, I then installed Vista on that drive, but didn’t reformat the original disk as I’d already recorded some programmes that I wanted to keep.

This meant that there was the old “Program Files”, “Windows” and other directories that Windows creates. The problem is that even running with UAC you can’t delete them. If I’d reformatted the drive, I would have never had this problem.

Tim Sneath went through a similar situation, and his solution worked for me too.

Tuesday, 9 September 2008

A new toy

When I left UniSA earlier in the year, one of the parting gifts I received was a gift voucher, and I’ve finally decided what to do with it. I bought an iPod Shuffle.

I’d been pining the loss of my trusty HTC TyTN II phone, which doubled as an MP3 player, but couldn’t justify the price to keep it. I decided all I wanted was a basic player – nothing too fancy, and the Shuffle seemed to fit the bill, whilst still having the slick Apple look. As long as I could listen to a few podcasts I'd be happy (.NET Rocks! and Hanselminutes for starters)

ipod shuffle RED

I priced the 1Gb Shuffle in some local stores at $AU64. Apple sell it online for $AU65, plus they let you engrave it with custom text. I liked that idea, so if you ever come across a Shuffle that looks like the one above, it’s probably mine and could I have it back :-)

It’s not the first purchase I’ve made from Apple - that would be a Newton MessagePad 2000 I bought many years ago (and many years ahead of its time), but I think this is just as nifty.

You might also notice it is red – that’s because part proceeds of (PRODUCT)RED™ iPods are donated to fight AIDS in Africa.

Monday, 8 September 2008

Cutting remarks

When I’m not cutting code, I cut trees :-)

David chainsawing a tree

It was a fine day on Saturday, so I hired a chainsaw finished up the job that a big storm started last year.

Two-thirds of our Manchurian pear tree was blown over (conveniently missing the roses and the other tree you can see on the left). At the time, a friend Craig (also a code-cutter by the way) came over to help clean up the mess. We left all the branches in a big pile, and that, along with the remaining trunk was chopped up on the weekend.

And it is true to paraphrase the old saying - when you have a chainsaw, everything looks like potential firewood.

Sunday was Father’s day, and rather than breakfast in bed, the kids decided not to wake us up early for a change – much appreciated – especially as I was feeling a bit sore from lugging the chainsaw around the day before (keyboard work doesn’t seem to give you as big arm muscles as you might think!).

Wednesday, 27 August 2008

Installing CruiseControl.NET on Windows Server 2008

We’ve been running CCNet on a very old workstation, and the build times were starting to get rather long. To fix this, we’ve had a new Windows Server 2008 virtual machine provisioned.

These are roughly the steps I followed to get things up and running:

  1. Enabled IIS 7, WPAS and SMTP
  2. Installed .NET 3.5 SP1
  3. Installed CruiseControl.NET 1.4
  4. Updated web.config to allow webdashboard to run in integrated mode by adding the following section:
<system.webServer> 
    <handlers> 
        <add name="*.xml_*" path="*.xml" verb="*" type="ThoughtWorks.CruiseControl.WebDashboard.MVC.ASPNET.HttpHandler,ThoughtWorks.CruiseControl.WebDashboard" preCondition="integratedMode,runtimeVersionv2.0" /> 
        <add name="*.aspx_*" path="*.aspx" verb="*" type="ThoughtWorks.CruiseControl.WebDashboard.MVC.ASPNET.HttpHandler,ThoughtWorks.CruiseControl.WebDashboard" preCondition="integratedMode,runtimeVersionv2.0" /> 
    </handlers> 
    <security> 
    <requestFiltering allowDoubleEscaping="true" /> 
    </security> 
</system.webServer>

  1. Installed applications required for building and testing:
    • CollabNet SVN 1.5.1
    • TortoiseSVN 1.5.1
    • Gallio
    • FxCop 1.36
    • Sandcastle
    • Sandcastle Help File Builder
    • Windows SDK for Server 2008 (just dev tools)
    • Report Viewer 2008 SP1
    • SQL Server Express 2008
    • Change CCService to run as Automatic and as specific ‘build’ user.
    • Grant ‘Modify’ access to ‘build’ user to ‘C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files’.

One issue I did find right at the end – one of our tests was failing with this unusual error:

System.Windows.Markup.XamlParseException: 'DockPanel' object cannot be added to 'Viewbox'. Exception has been thrown by the target of an invocation. Error at object 'System.Windows.Controls.DockPanel' in markup file 'AbbGrain.Aom.Client;component/shell.xaml'. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80070018): The program issued a command but the command length is incorrect. (Exception from HRESULT: 0x80070018)
at MS.Internal.HRESULT.Check(Int32 hr)
at System.Windows.Media.MediaSystem.Startup(MediaContext mc)
at System.Windows.Media.MediaContext..ctor(Dispatcher dispatcher)
at System.Windows.Media.MediaContext.From(Dispatcher dispatcher)
at System.Windows.Media.Visual.VerifyAPIReadWrite()
at System.Windows.Media.Visual.VerifyAPIReadWrite(DependencyObject value)
at System.Windows.Media.VisualCollection.VerifyAPIReadWrite(Visual other)
at System.Windows.Media.VisualCollection.Add(Visual visual)
at System.Windows.Controls.Viewbox.set_InternalChild(UIElement value)
at System.Windows.Controls.Viewbox.set_Child(UIElement value)

All the more strange, as the test was passing on the old build server and also passed on all our workstations. Turns out it’s a bug in .NET 3.5 SP1.

There’s a comment at the bottom of the bug that changing the service to run in XP SP2 compatibility mode should work around the issue. This didn’t work for me initially, until I realised I needed to click on the ‘Show settings for all users’ and then set compatibility for all users. eg.

Compatibility for all users dialog

Restarting the service then saw the WPF test pass.

Tuesday, 26 August 2008

HasMany and null foreign key columns

I’ve been trying to figure out why our data layer wasn’t saving a new item that we’d added to a [HasMany] collection.

To figure out what was happening, I build a simple sample based on the examples from the Castle ActiveRecord documentation.

ClassDiagram1

This generates a database schema like this:

BlogPostTableDiagram

Normally you’d make the foreign key column ‘blogid’ not null, but (as mentioned in this thread) for NHibernate, it does an INSERT then an UPDATE so the foreign key column does need to be nullable.

I can understand this might be the case if the Blog entity hadn’t been saved, but it is surprising that it doesn’t recognise that it could use a single INSERT statement if it does know the foreign key value.

Monday, 25 August 2008

NHibernate 2.0 GA

Fabio announced that version 2.0 of NHibernate is now released. This is great timing, as we’ve been using the release candidate for a few weeks now.

Download from SourceForge.

Unfortunately this release doesn’t include LINQ for NHibernate, but the word on the street is that is planned for 2.1. That will be a really useful addition. I’d much prefer to use LINQ to write queries and let the compiler check the syntax rather than have HQL strings that I only find out at runtime are incorrect.

Friday, 22 August 2008

UrlScan v3.0

Version 3.0 of this useful filter has been released. Just the thing to help keep the nasties out of your IIS server.

Nazim summarises the new features.

Thursday, 21 August 2008

And the winner is…

Last night the SA finals of Microsoft’s Demo competition were held. The state finalists were:

Andrew Coates hosted the show (well there were only the five of us there, so it was a small show) and also judged the presentations. At the conclusion, Andrew announced that Nigel was the winner!

After we posed for a photo in our very trendy bright orange T-shirts, Andrew then took us out to dinner along with Darren Neimke (who happened to be in the neighbourhood).

It was a great night, and all the best for Nigel in the national finals to be held at TechEd 2008 in Sydney in a couple of weeks.

Monday, 18 August 2008

Sticky taped

Taped I obviously haven’t been as productive as my ABB colleagues thought I should be, so they kindly taped up my mouse – presumably to encourage me to use the keyboard more.

I’m not sure what they’re saying by taping up my phone and my chair though.

Or maybe things just got extra silly on Friday afternoon after I left :-)

Friday, 15 August 2008

Teracopy

I saw this tool mention in a LifeHacker post last month and thought I’d try it out.

Copying large (or lots) of files with Windows Explorer can be an interesting experience, but Teracopy improves on this quite a bit.

I like it.

Thursday, 14 August 2008

Compiling the NHibernate 2.0.x branch

I downloaded the latest code for NHibernate 2.0.x from the Subversion repository.

When I ran nant to build the code, it was displaying a whole bunch of errors as soon as it got to the Iesi.Collections.Test project:

NH2.0.x-branch\src\Iesi.Collections.Test\Generic\HashedSetFixture.cs(7,7): 
error CS0246: The type or namespace name 'NUnit' could not be found (are you missing
a using directive or an assembly reference?)

Turns out because I’m using a current nightly build of nant, it defaults to .NET 3.5. Forcing it to use .NET 2.0 (using the –t argument) seems to do the trick. eg.

nant -D:with.core.only=true -D:skip.tests=true -t:net-2.0

Wednesday, 13 August 2008

Error installing SQL 2008

I just had the following error appear near the end of installing SQL 2008 management tools:

The following error has occurred: 

Unable to get installer types in the C:\Program Files\Microsoft SQL Server\100\Tools\Binn\Microsoft.SqlServer.Management.PSProvider.dll assembly.

Not sure what that means.

Finishing the Home Theatre PC

You might recall that I discovered one of the hard disks I’d purchased for my HTPC was defective. It was sent back, but I’ve had to wait for a replacement to arrive. It finally came in, and on Saturday I picked it up along with the Shintaro Wireless Keyboard.

As an interim measure, I’d installed everything on the WD 1Tb drive, but now I could use the Seagate drive as the system disk (Operating System, etc) and leave that 1 Terabyte of space for recording data.

While I had the case open, I also took the opportunity to remove the extra video card (my experiment with composite video had failed, and the onboard video should be more than adequate).

I then re-installed Vista onto the new drive (which pleasingly was noticed immediately by the BIOS – no problems this time!)

As it was more than a month since the original build, I checked to see if any new drivers were released:

I thought I’d be clever and configure the Free*EPG TV Guide settings before starting up Media Center, but that didn’t seem to work. After I’d gone through the Media Center configuration process and then closed MCE, I ran the Free*EPG tool again and things went better.

Everything was up and running again.

Shared media

I’ve heard about Media Centre Extenders, but never saw anything about how MCE can talk to other regular Windows machines. Well it turns out it is quite simple. You can point MCE to a network share in the Library settings, and then  you can browse all your digital photos and listen to your CD collection remotely.

Add-ins

I also wondered if there were any interesting add-ins for MCE. There’s quite a list mentioned in the Media Center forms on The Green Button.

I’ve installed the following to start off with:

  • Heatwave – displays the current and forecast weather
  • TVTonic – Internet TV and video podcasts

TVTonic comes with a whole lot of channels to choose from, but you can also add your own custom RSS feeds to the list. I added the feed for dnrTV, and it worked straight away.

A quick warning though – don’t forget that you’re downloading all that video, and like me you might discover that’s a great way to use up almost all of your broadband quota for the month! At least Internode are responsible and send you warning emails when you’re getting close to the limit. We normally don’t get anywhere near the 10Gb a month limit, so this is something I’ll need to monitor.

It does raise an idea for my own MCE add-in – A Media Center Usage Meter for Internode. Now just to find the time to do it!

Friday, 8 August 2008

All the best, Brenton and Hayley!

Brenton and HayleyIf you happen to watch the Channel 9 News on a weeknight in Adelaide, then you’re probably familiar with their weatherman, Brenton Ragless. You might also recognise his dulcet tones from one of his radio and TV advertising voiceovers, CFS spokesperson,  radio presenter on LIFE-FM, or maybe even the funny guy on the PA at the Blackwood Christmas Pageant.

I’ve known Brenton over the years through cake decorating (no, not us - our Mums) and Church circles, and now that he’s a big time TV personality, it’s quite nice for my kids to say “Daddy, isn’t that the man you know?”. I’m not famous, but at least I know someone who is :-)

Well the great news is Brenton and his fiance Hayley are getting married tomorrow, and I thought it would be nice to publicly wish them well.

I’m not sure if I’ll be able make it to the ceremony, but I hope everything goes well (even if the weather looks like it might be a little inclement – you’d think Brenton would be able to fix that!)

Thursday, 7 August 2008

SQL Server 2008 RTM

It looks like SQL Server 2008 is now done. Various bits are starting to appear on Microsoft Downloads, including Sync Framework v1 and Sync Services for ADO.NET v2.

The sync files are downloadable separately as part of the Feature Pack.

There’s also 2008 Books Online, and some 180-day trials of SQL Server 2008 Enterprise Edition – one for IT Pros and one for Developers.

Hopefully the Express versions will appear shortly. Greg says Visual Studio 2008 SP1 will come out on August 11th.

Wednesday, 6 August 2008

Welcome Ben

Monday saw Ben Laan join our team. The “Dream Team” is now complete and it’s all systems go.

Tuesday, 5 August 2008

SQL 2008 RC0 misery

On my old (and slow) work PC I had installed SQL 2008 RC0 and it worked fine.

I tried to install it on the new box and it has ended up causing me grief. The first indication that all was not well was when I tried to launch Visual Studio 2008 after SQL installation had completed. I was greeted with the following error:

"Package 'Microsoft.VisualStudio.Xaml' has failed to load properly"

Googling this error unfortunately didn’t give any ways to fix it, apart from reinstalling VS 2008.

So that’s what I did. I got rid of all the Visual Studio and SQL products using Add/Remove.

I then also fired up RegEdit and deleted their registry settings and clobbered their Program Files directories just to make sure. Reinstalling took a few hours, but was uneventful.

I then fired up Visual Studio again, only to see this new error when I tried to run our project

Unable to load DLL 'wpfgfx.dll'

It appears this is caused by some remnants of .NET 3.5 SP1 beta not being removed.

Rather than repeat the whole install process again, this time I just uninstalled all the .NET frameworks, used this tool to make sure, then finally clobbered the c:\windows\assembly and c:\windows\microsoft.net folders, before re-installing .NET 3.5 again.

Because some of Visual Studio’s assemblies would also have been clobbered, I then did a Repair.

All seemed ok, until I tried to use SQL Management Studio. Of course it had some managed assemblies too, but unfortunately I couldn’t see a way to repair it. Instead I uninstalled all the SQL bits again and reinstalled them.

Now everything appears to be back to “normal”.

Friday, 1 August 2008

SQL Express user instance failing when using RDP

I thought I’d log in via Remote Desktop to do some extra work from home. I attempted to run the database unit test project only for all the test to fail with the following error:

“Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.”

Turns out this is a bug in Windows XP SP2.

I installed the hotfix using Microsoft’s new Hotfix request service, and the problem is fixed.

Monday, 28 July 2008

Improving my PageRank

Last last year, I decided I would make use of Google’s Webmaster tools to indicate that my blog nominally resides in Australia. Of course because it is hosted on Blogger, Google wouldn't otherwise guess this from the domain name. At the time I was curious as to what effect this would have on my PageRank.

Entering "David Gardiner" into Google does bring back lots of matches, and I'd managed to be on the first page which I was pretty happy about. I'd been quite diligent in always linking back to http://davidgardiner.blogspot.com when ever I was asked to enter website details on other sites. My UniSA staff homepage also featured prominently, so it would be interesting to see what happened after I left there and that page ceased to exist.

Things didn't seem to go well though. I'd heard Google changed their algorithms around the same time, and I noticed my blog was dropping further and further down, until it was somewhere on the third page of results.

The crazy thing through all this was that my profile on the Australian Broadband site Whirlpool always rated very high. That must show an indication of how PageRank has changed - inbound links to your page don't seem to count as much now as the significance of the site as a whole. I'm pretty sure no one is linking to my Whirlpool profile, but obviously heaps of sites link to Whirlpool in general.

So last week I thought I'd try to make some changes:

First off, I removed the "Australia" designation. Even though I liked having my blog come up in the "pages from Australia" search, I wondered if this might be counting against me?

Secondly, I modified the blog title to include my full name. It is a little bit more wordy, but hopefully it helps Google out a bit.

Finally, I reviewed the template for my blog, and found some embarrassing errors. I'd added some <meta> tags for keywords and description, but for some reason had used a 'value' instead of 'content' attribute.

I then ran the page through the W3C Validator a few times and fixed some of the errors and warnings. After all, you figure if the markup is well formed, then the search engines are going to have an easier time indexing your content. One thing this did show was that Blogger is generating some invalid markup (eg. not properly encoding ampersands in URLs). It would be nice if they would fix that.

So with those changes done I thought I'd do another search today and see how I'm doing... Not too bad it seems - I'm now back on the first page of results - currently coming in 6th (with my Whirlpool profile 1st!)

Maybe as a further experiment, I'll go back and add back "Australia" as a geographic target in a few months, to see if that really did make a difference.

Note, other search engines also offer similar webmaster tools - eg. Live.com and Yahoo.com

Sunday, 27 July 2008

Embedding a Silverlight video in a webpage

When most people link to YouTube videos, it ends up embedding a still image of the first frame of the video. You can then click on it to start playing.

I linked to my demo video in my demo competition entry post, but I couldn’t figure out how to do the same thing. I personally prefer not to force someone to start downloading a video if they didn’t want it. Is there a simple way to do this? (Apart from having to manually save the first frame out as a jpeg).

Friday, 25 July 2008

Passed 70-561

To be honest, I didn’t expect this!

I just found out I’ve also passed Microsoft .NET Framework 3.5, ADO.NET Applications.

I remember I was pretty tired, and was still a bit exhausted after taking 70-562 the previous day. About 3/4 through I noticed the tiredness was catching up on me as I was having trouble focusing (Excom’s crumby old test computer doesn’t help – nothing like a CRT monitor with the refresh frequency set way to low to wear you out quicker). The thought even crossed my mind that maybe I should give up and leave. But then I figured, no, I won’t get this opportunity again so try and give it my best shot. Looks like it was a good thing I stuck it out :-)

Tuesday, 22 July 2008

Heroes Happen 2008 Demo Competition entry

Rob should be happy, I’ve finally got around to recording my entry for Microsoft’s demo competition!

I demonstrated this earlier this month at the Adelaide SQL Server User Group, and then did a slightly longer version at CodeCampSA.

Monday, 21 July 2008

Welcome Nigel and Richard

Today Nigel Spencer and Richard Hollon joined us at ABB.

Timothy has dubbed us the “Dream Team”. I’m not sure if that means we’re really good, or we’re really sleepy.

Thursday, 17 July 2008

Passed 70-562

I’ve received confirmation that I passed Microsoft .NET Framework 3.5, ASP.NET Application Development. This was one of the two beta exams I did in early May.

The one good thing about doing beta exams is they are free. The bad thing is that unlike regular exams, you have to wait 6-8 weeks to find out if you passed or not, and you don’t get a score – just a pass or fail.

Monday, 14 July 2008

CodeCampSA 2008 – Day 2

Presentation notes

Paul Stovell – Reactive Programming

  • Reactive programming. cf. Excel
  • Data binding – similar for .NET
  • Manipulating the flow
    • WPF ValueConverters
    • EditableAdapter class
  • Reactive Domain Models
    • Search query generic class
  • Bindable LINQ
    • A bit like SqlCacheDependency for LINQ expressions
    • Very cool!
    • Just add one method to LINQ and you’re done

Tatham Oddie - ASP.NET MVC

  • The “I” in URI is for Indicator
  • Controller – adds data to ViewData dictionary
  • Html.ActionLink (Html helper class)
  • Routes – more than just URL rewriting
  • System.Web.Routing – can also be used in WebForms
  • View Engines – WebForms, but can also use others
  • IoC
    • RegisterControllers – extension method for WindsorContainer class

Ben Mackie – Reflection, extension, injection

  • Three types of projects
    • Configuration
    • Extension
    • Purpose-built
  • SPI – service provider interface – how the host depends on the extension
  • Castle configuration – can pass references to other dependencies through the config
  • System.AddIn
    • Contracts, views and adapters

I wonder if you could write a whole application as a bunch of addins?

Dr Greg Low – SQL isolation levels etc

How much one user impacts others.

  • Read committed (shared lock, SQL default)
  • Read uncommitted (no locks, risky) – consider using a read-only partition on a table instead
  • Repeatable read (locks, but can have phantom rows)
  • Serializable (locks, no phantoms) – very consistent
  • Snapshot (2005+, writers not blocked, uses row versioning)

Locks

  • Shared (S)
  • Updated (U)
  • Exclusive (X)
  • Intent
  • Schema
  • Bulk update (Bu)

Make sure you use semicolons in your T-SQL as it will become mandatory in the future

  • Hints – use as a last resort
  • Use new DMVs to find blocking queries
  • Deadlocks
    • who ever did the least work gets killed (different from earlier versions)
    • Use deadlock graph (lock events) in SQL profiler
    • Make use of TRY/CATCH (2005+)
    • Build deadlock handling into client app from day one

Shane Morris – User Experience (UX)

UX design process

  • Information design
  • Interaction design
  • Presentation design

Interaction and presentation are mostly in the “coding” side.

Interaction design

  1. List everything you need to show
  2. Map out the workflow – what order are people going to work?
  3. Layout the elements (left-right, top-bottom)
  4. Check groupings
Presentation design
  1. Remove every unnecessary element
  2. ?
  3. Line stuff up – line up text to baselines (eg. labels and textboxes)
  4. Space and size things evenly
  5. Indicate grouping (group-boxes, similarity, proximity, alignment, empty space)
  6. Add visual weight
    • Colour
    • Size
    • Contrast
    • Irregular shape
    • Misalignment
    • 3D
    • Movement

Daniel Brown – SharePoint development

New Visual Studio 2008 extensions for SharePoint.

Corneliu Tusnea – Debugging the CLR

Debugging in Visual Studio

  • Use the Debugger attributes
    • DebuggerDisplayAttribute
    • DebuggerBrowseableAttribute
  • Use object ID to attach to objects in the watch window

Memory dumps

WinDbg

  • .loadby sos mscorwks
  • !threads (list threads)
  • !pe xxxxx (print exception)
  • !do xxxxx (dump object)
  • !dso (dump stack objects)
  • !iptomd xxxx (map instruction pointer to memory dump)
  • !dumpmt xxxx (dump method table)

gflags  - use to start debugger before service starts

Adrian Downs – PerformancePoint

Demonstration of Dashboard Designer

Final day thoughts

Another great day of content. I had to leave before Paul’s second quiz was finished (apparently the SMS proved problematic and they had to resort to paper in the end). Maybe next time the quiz could be run over the whole day (eg. a question in between each session). This would give time for answers to be received.

Well done to Peter for organising everything, and special thanks to the interstate speakers for making the effort to come down to Adelaide – very much appreciated.