Saturday, November 24, 2007

Air scare crunch

Fun with HTML, JavaScript and Adobe Air

I've been tracking Adobe Air for a while now, since it was called Apollo in fact, and earlier this year we ran a couple of tests for some of our prototypes. Last Thursday I caught one of Adobe's CS3 roadshows in Sheffield and got an overview of the latest release of Air which brought it back to mind.
For the last few weeks I've been hacking together some sweet AJAX for the interface for our upcoming alpha trial - after running into the same old IE doing it's own sweet thing nightmare I realized that wrapping the whole app up in Air and deploying to the desktop might solve all manor of headaches.

So, easy thought I, simply run my app through the air 'compiler' and ship to all OS's and no longer worry about rogue browser behavior. The current iteration of our app doesn't need any OS interaction, taking as it does only with a Web server, so what could be easier.

Well, its not quite as easy as that. The new version of the Air beta is quite different from the one I was playing with a while back. See, the post load alterations to the 'web page' which is the bread and butter of AJAX have become a security concern, especially when you throw HttpRequest coupled with JSON into the fray. Imagine a suspect JSON payload being eval()ed and doing all manner of nasties - now imagine that running under a framework which can also read and write to you file system - ouch!

So, Adobe have implemented a security model which tries to rectify the issue by running two sandboxes simultaneously:
i) The Classic Sandbox which will run all you good old Web apps but not allow access to the Air API which gives access to the OS etc
ii) The Application Sandbox which gives access to the Air API set but will not stand for any of that AJAX fiddling.

The good news is that you can still have your nice AJAXy interface built the way you like to do it and make use of the API through the use of the 'Sandbox Bridge'.

What all this means is that you can't just take you existing web app and run it through the Air 'compiler' an end up with a desk top app. If you do, your JavaScript won't run and you may see an error such as "Error: Parsing Disallowed". This is because the default mode is to assume the more paranoid (safer) Application Sandbox.

I myself spent hours crawling the web trying to work out why my HTML/CSS/JabaScript app worked perfectly in the browser (IE max-height humour ) but failed to work when compiled to a .air file. All the docs I had were out of date. At first I thought maybe it was something in the JQuery framework I was using - but after building simpler and simpler test models I eventually realized that even an alert box called as a function with 101 JavaScript doesn't work!

