Log on:
Powered by Elgg
Spreadfirefox Affiliate Button

Steve Lee :: Blog

December 11, 2009

The web has evolved into a flexible platform supporting the creation of innovative web applications. Features and resources of web services can be combined into so called mashups which build on those features and create something else, hopefully better. These so called Web 2.0 mashups are enable by Application Program Interfaces, APIs, which provide a controlled mechanism for programmatic access to the shared web services.

For example Google search facilities, Googler maps, Flickr photos and Yahoo services are all available through APIs and accordingly  can be used in web sites and web applications for all sorts of interesting (and mundane) uses.

I recently designed and created my first RESTful web API for accessing an open symbol set designed for a primary use in accessibility. I found it an extremely interesting exercise, resulting in my having a clearer understanding of how and why the web works so well. The primary reference here is Fielding's dissertation, but be warned, it's a fair old read and only part covers REST directly, the rest being full background.

RESTful APIs eschew the approach of SOAP and other API protocols which basically use HTTP as a low-level transport for more complex protocols. Protocols that require fairly heavy weight libraries and have a high entry level, requiring reasonably complex development skils. In comparison REST uses the characteristics of the web that web developers will be familiar with. This offers low barriers to adoption which is important for encouraging innovation.

Simply stated, in REST, an URL (URI if you like) identifies a resource which represents some data or object. The resource is accessed in some encoding format that allows it to be sent over the wire. The HTTP verbs like GET, PUT etc. provide the actions you can perform on these resources. That's pretty much it. Nice and simple.

You can often type in a URL in a browser, which automatically does a GET, and see the representation of the object in the output window.; this allows very easy exploration of the API. Writing data through a PUT is a little harder as you can't (usually) do directly from a web browser UI. I guess you could use a TELNET terminal, but usually you write a little javascript code. However the code that uses an API can be client side in the browser or server side using ascription language of choice, allowing flexibility in how web apps access data exposed via APIS. Originally the format used for resource representation was XML but these days JSON is the format of choice (although some APIs also provide a PHP friendly format).

The API I created is for access to the straight-street.com Mulberry open symbols. Hopefully this will encourage innovation for users with disabilities who use symbols for communication. Symbols are small pictures or icons and are vital tool for many who have difficulties communicating with speech or find it hard to understand written text. The Mulberry symbol set from Straight-street.com is a new and growing set of symbols designed to be used in a range of applications and licensed in a way that allows unrestricted use, copying or even modification without cost. The only requirement is that Straight-street are attributed when they are redistributed or modified and derived works are shared under the same licence. In addition the symbols are peer reviewed and selected with people such as speech and language therapists (SALTs) using the web site to request and review new symbols.

In addition to having zero cost at the point of use, the symbols may also be freely redistributed, making them ideal for use in web applications that can take can advantage of the latest technology for new ideas and allowing community sharing of resources that utilise the symbols. Resources such as communication charts, a standard tool consisting of a set of symbols used to indicate specific requirements by some form of pointing.

Providing public API access to the straight street symbols will hopefully encourage their uptake and use in applications that have yet to be invented. The API has been initially designed to support the development a simple communications book program that allows the selection and organisation of symbol charts followed by printing the pages. It is expected the API will be extend to give access to these charts.

The current beta API provides access to symbols using a search mechanism similar to that available to users of the straight-street website. The symbols and tags can be explored using URLs in much the same way as a user following website links, By accessing URLs as described information such as the symbol name is available for consumption by web applications. URLS provided in a resource can be used to navigate to a related resource. The data is visible as text in a web browser (mime type text/plain), allowing the API to be explored manually. The symbol images are also available via URLs in various formats including png. wmf and SVG. Sets of symbols are returned in pages, each of which has a link to the next page if one exists. Additional information such as  the current page number and the total number of symbols in a set is also provided.

The data accessed via the URLs are formatted using JSON, a popular and light weight way of encoding structured data. It is easer to work with than XML using popular libraries which convert to/from code objects. These are available in javascript for use in a browser or several other languages for server side access.

The API is implemented using the Python programming language and given the hosting facilities at UKFSN.org that meant creating good old CGI scripts. Actually a single script is used and Apache web server's URL mapping facilities of modrewite are used to invoke it from various URLs. The script determines how it was invoked and responds accordingly. A couple of modules are used; simpleJSON and MYSQLdb to encode data and access the database respectively. Coding proved straight forward though it took a while to work out one of the standard CGI variables has changed name and there are still some issues with returning the correct HTTP headers for error conditions.

The biggest challenge, and most fun, was deciding the actual URLs to use and what should be in the query part of the URL. I researched, asked people like the SAKAI developers, and looked at various examples in order to work out the parameters for 'good' design. I think I have a reasonable solution - but do let me know if you think otherwise.

