The Haunted House

Sunday, July 29, 2007

4 Tenets or Service Oriented Architectures

I was chatting to an ex colleague the other day, and he was saying that at work he was about to start working on a set of web services for one of their web projects. The conversation carried on down the web services design route for a bit. One comment that made me wince a little was, “they are just like online dynamic link libraries”. Well they could be seen as online dll’s I guess, but to produce a proper service oriented architecture you need to follow a few firm rules / principles. It isn’t the first time I have heard of web services described in this way, so I thought I would add a post briefly explaining the 4 tenets of services oriented architectures.

Service boundaries are explicit

Any service is always confined behind boundaries such as technology and location. The service should not make the nature of these boundaries known to its clients by exposing contracts and data types that betray its technology or location. Adhering to this will make aspects such as technology and location irrelevant. Another way of thinking about this is that the more the client knows about the implementation of the service, the more the client is coupled to the service.

Services are autonomous

A service should not need anything from its clients or other services. A service should be operated and versioned separately from other services. This will enable the service to evolve separately from the client.

Services share operational contracts and data schema, not type and technology specific meta data

Any data the service decides to expose over the service boundary should be technology neutral. The service must convert any technology specific data to some neutral representation. A service must also not expose any local implementation details such as instance management or concurrency. A service only exposes logical operations.

Services are compatible based on policy

A service should publish a policy indicating what it can do and how clients can interact with it. Any access constraints expressed in the policy should be separate from the service implementation details. Not all clients can interact with all services. It is perfectly valid to have an incompatibility that prevents a particular client from consuming the service. The published policy should be the only way a client can decide if it can interact with the service.

These are the main published rules around web services. There are also some other principles that are good practice to follow: First, services should be secure. Even if this only means securing the transport (ie SSL). The client should also have a way to authenticate with the service.

Services must leave the system in a consistent state. If an operation fails part way though, the service should be able to leave itself in a consistent state. This could be via transactions or any other method of maintaining consistency.

Services should be thread safe and designed so that it can sustain concurrent access from multiple clients. Services should also be reliable (yeah seriously). When a client calls a service, it will always know in a deterministic manner if the message was received. Messages should also be processed in the order that they were sent. As well as being reliable, the service should also be robust enough to isolate its faults, preventing them from taking down itself or other services. Well I hope that clears that up :-)


Carsington and Brassington Walk

At last the weather has started to pick up. We decided to take a drive out to Carsington waters near Ashbourne and do a walk that takes you down through Brassington.

Amanda first went to the supermarket to get stuff to make lunch with. When she got back I was shocked at the size of the bread rolls. They were tiny, you could only fit 1 slice of tomato in each roll. I think she is trying to starve me :-)

Once the lunches were packed, we set off to Carsington. We got there about 12pm and got ready. This walk isn't too long, the book said it was around 5.5miles. The walk started off next to the resevoir and headed down to Brassington.

Above is the obligatory photo of Amanda checking the map. Although the map reading went a bit wrong at one point and we went about half a mile in the wrong direction, oops. Oh well it's all good exercise.

This walk was quite scenic, and the sky was mostly blue with the odd cloud here and there. As we got to higher ground it was a lot windier, but still warm.

I think the farmers are making the styles in the walls a lot thinner these days, as you can see above. Either that or I have put on a few pounds (most likely).

We got to Brassington after about an hour. I quite fancied nipping into the pub for a pint, but Amanda pointed out that these walks are supposed to be getting us healthier. Oh well :-)

On the way down into Brassington we saw loads of cows all lined up across the edge of the field. It looked quite strange.

The whole walk took around 4 hours. We were both quite tired by the end of it. Especially as it was very warm. By the time we got back we were both hungry so have made dinner. It was good to get out in the country today before a week behind my desk at work.

It'll be good to get loads more walks in over the next month as we are thinking of going to the Lake District for a couple of days at the end of September for my birthday and our wedding aniversary.


Monday, July 23, 2007

Life Begins September 2007

ZiBiR's debut album (Life Begins) is almost upon us. This is the follow up to the Electrodes EP. I have had the masters delivered to Me. Mr Huckle has completed his photoshop wizardry on the CD case artwork. All that is left is for me to do the businessy and legal bit then it will be out.

The track listing will be as follows:

