Back in Japan

For the forseeable future I’m back in Japan since finally finishing my Uni course. After working full time since May I’ve decided to have a bit of a gap year style break before I settle down somewhere. Expect this blog to become a bit more of a personal one with some photos etc.

My phone is back in action and my keitai address is ed.andersen at :-) Feel free to drop me a line.

Lines now on Xbox Live

So my grand plan to rewrite my game for the Community Games launch didn’t quite go according to plan, so I decided to polish up the original version as a bit of practice. It has now been approved and is on Xbox Live Community Games – NXE users can download the trial and buy it now, while everyone on the old dashboard will have to wait until November 19th. The internet ranking site is up at – by soliciting scores I should be able to get a decent idea of how many people are buying the full game which you need to do to get internet ranking passwords.

Edbox-7 copy

The Community Games community is just getting off the ground, and already establishing its own “ground rules” for peer review based on the very loose guidelines set forth by Microsoft (presumably so they cannot be held responsible for anything that gets passed). The most important points to watch out for, and the community WILL FAIL you for breaking are:

  • Be able to use multiple controllers – much to the chagrin of some of the creators, the community will fail your game if you cannot play it with any controller plugged in. Don’t hardcode for PlayerIndex.One.
  • Test with more than one storage device – you have to be able to support memory cards as well as hard discs, and to be able to show the Guide selector asyncronously. I was caught out by the case where you can cancel the selection (which will cause EndShowStorageDeviceSelection to return null) so remember this is a valid input.
  • Small text and TitleSafeArea – many reviewers are using SD CRT tellies, not lovely HDTVs that many are now using and many creators use to test their games. Small text is a massive issue and SDTV users WILL fail your game if they can’t read anything crucial to gameplay (instructions etc). In addition, the area of the game screen you can see on a SDTV is much smaller due to the increased overscan, so use the TitleSafeArea property to make sure your text is within the overscan limits.
  • Make a “game” – the community has already had its fair share of drama, including one member simply submitting reskinned Starter Kits (templates from Microsoft) that didn’t meet the submission rules and one producing a Magic 8-Ball style game that requires the chatpad peripheral that simply nobody owns to play. Even if the game technically meets the submission criteria, the community can and will still fail it if they deem it unsuitable for the service (or increasingly if the submission will make the service look bad) either by trying their hardest to find a crash bug or simply not reviewing the game so it never passes peer review.

Lines is available for 200 Microsoft Points which is about $2.50. I get 70% of this so I could get some beer money. Fingers crossed!

Lines EX – rebuilding with XNA 3

My dissertation project saw me making an XNA game (Lines) and website to go with it ( which used web services to make essentially a cut down Xbox Live on the PC with rich presence support, automatic high score uploading etc. I feel it was very successful (and the markers agreed) but I didn’t get the time to spend on the game portion that I wanted to, instead concentrating mainly on the distribution scenarios and the user experience. With the Xbox Live Community Arcade coming up and the new CTP of XNA 3 released, I thought it would be the right time to rewrite the game using everything I’ve learnt over the last year since I began the project ready for the Community Arcade launch “this fall”.


Instead of using SpriteBatch, I’ve decided to place 2D flat quads in 3D space. While still getting free rotation, transparency etc, I now get resolution independence and extra effects such as being able to skew sprites.

I already have the main game code so am working on the menu system. By having sprites in a 3D space, changing the camera location means aspect ratio independence too by zooming out or changing the field of view – below shows the main menu in 16:9 and 4:3 (the zooming will work with all aspect ratios meaning no stretching).

image image

My favourite benefit however is the Smash Bros. style 3D effect you can achieve by moving the camera with the right stick. Completely pointless but very cool and can help you debug the locations of your sprites in the game world.


And yes, I am aware of the hidden word in the title and it is purely accidental :-) and iPhone encode Japanese as Korean

The latest of ridiculous bugs I have found after my switchover to Mac is that Korean takes precedence over Japanese when “Automatic” is selected as the encoding on It literally sees Japanese text as Korean and encodes emails as ISO-2022-KR (Korean) if both Japanese and Korean are selected under Languages.