One issue that is common to any web browser application that accesses web services is the ban on cross domain access by AJAX XMLHTTPRequests. Basically this means scripts can only access apis on the same server that they are themselves loaded from. There are a handful of well know work arounds to this security feature  (who said hacks at the back there?). These include providing a small proxy web program on the server that reroutes requests or getting the server to return the resource in a format that can be invoked (actually a function call). The later is also know as JSONP and is a big hack using the fact that scripts can be loaded from any domain yet still be run (scary indeed). JSONRequest is a proposed standard solution and it is hoped all web browsers will eventually implement this. For now there is a Firefox plugin if you can restrict the use to a single browser.

We also created a simple example web application to aid exploration of the API. This allows a tag or symbol name to be searched for and the selected symbols are then displayed in various formats.

Do have a play with the API and let us know what you think. You can use the example web app as a starting point for hacking.

Keywords: Accessibility, JSON, REST, symbols, wab applications, web, web 2.0

Posted by Steve Lee | 0 comment(s)

October 08, 2009

I'm disturbed to find that general application support for W3C's SVG Scalable Graphics Format is, well, to be frank, pathetic. I'd be pleased to be told otherwise, but why is it I can not find an open source word processor or indeed general document program that will embed SVG pictures. i.e not just open them for editing in a graphics editor, but actually use them to communicate something in a document. Sure the expensive proprietary DTP tools do.

You certainly can't in Open Office, despite it being one of the most requested features, A bounty exists for import SVG but not embedding. Come on guys.

The straight-street.com Mulberry open symbol set is designed for communications purpose, especially for those those who experience difficulties. We provide it in SVG as an option and I encouraged this for many reasons, including:

  1. Excellent vector format [should be] usable on all platforms (currently supported in file browsers on Linux and OSX, 3rd party add on for Windows);
  2. Open standard (from the W3C no less);
  3. As an open standard it works well with open content and open source solutions;
  4. Web friendly so ideal for use in web applications;
  5. Technically superior to WMF which is available only on Windows. WMF is proprietary which make it useless for an open symbol set;

Now we have reached the 1,000 symbol mark we want to start seeing it used more. The best current option is to use non scalable formats like png which makes a very poor substitute to a scalable image. Even on Windows the old WMF format has patchy support in applications.

Is this something Raising the Floor or AEGIS can sort out? Quickly?

My challenge is this

Let's make SVG as easy to work with in documents and ALL accessibility programs as raster formats currently are.

If we can sort out the open source solutions then the propritary folks may follow. There's even the libsvg and librsvg libraries to give you a coding head start.

</rant>

Posted by Steve Lee | 0 comment(s)

September 21, 2009

My son and I spent the weekend in Belstone, North Dartmoor with 14 other Dads and Lads from Belmont Chapel, getting to know each other and generally 'hanging  out'. The organised activities included a quiz, a competition requiring us to act out daft scenes with glow sticks, a walk, bonfire, toasted marshmallows. The lads produced a video of what they thought schooldays were like for us Dads (which was not so far from the reality in places) while we watch a well informed DVD on the relationship youngsters have with tech, now and near future. I definitely feel the benefit of an improved relationship with my son as well as having a great time.

For me a highlight was when our leader Brian led us up a ridge at 19:55 to watch the international space-station cross the sky. Though it was barely dusk the station was brighter than Jupiter, which was also visible, and moved across the sky in about 5 minutes before fading as it neared the horizon. Excellent.

Keywords: Belstone, Dads and Lads., Space station

Posted by Steve Lee | 0 comment(s)

August 11, 2009

Given a free choice these days I prefer to program in Python. There are a number of reasons for this. For example it hits a sweet spot by being an expressive high level scripted language which allows a range of programing styles and comes with many useful library modules. In addition the community that maintains Python is a good example of open development in action, with Guido taking the role of benevolent dictator for core language features.

I'm currently developing an accessibility program, Maavis, for Sheffield University which uses Javascript to program the Mozilla XUL platform (as used to create Firefox). Javascript is also a flexible scripting language with it's own style and is best known (and perhaps most often badly used) in the context of a web browser with it's attendant object models. However it is also suitable for a wide range of applications where Python might also be chosen.

While searching Mozilla's development documentation for some XUL or XBL feature or other, I stumbled across the pages describing newer features og Javascript. Some are in the related ECMA 5 standard AKA Javascript 1.9. These features have obviously been influenced by some of the more recent Python language additions that can make life much easier and code more succinct. If you get your Jaavscript knowledge from the popular language web pages or even David Flanagan's excellent, if bulky, JaveScript: The Definitive Guide, 5th Edition, then you will may not be aware of these features. However as currently the only browser to support the very latest Javascript 1.8.1 is only Firefox 3.5 you won't be able to use them for web code. That's not a limitation for XUL developers including the many Firefox add-on developers.

