Fully internal Shuttle SX48P2 Watercooling

September 7, 2009

I recently took “the plunge” and decided to watercool my PC. It is a project I have wanted to do for a long time – but the mixture of water and electronics has always put me off…
In reality it didn’t really take quite as long as I expected. It is definitely essential to leak-test before installation – my loop started leaking in rather short order the first time I switched the pump on!

Since my computer is a Shuttle (SX48P2, to be precise) it was rather a tight squeeze to get everything in there – yep, it’s a fully internal system :)
I had to cut a very large amount of metal out of the inside of the computer case so that everything would fit. My temperatures are around 20 degrees lower now under load – and the computer is far quieter – so I’m very pleased with the end result.

I took many photographs of the process and I will be posting a more detailed account of the experience soon.

0

DDD South West Video Showcase

July 7, 2009

DDD South West was held on 23rd May 2009 at Queen’s College in Taunton. I was part of the DDDSW team – my role being to create a promotional video to showcase the event. As such, all of my hard work began during the event – filming – then continued for a long time afterwards. After many weekends of video editing, the video was officially released at DotNetDevNet this evening!


N.B. To watch this video in a larger size, or to add comments/rate the video, the direct youtube link is here

1

Is this a .NET Framework error validating XDocument against an XML schema?

June 19, 2009

I spent a large portion of my time yesterday wrestling with validation errors for an XML document – a document which I was positive should be validating correctly. After a lot of fumbling around with options, various incantations of xsi, and checking & rechecking the schema, it occurred to suspect something could be up with the .NET Framework.

Sure enough, I discovered that Visual Studio’s built in XML document schema validation detected no errors in the document I was trying to validate. Furthermore, I discovered that if I wrote out the XDocument to a string first, and then validated that instead of the XDocument directly, there were no validation errors…

I went to work sandboxing the problem and I have now reproduced it in a very simple way. The root of the problem is the validation failing to resolve abstract types from the schema datatypes.

XDocument:
XNamespace rootNs = "testNamespace";
XNamespace xsi = "http://www.w3.org/2001/XMLSchema-instance";
XDocument document = new XDocument(
    new XElement(rootNs + "root",
    new XAttribute(XNamespace.Xmlns + "xsi", xsi.NamespaceName),
    new XElement(rootNs + "test",
        new XAttribute("value""true"),
        new XAttribute(xsi + "type""BOOLEAN"))
    )
);

Validation:
XmlSchemaSet set = new XmlSchemaSet();
set.Add(XmlSchema.Read(File.OpenRead("schema.xsd"), null));
document.Validate(set, (s, e) => validationErrors.Add(e));

Schema:
<xs:include schemaLocation="datatypes.xsd"/>
<
xs:element name="root" type="rootType"/>
<
xs:complexType name="rootType">
  <
xs:sequence>
    <
xs:element name="test" type="ABSTRACT"/>
  </
xs:sequence>
</
xs:complexType>

Datatypes:
<xsd:complexType name="ABSTRACT" abstract="true" />
<
xsd:complexType name="BOOLEAN">
  <
xsd:complexContent>
    <
xsd:extension base="ABSTRACT">
      <
xsd:attribute name="value" type="xsd:boolean" use="required"/>
    </
xsd:extension>
  </
xsd:complexContent>
</
xsd:complexType>

Error:
This is an invalid xsi:type 'BOOLEAN'.

Here is a small Visual Studio 2008 solution which illustrates the problem. You just need to run the solution and it will perform two types of validation on the same document with the same schema – one should succeed and the other should fail. Along with the complete files from which the snippets above are taken, also included in the solution is a sample valid XML file (which should be validated by VS’s inbuilt schema validation).

1

Xml Schema as an Embedded Resource

June 17, 2009

Today I ran into an interesting problem trying to validate an XDocument against an XmlSchemaSet.  The complication arose from the fact that the master schema referenced (<import>ed) multiple additional schemas.

Initially I tried copying all the schema files to the output directory, then loading the master schema using XmlReader.Read().  The master schema references other schema files to import  in the format “schema1.xsd“.  By default the XmlReader will automatically try to load all of these referenced schema files when you load the master schema.  However, it will do so by searching for the import path relatively to the path of the currently executing assembly. I.e. not the location which the master schema was read from.  As an aside, this is also a pain to manage cross-project (i.e. a test project testing the implementation project’s validation code — where both projects having different executing assembly paths).

I decided to switch to embedded resources to solve the problem.  The XmlReader.Read() still tried to load the referened schemas by file rather than from embedded resources (dare I say “of course”?).  Fixing this required creating a custom XmlResolver class which overrode the GetEntity method, redirecting requests for schema files to the current manifest.

Now I have a nice neat self-validating implementation assembly with no dependencies on external files/file structure.

0

Website back up & backups

June 11, 2009

My website has been down for a few days because my server provider was hacked and around 50% of their servers were wiped clean.  Unfortunately mine was in the half that got wiped.  Also unfortunately, my backups were somewhat dated, and I lost a fair bit of stuff.  This includes my SVN repository and Trac instance, so I am going to lose a fair bit of history for a few of my projects.  The code itself is checked out in a few places so all is not lost.

My server also hosted the Bristol Computer Gaming Society website.  Ironically, when our server went down, the Students’ Union had just opened voting for “Best Society Website” – an award we were nominated for and hoping to win.  We did not win.  I spent a lot of time doing CSS tweaks and making graphics to prettify the website for the competition and all of that work was lost :(

I still have some data restoration to do, now that the basics are back online.  Suffice to say I shall probably be a little more rigourous with my backups from now on…

1