Thursday, 13 October 2011

Goodbye windows phone 7

After having played with a WP7 device for about 8 months, I now have to say it's not for me. There are two reasons.

Firstly my current phone was lent to me, and now has to be returned. But this is not the show stopper. I'd buy a new one tomorrow if it wasn't for the second reason. The main reason I'm giving up on the Windows Phone 7 is that I cannot find a way (that works for me) to back up my telephony data. My text (SMS) messages and calling data are important to me and in order to continue using these devices I need to have a way to record and back up this information.

Because Microsoft has made it incredibly difficult to back up this data via their API's I cannot buy or even write an app that will let me back up this data easily or in fact at all. So finally I gave up trying.

It's a sad day because for all of it's flaws, the Windows Phone 7 is one of the most ergonomic phones I've ever used. It was mostly intuitive and in the main just works. And looking at the future of Windows Phone and Windows 8 - the metro paradigm (the one on the Phone) look like it's the future of Windows.

I'm now looking at either an iPhone (deep sucky in breath) or and Android Phone (slightly less sucky in breath).


Monday, 7 February 2011

The Suprising Truth about Motivation

I found this this morning via reddit and I think it sums up what's being playing on  my mind for years. What motivates us as people who make machines do 'stuff'.

For reference: original link to the Royal Society of Arts in the UK

Friday, 5 March 2010

Friday, 29 January 2010

Hard Disk Beat Boxing

I’ve just returned from a month away and have discovered that my disk has gone north last week, making the sounds of a rather rubbish DeeJay.

Since I use virtual machines for a lot of the work I’ve been doing and these machines actually run from a separate disk – I‘ve been fairly lucky and have only lost my vs2008 environment – the vs2010 is in a VM. This environment is easily recovered as we have a hard disk images for most of the vs2008 environments, and I only have to reinstall beyond compare, configure notepad++ and some VS settings, restore a couple of test databases and I’m back in business.

However this is another timely reminder for

  • Using Source Control – I’ve lost no source code, including all my part changes which are in TFS as shelvesets
  • Use a second disk for VMs – not only is it faster but it can also save your bacon from time to time
  • Keep hard disk images of important setups of your dev environment. I have to thank Aderant’s great IT team for this. They really are the best IT team I’ve ever worked with.
    Technorati Tags:
  • back up important things before going away – and please please please automate this as its trivial on windows to set up scheduled task to do this for you.

Monday, 28 September 2009

Make coding easier ???


The Resharper 4.5 splash screen during installation made me laugh today. I completely dig Resharper (though I prefer Refactor Pro) so don’t get me wrong. I just thought “Wow, that makes my code easier to understand”.

Thursday, 6 August 2009

TRX File decoder script updated to include Console output

Can’t image how I forgot this, but I did:

<xsl:stylesheet version="2.0"  

<xsl:template match="/">
<style type="text/css">
h2 {color: sienna}
p {margin-left: 20px}
.resultsHdrRow { font-face: arial; padding: 5px }
.resultsRow { font-face: arial; padding: 5px }
<h2>Test Results</h2>
<li>Tests found: <xsl:value-of select="t:TestRun/t:ResultSummary/t:Counters/@total"/></li>
<li>Tests executed: <xsl:value-of select="t:TestRun/t:ResultSummary/t:Counters/@executed"/></li>
<li>Tests passed: <xsl:value-of select="t:TestRun/t:ResultSummary/t:Counters/@passed"/></li>
<li>Tests Failed: <xsl:value-of select="t:TestRun/t:ResultSummary/t:Counters/@failed"/></li>

<table border="1" width="80%" >
<tr class="resultsHdrRow">
<th align="left">Test</th>
<th align="left">Outcome</th>
<xsl:for-each select="/t:TestRun/t:Results/t:UnitTestResult" >
<tr valign="top" class="resultsRow">
<td width='30%'><xsl:value-of select="@testName"/></td>
<td width='70%'>
<Div>Message: <xsl:value-of select="t:Output/t:ErrorInfo/t:Message"/></Div>
<Div>Stack: <xsl:value-of select="t:Output/t:ErrorInfo/t:StackTrace"/></Div>
<Div>Console: <xsl:value-of select="t:Output/t:StdOut"/></Div>


