Wednesday, 8 January 2014

Using JAXB to Parse a List of Items and References

I recently hit a problem using JAXB to parse a list of items in XML that contains both the actual items and references to items.
  <item-ref uri="itemC.xml"/>
  <item-ref uri="itemD.xml"/>
I had implemented an adapter to transform an ItemRef instance to an Item, but the following code did not work as I had expected.
  @XmlElement(name = "item", type = Item.class),
  @XmlElement(name = "item-ref", type = ItemRef.class)
private List<ability> items = new LinkedList<item>();
Instead of applying the adapter to the item-ref elements, it applied the adapter to all elements mapped to the list (it took a while to work this one out). The fix was to create a new adapter class that mapped Item to Item and use this as the adapter for item-ref elements. If this adapter was passed an ItemRef, it adapted it to an Item, otherwise it returned it unmodified.

Thursday, 28 October 2010

Why Software Needs QA

(or Blow this for a Game of Soldiers)

Yesterday, I returned my copy of Medal of Honor for a refund due to it being faulty. I went prepared for a fight as refunding software is notorious for being "against policy" at many places.  The reason for this attitude was that my complaint was that the software was faulty, not the disc.

I had only played the game for a total of a few hours, but had hit two very similar, critical issues. In one mission I was instructed to infiltrate a warehouse only to discover I couldn't open the door. After some time searching for another way in, I became suspicious and checked on-line. It seemed many people were getting stuck in all sorts of places due to issues like this. Restarting from the last save point made no difference, I had to start the mission again from the beginning. This time, another member of the squad, who was MIA in my first run through, opened the door for me.
In the next mission, a team mate said "follow me" and ran into a building. I tried, I really did, but for some reason I could not walk through the open door! At this point I popped the disc and took it back to the shop.

There is no way I should be hitting bugs like this in released software. As a developer I can understand and forgive the odd issue (coding is a complicated business), but glaring errors that affect many people should really have been picked up before release and any competent play-testing should have found these issues.

I can only imagine that it was tested by people who knew what they were supposed to do and followed a precise path as it seems that some sort of event was failing to be triggered. This has been my argument for QA or testers for software in the past. Programmers should not be trusted to be the only testers of their own code, they will only test for paths they can think of and it is was they didn't think of that needs testing the most.

Tuesday, 28 September 2010

Star Wars RPG, What Next?

Since Wizards decided not to renew the Star Wars license for their RPG (and minis game) I have been waiting for an announcement from some other company to say they will be releasing a Star Wars game instead. So far none has been forthcoming.

I have recently been wondering about the possibility of trying to drum up support for a community written/supported RPG. I'm sure the fan base is there, we just need a few individuals to get the ball rolling and to start working on a system and rules. The eventual aim would be to become officially licensed in some way.

I had been thinking along the community driven development for my own system (which may see the light of day sometime), but with the name Star Wars there should be more people interested in getting it started.

Android 2.2.1

It's here, but no-one seem too sure about what has changed.

Well one thing has definitely been added, the ability for android to force a PIN or password on access if requested by an exchange server. Our server at work does such a thing, so while I am happy that I can now access my work e-mail, I am saddened by the fact that I no longer get to use the 9 dot pattern login.

Monday, 27 September 2010

Retro Weekend

This weekend I decided it was time to free up some space under the TV and get rid of my old Nintendo consoles. Since I had not used either the SNES or the N64 for over a year I decided it was time to move on.

Having decided to get rid, I spent some time this weekend dusting off the consoles and games and checking they were in working order before putting them on eBay. As I worked my way through the collection, checking things worked and deleting save games, I got a little misty-eyed as I recalled old friends whose save games I deleted and remembered some of my favourites from years gone by...

The upshot of this is that once the consoles and games were tested and packed up ready for sale, I decided to browse the marketplace on my new(ish) xbox and see what I could find of those games that I ended up playing more than testing. Seems a few are available for download, while others have modern-day sequels, I'll have to take a look when I have more money.

Still, I did discover the Game Room, a virtual arcade, on the marketplace and spent a little too long playing asteroids and pitfall on my modern wonder of entertainment.

Wednesday, 22 September 2010


Last night I discovered what a pain an xbox is to set up.

Maybe I'm getting soft and expect too much to just work. Maybe I was just unlucky. Maybe I should just stop whingeing and play some games.

OK, first I must admit that I did not read the instructions. I just plugged in cables where they fitted and then switched it on. That worked fine.

What came next proved more difficult.
I squeezed some batteries into the controller and pressed random buttons until something lit up. I then tried to sync the controller with the console.
I found the sync buttons pretty easier (if in doubt, look for small, unlabelled and out of the way buttons for syncing things), but I could not get the controller to sync with the console. I pressed the contoller sync and the light started flashing, so I pressed the console sync and the light started flashing. Eventually they stopped, but there was no connection. I tried in the other order. Same thing. I tried pressing both together. I tried holding one down while pressing the other. At this point I decided to read the manual.

The manual stated they should already be sync'ed (but mine was second hand) I eventually found the right page. It explained what I had already done. I tried again. It still didn't work. I kept trying. On the 4th attempt, the flashing stopped after a shorter amount of time and things moved on the screen when I waggled by stick.

I hadn't even started on the internet connection and half the evening had gone. Still the wired connection to the internet worked (although it seem rather slow to connect, hopefully this is just a first time usage issue) I don't plan on buying a wifi card for it as it costs more than a more generic (and useful) wifi-ethernet bridge.

Anyway, everything seems to be up and running now. All I need now are some games.

And a live gold account to play online.

And, apparently, some microsoft points.

And the wifi-ethernet bridge, of course.

Friday, 20 August 2010

Experiments into 3D Video

Now I don't have any fancy 3D TV or projectors, but I do have some old amber/blue 3d glasses lying around, so I thought I'd have  go at 3D  video on no budget.

I have experimented with 3D images before, using Poser and Photoshop, but this time I would be working with real-world video (not CG) so I needed 2 cameras for my DIY 3D rig. I have 2 cameras. I have a very nice Sony-Z5 for high quality video and I have a cheap little JVC Everio for anything else. The way that the amber/blue 3D glasses work (so I am informed) is the the amber image has most of the colour, while the blue provides the depth. So I decided to use the Sony for the amber (left) and the JVC for the right (blue).
The first task was to patch together a 3D rig to hold both cameras. I didn't have much time, or materials, so I came up with an interesting workaround. I set up the Sony on a tripod as usual, then used a Joby Gorillapod to suspend the JVC, upside down, from the microphone mount on the right of the camera. With a bit of trial and error I got both cameras at about the same level and zoom and started recording.

Once I had my footage I imported both into After Effects as separate compositions, created a parent composition containing the two and began the work of lining them both up. Obviously, the first thing to do was to rotate the JVC footage 180 degrees so that it was the right way up. Once I had done that, I created a solid layer in the parent composition and applied the 3d glasses effect. I will not be using this effect for the final result, but it is useful to set it up to interlace the videos while aligning.
While displaying the interlaced view in one window, I scaled, rotated, resized and distorted the JVC footage, until it was a close match to the Sony footage (as the Sony footage was to contain the details I did the work on the JVC footage).

Once the clips were aligned, I hid the solid layer and tinted the JVC composition so that it appeared in greyscale. Making sure the Sony layer was above the JVC layer, I used the Set Channels effect on the Sony layer, setting the blue channel to be sourced from the JVC footage's lightness.

Et VoilĂ !
(obviously you will need amber/blue 3D glasses to see the effect)