Monday, May 05, 2008
... a nice way to end the school holidays :)

Coming back to work is the hard part:

LongWeekend.jpg

posted on Monday, May 05, 2008 11:00:11 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Friday, May 02, 2008
Good news that Scott Hanselman is coming to TechEd NZ which runs from Sept 1-3 in Auckland.

Hopefully this year I'll get to present again. The past two years I have had fun presenting PowerShell sessions, and there's lots of news of new PowerShell providers (and more coming), so there should be something good to report.

This year TechEd is tantalisingly close to PDC - which is Oct 27-30 in Los Angeles. I say 'tantalisingly', because a lot of teams within Microsoft will be holding off releasing new versions of their technology, or making big announcements at PDC (e.g. the mysterious Purdy team language / editor stuff will be divulged then).

Thank goodness for open projects like ASP.NET MVC - we're seeing right into the bowels of the project on a regular basis thanks to their open and frequent releases.

posted on Friday, May 02, 2008 4:49:37 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Wednesday, April 30, 2008
Simon Green posted a good comment on a previous post of mine (I like Guids), which is a generic class that wraps Guids, so that you get a nice compile time error if the wrong guid is used in the wrong place.

e.g.

/* Doesn't compile
Library.BorrowBook(bookId, personId);
*/

// Compiles fine
Library.BorrowBook(personId, bookId);

Whereas with a normal signature of (Guid, Guid) you'd get no compile-time error if the parameters were mixed up.

Try his solution out, and let me know what you think.

Cheers,

Kirk

posted on Wednesday, April 30, 2008 12:34:52 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
On Krzysztof Cwalina's blog there's an example of what may be coming in the Managed Extensibility Framework, a framework for dependency injection, naming and activation, and duck typing. Looks like it could be interesting when released.

While on his blog, I got to reading some of the older posts:
There's good stuff buried in the archives of Krzysztof and Brad Abrams blogs.


posted on Wednesday, April 30, 2008 12:28:15 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Friday, April 18, 2008
Here's an idea that would work well in Courtenay Place:
http://stevewellsphoto.wordpress.com/2008/04/16/cruising/

A sign on the side of the road that says:
No Cruising Zone
Motorists passing the traffic control point 2 or more times in 4 hours are subject to citation
That'd teach those kids a lesson!

The photo is taken by photographer extraordinaire Steve Wells. Formerly of Wellington, now in Paris, and has a great new photo every day on his blog.
posted on Friday, April 18, 2008 1:14:13 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [2]
 Monday, April 14, 2008
I'm presenting at the Wellington .NET Users Group this Wednesday night.

The aim is to have a bit of a run-through some of the interesting bits I pulled out of the Lang.NET Symposium videos, run through how the different CLR languages fit together and into the CLR, and talk about some of the things we have been hinted at for the future.

More details on the Wellington .NET Users Group site.

posted on Monday, April 14, 2008 10:46:04 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]

These guys crack me up:

And congratulations to Stephen and Melanie :)

posted on Monday, April 14, 2008 4:00:23 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Tuesday, April 08, 2008
Cool - Igor Moochnick has announced the release of pash, an open source implementation of PowerShell that runs on Mono or Microsoft's CLR.

I will be interested in seeing the uptake of Posh among Unix developers -- Powershell is more of an evolution of the standard Unix scripting environments such as bash, perl, and tcl, so should feel right at home.


posted on Tuesday, April 08, 2008 9:22:20 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Wednesday, April 02, 2008
This Star Trek parody to the tune of Ruby is quite nerdy and fun:

http://www.youtube.com/watch?v=mQoVqY2mWus

From 2006 - you may have seen it already, I hadn't.

posted on Wednesday, April 02, 2008 11:19:14 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Tuesday, April 01, 2008

I've been reading Charlie Calvert's blog, and his list of LINQ providers, and watching both the Lightspeed and LLBLGen Pro LINQ beta's with interest.

There's an available product that you can buy - the CHI69 "Computer Human Interface" - I have written a LINQ provider over the API provided within the supplied SDK.

Download the beta LINQ to Spouse provider here.

Connect to the CHI69 device, and read in the environment:

// Open environmental interface
Environment environment = CHIConnector.Connect<Environment>();

Build the representation of the user:

// Open self-representation
Husband me = CHIConnector.Self<Husband>();

The device allows querying the local environment for objects of different types using LINQ: 

// Search all available for a girlfriend
var prospects = CHIConnector.AllAvailable<Girlfriend>();

Girlfriend girlfriend =

(
from prospect in prospects
where
(prospect.Husband ==
null || prospect.MaritalStatus == MaritalStatus.Rocky)
&&
prospect.IsCompatibleWith(me)
select prospect
).First();

Peform some realistic actions with returned objects:

Thread.Sleep(69);

The library exposes a rich interface:

// Test marriage criteria

if (me.Mood == Mood.Romantic &&
    environment.Lighting <=
Lighting.Flattering &&
    girlfriend.Emotions.Contains(
Emotion.Desperate))
{

// Note the downcast. Some functionality will become unavailable
me.Wife = (Wife)girlfriend;

}

So go ahead and test the library and provider. I'm interested in any feedback you can give.

Some notes:

  • Wife inherits from Husband (by definition, the functionality is a superset)
  • Version 69 of the CHI device only allows for monogamous relationships. Due to demand, apparently this requirement will be removed in an upcoming release
  • As an optimisation, some inherited properties are implemented or cached in the class library, rather than querying the real-world object (e.g. wife.IsRight does not require a remote call as the result is deterministic)
  • The default device communication protocol is messy. Using SOAP would clean it up.
  • Setting me.Salary = 0 will throw an OutOfLuck exception, terminating the program.
  • High intensity emotions (e.g. wife.Emotion.Intensity >= Intensity.Danger) result in unpredictible behaviour.
PageofWords.LINQToSpouse.zip (14.36 KB)
posted on Tuesday, April 01, 2008 12:39:33 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [1]
 Thursday, February 21, 2008
It's good to see on John Lam's blog that videos from Lang.NET are now available.

They are Silverlight hosted, but if you want to download them directly, here are the links to the WMV files (right-click to save them to your disk):

Videos/1-00 - Keynote - Jason Zander

Videos/1-01 - CSharp3 - Anders Hejlsberg

Videos/1-05 - Lively Kernel - Dan Ingalls - Sun

Videos/1-06 - JScript - Pratap Lakshman

Videos/1-07 - Irony and ERP Language Challenges - Roman Ivantsov

Videos/2-00 - Democratizing the Cloud with Volta - Erik Meijer

Videos/2-01 - Newspeak - Gilad Braha - Cadence

Videos/2-02 - Resolver One - Giles Thomas - Resolver

Videos/2-03 - Retargeting DLR - Seo Sanghyeon

Videos/2-04 - Visual Basic - Paul Vick

Videos/2-06 - PHP - Wez Furlong

Videos/2-07 - Phalanger - Tomas Petricek

Videos/2-08 - Pex - Peli de Halleux

Videos/2-09 - Numerical Computing with the CLR - Jeffrey Sax - Extreme Optimization

Videos/2-10 - remotion Mixins - Stefan Wenig and Fabian Schmied - rubicon

Videos/2-11 - CodeIt - Serge Baranovsky - submain

Videos/3-00 - IronRuby - John Lam

Videos/3-01 - Ruby.NET - Wayne Kelly

Videos/3-02 - FSharp - Luke Hoban

Videos/3-03 - Parsing Expression Grammars in FSharp - Harry Pierson

Videos/3-04 - NStatic - Wesner Moise - SoftPerson

Videos/3-05 - Moonlight and Mono - Miguel de Icaza

Videos/3-06 - Visual Studio Shell - Aaron Marten

Videos/3-07 - Modeling and Languages - Don Box

Videos/3-07 - Modeling and Languages - Don Box_1

Videos/3-08 - Cobra - Chuck Esterbrook

Videos/3-09 - Intentional - Magnus Christerson


posted on Thursday, February 21, 2008 12:12:54 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Friday, February 08, 2008
The .NET user group is kick-starting the year with a country-wide road trip around New Zealand. Chris Auld and Jeremy Boyd are travelling to 11 towns and cities around NZ, and this Wednesday Feb 13, they come to Wellington:

http://wellingtonroadtrip08.events.live.com/default.aspx

Please come along and check it out. The event is shaping up to be the biggest .NET user group event that Wellington has seen yet, with over 350 people registered! I remember the first .NET user group meeting I organised, it had less than 10 people...

The session starts at 1:30 (doors open at 1pm), and will cover lots of cool new things, including Windows Server 2008, SQL Server 2008 and Visual Studio 2008, as well as covering some other cool related technology such as HyperV.

See you there!

Kirk

posted on Friday, February 08, 2008 9:22:30 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
A few years ago I wrote a guid shrinker, so that I could send out urls with guids in them, but have shorter messages. This was for mobile work, and so I called them "Muid's" (for mobile unique identifier).

To do this, I wrote a converter that converted from a 16 byte guid to a 21 or 22 character string, increasing the character set to 64 characters instead of the 16 characters used by guid's default ToString() (A-Z, a-z, 0-9, - and $).

It was with a little embarrassment that I read Dave Transom and Mads Kristensen's posts, where they use the Base64 encoder to do the character encoding, while I didn't think of that, and wrote an encoder / decoder myself.

So check out Dave's ShortGuid if you want shorter urls with all the benefits of guids (very hard to guess, globally unique), but don't want to sacrifice the extra 10-14 characters in every url.

posted on Friday, February 08, 2008 9:16:35 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Tuesday, February 05, 2008
Ever wondered which website stole your address and sold it to nasty spammers?

If you use GMail you can use a handy feature known as "Plus Addressing", which lets you receive emails into one GMail account using a variety of email addresses.

When spam arrives in your inbox, you can use the extra information you put into your email address to figure out which website sold your email address or spammed you.

How to do it:

You don't need to make any changes to your GMail account. When signing up to each new website or mailing address, use a slightly different email address.

For example, if your email address is kirkjackson@gmail.com, when you sign up to www.last.fm, you can use the email address kirkjackson+www.last.fm@gmail.com and the mail will still come through to your GMail account.

e.g. Sign up to each site with a distinctive email address:

live.com - kirkjackson+live.com@gmail.com
facebook.com - kirkjackson+facebook.com@gmail.com
evilnasty.com - kirkjackson+evilnasty.com@gmail.com
etc

When you receive emails:

Each email you receive in GMail will have a different "to" address, with the site that sent it to you. Click "Show details" on the message to see the full address that the email was sent to.

If you're receiving spam to a particular email address (e.g. kirkjackson+evilnasty.com@gmail.com), then you know which site to complain to -- although that probably won't work. But better than that, you can write quite a simple filter in GMail delete messages as soon as they arrive.

Caveats:

This works best for sign up emails to sites that you don't trust, and that you don't expect to use again. It can be hard to remember your email address to log in if you need to return to Facebook.

If spammers get smart, they could just send email to your base email address (e.g. kirkjackson@gmail.com), even if you entered kirkjackson+evilnasty.com@gmail.com into their site.

Some websites won't allow you to enter +'s into an email address form -- because they haven't read RFC 2882.



posted on Tuesday, February 05, 2008 4:58:47 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Wednesday, January 02, 2008
Another year coming up. Back to work tomorrow after a relaxing few days off.

Today I was awarded a Microsoft MVP again, so that's a good start to the year.

posted on Wednesday, January 02, 2008 10:07:17 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [1]
 Saturday, December 22, 2007
The Australian Windows Server team have done a good job with the new comic strip Server vs Client:





Not sure how you subscribe, but they're going to update weekly. Check it out.

Kirk
posted on Saturday, December 22, 2007 10:53:53 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Saturday, November 24, 2007
On Wednesday I listened to an interesting talk on IronRuby by Ivan Porto Carrero.

Ivan has a set of interesting posts on IronRuby on his blog, including a few examples on how to wire up WPF apps using IronRuby rather than XAML.

The slides from his talk are available.

Thanks Ivan!

Next session at the Wellington .NET User Group is 5 December. More details to follow.