Using Beyond Compare with Visual Studio

This info is in other places on the internet but I’m putting it here for my future reference:

Under Tools|Options|Source Control|Visual Studio Team Foundation Server

Select Configure User Tools


Then add the following tools:


   Tool: C:\Program Files (x86)\Beyond Compare 3\BCompare.exe

   Arguments: %1 %2 /title1=%6 /title2=%7 /solo


   Tool: C:\Program Files (x86)\Beyond Compare 3\BCompare.exe

   Arguments: %1 %2 %3 %4 /title1=%6 /title2=%7 /title3=%8 /title4=%9 /solo

Monday, 29 June 2009

MS Test Error: Metadata files that belong to projects cannot be edited. If you wish to use this metadata file, please import it into the solution

Visual studio (2008) sometimes gets into a bind. It loses the binding with a testadatafile (vsmdi) and try as you might you cannot reattach it and you get the message:

“Metadata files that belong to projects cannot be edited. If you wish to use this metadata file, please import it into the solution”.

Well there is one proposed solution on msdn but it didn’t work for me. To get round it I dropped the vsmdi from the solution. Added it back using add existing item in the solution designer and then went to the Test | Create a new Test list


This allowed me to recreate my test list. since I don’t really use many test lists it was a piece of cake but I don’t recommend this solution if you have legacy test lists and are afraid of losing them.

Tuesday, 9 June 2009

MS Test Error : Test skipped/Test host process exited unexpectedly

I get this occasionally – esp. when I’m killing the tests part way through a debug session. The trick is to kill the VSPerfMon process that hangs around.


Or the way I do it:

c:\>tasklist | findstr /i VSPERFMON
VSPerfMon.exe 6500 Console 1 23,192 K
c:\>kill -f 6500

Thursday, 21 May 2009

Why Oh Why Oh Why….

Has MSTest decided it needs me to have a DVD in the drive in order to run my tests.


I swear its got it in for me… Ye gads even if I kill the process it and restart it still refuses to proceed unless I replace the Chef Series 2 DVD I was listening. I suppose it must have like Lenny Henry!

Update: It’s now decided I cannot take “Romeo and Juliet” out of the DVD drive!!!!

Tuesday, 12 May 2009

Awesome intro regexp!!!

Found this tutorial on digg today. It’s definitely worth reading.

Monday, 13 April 2009

Scratch That

After realising that my son is producing his own videos using ms movie maker, hypercam and the awesome pivot stick figure animator and seeing the quality of this work I decided to introduce him to the really cool Scratch tool from MIT.

This is his first attempt at event driven programming.

This is his second

