Monthly Archives: June 2008

Strategy Pattern

Over the next couple of months I hope to cover some of the common software design patterns. I’m going to cover them in the order they are written about in the book Head First Design Patterns.

Motivation

The desire to model varying implementations of the same core behaviour and to decouple this behaviour from the consuming client.

Solution

The Strategy pattern defines a family of behaviours or algorithms. Each type of algorithm is encapsulated in a separate entity. The client can consume different types of algorithm interchangeably.

Strategy

Resources

Advertisements
Tagged

Is Windows Live Writer failing to display your blog theme correctly?

Yesterday I changed my WordPress blog theme to use the K2 design. Diligently I asked windows live writer to ‘please go get this new style’ and ended up with some rather pleasant but unasked for Times New Roman in the edit pane.

WatiN supports Firefox! - Windows Live Writer

The preview pane also didn’t look anything like my blog, obviously the style sheet reference was missing. Graphics and content appeared, just no styling.

WatiN supports Firefox! - Windows Live Writer (2)

I fired up ol-procmon to find out where an earth wlw was downloading the templates too.

\Users\[user name]\AppData\Roaming
\Windows Live Writer\blogtemplates

\Guid (Each blog ?) *1
\Guid 1 (For edit) \Guid 2 (For preview)

This is on Vista and Windows Server 2008, I imagine it’s different on other OS’s.

*1In this folder you will find 2 index[*].htm files which represent your edit and preview panes. Once I found these html files it turns out wlw had download the k2 css file ‘core.css.php’ as ‘core.css.css’. Renaming fixed my problem, yay!

Tagged , , ,

WatiN supports Firefox!

Back in March I finished developing a release of the WatiN framework that enabled testing in Firefox in addition Internet Explorer (already supported). This was the first time I’ve been involved in collaborative open source development. I worked with Jeroen van Menen, the creator of the WatiN project using Basecamp for project management and sourceforge svn for source control. It was also my first time using Basecamp which worked out pretty well for us. It’s simplicity is what I like. You basically just manage a bunch of grouped lists:

WindowClipping (11)

WindowClipping (12)

Anyhow… It’s now pretty straight forward to make a unit test execute under both IE and firefox

[Test] public void SearchForWatiNOnGoogleVerbose() { using (IBrowser ie = BrowserFactory.Create(BrowserType.InternetExplorer)) { ie.GoTo("http://www.google.com"); ie.TextField(Find.ByName("q")).Value = "WatiN"; ie.Button(Find.ByName("btnG")).Click(); Assert.IsTrue(ie.ContainsText("WatiN")); } using (IBrowser firefox = BrowserFactory.Create(BrowserType.FireFox)) { firefox.GoTo("http://www.google.com"); firefox.TextField(Find.ByName("q")).Value = "WatiN"; firefox.Button(Find.ByName("btnG")).Click(); Assert.IsTrue(firefox.ContainsText("WatiN")); } }

It’s also quite trivial to collapse these two using constructs into a single chunk of code for better maintainability etc..

Check out the WatiN Firefox Community Technology Preview for more information.

Tagged , ,