So here's a little example from the Maavis code of the sort of simplification that can be gained. Functions like the DOM getElemementsByTagName() return nodelists, which act a little like arrays. NodeLists implement an item() method, the equivalent [] operator and a length property. Accordingly the way to iterate over them is to use the idiom that first saw the light of day when C arrived (unless it was also in B), namely

    for (i = 0; i < list.length; ++i)
doSomething(list[i]);

A while back Python unified all iteration into a simple scheme allowing the for .. in ... loop construct to be used on any iterable object, whether a collection or a type of function called a generator. This acts more like the C# ForEach. For example in Python

    for element in list
doSomething(element);

In Javascript 1.6 you can make an array from the nodelist and then call the forEach method to call a function for each element. Further Javascript 1.7 introduces array comprehensions that provide neat syntax to do this.

However another approach is to use a generator function that returns an iterator which in turn returns the next value on demand. This is perhaps easier to show that describe.

function nodeGen(nodelist)
// so we can iterate over HTML nodelists
{
for (var i = 0; i < nodelist.length; i++)
yield nodelist[i];
}

And we call it like so...

    for (var element in nodeGen(list))
doSomething(element);

The first time nodeGen is called it returns an iterator which is then used by the for statement to get at each item in turn. Each time the iterator's .next method is called it returns a value from the yield statement. A feature of generators is that they create each value on demand, whereas an array will have all values in memory.

The nice Pythonic features to look at are; array extras, iterators, generators, generator expressions and list comprehensions. Enjoy.

Posted by Steve Lee | 0 comment(s)

June 12, 2009

Last week I attended the AEGIS (#aegis) open accessibility workshop and came away with a sense that something good is happening to European open accessibility. Below are my personal thoughts and a more detailed 'official' report is available on the OSS Watch blog.

In addition to hearing more about AEGIS, the workshop offered the opportunity to catch up with old friends and e collaborators from the Ace Centre, OATSoft.org, aIDEAS & Mozilla as well as being something of a 'tweatup' for those who follow each other on Twitter, including Henni of Opera, Steve Faulkener and Gez Lemon of TPG and Davis Sloan of the University of Dundee. There was woefully little time to chat and I completely missed David Banes of AbilityNet and David McKay of Inference Labs, Cambridge (Dasher is an alternative text input program). I did finally meet Jutta Treviranus, director of ATRC at University of Toronto. Jutta is the boss of long term open accessibility developer David Bolter (e.g. GOK, dojo, ARIA), and we also heard the news that David is taking a years break from ATRC to work on Mozilla core accessibility with Maroc and Surkov.

I was pleased to see a place for the open accessibility projects I have been personally active in. In addition to key projects such as Mozilla, GNOME and NVDA I saw some potential for those I have been closely involved in as a developer; Simon Judge thought Maavis has something to offer in many use cases, and the straight-street.com open symbol set has much to offer. Jambu may also be useful as a starting point for some work. I'm not sure about PowerTalk as it relies on MS technologies but at least that is now included in the EduApps USB stick collection. Greg again mentioned his interest in OATSoft.org as providing the master list of projects, though the announcement of the OAEG seem to indicate it would be providing similar functionality after all.

Posted by Steve Lee | 0 comment(s)

March 31, 2009

Access Apps stick with a tartan ribbonDuring the AccessApps presentation at the JISC conference, JISC kindly offered to fund a stick for all attendees. Mine arrived fresh from the AccessApps team resplendent in a Tartan ribbon, possibly Buchanan muted. Nice touch

Posted by Steve Lee | 1 comment(s)

March 26, 2009

Wrote an article introducing open accessibility for Open Source Schools at Miles' request.

Posted by Steve Lee | 0 comment(s)

March 25, 2009

I attended the JISC 09 Conference ( #jisc09) representing OSS Watch and along with Gabriel Hanganu held camp at our stand, talking about our work and advisory service. JISC funding proposals recommend discussion with us and several people approached us about their work and others had questions about open source in general. We had info packs that include several of the very useful reports on our website and also the OSS Watch National Software Survey 2008 report .

I was also there to meet the AccessApps team and present a report to them on how OSS Watch could help them open up their development of their collection of open source and free accessibility programs (and others) that run from an USB stick plugged into a Windows PC.

The following is a quick summary of my observations on the OATS and accessibility side, which was much higher profile than I expected.

Lizbeth Goodman's keynote is available as a podcast (hopefully video soon) and she mentioned AT and Open Source several times. Also showed Mick Donegan's work with myTobii and COGAIN. Her dance performance work put Drake Music Project and Tim Anderson's E-Scape in mind. Lizbeth is now Reserach Director at Futurelab so we can expect accessibility and open source to be on their agenda as well as all those great games and innovative mobile exercises like Mud Larking in Depford.

The AccessApps team's presentation was fun and introduced open source and free accessibility programs to the attendees. Dasher got a quick mention with another cameo from Mick. They had the great idea of getting people to discuss the programs listed on bits of paper inside a large cardboard USB stick an decide which would be useful. That got the chap next to me very interested and he was only there on a whim (he may include FOSS in his ICT HE teaching, and I suggested contributions like testing/bug reports). Sarah showed me the attractive (and pointy) trophy they won for their work at the Scottish open source awards.

I also chatted to E.A . Draffan and watched her Lexdis 10 min speed demo. Lexdis is an excellent resource, very much a labour of love with much developed by students themselves. I'm pleased to hear it will live on in a "new improved"  form in collaboration with TechDis.  As always E.A had good project ideas and was briming with enthusiasm.

From a brief chat with Sal Cooke, director of TechDis, it seems they are now taking a very broad view and planning to embrace "the cloud" and mobile spaces in interesting ways.

Posted by Steve Lee | 0 comment(s)

February 26, 2009

In the space of the week we have 2 excellent guides that will help users of Open Source:

  1. Mozilla's Community Marketing guide
  2. Stormy's Best Practices for Creating an Open Source Policy

One provide many ideas for telling people about open source projects and the other how to ensure you understand and control how you use and contribute to open source.

We also heard that the UK Government have refreshed their Open Source Policy with a new Open Source, Open Standards and Re–Use: Government Action Plan and aggregating website for the tag #ukgovOSS .

Keywords: Government, open source, policy. marketing

Posted by Steve Lee | 0 comment(s)

February 18, 2009

After a recent ADSL outage at a critical time I decide I needed a backup and Mobile broadband seems reasonable now the price has dropped and there are some OK pay-as-you-go deals around along with wider 3g network coverage for speed. A limitation is that it's not shared between computers as you have a USB dongle modem (though I see 3 do a router that you can plug the dongle into). The other limitation is it not going to be fast, only reasonable where 3g coverage is available, painful where you have only GPRS. Still that will be OK for emergency backup use and occasional trips like for the weekly OSS Watch lovein.

Anyway after looking around I settled on T-Mobile's PAYG plan (UK) as having the best deal for my usage: £39 for the USB modem dongle, £2 per day with £7 per week and £10 a month options, all with a 3GB monthly fair use (i.e they send you a letter, not cut you off). Vodaphone were second with non time-limited topups. In all cases you can ignore the speed claims (I'm getting 530/265 at home according to speedtest.net so that's equivalent to first generation ADSL). T-Mobile also wins for giving access to wifi hotspots in places like airports and Starbucks (but I've not tried them yet and it looks like it might need a plan extension). A caveat is that VOIP like Skype is blocked unless you go for a more expensive plan option.

As for use in Ubuntu it just works with the Network Manager in 8.10 Ibex. Just plug in the dongle, select UK, T-Mobile and that's it (go to the network manage applet in the top panel if you don't get a dialog).

