Wednesday, November 26, 2008

Indoor Positioning using Wifi

SCYP LogoHave you ever wanted to pull up a floorplan on your mobile device to help you find your way?

Jorge Silva, our mobile lead here at the ATRC, and students Jamon Camisso, and Yura Zenevich gave a lunch talk the other day to show off the state of their Wifi based indoor positioning system. It seems they have managed to get within 5 meter accuracy using existing WiFi points and some nifty statistical algorithms. Jamon is looking at how this technology might tie into geolocation efforts such as Mozilla's Geode. We'll also look at connecting with efforts in GNOME, AEGIS and other projects. Exciting stuff.

Here's the quick upload of the talk in five parts. Captions are coming, and apologies for the lighting.

This work is done as part of the SCYP project and like many innovations is coming from an accessibility angle. I think this work provides a nice foundation for all kinds of student engagement here at the University of Toronto and elsewhere.

Thanks for reading.

Friday, November 21, 2008

There's something about prototypal inheritance...

Let's look at some JavaScript, and today I'll ask Crockford to pass the sugar:
Object.create = function (o) {
function F() {}
F.prototype = o;
return new F();
};
Now let's create an object a, and a two objects b and c based on a.
var a = { name: "a" };
var b = Object.create(a);
var c = Object.create(a);
c.name = "c";

At this point both a and b have name "a", and c has a customized name "c". Now lets change a:
a.name = "foo";
Objects a and b now have name "foo", and c still gets to keep name "c" (a good language design decision methinks). Since a is just a mutable object we wield this sort of godly power to change or inject DNA. Every time I come back to it, it tickles me.

Sunday, November 9, 2008

Using .attr for ARIA in jQuery UI

Last week I found some time to hack on jQuery UI again. After talking to Scott we decided to pull the ariaRole, and ariaState API out of UI core, and put the browser normalization for ARIA right into the popular attr function where it belongs.

At this time, jQuery UI is a dependency for this enhanced attr function. We add the ARIA smarts in ui.core.js via proxy function, like this:
// proxy attr
var attr = $.attr;
$.attr = function () {
// if aria usage then normalize
// else
attr.apply(arguments);
};
See the patch for the real deal. You might notice that we actually only proxy if a naughty browser/version is sniffed. Let's hope this ARIA normalization business won't grow too big and complex when the other browser ARIA implementations roll out. If we can keep it small and tight the attr enhancement really belongs in jQuery core. Or maybe it belongs there regardless? If you are doing Web2.0 development you're probably going to need it.

Here's an example of how one might use chaining to add the ARIA role of "tab" to all elements with a class "ui-accordion-header), and the ARIA state "aria-expanded=false", and add the ARIA role "tabpanel" to the next sibling of each (which happens to be the panels).
$(".ui-accordion-header")
.attr('role','tab')
.attr('aria-expanded','false')
.next()
.attr('role','tabpanel');
Working with Scott González and others on jQuery has been a very meaningful aspect of my Mozilla Foundation grant. Thanks Mozilla.

Thanks for reading.