Mobile TFL 1.0.0.4 – London Tube Status Updates On Your Windows Mobile

March 17th, 2009

[NOTE: This post relates to an old version of MobileTFL - Please see http://www.davidwhitney.co.uk/software for the latest version]

I’ve just compiled what I hope is the final version of this application barring London growing extra underground lines.

I’ve written a small Windows Mobile application for phones running WinMo 5.0+ with Compact Framework 2.0+.  It syndicates the Transport for London live data in similar way to the pre-existing iPhone and Android applications allowing you to view the current tube network status, planned engineering outages and local station notifications at the push of a finger on your Windows Mobile.

It’s currently living at a holding page at http://www.davidwhitney.co.uk/software (soon to become a larger site) and it’s a free download for anyone that uses Windows Mobile.

The 1.0.0.4 update is a reaction to some feedback I’ve received over at http://www.xda-developers.com and comes complete with coloured glyphs representing each tube line and enhanced resolution support for devices with “unusual” resolutions such as the Sony X1.  I’ve also had a stab at some font and UI element scaling so hopefully the interface will look quite natural on all your devices.

I’ve only managed to test it in the wild on a Touch Diamond, Touch Cruise and the Windows Mobile 5.0 Virtual Machine (along with in Windows).  It seems to run admirably in those conditions.

Obviously it requires a data plan so beware of any provider costs.

You can download the .cab directly at this link: http://www.davidwhitney.co.uk/software/repository/MobileTFL/1.0.0.4/MobileTFL.Setup.CAB

ss1 ss4
ss5 ss6

Mobile TFL – London Tube Updates On Your Windows Mobile Phone

March 16th, 2009

A very quick late night post.

I’m a big fan of HTC’s Touch Diamond once you remove all the cruft that the major phone networks like to cram onto their devices.  It’s a pocket sized, powerful smart phone.  I picked one up only a few months ago as a replacement for my HTC Touch, which was starting to feel very very slow compared to some of the handsets on the market, and the addition of HDSPA on the Diamond was the clincher.

Anyway, as a result the good lady has been quite impressed with the functionality of the Diamond.  She works in the media and the ability to access the internet with an almost desktop like experience (and without an iPhone) was very appealing.  While we were in town this weekend sorting out a new contract for her, I noticed that Google’s G1 ships with a London Tube service status application.  Seeing as Eleanor lives in London it seemed like an instantly cool thing to have on hand, but to my surprise, there isn’t anything comparable available for Windows Mobile (or there is and it’s too difficult to track down).

So I wrote one.

I’ve put up a really REALLY retro holding page at http://www.davidwhitney.co.uk/software for the purpose of releasing this application, hopefully over the coming months I’ll use it as a gather place for all the applications I’ve written, both free and pay-for, but for the moment, feel free to go and pick up a copy of the ingeniously named MobileTFL (after the transport-for-London website, where the application sources its data).

If you’re too lazy to click through one link:

Download Mobile TFL for Windows Mobile Here (Cab file)

You’ll have to forgive the exceptionally low-fi website and hilarious low res Visual Studio 2008 virtual machine screenshot.  I’ve only really tested the app on the Diamond I have sitting on my desk right now and it works a treat.

Obviously it requires you have a data plan that’s from a company that believes in Mobile internet rather than customer robbery but it only uses a tiny amount of data (it’s just a Http request).

It also requires the Compact Framework.  I’ve built it under CF3.5 but I suspect it’ll run just fine under CF2.0 (they’re binary compatible after all).

Feedback is more than welcome, just send me an email about it.  I’m especially interested on how the rendering looks on your devices, as the rendering code was written quite quickly and as soon as it looked ok in the VM and on my device I pretty much packaged it up.

I doubt it’ll brick your device, but if it does, you know the drill, it’s your problem.

Time for sleep now.

[Update: Microupdate to version 1.0.0.3 to fix a few bugs and aestetics, the above link has changed, revisit it for the new version]

XNA Game Development: Coding For Multiplatform Multiplayer 2

March 12th, 2009

It occurs to me that I wasn’t thinking straight when I wrote the previous entry regarding my reluctance to use .Net 3.5 SP1 in ‘Encounters’ for hybrid networking.

In a clearer state of mind, it occurs to me that because only the Windows version of the game is going to use the WCF networking implementation, that only the Windows version of the game will require the 3.5 SP1 version of the framework as a result.

The Xbox 360 appears to use a version of the Compact Framework 3.5, however it’s worth noting that 3.5 is a binary compatible set of additional assemblies that run in the .Net 2.0 environment.

What this effectively means is that I can use functionality in 3.5 SP1 (specifically the ability to serailize objects that aren’t marked as DataContracts or Seralizable) for the Windows version of the networking stack without contaminating the code of the game and preventing it from running on a 360.

Even better, it means I don’t need to mark-up my data model with any kind of attributes to support network play on Windows and I shouldn’t need to use a dubious set of byte array wrappers for data that can be typesafe, effectively letting me maintain a “purer” game model.

I’ll move my development environment to 3.5 SP1 and test this theory later, but I suspect I can simplify the networking stack on windows without the need for any messy hacks because of SP1.

Sometimes sleeping on a problem really is the answer; I was about to do something pretty stupid.

XNA Game Development: Coding For Multiplatform Multiplayer

March 12th, 2009

I’ve jumped right in to the deep end with my game project (which is going under the working title of “Encounters” – I needed to call the solution something!) and one of the core design goals of the project is the multiplayer focus of the game.

I’m a huge fan of Id SoftwareJohn Carmack is probably my favourite “celebrity computer programmer”.  He’s incredible smart and consistent and has made some of both the most influential and my own favourite games.

Standing on the shoulders of giants - The “Quake” model

I’ve always thought the “Quake model” of single player and multiplayer game development to be a good one.  For those that don’t know, one of the simple design tenants of the Quake engine is that everything is a multiplayer game.  When you play the campaign in the original Quake what the game actually does is start a local game server which you then connect to.  Due to the proliferation of the Quake engine and other engines that have been inspired by it’s design this became quite a common way to build first person shooters with multiplayer support from the offset.  It reduced the implementation of multiplayer to simply having a second player connect to the active session.

Standing on the shoulders of giants, I’ve decided that this is the model I wish to follow for Encounters, especially seeing as the primary work-in-progress game design desires 4-player coop as the main campaign (with NPC assistants if you play with fewer humans).  Because of the way supporting multiplayer from the offset effectively means that all the games “thinking” is done in the server component (collision detection, cheat prevention, state management..) I decide that it’d be the best place to start the implementation.

Prototyping

So far so good, I spent an hour or two last night designing a simple state managing game server and retrofitting it to my previous prototype (an arena with a player-controlled unit moving around it) and moving all the logic and validation to the server side.

At this point the “game server” was a singleton class that the game accessed though a fake “proxy” class (left empty for eventual network implementation) and it worked pretty well.  The collision detection worked on the “server side” when the server was running in the same application domain and as a proof of concept everything was quite sound. I’m still left facing a few issues surrounding the frequency of syncing with the server and client side prediction, but they’re all relatively well solved problems in gaming (and there’s certainly some prior art to take inspiration from in XNA tutorials around the web).

Building a network stack

Once the proof of concept was working I started looking into the networking support provided by XNA and hit the mother of all roadblocks.  Because I’m targeting both the 360 and Windows, networking becomes significantly more complicated.  See, Microsoft offer no direct network access on the 360, via XNA, or even to their licensed partners (internet hearsay claims).  They provide Xbox Live APIs as part of the XNA framework however, which seemed like a decent solution until I realised that these networking APIs function only on a 360 as part of Xbox live.

Not so multiplatform really

So I’ve started thinking around the problem.  I do a lot of work with WCF in my day-job writing distributed systems so my obvious inclination was to provide a WCF client-server architecture for the Windows targeted version of the game.  This adds an additional set of issues.  For a start it looks as though the WCF assemblies (System.ServiceModel) are probably not available on the 360.  You’d think that’s not much of a problem if you’re going to use the Live APIs, but then you realise that if you’re using a version of .Net 3.5 prior to the first service pack, you need to annotate any classes you want to transfer via WCF with the DataContract attribute.  Which is in the System.ServiceModel namespace.

I’m not sure (as I currently don’t have a subscription to deploy my test code onto my 360) what version of the framework the 360 is running, but I’d hazard a guess that it’s pre SP1.  I’m going to have to further research this problem, because if you can use SP1 on the 360 (which supports serialization without any attributes on the classes) then we’re home free.

Multiplatform networking code using Inversion of Control

In the interim I’ve devised a cunning solution (or perhaps workaround, I’m not sure).  See, all of these issues lead me to need two entirely separate network stacks for my game.  One that supported the Windows, and the other that supported Xbox live, without contaminating my data model with mark-up that’s useable in only one or the other of the stacks.

Castle Windsor to the rescue.

This is purely speculative as I haven’t attempted to implement the 360 network stack yet, but I intend to use the Castle Windsor IoC (inversion of control) container to load a separate network stack at runtime, depending on the platform.

My idea is that the game knows about two interfaces IGameServer and IGameServerConnection.  I then create two entirely separate assemblies, one with the networking code for the PC, the other with the Live networking code.  The PC version contains a class called WcfGameServer which implements IGameServer (I’ve already written this code), and a class called WcfGameServerConnection which implementes IGameServerConnection (and acts as a hand crafted WCF proxy).  The 360 implementation will feature XBL counterparts to these classes.

As far as the game is concerned, it’ll use the Windsor container to load an instance of IGameServer, call the StartListening(); method, then use Windsor to load an instance of IGameServerConnection() and call JoinGame() on that connection.  This way, the specific networking implementation is entirely removed from the game and hidden behind these two simple interfaces.

I’ve currently got a good way through implementing the WCF version of this model though I’ve hit a few snags on the way.  Because I’m deliberately developing in a pre-SP1 environment for the sake of this exercise, WCF doesn’t like serializing the game model to send over the wire.  As a result I’ve had to produce an inelegant hack to work around my desire to keep the System.ServiceModel assembly reference clear of my game model.

Trying to keep it light

I’ve marked up my model with Serializable attributes (.NET 1.1, that’ll be fine) and inside my WCF implementation of IGameServerConnection I’m marshalling all my data into byte[]’s before sending it over the wire.  This isn’t ideal as it requires the WCF implementation to manually deserialize the byte[]’s into their correct data types in the service implementation and the client library, but it does work.  Unfortunately at the moment these byte arrays are being stored as XML before being sent over the wire (as is the default WCF way) so I’m going to need to force WCF to binary serialize all it’s data rather than bloat my packets (and as a result, the game latency).  I’m using Net.Tcp so it’s pretty lightweight as far as protocols go but I suspect I’ll need to do some additional fine tuning to make the WCF implementation viable.

Either way, I’ve got a good feeling about the model, subtle hacks aside, and I think this is quite a good way to target both platforms with minimal impact to your game code.

So this is day 3 of development (I’m sure I’m going to loose count pretty quickly).

[Footnote]

It occurs to me that I got a few fundamental things wrong when this post was originally written regarding the requirements for .Net 3.5 SP1.  These mistakes almost complicated the design of the networking stack.  Read more in my follow up here.

Game Development

March 10th, 2009

It was always a matter of time before my addiction to games and my addiction to programming eventually collided in a horrible mistake.

I’ve decided to start writing a game, using a home grown game engine hopefully with “a little help from my friends”.

I won’t spoil anything too much (as I don’t really want to play my hand too early) but the gist is a 2d, top down, multiplayer action game, with heavy RPG tendencies.  Think of it as a cross between 2d Zelda games, Cannon Fodder and high end raiding in World of Warcraft.  The game design is up in the air at the moment, but hopefully it’ll be derived from a system my good friend Matt has started fleshing out (with the potential for a more RPG leaned game mode, and a more arcade oriented game mode).

The only problem is, I’ve never attempted to write a game before.

So hopefully we can learn together.  I have a rough hit-list of the ground I’m going to have to cover to pull this off, and a rough idea of the technology involved (partially from my other programming pursuits, partially from my enthusiastic following of the games industry) but actually implementing it from the ground up is going to prove an entertaining learning experience.

I’ll tag these posts so people can avoid or watch them at their leisure- there’s a good chance I’ll be dropping into lots of technical detail with complete disregard for the experience levels of my audience. That said, I’m going to be learning a lot of this stuff from scratch (collision detection, graphics rendering, effective ways to script games) while dragging in my bread and butter (distributed systems, C#, etc) to hopefully fill in around the edges.

I’m going to be working in the XNA framework, partially to lower my barrier to entry (seeing as .Net is the day-job and the hobby) and partially because I enjoy the ability to target both the PC and the Xbox360 platform using roughly the same code.

It’s going to be a rocky ride I’m sure, I’ve been working on proof-of-concept code for about a week on and off and it looks like it’s something you can stumble in to (especially with some of the fantastic guides available online).  I’m more than willing to take pointers or tips, so if anyone knows of any especially trustworthy resources on authoring 2d games I’d love to hear some suggestions.

Why I Love Stand Up Meetings And How To Make Them Work For You

February 27th, 2009

I hate meetings but I love stand up meetings- contradiction?  No.

They’re a brilliant, informative, low impact way to keep communication fluid amongst your (small to medium sized) team, regardless of profession.

I’m going to talk a little about the reasons I’m writing about this, before getting on to the anatomy of my perfect stand up meeting, then tell you what stand up meetings could do for you and your team.

The Media Circus

My partner works in magazine journalism as the chief sub-editor for a title with a reasonably large international circulation.  Consequently, every month without fail, press week is a nightmare.

As is apparently the norm in the publishing industry (or what’s left of it) the eternal cycle of content creation is a very stressful process.  Freelancers are always late; things never hit the editors desk on time, people have to be continously chased up, facts need to be checked, and all before a press date.  If this isn’t complete by the press date, the company starts haemorrhaging money by the hour as the presses are literally “stopped”.

All of the above is exaggerated by the fact that writing is one of the industries that allows single workers to effectively “go dark”, drop off the radar and appear x-days later with finished content.  Not exactly communicative, ironically.

You Were At Work How Long?

She’s quite durable in regards to getting work done and quite effective at not letting the battle of press week become emotional or stressful, but I get the distinct impression it can be highly frustrating when you’re working until 11.30pm and getting the last tube home for a few days at the end of every month just to cover for the lack of structure to publishing a medium sized monthly title.

This pattern cumulated in a conversation with the good lady, with her expressing a little bit of exasperation on the topic and wondering if there was actually anything she could do to ever change this bad pattern of behaviour and improve the workflow of the entire team.  To me, there were a few simple tricks that could be employed to help facilitate change.

The Programmers Perspective

As a stark contrast I work in technology, specifically software development using what commonly comes under the banner of “Agile Methods” (there’s an on-going debate as to what counts as an agile method, but that’s beyond the scope of this piece, and frankly, my patience).

I’ve been lucky enough to only suffer one professional role that insisted on following an old trusty waterfall model of software development- that is to say, a software project where you first sit down and collate a monolithic requirements document, then produce a complete system design, then implement it, then deliver it.  Because of this, I’ve been working “agile” since my second professional role, and the first thing I was introduced to on my first day was the concept of the “Stand Up” (meeting).

I’d never come across one before, but they turned into one of the most useful parts of my day, and for something that lasts the best part of 10 minutes, that’s saying something.

What’s A Stand Up?

To quote the Wikipedia entry in it’s entirety:

“A stand-up meeting (or simply stand-up) is a daily team meeting held to provide a status update to the team members. The ’semi-real-time’ status allows participants to know about potential challenges as well as coordinate efforts to resolve difficult and/or time-consuming issues. It has particular value in agile software development processes, such as Scrum, but can be utilized in any development methodology.

The meetings are usually time boxed to 5-15 minutes and are held standing up to remind people to keep the meeting short and to the point. Most people usually refer to this meeting as just the stand-up, although it is sometimes also referred to as the morning roll call or the daily scrum.

The meeting is usually held at the same time and place every working day. All team members are expected to attend, but the meetings are not postponed if some of the team members are not present. One of the crucial features is that the meeting is intended to be a status update to other team members and not a status update to the management or other stakeholders. Team members take turns speaking, sometimes passing along a token to indicate the current person allowed to speak. Each member talks about his progress since the last stand-up, the anticipated work until the next stand-up and any impediments they foresee.

Team members may sometimes ask for short clarifications but the stand-up does not usually consist of full fledged discussions.”

You’ll notice that there’s a hell of a lot of references to software development both in the prose and on the Wikipedia page and it surprised me to discover that outside of technology, stand ups aren’t a common thing, they essentially don’t exist.

I could hardly believe it at first, but a cursory Google search for “stand up meeting” concluded that outside of software, stand ups either don’t exist or are so rare as to not appear on general business websites.

For the sake of completeness, it’s worth noting that the internet is always skewed to technological topics in these kind of searches, but when all the results are about programming I can at least see some anecdotal evidence to confirm my suspicions.

My Favourite Stand Up Meeting Pattern, And What It Gets You

First things first, I really don’t like calling “stand ups” “stand up meetings”.  I always feel like the word meeting is loaded with negative and tedious connotations- meetings are boring and shitty and people don’t like going to them, period.

It’s important to note that because a stand up isn’t really a meeting, it doesn’t have the emotional baggage associated with one.  A stand up works best for teams of about 2-15 people (for the sake of brevity).

The Ideal Stand Up

A perfect stand up lasts between about 10 and 15 minutes (you’re “standing up” to try and enforce this) and takes place EVERY day.

The jist is, somebody starts it off (it doesn’t matter who) and everybody states what they did yesterday, what they’re planning on doing today, and anything that they think is going to get in the way of their current task.

Other team members are allowed and encouraged to comment and ask brief questions after the current speaker has finished.

The meeting should take place roughly 20 minutes after the start of the working day, to allow people time to sit down, get a coffee, have a chat, read their email and work out what they’re doing.

What You Get

The idea is, through the use of this simple 1 to 2 minute exchange from each person, everyone has a much clearer understanding of what each team member does.  Just ask yourself, do you REALLY know what all the members of your team do?  This is especially pertinent if your job involves managing your colleagues in some way.

The other participants should be encouraged to ask questions and comment after the speaker has finished but in-line with the comments they just made.  The idea behind this is that another team member may well have solved a problem that the speaker was suffering, but due to isolation, the pace of the workday or a lack of communication the fact that the problem has been solved may have been lost.

It’s a great way to share knowledge and has a very low impact on time.  The one caveat is that any lengthy discussions should be followed up privately after the stand up, because if you stray into detail or go off on a conversational tangent you’re wasting collective group time.

Psychological Effects

Stand ups make your team work harder and more efficiently.

That sounds absurd but stay with me.

Because, of the permanent rolling accountability of stating what you’ve been up to, stand ups are a good way of reducing the likelihood of your staff time wasting.  They’re nice and self regulating, nobody wants to stand in front of their team and say exactly the same thing, every day for a week.  It attracts the kind of attention that most people, lazy or not, prefer to avoid.

Past that, people enjoy having something new to say every day.  It’s a little like a grown up, caring sharing version of show and tell for the business world.  You don’t want to be the kid that doesn’t participate.  Peer pressure?  Totally.  But it’ll make your team more effective.

This side effect has two key uses.  Firstly, it positively encourages teams to be proactive, but secondly, it gives the managing member a very solid handle on team activities (or if relevant, the lack of).

Will This Work For Me?

Honestly?  I don’t know.  My experience is very slanted towards technology businesses so please remember your mileage may vary.

I think stand ups are a vital and useful part of an agile team however you shape them, and I’d say it’ll certainly work for you in software development.

Outside of technology, I genuinely don’t see how these clearly transferable practices wouldn’t apply and give you at the very least, team communication benefits.  Even if you think your team communicates well, ask yourself how much you know about both your colleagues’ roles, and what they’re doing today.

I found a good article on the anti-patterns of stand up meetings; the stuff to avoid.  I’d recommend having a quick read of it, in order to have all the information.

If you think the answer could be “not enough” than I’d really recommend you give it a go.  I have no idea if the good lady is going to suggest her team experiment with stand ups to help smooth out the pressures of their press week, but I think it would be an awesome idea for everyone.

I love stand up meetings and you should too!

XBox Live Gamer Banned For Her Lesbian Gamer Profile - But Are Microsoft Wrong?

February 26th, 2009

So the sticky issue of banning gamers based on sexual preference has come up yet again on Kotaku today.

The comments on this thread make for both a good and disheartening read.

From the article:

Perhaps more alarming than someone being banned for their expression of sexual preference was how this particular gamer was treated by the gaming public.

Teresa tells the Consumerist “I was harassed by several players, ‘chased’ to different maps/games to get away from their harassment. They followed me into the games and told all the other players to turn me in because they didn’t want to see that crap or their kids to see that crap.

“Five minutes worth of interaction with the general Xbox Live population will get the point across—they don’t care for “the gays.” But does the policy go too far in one sense, not far enough in another?

There’s a lot of interesting questions in there about her pride deliberately putting her in harms way in a known hostile environment (anyone that’s played any of the AAA mutliplayer games on XBL knows all about the terrible undercurrent of racism and sexism).

Microsoft, however, are taking flak (and rightfully so) for banning the account.  Though I have a certain amount of empathy for their point.  I guess my question to you guys is “is it prudent to be less “proud to be different” in scenarios where you know it would distinctly be to your disadvantage?  What do you think about removing sexuality and politics from gaming in order to “keep everything running smoothly”.

Certainly it’s very hard to police- XBL is largely based on a Peer-to-Peer architecture resulting in a lack of server logs.  As a result the only way to police an incident of this kind is to look for evidence before banning.  Unfortunately the only evidence in the case of this horrible persecuted XBL member is a terms of service violating gamer profile.

Whilst it’s a sorry state of affairs that it comes down to this, if the gamer in questions recount of the griefing she suffered is an example of general XBL behavior (and from experience I wouldn’t doubt it) then actually, keeping a “just keep any mention of sexuality off XBLA profiles for your own good” policy is probably prudent.

It’s not Microsoft’s fault that the world is full of hostile intolerant fucks, and if not stating your sexual preference diffuses a load of awful griefing then it’s probably a good idea.

That said, banning people over it, rather than just notifying and removing the perceived “offensive” content is really off the mark.

Ultimately the question is if it should be left to user choice to make themselves obviously a target, given the known nature of the audience. I think it’s terrible that stating a sexual preference can be the same as putting yourself in harms way (virtual harm, at that), but I wonder if the same person would go into a known homophobic bar and loudly proclaim they were gay/lesbian? Would their natural better judgment take over in that case.

At the end of the day it’s just representative of how you can’t be totally open around the unknown quantity of strangers without unpredictable results. It’s a shame because I think games should be allowed to deal with politics and sexuality and difficult topics, but unless the audience that consumes that material is on the same intellectual level as the material itself, things like this will *always* happen.

The solution probably is that when people run across any kind of intolerance on services like XBL, they should report the abuse.  There are far too many terrible instances on griefing that go unreported, allowing the perpetrators to “escape” while the victims get punished.  Microsoft have spoken about this in the past.

Or maybe it’s just indicative that people who play COD4 online really are drooling intolerant fucks, who knows.

So what do you think?

It’s a tough issue when you think about it and there’s no obvious answer or solution.  Microsoft are getting shot at because they’re the messenger, but it certainly raises some debate on human nature.

Simple C# HTTP Server for Windows Mobile

February 17th, 2009

Recently I’ve been trying to pay a debt of sorts.  I use the software provided on the fantastic XDA-Developers frequently on my Windows Mobile devices and have been doing for almost three years now.

So currently, if I have a little bit of free time, I’ll nip past their development section and try and fulfil a random request.

Today’s request might come in useful to a little bit of a wider audience so I’ll post it here.  The initial problem is outlined in this thread and the upshot was that someone needed a very simple Http server that could run on Windows Mobile, written in C#’, and was programmable.

What the guy really seemed to be looking for was something that used the Http protocol to return random computed data, so after a tiny bit of googling and a simple MSDN example, I’ve built a really simple web server for Windows Mobile.

Amusingly, my sample doesn’t behave much like a web server at all.  It just tells you what you requested, but it should be enough to get you going in the right direction.  It’s derived from the MSDN example with some additional sugar, and I certainly wouldn’t suggest that it’s got a threading model that’d stand up in a production environment (at a glance it looks like it’d process requests in sequence…) but hopefully it’s useful to somebody looking to produce a simple server, or who is just interested in how Http works.

I’m not really sure if I can accurately call it a webserver, seeing as it doesn’t even support a full set of Http Verbs, but you get the idea.

I’ve not actually bothered compiling this on a mobile device yet (lack of inclination) however seeing as it was explicitly based on a socket programming for Windows Mobile MSDN example, I suspect it’ll work just fine.  No warranty, do what you will with it.

Download Simple C# Http Server for Windows Mobile (Source Code Only) (7kb)

Installing Certificates using Wix (Windows Installer Xml / Voltive)

February 11th, 2009

I’ve been working with WiX ( wix.sourceforge.net ) for generating application installers over the past few weeks.

The project is rapidly evolving (if I recall, it was one of Microsofts first forays into open source development) but as a side effect finding up to date documentation can be a little taxing. The documentation is good and quite comprehensive, but often subtly incorrect or outdated.

Anyway, we have a few services at work that require certificates to be installed at install time into the Windows certificate store. Previously we had a couple of custiom actions designed to configure the user and store, but after a little investigation it appears like this functionality comes for free in the Wix toolkit.

It’s confusingly in the IIS extensions, which is a bit of a misnomer- it’s only in there because it was originally designed to install certificates for web servers, however it works perfectly for any certificate.

So how do you do it? In Wix3, ensure you first have a reference to WixIIsExtension.dll (in the default install, it’s in c:\Program Files\Windows Installer XML v3\bin) in your project if you’re using voltive, or manually linked if you’re building on the command line. The following example is of a fragment which installs two certificates, one as a Root certificate authority and another as a certificate in local machine.

<?xml version=”1.0″ encoding=”utf-8″?>
<Wix xmlns=”http://schemas.microsoft.com/wix/2006/wi”
xmlns:iis=”http://schemas.microsoft.com/wix/IIsExtension”>

<Fragment>
<Directory Id=”Directory_Certificates” Name=”Certificates”>
<Component Id=”MyRootCert.cer” Guid=”*”>
<File Id=”MyRootCert.cer” Name=”MyRootCert.cer” Source=”..\..\Path\To\MyRootCert.cer” />

<iis:Certificate Id=”Certificate.RootCA”
Name=”MyRootCert.cer”
Request=”no”
StoreLocation=”localMachine”
StoreName=”root”
Overwrite=”yes”
BinaryKey=”Certificate.RootCA.Binary”
/>

</Component>
<Component Id=”RandomCert.p12″ Guid=”*”>
<File Id=”RandomCert.p12″ Name=”RandomCert.p12″ Source=”..\..\Path\To\RandomCert.p12″ />

<iis:Certificate Id=”Certificate.MnpTestCertificate”
Name=”RandomCert.p12″
Request=”no”
StoreLocation=”localMachine”
StoreName=”personal”
Overwrite=”yes”
BinaryKey=”Certificate.RandomCert.Binary”
PFXPassword=”myCertPassword_Optional”
/>

</Component>
</Directory>

<Binary Id=”Certificate.RootCA.Binary” SourceFile=”..\..\Path\To\MyRootCert.cer” />
<Binary Id=”Certificate.RandomCert.Binary” SourceFile=”..\..\Path\To\RandomCert.p12″ />

</Fragment>

<Fragment>
<ComponentGroup Id=”Component.InstalledCertificates”>
<ComponentRef Id=”MyRootCert.cer” />
<ComponentRef Id=”RandomCert.p12″ />
</ComponentGroup>
</Fragment>

</Wix>

C# Subversion ChangeLog Generator

January 19th, 2009

Ever wanted to generate a change log from all your (dubious) Subversion repository comments?  For some reason want to do it in C# or just by calling an exe?  Now you can!  You can even tie it in to continuous integration!

About 6 months ago I spent an evening porting the Subversion Change Log generator to C# in order to integrate Change Log generation it into our Cruise Control.Net nightly builds at work.

It’s not a direct port, more a C# reimplementation, but it produces the same output as svn2cl (which in itself was inspired by cvs2cl).  The gist is, that it calls svn.exe on the command line and retrieves the full history of comments for whichever svn path you request.

It’s not the most elegant thing I’ve ever written (it pretty much just spawns the svn.exe and pipes the output through an XSL transform) and requires you having a command line svn.exe on your system (which if you use subversion on windows is pretty likely), but if you do you should be able to generate change logs from your repositories by calling the compiled executable like so:

SubversionReportProducer.exe –style=ChangeLog.xsl –outputLocation=out.txt –repositoryPath=svn://repo/trunk

If you don’t want to pass the subversion exe path and repository path through on each execution you can specify them by modifying the values in SubversionReportProducer.exe.config.  Those values will always attempt to load from configuration, and then attempt to load from a command line parameter (overwriting any app.config settings) allowing for maximum flexibility in batch scripts and automation.

I’ve bundled it with a couple of XSL transform files to produce some output, mostly taken from svn2cl and one subtle adaption that we use in our build process (ingeniously named changelog.xsl).

Your mileage by vary, but this could well be of use to someone.

Source code provided, feel free to contact me about any bugs but I’m pretty much just kicking this out into the wild..

Download Source
Download Compiled Executable
Requires .Net 2.0+