Monday, 23 November 2009

XML Namespaces

Recently I have been lucky enough to be working on a project that uses LCDS so I don’t have to write XML translators – all the objects arrive from server ready typed – it is soooo much easier and saves an awful lot of time.

At home though I have started working with the Picasa data API which means I am back to writing translators.
This is a job I really don’t like – it never works the first time and takes a lot of trial and error to get it write. I am actually going to write a base translator class to make it a bit easier the next time I have to do it.

Getting to grips with xml can be tricky but when namespaces are involved it gets exponentially more difficult and annoying!

I’ll make a note of the syntax of how to deal with namespaces here so that next time I’ve forgotten how to do it I can look it up.

I am trying to retrieve the href of the link node below with the relevance of self:

<feed
    xmlns='http://www.w3.org/2005/Atom'
    xmlns:gphoto='http://schemas.google.com/photos/2007'
    >
    <link
        rel='alternate'
        type='text/html'
        href='http://picasaweb.google.com/Giles.Roadnight'
        />
    <link
        rel='self'
        type='application/atom+xml'
       href='http://picasaweb.google.com/data/feed/api/user/Giles.Roadnight'
        />
</feed>

My first attempt was as follows:

var href : String = xml.link(@rel=’self’)[ 0 ]@href;

but that didn’t work. The give away is this line:

xmlns='http://www.w3.org/2005/Atom'

declaring the default namespace for the xml. What worked in the end was this:

var atom : Namespace = new Namespace( "http://www.w3.org/2005/Atom" );
var href : String = xml.atom::link.( @rel == 'self' )[ 0 ]@href;

Hopefully that’ll save me (and maybe you) a few hours in the future.

Sunday, 15 November 2009

Picasa Web Albums Data API

I have previously tried to get Flex to play nicely with the Picasa API. I use Picasa a lot and host all my pictures there so to be able to do things with them with Flex would be very useful.

Before I have had issues as there was no crossdomain.xml but having had a look at the docs today this seems to now be fixed (or I missed it last time) as detailed here.

There are a couple of small projects I want to build on this API so it’s great that I won’t have to proxy these calls through the server.

Saturday, 10 October 2009

More Waving

I’m excited to learn that there is already an Actionscript client library that enables you to write a flex application as a Google wave extension!

Not sure what I would develop yet but there is a lot of scope for some cool apps I think.

http://code.google.com/p/wave-as-client/

http://wave-samples-gallery.appspot.com/results?q=flex

Google Wave – first impressions

I got my invite to Google Wave today and have had a bit of a play about. If you don’t know what it’s all about then here is a 10 minute video explaining the basics:

So far it’s a bit frustrating as I don’t know many other people who have Google Wave. I can see the potential and would love to be able to use all the features. I am actually organising a trip to Scotland for May next year with Linzi and 4 friends and Google Wave would be great to help organise that but only Linzi and I have access so we can’t use it.

So far I have installed Tweety which is pretty cool – you can get all your twits directly in Google Wave. I’ve also had a play with the map extension and the Sudoku extension.

So, if anyone from Google Wave is listening please give me 4 invites so I can use wave to organise our trip next year!

Monday, 31 August 2009

Flex, Blaze DS and GAE

I’ve spent a fair bit of the long bank holiday weekend trying to get Blaze DS installed on Google App Engine but frustratingly I’ve not managed it so far.

I was working off this blog post but when I tried to create a flex project it would not validate the Blaze DS server. I think it is something to do with the flex context root that  he is using in the example. When the validator tries to do a test on that context it doesn’t work.

I’ll have another go next time I have some time. It’s annoying when you can’t get these things to work.

Other than that I am very impressed with GAE – the eclipse plug-in is really easy to set up and use. It builds a sample site with web kit and a server call for you which works as soon as launch it.

I really hope I can get it playing nicely with Flex.

FlexUnit 4 Beta 2

A new version of FLexUnit has been released as blogged about here.

The biggest improvements on the old version is a really easy to use FlexUnit ant task to run your tests as part of your CI build.

There were a couple of teething problems with the first version that they released.
The first issue was resolved very quickly with a new release within 24 hours or so of the first release.
I managed to get round the second issue by tweaking and re-building the ant task so that it would work on 2003 server. This fix may now be in the trunk build but I haven’t checked.

There is still a bit of an issue with setting up a trusted swf so that the tests can run but I understand there is a fix for this on the way.

Windows Live Writer Re-Install (again)

I’ve just had to go through another round of re-installing Live Writer and deleting any settings files that I can find.

The fix that worked last time for Live Writer not starting didn’t work this time but a re-install did.

I’ve looked for alternatives but have not been able to find anything that looks as good.

Any suggestions?