Anyway here's a few notes that might save you some hassles

  • Buy the modem from the T-Mobile online shop. It's £10 cheaper than all the shops I saw it in.
  • There's conflicting information as the shop says the stick is a 110 but its actually marked as a Huawei E160 and Network Manager thinks its as E220/270. Still it works.
  • In order to use it you need to link a credit card to your account and top up the account. The official way is to register the account on the myt-mobile website (from an existing Internet connection). You can phone tech support as I ended up doing when I did not spot the phone number you require to procede. The phone number DOES exist for the modem, look for the 07**** number with a barcode on the packaging and even the despatch note. You get emailed a pin for first login but this can take up to a month (so I was told, but cannot quite believe) and I certainly didn't get mine, again tech support sorted this out.
  • As always get past front line support - it sucks. The Technical support (0845 4122993) are a great help, knowing most things and they even set up my account and credit card etc.
  • It's going to cost you £2 just to test it out so plan to use it on the same day if you can risk leaving it till then (ok so I'm tight).
  • In order to get the week or month you need to get a pass by texting a number using the software they supply. Yes, you knew it. it's only available on Windows (fail). However despite the 'sod you Linux and Mac users' notes in the manual, I'm told you can call support and get them to do it assuming you have a enough in the account. I just spotted a web app for texting on the myt-mobile site so perhaps that will work.
  • You'll want to call support to remove the content block
  • Pictures are compressed (so look grainy) apparently the software can change that, but that's not available on Linux/Mac. There must be an API on the modem so hopefully someone will fix it.
  • Oh the myt-mobile registration form is an accessibility travesty - tab doesn't work and there's a great example of a non accessible CAPTCHA.

Keywords: Linux, mobile broadband, T-Mobile, ubuntu

Posted by Steve Lee | 0 comment(s)

<< Back