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.
<examplelist>
  <item>A</item>
  <item>B</item>
  <item-ref uri="itemC.xml"/>
  <item-ref uri="itemD.xml"/>
  <item>E</item>
</examplelist>
I had implemented an adapter to transform an ItemRef instance to an Item, but the following code did not work as I had expected.
@XmlElements({
  @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.

Anyway.
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

XBoxing

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)

Thursday, 5 August 2010

3WR: Inception

Cinematic and engrossing.

Thursday, 22 July 2010

3WR: Toy Story 3


Must... not... cry...

3WR: IMAX 3D


Not very impressed.

Thursday, 8 July 2010

3WR: Predators

Wanted everyone dead.

Thursday, 1 July 2010

3WR: Shrek Forever After

Good. Not great.

Monday, 7 June 2010

Too Much Bluetooth

I set up my bluetooth headset to work with my laptop today for skype.
I also set up my nexus one to play music on the TV through the dock (which, it turns out it does using bluetooth).
Imagine my surprise when my laptop suddenly started talking to me! It seemed that my laptop had connected to my phone and set itself up as a headset. It then automatically answered an incoming call and put it through the laptop's speakers (and microphone) without any sort of prompt!!!
On top of all that, disconnecting the laptop as a headset caused the phone to dial my Dad!!

I think I have it sorted now by completely disabling the laptops ability to be a headset. Hopefully my work phone is not involved in this conspiracy.

Thursday, 27 May 2010

3WR: Prince of Persia

highly entertaining fi... wooosh...
action packed enter... wooosh...
time travelling

Friday, 7 May 2010

First Impressions: Rotobrush

Following the (relatively quick) install of Production Premium CS 5, I imported the project files I used for producing my latest DVD into the new versions of Premier Pro, Encore and After Effects. All of them loaded fine and I saved out some CS5 versions for later use. I then jumped straight into After Effects to try and implement a shot using the new rotobrush I did not have the time and patience to do with manually controlled masks.
At one point in the show, the 2 leads are singing a duet, with a pretty full stage behind them. The problem is that to make things easier for the cameraman, and due to the camera positioning, the depth of field was pretty big. This was OK for most of the show, but in this one shot as the leads sing to one another, one of the background characters is right in the middle of the shot looking out from between them. Now I could have fixed this in CS4 if I had a lot of time. I could have created an adjustment layer and focus blurred the background, leaving the two leads in focus. This would mean manually masking out the two leads for each frame of the shot.
The shot is about 40 seconds long, that would mean manually drawing the mask for 960 frame!
With the release of CS5 the rotobrush was announced, and for me this was the decider as to whether I upgrade or not. I will be using this tool a lot.

The red will be blurred...

So I loaded up the clip, drew a stick figure over the two leads and "hey presto" they had a nice purple outline around them. It wasn't perfect, but it didn't take long to tidy up. I then hit play and watched as it process each frame in turn. When it went wrong, I corrected it then continued to play. After a while, however, it stopped tracking and simply played back, there was only a purple box around the whole screen. After some trial and error, it seemed that it would calculate 9 frames each time I made a change, then stop. In order to progress, I would make a minor change to the rotobrush area every 9 frames, while reading the manual in between.
It was some time before I realised what I was doing wrong. When the brush is used, it creates a base frame. All the changes are tracked from this frame for a limited time, so as to preserver resources. In the rotobrush view, there is a track under the timeline that highlights the base frame and displays the span (the frames that AE will rotoscope for you). By default the span was 9 frames. I simply had to click and drag the end of the span to where my effect would end and it would do it all for me. (The reason I had missed this before was than my source clip was much longer than the bit I was editing, so the track seemed to be showing a single dot when zoomed out.)
Unfortunately, due to the way it works, all changes are calculated from the base frame. Once that is set and the span extended for 40 seconds, when you click on the last frame of the span, all of the frames before that must be calculated for it to display. It still takes a long time to create the mask, but at least now it is my computer doing the work and now me!
Well, at least I know it's working in 64-bit now...

What A Wake Up!

Having watched the election results with fascination for some time last night, I was awoken this morning by a banging on my door and a very nice delivery man handing over the CS5 version of Production Premium.
I sit here now, listening the the fact that we have a hung parliament, still bewildered by the fact that hundreds of voters were turned away from the polling stations, swigging coffee to stay awake and installing new software (only had 5 hours of sleep after following the election results).
The biggest election surprise for me (and many others by the sounds of it) is that the Lib Dems have actually lost more seats than they have gained and that their overall votes have increased by only 1%.
On a local note, Oxford East is looking like a spot of Red in a sea of Blue as Oxford West has now gone from Gold to Blue.
http://news.bbc.co.uk/1/shared/election2010/results/constituency/d47.stm

Sunday, 2 May 2010

Important Note:

When creating DVDs, do not forget to credit the director.

Friday, 30 April 2010

3WR: Iron Man 2

Iron Man, improved.

Tuesday, 27 April 2010

3WR: Date Night

Very, very funny.

Tuesday, 20 April 2010

Android

So yesterday I decided that I would look into what is involved in writing an app for Android, Google's mobile phone OS.

I downloaded the various SDKs, eclipse plugins and emulators and spend about half a day setting them all up (Tip of the day, if using this in a Jazz client, change the Jazz client to use a Sun JVM instead of the default IBM one).

Once the set up was done, I jumped right in at the deep end and started to put together a UI for a very simple app designed to display a D&D character builder save file. I originally tried to build the UI using java, but nothing appeared. Puzzled, I looked through a the docs and tutorials and nearly everything used XML files to define the UI instead, so I tried that and quickly got something up and running. It wasn't pretty, but it did the job.

I'll reserve judgement until I see how hard it is to make it pretty (including the support of changing orientation to landscape).