Try it yourself: make sure both Korean and Japanese are in the Languages list (so they show both show up in’s Message > Text Encoding) and send an email containing Japanese text when encoding is set to “Automatic”. View the full message source and see that it encodes the message as ISO-2022-KR, not ShiftJIS or UTF-8 which it should. You have to completely remove Korean from the list if you want to use Automatic encoding, or manually select the encoding yourself every time. I cannot find a setting to force an encoding (er, UTF-8) on every email you send.

This is not a problem if the recipient is a PC/Mac user since the mail client will sort it out – but sending mails to a Japanese phone, which obviously has no idea what to do with Korean text encoding (and can’t suss out that its actually Japanese text) means that the lucky recipient gets 文字化け、mojibake, jumbled garbage.

Its even worse on the iPhone

If you ever decide to turn Korean keyboards on in the Language settings, or switch to Korean, iPhone appears to add Korean to the Languages list when choosing its own encoding. However, you cannot change the encoding manually on iPhone, or ever remove Korean from the list, even if you then disable Korean input.
The net result? You can never send Japanese mails to Japanese mobile phones ever again on your iPhone, until you do a full system restore. Which I am now doing. If you reply to a mail that was sent to you in ShiftJIS, the iPhone is at least clever enough to reply in the same encoding type but you are SOL if you want to compose a new one.
Rubbish. Windows Mobile has an option to “always send mail as UTF-8″. I wonder how many iPhone users in Japan have fallen foul of this?

iPhone O2 – how to fix the image compression

O2 in the UK butcher images while using GPRS/3G/EDGE – seriously effecting the iPhone. Images are recompressed to horrendous levels – look at the App Store here:


As you can see, the Facebook and Super Monkey Ball banners have been recompressed. This effects webpages aswell – meaning downloading new wallpapers or browsing Flickr is a waste of time. However, if you change the username for the O2 access point under Settings > General > Network > Cellular Data Network to “bypass” from the default “vertigo” like so:


The compression is now turned off! Now the “whole internet in your pocket” is actually the whole internet in your pocket.


Symfony in Enterprise – Tips and Experiences


At work I am currently tasked with redeveloping an intranet application used to track customers, products owned, support contracts, support records and all sorts of other CRM-esqué functions. The version used at the moment is a very fast Perl/MySQL/Mod_perl/Apache setup built over a few years. Its got to the point where the company needs more functionality and hacking extra functions into the current code is getting more and more difficult.

Why Symfony? Why PHP?

The current trend for “rich internet applications” is Ruby on Rails. Ruby has very powerful Object Role Modelling features that completely abstract the database from your code – no more writing SQL queries once the initial database has been set up. Database tables become class generators and rows become class references, free to be instantiated, updated and saved. Symfony is probably the closest PHP Framework to Ruby, as it utilises the Propel ORM layer (so can use almost any RDMS) and has a full Model View Controller structure. PHP runs on the vast majority of Apache installations and requires no extra software installed on the server – in addition finding skilled PHP programmers is far easier (although this might change). Symfony is also probably one of the most well documented Open Source web framework projects that I have come across, featuring a whole book written by a member of the community very close to the development team, an expansive Wiki on the project homepage and hundreds of plugins to simplify everything from AJAX to RSS feed generation.

Symfony can be used in two ways – through config files (text files defined using YAML, a simple markup language) which are passed to Generators to create the final scripts, or by manually coding the actions and pages. In reality, a combination of the two will be used. Tweaking the included Administration Generator will yield respectable results for the standard CRUD (Create, Read, Update, Delete) functions and it is extremely simple to create modules and actions with the included command-line tool that creates skeleton templates for you to use.