Part of the issue was that I abandoned the command line SDK because I was having issues with the path settings - again the result of out of date documentation - and instead added the DreamWeaver Air extension. Now - I'm old school, I started my scripting long before DreamWeaver, GoLive et al came along and so it took me a while to find the 'site' arrangement. Any how, in the end I got my app together and ran it though the Air create extension, which worked smooth enough - but my app didn't work.
It was only after getting a little bash help (I swear I used to know this stuff in the early 90's) and running my tests through the command line SDK that I found the error message "Error: Parsing Disallowed" - which gave me something else to ask The Google. Which lead me eventually to the security model documents and some worked examples!

Now all this sounds a little bit like hard work especially if you have a nice Web app and all you want to do is port it to the desktop to start getting a feel for AIR!

Well, the fact is that it is actually very easy - its just new so there are precious few quick start idiots guides out there.

So if you have been harassing search engines with queries like "Why doesn't my JavaScript work in Air","Air JAVASCRIPT problems" etc, I hope the example below helps you.

So, how is it done?

Well - You create a new HTML file which is the root for your Air app (the file your air XML file calls root) and in this you call your app start page as an IFRAME. Simple as that - well for the base case anyway. This new Root HTML file is the place where you set up the Sandbox bridge and Application Sandbox etc too - but hey you can work up to that.

So by way of a helpful example:

Your App start page:

Lets call this HelloWorld.html

Your Air app root

Lets call this HelloWorldRoot.html

And finally your Application Descriptor File

Lets call this HelloWorld.XML

Download a text file here with all this code in for cutting and pasting.

And thats it - stick these in the same directory at run the Air command line at the XML file - job done!

Now you know how to get your Web app to work on the desk top you can start looking at interacting with the OS through the Air APIs and setting up you Sandbox bridge.

Read about the security model and why here.

See worked examples to help with your next steps here.

Labels: , , , , , ,

Sunday, November 11, 2007

More WGC news coverage ...

... this time on TV!!!

With the rest of the team quite literally spread across the world last week, it was up to Dave to represent us when 'NewsChannel 9' swept into the office to do a piece on our little start-up. I'm not sure how long this link will work but take a look at the news feature, you'll have to wait through a short ad first.

Also, I believe we made it to the print edition of Business Week last week.

Labels: , , , , ,

Thursday, November 08, 2007

OpenCoffee Leeds {Sei} - The Low Down

November 6th was the first Tuesday of the month and that means only one thing ... OpenCoffe Leeds. (Actually it means many things, not the least my Mum's Birthday! - but you get my point)

So the 6th OpenCoffee Leeds, on the 6th of November saw a happy band of loose affiliates and common interest holders once more descend on the venue and partake of the refreshments and WiFi all kindly provided once again by Justin.

Having pulled a couple of all-nighters, the feeble efforts of his ring tone invoked by my incessant stabbing of redial were inadequate to rouse Imran from his well disturbed slumber and so he never made it. Which is a shame, firstly because there were a number of interesting newcomers and secondly because it falls to me to report on the event!

Not the biggest turn out but we did notch up 23 concurrent OpenCoffee-ers (?) and see around 27 people in total pass through at some stage. Word on the street has it that many people were at their home/office frantically working on their demos and presentations for BarCamp.

As per usual we managed a nice spread of geeks, designers, entrepreneurs, academics, Venture and other generally tech related peeps.

It was heartening to see that the new faces doted around the place were getting actively involved in conversations. Had I realized I'd be on point as official correspondent this month I would have made more of an effort to get round everyone, as it is I got drawn into a number of very engaging discussions. However two stories I can recount are illustrative of the day.

1. Richard came along for the first time. He is overseeing the set up of interesting new MVNE company smallPlanet based in Huddersfield, and was fortuitous enough to be able to discuss the ins and outs of making a success of a small Telco player with Plus Net founder and tech business guru Lee Stafford.

2. Paul, a biochemist based in Leeds came along for a very different reason. He has a couple of very intriguing business ideas which he and a partner are currently developing. Paul is a smart guy but not well enough versed in computing to get a handle on the tech requirements of his product and so was seeking some assistance in this regard. Firstly he came away assured that yes indeed, there is more than sufficient talent around the area to help him spec up and build his product. Secondly that it wasn't necessary to blat around Cambridge, London or Silicon Valley to get tech startup funding (I was not the only one present to speak from personal experience on this topic). Finally he came away having met people who could either offer advice, help him directly or refer him to the tech talent he is going to need. And really, thats what this thing is all about.

Best of luck to both Richard and Paul and to all the others in the region who are cracking on and launching their own ventures.

No photos this month I'm afraid!

The December event is set for Tuesday 4th once again at Loftart on Vicar Lane - details of everything cam be found on Upcoming.

Labels: , , , ,

Friday, November 02, 2007

In the news!

One of my most time consuming gigs this year has been as VP Engineering for startup WGC. We have spent a lot of time hacking away in our 'Lab', talking to potential collaborators and presenting at academic conferences fueled by a mix of visionary angels and belief.

In the new year we are set to unleash our first trial product, which will be installed in a student dorm at Syracuse University, NY. Now that we are on the verge of presenting something real as opposed to our demos and prototypes we are getting a great deal of Interest. Lee and Norman especially are dealing the with daily amourous advances of potential larger investors, industrial partners and customers.

Of course we have all had a strong belief in our technology and vision for some time but its nice when that potential starts to be recognized in wider circles and so I have to admit to being somewhat excited that Business Week saw fit to cover us in a story which pretty much gets the key concepts across.
Of course I'd have liked a little less emphasis on content sharing and more on Personal Infrastructure and hardware resource sharing - but in truth it has taken us a while to work out how to talk about these things in the wild and would probably have bogged down the article.