posted on Saturday, November 24, 2007 7:51:10 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Friday, November 16, 2007
Wellington is a happening place if you want to learn something new. Last week at the .NET user group we had a great presentation by Jeremy Boyd on the developer features in SQL 2008.

Next Wednesday we've got a presentation on IronRuby by Ivan Porto Carrero.

Mark Carroll is starting a new Team System user group in Wellington, the first meeting is 28 November (Jeremy has the details).

As well as .NET and Team System, other user groups in Wellington are:

If you managed to go to all of them, you'd be eating lots of pizza!

Kirk




posted on Friday, November 16, 2007 9:45:09 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Wednesday, November 14, 2007
Perhaps more interesting than the other PowerShell features announced in the past week, the SQL 2008 team will release a PowerShell provider in their latest CTP.

For a little more on providers, see my earlier post. I hope the provider allows data access, and not just management capability.

Looking forward to having a play with that when I can get my hands on it!

Kirk
posted on Wednesday, November 14, 2007 11:10:50 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
Reading, transforming and instrumenting MSIL has been something that has kept me interested (and sometimes over-wraught) since the .NET framework came out in 2000.

It's interesting to see the benefits that a common intermediary language and a virtual machine bring to the party: difficult problems can be dodged by programming language designers (such as garbage collection); languages can interoperate; compiled code can be platform independant, and JIT compiled when needed -- and doing fun stuff with compiled code is easier (and more fun!) with MSIL or Java bytecode.

A few interesting things have happened with Java bytecode over the past few years, with a couple of high profile cases recently. Java bytecode is no longer just the output of a java compiler and the input for the Java Virtual Machine:
  • Google's new Android phone platform translates from Java bytecode to its own virtual machine -- which is not a JVM (via Miguel and Stefano)
  • IKVM.NET, a runtime and set of libraries that convert Java bytecode to .NET MSIL
  • Jython, a version of the python language that compiles to the JVM
Of course the same thing happens in the .NET land -- there are a multitude of languages that compile to MSIL, and MSIL can be run on the Microsoft .NET CLR, Mono's runtime engine and a few other runtimes built by Microsoft and third parties.

The angle taken by Google in developing an alternative virtual machine, rather than using the CLR or Sun's JVM is very interesting. On one hand, they have the benefit of full control of their platform, and this move means that they are not reliant on other vendors solutions. They promise to open source the platform, so the typical arguments about closed proprietary platforms may not apply, but it will still be interesting to see how another VM fits into the ecosystem.

posted on Wednesday, November 14, 2007 10:14:33 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Thursday, November 08, 2007
I think it was Derek that first convinced me of the beauty of the Guid, and I have been using them in databases ever since.

Wade Wright has written up the "Gospel of the Guid". It has a humorous coverage of some of the good Guid reasons:

  • No database roundtrips to get the next integer ID
  • Easy merging, mirroring and deletion of erroneous merges
  • Ability to wire up relationships in memory before saving
I remember when I first started using Guids there was talk of them not being unique, due to dodgy network cards having the same MAC address. Thankfully that's no longer a problem.

Something that I struggle with though, is the lack of type safety when using Guids. e.g.

Guid personId = Guid.NewGuid();
Guid bookId = Guid.NewGuid();

Library.BorrowBook(personId, bookId);

...or is it this way around?

Library.BorrowBook(bookId, personId);

There's no compiler checking that the correct Guid is passed to the right parameter. I've been toying with a Guid wrapper that would be a bit like a typedef in C++, but typesafe. Has anyone already done this?
posted on Thursday, November 08, 2007 9:10:30 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [3]
I seem to spend less time in Virtual PC and more time in (nested) remote desktop sessions these days. I'm not a huge mouse fan, and when using the keyboard I need to do this when I'm in a windowed remote-desktop session:
  • ALT+PgDn / ALT+PgUp - cycle through programs (ala ALT-TAB)
  • ALT+Home - display start menu (ala CTRL-ESC)
My fingers still do the regular ALT-TAB / CTRL-ESC the first time round, but after a while I remember to use the alternate shortcuts.

Thanks to Mark Wagner.