01 - Seeds
02 - Expectations
03 - Post Process
04 - Life Begins
05 - Jitter
06 - Electrodes
07 - Entice
08 - Princess
09 - Sound Off
10 - Space It Out
11 - Scoop
12 - Deliver Us
13 - The Chamber
14 - Aftershock

We will soon have some snippets from the tracks available at the Haunted House Records website. If you liked Electrodes, you will love this release. I can only describe it as Wizz Bang Electro Pop.


Sunday, July 22, 2007

C# RSS Feed Generator Library

You can download the MSI installation package from here.

A while ago I wrote a library in C# for creating and saving RSS xml feed files. I recently dusted off this code and gave it a tidyup.

RSS (which stands for "Really Simple Syndication") is a family of web feed formats used to publish frequently updated content such as blog entries, news headlines or podcasts. An RSS document, which is called a "feed", "web feed", or "channel", contains either a summary of content from an associated web site or the full text. RSS makes it possible for people to keep up with their favorite web sites in an automated manner that's easier than checking them manually.

RSS content can be read using software called a "feed reader (such as Outlook 2007)" or an "aggregator." The user subscribes to a feed by entering the feed's link into the reader or by clicking an RSS icon in a browser that initiates the subscription process. The reader checks the user's subscribed feeds regularly for new content, downloading any updates that it finds.

I will not go into the full RSS spec in this post, but you can read about it at this following address :

The library is very easy to use. The following code shows its use in the most basic form creating an RSS channel and item containing just the mandatory fields.