No longer do you have to plug in debugging tools (such as the Xdebug php extension) to get decent errors and stack traces when your application fails – Symfony provides a development view of your application that will output extremely useful information (such as execution time, a list of all SQL queries made and globals) right in the page outputted to your browser. Debugging the application I’ve been working has been as easy as that of a desktop app (coming from my experience of Visual Studio) – Symfony will work in conjunction with many PHP debugging extensions for further information if you need it (I haven’t).

Plus, Symfony is good enough for Yahoo to use it for a 20 Million user app, Yahoo Bookmarks!


I’ve been working alone for a month on the project and what strikes me is the huge amount of already achieved with no prior experience of Symfony:

  • A complete database redesign using the excellent MySQL Workbench. Adding many-to-many relationships where there were none before requires a good deal of thought but the results when the ORM classes are generated by Propel in Symfony are well worth the effort
  • Database migration handled by the CLI features of Symfony. One command will generate a .php file you can run at the command line (or cron job) with automatic access to all the features of your main application. Where the database had been vastly redesigned to support relationships, custom migration code had to be written (but where tables have not changed, you can copy table data directly in one line of manual SQL). The migration script takes about half an hour to run (approx. 3,000,000 records).
  • User security and session support, timeouts etc
  • Full creation and editing of all the major record types with administration control panels
  • AJAX views and manipulation of information with per-user rearrangeable panels ala iGoogle
  • Full filtering functions for searches with auto-paginated results (soon with Excel export)
  • Global per-user filters that effect all searches
  • …and lots of other actions specific to the application


Some advice to newcomers to Symfony from my experience:

  • Don’t rewrite the wheel. Use the plugins available and tweak them if necessary.
  • Use the Admin Generator, don’t fight it. Instead of writing custom create/edit/list actions when the Administration Generator does not meet your requirements (or altering the CSS won’t help), override templates with per-module versions of your own. Even better is creating a new Generator all together (although it is a headache writing PHP code that writes PHP code!) – check out the sfAdvancedAdminGenerator plugin for inspiration.
  • Don’t worry too much about performance especially if your application is running a bit sluggish on your local machine. On a proper server with a production installation of Apache and MySQL, the application I thought was a bit slow flew given the chance. You can optimise later.
  • Don’t be scared of upgrading – I went up a symfony version during production without a hitch and without a change in my code (from 1.0 to 1.1 this will be different)
  • Use a decent IDE. I use PDT Eclipse and it definitely speeds up development. You will frequently have to edit several files at once so at least use a text editor with tabs.
  • Read the book! I can’t stress this one enough. It is extremely well written and is available for free on the website.

I’ll post some more impressions and a brief postmortem when the project is finished.

Vista net problems? Disable auto-tuning

I have been having a problem where I would get “This page cannot be displayed” errors the first time I tried to access a website. The odd thing was that hitting Refresh would solve the problem and I would get through to the site immediately. At first, I thought it was a DNS problem due to the Internet Connection Sharing setup, but turns out it is Vista messing around with the net connection with a process called “Receive Window Auto-Tuning” (this alters the size of the packets on your network based on network conditions).

To turn this off, fire up an elevated command prompt window and type in “netsh interface tcp set global autotuninglevel=disabled” without the quotes. This solved all the problems I was having with my net connection in Vista SP1. Strange.


Presentation Zen by Garr Reynolds

I’ve finally had the pleasure of getting a copy of Garr Reynolds’ Presentation Zen: Simple Ideas on Presentation Design and Delivery. Garr Reynolds, for those of you that don’t know him, is the world’s Powerpoint guru and his Presentation Zen blog is essential reading for anybody in the business of delivering presentations or public speaking.

The book is very visual, giving hundreds of examples of both good and bad Powerpoint design. Garr is of the “less is more” school of thought and he shows you how to turn horrific clip-art bullet point laden disasters into slick, to the point and punchy presentations that would make Steve Jobs proud.

Garr also touches on some aspects of Zen (of which he is very fond) and how it applies to the delivery and preparation of presentations. Be prepared for a bit of a Japanese lesson when reading about some of the concepts.