posted on Thursday, November 08, 2007 8:36:14 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Wednesday, November 07, 2007
Adam from Xero and I went to look at the Eee PC at Dick Smith's today. Quite a cute little PC that has no spinning hard drive, no fans and only weighs 900 grams.

Looks like a nice little email / web PC, but the screen is a little tiny for my liking. The install of Linux is quite smooth, and Firefox is integrated nicely onto the desktop.

Quite good for $600NZ though!

Kirk

posted on Wednesday, November 07, 2007 9:13:35 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [4]
I've been looking forward to the CTP of PowerShell 2 for a while, and it's finally here.

I'm looking forward to installing it on a VM tonight (don't install it on your production / main desktop system just yet).

The stand-out features from the two blog posts (The Community Technology Preview (CTP) of Windows PowerShell 2.0, What's New in CTP of PowerShell 2.0) are:

PowerShell Remoting

"Windows PowerShell 2.0 provides support for executing Cmdlets and Scripts remotely. PowerShell Remoting allows managing a collection of remote machines from a single client. Managing remote computers using PowerShell 2.0, requires that PowerShell 2.0 be installed on all the computers taking part in the operation; that is the client computer and the computer(s) being managed."

This solves a problem that a lot of sysadmins have - being able to nicely administer many machines in their farm / network using PowerShell.

Background Jobs

"Windows PowerShell 2.0 introduces the concept of a background job (PsJob).  A PsJob runs a command or expression asynchronously and "in the background" without interacting with the console. The command prompt returns immediately and you can query for the job results at your convenience.  You can run background jobs on a local or remote computer."

Hurrah! I was surprised how much I missed this unix feature, so it's good to see background jobs make an appearance. I'll be interested to see if they have changed the threading model within PowerShell.

Graphical PowerShell

"This release includes a very early alpha version of the new graphical shell..."

Definitely something that people want, although others have filled the void quite well up until now. Looking forward to playing with this.

Well done PowerShell team!

Kirk

posted on Wednesday, November 07, 2007 9:27:23 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]
 Thursday, September 27, 2007
No, not PowerShell.
I have been having fun measuring how much electricity our house uses, and which appliances are the worst offenders (Oil column heaters = bad, heat pump = good).
The tool I have been using is a Centameter, which is a clever little gadget that you clip onto your mains feed into your house (www.centameter.co.nz). You can also get one for a single power point from Jaycar.
A good idea if you want to reduce the impact your consumption has on the world (and your wallet!)

Kirk

posted on Thursday, September 27, 2007 9:16:32 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [2]
 Friday, September 21, 2007
James Newkirk and Brad Wilson have cooked up a new testing framework for .NET development: xUnit.net.

In his blog post announcing xUnit.net, James outlined the reasons why they have created a new framework -- primarily to bake best practice techniques into the test framework, and leverage some of the newer .NET features.

The Comparison between Nunit, MSTest and xUnit.net page on the site lists some of the differences between xUnit.net and Nunit / MSTest. Removing setup and teardown, and providing aspect-like functionality are both interesting angles which I want to spend some time with.

Here's a couple of examples from the samples download. First, an example of usage of BeforeAfterTestAttributes, which let you add behaviour before and after the execution of a test (ala AOP):

[Test, TracingSplicer]
public void TestThis()
{
}

...

public class TracingSplicerAttribute : BeforeAfterTestAttribute
{
    public override void Before(MethodInfo methodUnderTest)
    {
        Console.WriteLine("Before : {0}.{1}",
            methodUnderTest.DeclaringType.FullName, methodUnderTest.Name);
    }

    public override void After(MethodInfo methodUnderTest)
    {
        Console.WriteLine("After : {0}.{1}",
            methodUnderTest.DeclaringType.FullName, methodUnderTest.Name);
    }
}


Here's an example of test method extensibility:

[RepeatTest(5, Timeout=500)]
public void RepeatingTestMethod()

You can create your own attributes that inherit from the TestAttribute base class, and define what will happen when the test runs (in this example, the test will run 5 times).


Good work guys, looks useful!

Kirk
posted on Friday, September 21, 2007 10:03:26 PM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]