Wednesday, 29 October 2008

Help - the Storm Troopers have got me

Help - the Storm Troopers have got me
Originally uploaded by visited
Visited the Alien Invasion at the Spinnaker Tower recently. The best bit was the Storm Troopers from the UK Garrison. Scarily realistic!

Basil and teddy

Basil and teddy
Originally uploaded by lyndsayp
Five years of nagging, and we finally do it!

Yes, we've got a dog (the one on the right). The kids agreed to give up Christmas presents in exchange for having a dog. He's a Border Collie and is ten weeks old in this picture. Named Basil, after Basil the Brush (the one on the left).

House training is going well so far!

Tuesday, 14 October 2008

Serialising, streams and strings

A common operation is to serialise and object to a string. I'm still finding better and better ways of doing this. My current favourite makes use of .Net 3.0's DataContract. It uses a UTF8Encoding and a MemoryStream as this ensures that the output XML is UTF8.


using (MemoryStream stream = new MemoryStream())
DataContractSerializer serializer = new DataContractSerializer(typeof(SomeClass));
serializer.WriteObject(stream, instanceOfSomeClass);

// Serialisation defaults to UTF8Encoding when used with a stream.
// See Simple Serialization at
string data = Encoding.UTF8.GetString(stream.ToArray());

// Do something useful with the data.

Filtering log4net messages

I can never remember how to do this: filter out logging message based on where they come from.

The solution is to use a LoggerMatchFilter. The code below can be inserted into any appender definition:

<filter type="log4net.Filter.LoggerMatchFilter">
<loggertomatch value="NHibernate.Loader.Loader"/>
<acceptonmatch value="false"/>

Tuesday, 7 October 2008

Love is ... unconditional (really, truely)

I've been a blown away by the book Velvet Elvis. It challenges many assumptions we make about faith, and strips it back to its bare essentials.

A quote from the book that particularly struck me was this:

"If the gospel isn't good news for everybody, then it isn't good news for anybody.

And this is because the most powerful things happen when the church surrenders its desire to convert people and convince them to join. It is when the church gives itself away in radical acts of service and compassion, expecting nothing in return, that the way of Jesus is most vividly put on display. ... We have to surrender our agendas. ... I have learned that when I toss out my agenda and simply love as Jesus teaches me to, I often end up learning more about God than I could have imagined."

Mind blowing stuff. The exciting part is living it.