Skip to main content

Posts

Showing posts from 2010

Colin McRae Dirt 2 – Choppy sound and crashes in multiplayer

I like my driving games; always have done since the original Mario Kart on the SNES way back when.So the other day I bought Dirt 2 on Steam as I needed some driving action (my previous driving squeeze was Grid – and I can highly recommend that too).  Very cool, especially with XBox 360 wireless controllers.After clocking up 20 hours or so on the solo missions I decided to give the online game a go.  Whilst in the trailer I navigated to the Multiplayer ‘board’ and hit ‘online’.The instant I hit the button on the pad, the sound started to crackle & stutter; then I lost everything except the menu sound effects (only later for them to return for about 10 seconds). I’ve had this before (during the videos on Streetfighter 4, for example) and I just thought ‘well if the game still plays, I’ll put up with it for now’.Only it didn’t play – not exactly anyway.  The first race went okay (apart from getting battered by the opposition!), and then I went back to the menu ready for the next race…

Map System.TimeSpan to xs:duration for the DataContractSerializer

I’m working on a new RESTful service (I’m using Asp.Net MVC for this) and I’m keen to make it as easy to integrate with as across as many client platforms as possible.I’m going to be using XML exclusively, as I it enables me to produce schemas that our service clients will be able to download and then see the shape of each object that the service operations will expect.I also want to employ XML schema validation on the data coming in from the request.  Doing this will trap most data errors it gets further down the request pipeline, thus protecting my code; but will also ensure that the caller gets nice verbose error messages – XML Schema Validation is pretty explicit on what’s gone wrong!Thus, I’ve wired up an MVC action to produce a schema for the relevant objects using the XsdDataContractExporter class.  I will simply point users at this, alongside documentation for each of the operations; which will include schema type names from that ‘live’ schema.While testing out one of the type…

MVC Bug: The virtual path '[path]' maps to another application, which is not allowed

I’ve being doing a lot of work on Asp.Net MVC (now v2) over the past few months and, firstly, I have to say that it totally rocks.I will not go into any real detail about MVC here – this post is about the method System.Web.Mvc.HtmlHelper.AntiForgerytoken and that it highlights a bug in an internal class TokenPersister that you’re potentially going to get if you ever use spaces in your virtual directory names.  Ironically, the class in question is marked with a comment that says it’s difficult to unit test because of the way it fakes Asp.Net requests – ironic that it should be such a class in which we find a bug!  A better argument for unit-testing you’re unlikely to find.Detail – Reproduce that bugUsing MVC it’s very easy to reproduce.  I should start by declaring my system configuration:Windows 2008 R2 IIS 7.5 installed and configured Visual Studio 2008 with all service packs etc .Net 3.5 sp1 plus security patches VS2010 and .Net 4 are also on this machine – and I would welcome an…

Serializing to attributes in WCF with DataContractSerializer

It’s a common problem – you want to return an object from a WCF service as XML, but you either want, or need, to deliver some or all of the property values as XML Attributes instead of XML Elements; but you can’t because the DataContractSerializer doesn’t support attributes (you’re most likely to have seen this StackOverflow QA if you’ve done a web search).  Most likely you’ve then migrated all your WCF service code to using the XmlSerializer (with all the XmlElement/XmlAttribute/XmlType attributes et al) – and you’ve cursed loudly.Well, I’m here to rescue you, because it is possible – and the answer to the problem is actually inferred from the MSDN article entitled ‘Types supported by the Data Contract Serializer’.The example I’m going to give is purely for illustration purposes only.  I don’t have a lot of time, so work with me!Create a new Asp.Net WCF service application, you can use Cassini as your web server (probably easier – otherwise you might have to enable Asp.Net compatibil…