RssLib rss = new RssLib();
rss.Channel = new Channel("Steves News", "", "Steve news and related bits and

rss.AddItem(new Item("Cat Saved", "A black cat was today saved from a tree."));

The library handles conversion from the .NET DateTime object in to the RFC882 date specification required by the RSS feed specification. The library also handles converting langauge codes into the RFC1766 language specification.

I have included an nUnit test suite with the library containing over 100 unit tests, so if you want to refactor any of the code you can do so with confidence using the unit tests.

The code is written in C# under the .NET2 platform. You will need Visual Studio 2005 to open up the solution file. To run the unit tests you will need nUnit.

You can download the MSI installation package from here.


Sunday, July 15, 2007

Recoil - SubHuman

If you're going to buy just 1 album this year, make sure it's Recoil's SubHuman. I have been waiting for this album to be released for quite a while and now that it has, I have to say the wait has definately been worth it. It's a synth laden blues fest done in the way Alan Wilder knows best. Alan (former Depeche Mode) has had a break from recording for a number of years, so this marks his first release back in the fold.

There are 2 versions of this album. The first being 7 tracks, and the second version containing the original 7 tracks plus ambient remixes of all the tracks, and they are all very very good.


Belper Food Festival

Today in town was the Belper Food Festival. Essentially this was a market with local food producers selling their products. There were some interesting stalls. We ended up spending a fair bit of money here. We got some chilli jam, different cheeses and a load of cakes.

Unfortunately the weather was pretty horrible. It was raining all morning. But this didn't put people off as by 10.30 it was quite busy. The event was smaller than I was expecting. I think there were less stands there than the normal market that is held once a month.

Hope the weather picks up though as we want to go for another walk today. Although we'll still probably go even if it is still raining.


Saturday, July 14, 2007

Walk Around Mackworth and Markeaton

After a night out at the beer festival we decided to be good and get some exercise. Amanda picked a walk out of our trusty AA book. We decided on a walk starting at Markeaton Park in Derby and walking around too Mackworth, through farmers fields.

We left around 1.30 in the afternoon as Amanda wanted to catcht the repeat of Big Brother on Channel 4. We got all our walking gear together loaded the car and went to the supermarket to get some sandwiches to take with us.

We got to the car park around 2.15 and got going. The walk was fairly flat and lasted for 6 miles. Most of the walk was through farmers fields. On public foot paths, naturally.

This is the first walk we have done since before we went to Portugal. The weather has been pretty crap in the UK since we got back, so made it too risky to go walking. Well, we could have, but being stuck out in the rain is not much fun, even if you do have waterproofs.

The weather today has been very warm, both of us have caught the sun and look a little red. Not complaining though, it will probably be raining next week.

The whole walk took around 4 hours and we were both pretty tired afterwards. When we got back to the car we went to the supermarket to get stuff for dinner. Tomorrow there is a food festival in Belper, so we will go to that and hopefully get to try lots of nice foods.

We might even go for another walk in the afternoon if it is sunny. Ok thats enough writing from me as I'm knackered. Hopefully we'll get some nice photo's tomorrow :-).

Labels: ,

Derby Summer Beer Festival

Tonight we (Me, Amanda, Elaine, Andy, Neil and Caroline) went to the CAMRA Summer Beer Festival. We all met at 7pm at pizza express for dinner. I always like our trips to pizza express. It's like pizza hut, but posh :-) We finished our pizza about 8 and then headed for the festival.

When we got there the queue was huge and wrapped around the side and back of the Derby Assembly Rooms. This was because they had an offer where if you are aged between 18-30 you got in free. But, the venue was only allowed to admit 1800 people. So by 8pm they were operating a one out, one in policy, which was shit. We had to queue for over an hour. Oh well. Once we got in we found out they had closed the cloak room also, so we couldn't put in our coats. Not going well so far.

It was quite busy inside, so there was a fair bit of queueing to get some beers but the ones I tried were quite good. The best beer of the night for me was called 'Blonde'. Amanda was on the Cider, but she only got to try 1 kind but she didn't think it was that good.

All in all this is probably the worst of the beer festivals I have been too over the past 3 years, which is a shame. The organization of the event was pretty shocking. I wonder if they have diferent people organizing it this year.

The band playing were called 'Shameless Quo' who were a Status Quo tribute band. They sounded pretty good, your typical sort of covers band. We didn't see the other band playing in the other room. I hope the show at Christmas is a lot better.


Saturday, July 07, 2007

Cherries Galore

The cherry tree in our garden has gone mental this year. We got a good crop last year, but this year there are litterally thousands of the things. We need to harvest them before the birds get to them all.

I took cherries just off 1 branch and filled up one large tupper-ware tub. I think Amanda is quite happy as I said I would make a cherry pie.

Anyway, I'm not going to waffle on I just wanted to brag about our cherry crop ;-)


Sunday, July 01, 2007

Excellent Review In Virus Mag

Just found a new review for my debut album Mechanical in an electronic music magazine called Virus Mag. The cd scored 8 out of 10, which is a fantastic score to get. I have included the review text below:

"Creature is an electronic music project of Stephen Haunts, who also happens to run Haunted House Records.

Using circuit bending as a compositional technique, this CD is armed with an impressive array of sampled sounds, simple but strong melodies, and creative programming, therefore making "Mechanical" an unexpected listening pleasure.

The circuit bending technique is when one takes old electronic gadgets and toys and rewires them to create new and interesting sounds. These sounds are then recorded and sampled and are used to create beats and melodic structure.

In my opinion, what was even more impressive than the circuit bending technique were the abundance of consistently catchy melodies, which act like viscous fluid for the seamless stream of sampled sounds and beats. "Mechanical" is one of those CDs where nothing is overstated and everything works well together.

I would have rated this CD higher, but there were some abrupt track changes that seemed more like technical issues than intention, and were more noticeable while listening with headphones. Otherwise this was a very balanced and encouraging release, and a sure sign that the musical future is looking bright for Mr. Haunts and his label.

Michael Casano, 01 Jul 2007"


Fun With Cryptography

Last year I watched the Thomas Harris film adaptation of his World War 2 novel, Enigma. The film was about Alan Turin's work in cracking the German Enigma cipher system. This got me thinking about different type of text encryption techniques. So one weekend when my wife was away on business, and I had nothing else to be getting on with, I started writing some simple text encoding routines.

The first routing in the sample code is a monophonic substitution cipher. This simply substitutes a different letter for each letter of the alphabet.

MonoSubstitute mono = new MonoSubstitute(KeyType.USER_KEY, true);
mono.PlainText = ”Text to encrypt”;
mono.Key = "This is my key";

Next up we have homophonic encoding. This assigns 2 values per letter of the alphabet. This helps even out the spread of characters to make the encoding more secure against attacks. Each letter of the alphabet is assigned 2 numbers.

HomophonicCoding homo = new HomophonicCoding(KeyType.USER_KEY);
homo.Key = "This is my key";
homo.SubKey = "This is my sub key";
homo.PlainText = ”Text to encrypt”;

When a monophonic cipher is used, the frequency histogram of the cryptogram is made flatter by increasing the size of the alphabet. This ensures that more than one ciphertext character may represent the same plaintext character. However there is always the danger of an attacker compiling a dictionary of known plaintext and ciphertext pairs for a given key.

Another way of achieving the objective of flattening the frequency histogram is by the use of a polyalphabetic cipher. When a polyalphabetic cipher is used, the ciphertext character replacing a particular plaintext letter may vary through the cryptogram and might, for instance, depend on its position in the plaintext message or the content of the plaintext that precedes it.

The final algorithm shown in the sample is the Vigenere cipher, invented by Blaise de Vigenere, a 16th century French diplomat. The Vigenere uses a vigenere square to perform encryption. The left hand (key) column of this square contains the English alphabet, and for each letter, the row determined by that letter contains a rotation of the alphabet with that letter as the leading character. So that each letter in the left hand column gives a Caesar cipher whose shift is determined by that better.

VigenereCipher vig = new VigenereCipher();
vig.Key = "This is my key";
vig.PlainText = ”Text to encrypt”;

Also included within the sample source code is a combined cipher that uses a combination of all 3 encryption type. I’ll leave it as an exercise for the reader to see how this all works.

CombinedCipher com = new CombinedCipher();
com.Key = "This is my key";
com.PlainText = ”Text to encrypt”;
com.SubKey = "This is my sub key";

I’m sure I don’t need to say this, but I will mention it anyway. These are very old types of text encryption that by todays standards are not secure, so please don’t use them for encrypting anything important. The code was only written for fun.

The source code is written in C# and the solution file was created with Visual Studio 2005. There are some unit tests in CryptTests.cs. These can be run using the NUnit test runner or the Resharper test runner.


Vista File Dialogs

Recently I upgraded my laptop to run the new Windows Vista Ultimate Edition so that I would play around with some of the new technologies for work. I thought it would be fun to play around with the new Windows Presentation Foundation.

As I was creating a small application I wanted to bring up an open file dialog box. But guess what, Microsoft has moved this to a different namespace. The normal file dialog box can be found in the Microsoft.Win32 namespace. Ok, this isn't to bad, I can live with that. I fired up the open file dialog box with the following code:

OpenFileDialog openFile = new OpenFileDialog();
openFile.Title = "Open a lotter file.";

Up popped the dialog box as shown below. The only problem is, I am using Vista, so I want to use the new latest greatest snazzy graphical dialog box, not the old XP clunky grey dialog.

By default the Vista common dialogs are not included with .NET3, but you can use them. First you must download the Microsoft Windows SDK for Vista. Once you have done this browse in explorer too :

C:\Program Files\Microsoft SDKs\Windows\v6.0\Samples

Load up the Vista Bridge solution file and build it. Then copy the assemblies to your solution and include them as references.

The common dialog boxes are in the following namespace:

using Microsoft.SDK.Samples.VistaBridge.Library;

You can access the file dialog boxes like follows:

CommonOpenFileDialog openDialog = new CommonOpenFileDialog();
openDialog.Title = "Open a lotter file.";
openDialog.Multiselect = true;
CommonFileDialogResult result = openDialog.ShowDialog();

CommonSaveFileDialog saveDialog = new CommonSaveFileDialog();
saveDialog.Title = "Open a lotter file.";
CommonFileDialogResult result = saveDialog.ShowDialog();

There are lots of other common vista dialog boxes in this library but I havn't had a chance to try them out yet.

Pipeline Execution Pattern

Click here to view larger UML diagram.

This is the first version of a library for implementing a pipeline execution pattern. I originally wrote this library a couple of years ago and recently found it on one of my backup discs. So I dusted it off, tidied it up, and decided to release it as a code example.

This is only the first version and is by no means perfect; I have lots of ideas that can be added to this pattern to improve it.
The code is written in C# and the solution file is for Visual Studio 2005. If you want to run the unit tests you will need either NUnit, or the Resharper test runner.


A pipeline consists of a series of nodes that are registered with the system. Once the nodes are registered, you can assemble the nodes in any order to form a pipeline. Once the nodes are assembled into a pipeline, you call execute() and the nodes will be executed in order.

You might be wondering what the point of this is, but a pipeline allows you to break a complex computational task down into smaller discreet steps. Before you run the pipeline you can set some initial xml data to the pipeline that is passed in between the nodes as they execute. This essentially allows each of the nodes to talk to each other.

Pipeline Configuration

Via Code

A pipeline can be configured in 2 ways, through code, or via an xml config file. First we will discuss setting up a pipeline via code. To create a node you need to derive from the common Node base class.

internal class TestNode : Node
public TestNode(Pipeline pipeline)
: base(pipeline)

public override bool Verify(XmlDocument doc)
return true;

public override bool Execute(XmlDocument doc)
return true;

When you derive from the base class you much override 2 virtual functions, Verify, and Execute. When a pipeline executes, Verify will get executed first for a node. This give you a chance to do validation and integrity checks on the node, this might be examining the data passed into the node. If Verify fails you return false and the pipeline stops executing. If Verify returns true, the pipeline then calls Execute on the node. This is where you perform the actual node task.

To use your nodes with the pipeline you must first register the nodes. You do this as follows:

Pipeline pipeline = new Pipeline();
pipeline.RegisterNode("node1", new node1(pipeline));
pipeline.RegisterNode("node2", new node2(pipeline));
pipeline.RegisterNode("node3", new node3(pipeline));

You first construct an instance of the pipeline class, and then you create instances off you node. You must pass the pipeline instance into the node constructor. This gives the node access to the error reporting method of that pipeline instance.

Once a node has been constructed you must call RegisterNode on the instance of the pipeline. This makes that node available to the pipeline.

Now that you have registered your nodes, they are now available to be added into a pipeline. This is done a follows.


You will notice that node1 has been added twice. This is perfectly fine. A node can only be registered once, but it can be added to the pipeline as many times as neccessary.
To execute the pipeline you call:


Via XML Config file

You can also add nodes to a pipeline via a config file. At the moment you still need to register the nodes in code, but the config file will add the nodes to the pipeline. A future enhancement to this code will be for node registration via the config file. You load a config file as follows:


Look at the example.xml file included in the MSI package.

As you can see, inside the pipeline element we have a Nodes section. Within here individual Node tags specify the running order of the pipeline.

You will also notice we have parameters setup in the first node. This allows you to configure parameters that are available to the node. These parameters are stored in the NodeParams part of a node. To extract the parameters inside a node you do the following:

String tolerence = Params.Find("tolerence")

Passing Data through the pipeline.

When you create the pipeline you can add data that will get pass through the pipeline when it is executed. This data is available to each node to change as necessary. This data is passed into both the Verify method and Execute method as a standard .NET XmlDocument object. See the .NET documentation on how to extract and add data to an XmlDocument. Data is added to the pipeline as follows:


Object Cache

As well as passing an xml document to each node, a pipeline provides a central object cache where a node can store data to be retrieved by each node. This is useful if you want to store temporary data that should not be stored as part of the xml document. This also aids performance because serializing temp objects to xml can get slow if done a lot. A node can cache data like the following:

CacheObject("myobject", myObject);

Reporting Errors and Warnings

As each node executes you store a list of error and warning messages. When the pipeline finishes executing, either successfully or unsuccessfully, your program can present the list of errors and warnings to the user. For a node to add errors and warnings you do the following:

AddWarning(“Warning, something is not right.”);
AddError(“Error, something has gone wrong.”);


I hope you find this pattern and code useful. As I mentioned earlier I originally wrote this a few years ago so have only recently dug it out and updated it. I have more ideas I want to incorporate like:

- Node registration via config file.
- Nodes as separate plugin DLL’s which are automatically loaded by the pipeline manager.
- Node branching.

I recommend you load up the code and dive in, it’s not that complicated to find your way around. In the solution there is a test project that contains a load of NUnit unit tests. So if you want to fiddle with the code you will easily be able to tell if you have broken anything. The unit tests also make for good examples in how things are working. Have fun.

Download MSI Installer for Source Code



Now that Google has added categories to this blog site I can now properly segregate all my posts into different sections. To the right of this post you will see a categories section. You can use this to go to categories that are of most interest to you. So for example, family and friends will most probably be interested in the out and about site. Fellow musicians will most probably only be interested in the Circuit bending and music section.

Labels: , , , ,