He is sympathetic with the current nightmare of slideshows shown in almost every lecture theatre and boardroom in the country, blaming slideware (Powerpoint, Keynote) for “guiding users toward presenting in outline form with subject titles and bullet points grouped under each topic heading” – basically the usual bullet point snoozes we have to endure every day. I really wish that this was compulsory reading for University lecturers.

Look at this slide from a lecture I was in today – I actually could not read the text from my seat in the room:


By quickly redesigning the slide based on the principles of Presentation Zen (in Powerpoint 2007), I get the following slide:


You might be wondering where all the information has gone – it is however the presenter’s job to present the information by speaking and explaining each point clearly and concisely, not reading from a slide. Streams of text copy and pasted from the net need to be in a seperate handout. The “watermarking” at the bottom of the slide is equally useless.

Teachers, please buy this book and start delivering engaging presentations that encourage students to come to the lecture. 5 people came to the class today – it started with 50. Engaging presentations will also teach the kids more!

XNA2.0 Dependency checking

After a lot of trial and error using Process Monitor and Virtual PC, I have finally sussed out exactly what XNA2.0 games on Windows need to run. The requirements are slightly different to XNA 1 games.

Direct X runtimes

There are four files that need to be installed in the system32 folder for XNA to initialise properly. They are:

  • xinput1_3.dll
  • x3daudio1_3.dll
  • d3dx9_31.dll, and
  • xactengine2_9.dll

The first three can be placed alongside the application exe and then load fine, but xactengine2_9.dll does not load this way for some reason, and has to be present in the system directory. Distributing these files alongside the application breaks the DirectX EULA, so they have to be installed using dxsetup.exe.

To check the presence in your XNA game, just put this code in Program.cs before game.Run() is called:

bool HasAllPrereqs = true;
// check all the required files, if any missing, return false
if (!System.IO.File.Exists(System.Environment.SystemDirectory 
    + "\\xactengine2_9.dll")) HasAllPrereqs = false;
if (!System.IO.File.Exists(System.Environment.SystemDirectory 
    + "\\d3dx9_31.dll")) HasAllPrereqs = false;
if (!System.IO.File.Exists(System.Environment.SystemDirectory 
    + "\\x3daudio1_2.dll")) HasAllPrereqs = false;
if (!System.IO.File.Exists(System.Environment.SystemDirectory 
    + "\\xinput1_3.dll")) HasAllPrereqs = false;

If HasAllPrereqs is false after those lines, exit the application before it crashes horribly when XNA tries to initialise.

Visual C++ 2005 SP1 runtimes

Even a fresh Vista install doesn’t have these. They are provided when updating Visual Studio 2005 to SP1, or installing SP1 of the .Net Framework 2.0. However, Vista comes with SP0 of .Net 2.0, meaning 99% of machines you come across will be lacking what XNA 2.0 needs. There is a 2.5MB standalone installer on the MS download site here which installs what you need even on .Net 2.0 SP0 machines. .Net 3.5 installs Net 2.0 SP1.

So if any of the following are installed, we safely have the right Visual C++ 2005 runtimes:

  • .NET Framework 2.0 SP1
  • .NET Framework 3.5
  • Visual C++ 2005 SP1 Redistributable

By looking up the product codes in the registry, we can also check at runtime if we have the runtimes (again, before game.Run()):

public static extern Int32 MsiQueryProductState(string szProduct);

…goes before the main application entry point, and

bool vccOK = false;
// check for VC++ 2005 SP1 redist (very rare in the wild)
if (MsiQueryProductState(
"{7299052b-02a4-4627-81f2-1818da5d550d}") == 5) vccOK = true;
// check for .NET Framework 2.0 SP1
if (MsiQueryProductState(
"{2FC099BD-AC9B-33EB-809C-D332E1B27C40}") == 5) vccOK = true;
// check for .NET Framework 3.5 (includes 2.0 SP1)
if (MsiQueryProductState(
"{B508B3F1-A24A-32C0-B310-85786919EF28}") == 5) vccOK = true;

If vccOK is still false, exit the application before you call game.Run().