and its a great but simple game. The diver swims from left to right and back again. The left right cursor keys control the cannon (the pointy wizard's hat) and the space bar fires a bullet at the diver. Each time you hit the diver you get one point.

My son is only 10 and the game's official tester only just turned 7 this week. But they've managed to build and have a global release of their first game in the space of one sunday afternoon - amazing what two easter eggs can achieve in terms of productivity. I wonder if Joel Spolsky is listening....

Wednesday, 8 April 2009

Beer and Bytes inaugural meeting

Last night was the first meeting of the Auckland North Shore Beer and Bytes group. I consider is a great success not because I wasn't the only person there (I ensured that by dragging a couple of willing cohorts from work - cheers Joe and Steve), but because I had not anticipated how the evening would progress. Would everyone be bored? What would we talk about?

Well as it happened there was some very interesting things discussed. Joe tells me there were tape (actually digital but due to my age they'll always be tape) recorders in action. If anyone has any snippets they'd a like to add please feel free to add a comment.

Mark and Greg from Tracado gave us a run down on all the cool new things in Silverlight 3 that make this the best release yet. I had discussion about NHibernate and magic. Peter recommends this project as a great example of why WPF is great. But I think my favourite of all was Peter (please could you,  and everyone else who wants to, send me links to your web pages?) encouraging us to have a .net (real guns and bullets) shooting night!

Actually the other main thing we discovered was how many of us have DBase or Clipper in our backgrounds....  Thanks to Steve, Guy, Patrick, Peter, Allan, Joe, David, Mark, Greg and Bruce!

I think the general consensus was that we should do it again so I'll organise one for a couple weeks after Easter. Next time I'll bring my laptop and maybe we'll look at some code too :-)

Wednesday, 18 March 2009

MSTest - Specified cast is invalid

Just remembered this one. When running a VSMDI from the command line (using the mstest command switch /testmetadata) sometimes this error just happens - no help just 'specified cast is invalid'.

I found out a while ago that if you have test lists that are empty this error sometimes happens. What you do is go to the VSMDI editor in visual studio and in the VSMDI in question ensure that you either have tests in each Test List, or remove the test lists that are empty.

One more hassle from MSTest!!!!

Tuesday, 17 March 2009

Generating SQL from the NHibernate mapping file

I spent 10 minutes searching for a simple program that would dump out the SQL that NHibernate generates from a mapping file if requested. In the end I just wrote my own. This is the relevant snippet.

                NHibernate.Cfg.Configuration config = new NHibernate.Cfg.Configuration();
                var export = new NHibernate.Tool.hbm2ddl.SchemaExport(config);
                export.Execute(true, false, false, true);

Monday, 16 March 2009

For future use

For those idle moments I like to visit - there's always a gem or two there. This morning I learned about quux's Excellent WMIC cheat sheet!

Friday, 13 March 2009

Finally it's out!

It's been a while coming and taken its toll in terms of long hours and hard work but the ADERANT team have finally released our new software - ADERANT Expert "Golden Gate" Release. I leave you read the press release but I must say it's an exciting release - workflow, DSLs, WCF, WPF, new User Experiences, - you name it - it's in there! Well done everyone!

Thursday, 12 March 2009

Awww what a shame ....

Sorry but I couldn't help but feel a tinge of sadness this.... Only joking!

Tuesday, 3 March 2009

Taking ownership of a file without explorer

Use the following command on vista (elevated) command prompt:

icacls full_path_and_filename.ext /setowner name_of_user_or_group

Notepad++ on Vista 64 - replacing Notepad.exe

There are links here and here (among many other places) that shows how to replace notepad editor with the excellent Notepad++ on a vista or xp machine as the system default text editor. If you use vista 64 you'll need to add another directory to the location where you replace the original notepad.exe


So the set is :


As always on Vista you'll need to jump through a few hoops to allow you to do this. The first is to replace the file owner with someone other than the default 'TrueInstaller' and secondly to give the new owner full control over the file.

The above links give more info if you need it.

Don't forget - you mess with windows at your own risk :-)

Monday, 23 February 2009


There are other nerds out there!!! Nuff said!

Chainsaw (log4net viewer) won't refresh properly

We use Apache project's Chainsaw utility to view our log4net based logging messages. Being a Java Swing/AWT app it has a loads of funnies when running on windows such as commands not being where a windows user typically expects them but as a log viewer I find it outstanding - well, once you've got it to work that is!

Anyway recently we had a case where on one and only one machine it just refused to refresh the display properly. Though messages could be read one by one, using the cursor key down method, it was slow and painful, as reading the general flow and history of messages usually helps debugging more than an individual message. We spent ages over the past few weeks looking at different setting - java, log4net, networking/firewalls etc (we use chainsaw over UDP), we even tried running different versions of chainsaw but to no avail.

Finally a flash of inspiration - where are user settings stored? Yes! In your c:\users\blah\.chainsaw directory!!! Just delete this and low and behold like any decent app it recreates the info with sensible defaults.

Sometimes it helps not to be too clever!

NB. I always forget how to format a application configuration url for chainsaw on windows as there is small funny in chainsaw setting it via the UI. The correct format for us on vista64 is:


You can find this under the application preferences:

Chainsaw Preferences Location

In the Automatic Configuration URL

Chainsaw Automatic Configuration URL

Friday, 13 February 2009

Stopping command line building from signing assemblies

we all know that signing assemblies is a good thing, and I'm sure that most people know that the visual studio built in profilers (in instrumentation mode) need to work with unsigned code. So to stop the team build from signing I used the property SignAssembly and set it false before running msbuild (via the environment). I don't know if it works yet as it's running right now but I hope its as simple as that.

Saturday, 20 December 2008

Thursday, 11 December 2008

During a code review

My code may not be the best in the world, but yesterday I came across the following snippet:

            DrawingImage image = null;
IDictionaryEnumerator enumerator = dictionary.GetEnumerator();
if (enumerator != null) {

while (enumerator.MoveNext()) {
DictionaryEntry key = (DictionaryEntry)enumerator.Current;
image = key.Value as DrawingImage;
if (image != null) break;

return image;

Which after thinking about reduced to this:

            return dictionary.Values.OfType<DrawingImage>().FirstOrDefault();

Interesting? No not very except for the following thought, as we move to a world where we write less and less imperative code and more and more declarative code, some of us (esp. me) really have to give up control to other more talented programmers out there a just use their code 'declaratively'.

Saturday, 22 November 2008

Quick Mention For Ex Colleagues New Venture -

A couple of colleagues have just left Aderant to set up their own venture ( in Auckland, New Zealand. Mark Greene and and Greg Smith are two of the most talented software people I've had the privilege of working with. Between them they have an immense and detailed understanding of building large software systems using the very latest Microsoft technologies. It's been a great pleasure working these guys and I'm sure that they'll make huge success of their new consultancy. So if you want properly architected and built software see these guys!

Thursday, 28 August 2008

SQL Server Management Studio Madness - why do I have to have scripts as strings?

What do you think the following option in the SQL Server Management Studio does?

SSMS Option

Now one side of my brain says that I'll get a some preamble on my script looking a little bit like

IF NOT EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[SomeTable]'))

Well you'd be right! Well in the main.

Without the option:

/****** Object:  Table [dbo].[SomeTable]    Script Date: 08/28/2008 09:03:29 ******/
CREATE TABLE [dbo].[SomeTable](
[Column1] [nchar](10) NULL,
[Column2] [nchar](10) NULL

And with the option:

/****** Object:  Table [dbo].[SomeTable]    Script Date: 08/28/2008 09:03:49 ******/
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SomeTable]') AND type in (N'U'))
CREATE TABLE [dbo].[SomeTable](
[Column1] [nchar](10) NULL,
[Column2] [nchar](10) NULL

But for stored procedures?

Without the option:

/****** Object:  StoredProcedure [dbo].[DoIt]    Script Date: 08/28/2008 09:10:53 ******/
create procedure [dbo].[DoIt]
select *
from SomeTable
where Column1 = 'blah'

With the option:

/****** Object:  StoredProcedure [dbo].[DoIt]    Script Date: 08/28/2008 09:10:35 ******/
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DoIt]') AND type in (N'P', N'PC'))
EXEC dbo.sp_executesql @statement = N'create procedure [dbo].[DoIt]
select *
from SomeTable
where Column1 = '


What I want to know is why does the 'IF NOT EXISITS' check require me to generate a script as a string invocation of sp_executesql?

Tuesday, 26 August 2008

RDP over two monitors

I'd not even thought about doing this until today but at work we have dual monitors and we can work via remote desktop but this usually doesn't expand correctly over my home laptop and spare lcd setup. Today I did some hunting around and came up with the /span option on MSTSC (the rdp client).  Cannot do full screen but it expand just about perfectly!


TFS Command line (un)locking a file

I locked a file to prevent other users being able to checkin as I was doing radical surgery on it. This is something I hardly ever have to do with TFS but I was justified in this case. Since I use the command line I found that the easiest to issue a

tf lock /lock:checkin somefile.xml

However when unlocking it I discovered no unlock command. Rather you have to

tf lock /lock:none somefile.xml

This is (IMO) a real programmer choosing an API that is sensible for them (lock a file with no lock) but opaque to the new user. As I write lots of little tools/scripts etc, it's made me think about API discoverablility/design for the future.

Thursday, 21 August 2008

Playing with Extension Methods

I've had a issue with option Xml such as in our configuration stores. Basically I wanted to grab data from an XAttribute (see System.Xml.Linq) but wanted to avoid having to constantly check for null nodes. To ease the pain I wrote the following:


public static class Extensions {
/// <summary>
/// The extension method allows you to grab data from an XAttribute of if its null, supply a default
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="node">The node.</param>
/// <param name="defaultValue">The default value.</param>
/// <returns></returns>
public static T ValueOrDefault<T>(this XAttribute node, T defaultValue) where T : IConvertible {
if (node == null) {
return defaultValue;
return (T)Convert.ChangeType(node.Value, typeof(T));

now I can write

var results = from element in doc.Descendants("SomeTag").Where(e => e != null)
select new {
Prop1 = element.Attribute("attribute1").ValueOrDefault(String.Empty),
Prop2 = element.Attribute("attribute1").ValueOrDefault(String.Empty),

instead of

var results = from element in doc.Descendants("SomeTag").Where(e => e != null)
select new {
Prop1 = element.Attribute("attribute1") != null ? element.Attribute("attribute1").Value : String.Empty,
Prop2 = element.Attribute("attribute2") != null ? element.Attribute("attribute2").Value : String.Empty,

Or some multi line version of it. Its was just as easy to create one for XElement.

Wednesday, 13 August 2008

How Did I Get Started In Software Development?

I just been tagged by my friend Mike Hadlow to join with this meme. The question is a very popular topic with us nerds, and for me especially considering my passion for technology.

How old were you when you first started  in programming?

This is a favourite story of mine. I was 11 years old (1978) and in Mr Beardsley's maths class. At the back of the room was a partition, behind which only the 6th formers (16 year and older) kids were allowed. In the fateful particular lesson a series of beeps and other noises were heard. Asking Mr Beardsley about them was the probably the most life changing thing (a part from having kids) ever to happen to me - "That's the 6th formers playing with the computers. Would you like to find out more about that?" Well we started youngsters computer club that week and the rest is history.

What was your first programming language

Sorry I'd like to say machine code but no it was BASIC (PET ISTR then TRS80 then Acorn).

What was the first real program that you wrote

The first program I entered into a computer was from my (then) best friend Mandeep:

10 print "********************* Nuclear Alert ******************************"
20 goto 10

However the first program I actually wrote myself was called fatty, and it was a game to teach my younger brother maths. It had a some simple maths questions like 'what is 15 + 4'. If you selected the right answer a fat man would move along the screen all way across, but if you got it wrong then the man would randomly fall down the screen on his journey across the screen :-) It was called fatty because the man sort of looked, well, fat!

What languages have you used since you started programming

Ok, apart from BASIC and some simple machine code on my home computer I've used Pascal, Modula2, C, C++, Assembler (many varieties), PL/1, PLS, SQL, and of course C# and VB, not to mention PERL, and various shell languages and now iron python. But without a doubt the most interesting language I've ever written in was micro code at university. Here we had to do such things like loading buses with addresses, issuing memory refresh and read instructions, unloading buses etc. Together these  instruction primitives would end up forming a single machine code instruction like load register with contents of memory address.

What was your first professional programming gig

I was hired by IBM for a year during my degree to to testing of network apps, but after graduation I started work at NatWest bank in the UK as a systems analyst but left that after 9 months to return to programming at small company in Surrey, UK. Here I learned C then C++ and became firmly entrenched in the MS world with the first visual studio. I have to say working here was was another life changing experience - I learned the difference between hacking code and engineering software systems (which I'll expand in another post).

What's the most fun you've every had programming

For me its all about the paradigms and abstractions,  and how they affect cognition. It sounds lofty but really all I mean is that I think civilisation is really just the application of one technology after another that leads us from one way of thinking to another. Software is a great medium as we can create new models, use and break them, learn from them and then start over much more easily than say working with, say, hardware.  I have fun with programming nearly every day. But I get the most fun from getting into a tough debug session where you dig deep, learn some, try again , dig deeper and so on, every time building new models and breaking through abstractions to try and understand what was intended and what was achieved.

Who am I calling out?

Peter Goodman and Simon Shearston....

Tuesday, 22 July 2008

MS Test is hurting

Normally I try not 'me-too' post but I had to link to this. A friend of mine has just written an interesting post about how difficult he finds MS Test. Mentioning this to a colleague resulted in a link to Jeff Atwood's Coding Horror 'Why Can't Microsoft Ship Open Source Software?' post basically going further and trying to understand the reasons behind this.

I'm actually fed up with littering my tests with [DeploymentItem] attributes, having to hack around virtually opaque XML files, and bending over to assume the god forsaken position that MS Test wants me in. Yes I've tried to get change implemented - but some arguments I lose and some I win!!!

Sorry - rant over.

Tuesday, 1 July 2008

Access Denied Error when attaching to process

I've had this problem the that I've been trying to solve over the last few days and its stopped me from debugging into services (remoting and WCF) in other processes. Every time I went into (in VS2K8)  Tools|Attach to Process, and I selected a one of our processes, I got an Access Denied error. There was nothing in the event log, so I really didn't know what to try - except perhaps to reinstall VS, which hasn't worked.

The solution is actually very mundane and is related to the fact the I was attempting, not to do managed code debugging, but something called 'workflow debugging'. I'm not sure what this is but VS tells me it incompatible with managed debugging. I suspect that its TFS related and I was basically attempting to attach the wrong kind of debugger, and since I'm no longer a TFS admin, I suspect this is why I'm getting access denied messages.

To fix this all I had to do was to specify the correct debugger in the attach dialog, by clicking on the Select button and and changing the debugger type.






Friday, 27 June 2008

MSBuild Tasks - DLL or EXE

Quite often I find that I need the reuse the functionality that is in a custom msbuild task within small tool elsewhere. Usually the way round that issue is to refactor the nuts an bolts of the task into another dll, and then referencing this where needed. This is still the best option in my opinion. However this morning we discovered that you put your tasks assembly in exe wrappers also. This allows you to have a static main etc etc to allow to you call the nuts and bolts of the task from, say, the command line. Thanks to colleague Martin for verifying my ad hoc musings on this subject.

Wednesday, 25 June 2008

MSTest fails with UTA058: Trust problem

I kept getting this error for all my unit test dlls even though I was absolutely  certain that their locations were 100% fully trusted on my local cdrive. I even checked using the .net config tool in control panel. Finally I had a go at specifying the full paths to the dlls and 'viola'  it worked! You'll see that in the previous posting we use /testcontainer:%%~ff . The necessary bit is ~f. To find out more about this you can type 'for /?' in the a command window.

In addition, substitution of FOR variable references has been enhanced.
You can now use the following optional syntax:

    %~I         - expands %I removing any surrounding quotes (")
    %~fI        - expands %I to a fully qualified path name
    %~dI        - expands %I to a drive letter only
    %~pI        - expands %I to a path only
    %~nI        - expands %I to a file name only
    %~xI        - expands %I to a file extension only
    %~sI        - expanded path contains short names only
    %~aI        - expands %I to file attributes of file
    %~tI        - expands %I to date/time of file
    %~zI        - expands %I to size of file
    %~$PATH:I   - searches the directories listed in the PATH
                   environment variable and expands %I to the
                   fully qualified name of the first one found.
                   If the environment variable name is not
                   defined or the file is not found by the
                   search, then this modifier expands to the
                   empty string

The modifiers can be combined to get compound results:

    %~dpI       - expands %I to a drive letter and path only
    %~nxI       - expands %I to a file name and extension only
    %~fsI       - expands %I to a full path name with short names only
    %~dp$PATH:I - searches the directories listed in the PATH
                   environment variable for %I and expands to the
                   drive letter and path of the first one found.
    %~ftzaI     - expands %I to a DIR like output line

MSTest.exe on the command line

Heres a little batch file to run your tests locally (neatly) from test containers (courtesy of Paul)

rmdir TestResults /S /Q
for %%f in ("..\bin\debug\*UnitTest*.dll") do del "%%~nf".trx & mstest /testcontainer:%%~ff /noisolation /resultsfile:"%%~nf".trx
for /f "Tokens=*" %%f in ('dir *.trx /b') do @nxslt2.exe "%%f" trxsummary.xsl

Works for me!!!