<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dougt&#039;s blog &#187; mozilla</title>
	<atom:link href="http://dougt.org/wordpress/category/mozilla/feed/" rel="self" type="application/rss+xml" />
	<link>http://dougt.org/wordpress</link>
	<description>best. tagline. ever.</description>
	<lastBuildDate>Fri, 29 Jan 2010 17:34:08 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Labyrinth Game in the browser</title>
		<link>http://dougt.org/wordpress/2009/12/labyrinth-game-in-the-browser/</link>
		<comments>http://dougt.org/wordpress/2009/12/labyrinth-game-in-the-browser/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 21:18:05 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[accelerometer]]></category>
		<category><![CDATA[device api]]></category>
		<category><![CDATA[MozOrientation]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=516</guid>
		<description><![CDATA[A few months ago, I mentioned the game Labyrinth and how I wanted this to work in the browser.  Syd Lawrence took up the cause and put together a cool implementation.
Play it here.  You must be running Firefox 3.6 RC or better.
This uses the new  orientation events added to Firefox 3.6.
Syd also [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago, I mentioned the <a href="http://dougt.org/wordpress/2009/08/orientation/">game Labyrinth</a> and how I wanted this to work in the browser.  <a href="http://twitter.com/sydlawrence">Syd Lawrence</a> took up the cause and put together a cool implementation.</p>
<p>Play it <a href="http://playground.marmaladeontoast.co.uk/labyrinth">here</a>.  You must be running Firefox 3.6 RC or better.</p>
<p>This uses the new <a href="http://hacks.mozilla.org/2009/10/orientation-for-firefox/"> orientation events added to Firefox 3.6</a>.</p>
<p>Syd also put together a demo of what orientation looks like for those that do not have Firefox 3.6:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="340" height="285" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/M5GMWaGiV1g&amp;hl=en_US&amp;fs=1&amp;border=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="340" height="285" src="http://www.youtube.com/v/M5GMWaGiV1g&amp;hl=en_US&amp;fs=1&amp;border=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>This web feature is going to be standardized in the <a href="http://www.w3.org/">W3C</a> in one of two working groups.   The general idea is to separate out acceleration (values in <a href="http://en.wikipedia.org/wiki/Standard_gravity">g</a>) and orientation (values in degrees for azimuth, roll, pitch).  More on that next year when we figure out where the work will be done!</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/12/labyrinth-game-in-the-browser/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Fast Flash in Fennec</title>
		<link>http://dougt.org/wordpress/2009/11/fast-flash-fennec/</link>
		<comments>http://dougt.org/wordpress/2009/11/fast-flash-fennec/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 20:14:47 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[fennec]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[npapi]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=506</guid>
		<description><![CDATA[For the last few days, we have been making Flash fast in Fennec.
Our situation in Fennec is that we have a hidden browser element that contains the flash object/embed element.  When a paint needs to happen, we draw whatever the plugin wants to draw into a canvas or sent of canvas elements.  These [...]]]></description>
			<content:encoded><![CDATA[<p>For the last few days, we have been making Flash fast in Fennec.</p>
<p>Our situation in Fennec is that we have a hidden browser element that contains the flash object/embed element.  When a paint needs to happen, we draw whatever the plugin wants to draw into a canvas or sent of canvas elements.  These canvas elements are what the user sees on the screen &#8212; they are part of Fennec&#8217;s tile manager.  Now these draws to the tile manager consistent of a 16bpp to 24bpp conversion (I am told that the flash is optimized for 16bpp), then a copy to a gfxXLibSurface, then a final blit to the screen.  This final bit also contains a 24bpp-&gt;16bpp conversion because the screen is 16bpp.  To make matters much worse, many plugins intersect multiple canvases in the tile manager which causes this drawing path to happen multiple times per video frame.  The end result is that we were getting no more than 4-5 fps.</p>
<p>We took some incremental steps to improvement performance, but we were no where close to double digit fps.</p>
<p>At this point, we decided to just draw directly to the screen avoiding the tile manager completely.  This allowed us to render without any conversions and only one copy &#8212; the plugin could write directly to X11 shared memory.</p>
<p>In making this decision, we would lose a bunch of information that Gecko provides such as where the plugin should be position relative to other elements, and how it should be clipped.  The solution we came up with was to let Fennec tell each of the object and embed elements where they should be drawn.  The frame painting code would honor the position and clip that the front end set.  In this way, we could have plugins do the right thing during pans and when content is below the Fennec sidebars/urlbar.</p>
<p>You can check out how Fennec positions elements here:</p>
<p><a href="http://mxr.mozilla.org/mobile-browser/source/chrome/content/browser.js#2937">http://mxr.mozilla.org/mobile-browser/source/chrome/content/browser.js#2937</a></p>
<p>The end result in this work is that we get over 25fps when <a href="http://en.wikipedia.org/wiki/Sorenson_codec">Sorenson</a> encoded videos.  Over the next weeks and months, I hope to see more video content honoring Fennec&#8217;s user agent and provide optimized content.  (YouTube and other sites do not recognized Fennec&#8217;s UA, yet).</p>
<p>This fast path is only implemented on Maemo, but it can be implemented on any platform assuming the plugin has support to draw directly into a memory buffer.</p>
<p>You also can check out the details in bug <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=528551">528551</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/11/fast-flash-fennec/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Geolocation support in add-ons</title>
		<link>http://dougt.org/wordpress/2009/11/geolocation-support-in-add-ons/</link>
		<comments>http://dougt.org/wordpress/2009/11/geolocation-support-in-add-ons/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 21:03:19 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[device api]]></category>
		<category><![CDATA[geolocation]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=500</guid>
		<description><![CDATA[Today, I checked-in a set of changes that will allow mozilla addons the ability to acquire the location information.  It is pretty simple to do:

geolocation = Cc["@mozilla.org/geolocation;1"]
                       .getService(Ci.nsIDOMGeoGeolocation);
geolocation.watchPosition(successCallback);

In this trivial example, the [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I checked-in a <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=493615">set of changes</a> that will allow mozilla addons the ability to acquire the location information.  It is pretty simple to do:<br />
<code><br />
geolocation = Cc["@mozilla.org/geolocation;1"]<br />
                       .getService(Ci.nsIDOMGeoGeolocation);<br />
geolocation.watchPosition(successCallback);<br />
</code></p>
<p>In this trivial example, the object |geolocation| is fully compatible with the<a href="http://www.w3.org/TR/geolocation-API/"> W3C&#8217;s geolocation</a> object that exists under the navigator object in web content.  |successCallback| will be called when Firefox acquires your position.</p>
<p>The prompting of the user is left up to your application.  All addons hosted on addons.mozilla.org must <a href="https://wiki.mozilla.org/Update:Editors/ReviewingGuide#Reviewing_Geolocation_stuff">follow the guidelines</a> and prompt the user.</p>
<p>If you have questions about what is permissible, please contact <a href="mailto:dougt@dougt.org">me</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/11/geolocation-support-in-add-ons/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>how i made the 192 pushlog ugly</title>
		<link>http://dougt.org/wordpress/2009/09/how-i-made-the-192-pushlog-ugly/</link>
		<comments>http://dougt.org/wordpress/2009/09/how-i-made-the-192-pushlog-ugly/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 02:52:49 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[hg]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=494</guid>
		<description><![CDATA[in other words, how i screwed up a hg push.  I wanted to push changes from mozilla-central to mozilla-1.9.2.  The standard way is to:

=============================================================
how to apply a m-c committed patch to a release branch
=============================================================
    hg qimport http://hg.mozilla.org/mozilla-central/raw-rev/
    hg qpush
    hg qref -e # add [...]]]></description>
			<content:encoded><![CDATA[<p>in other words, how i screwed up a hg push.  I wanted to push changes from mozilla-central to mozilla-1.9.2.  The standard way is to:</p>
<blockquote><p>
=============================================================<br />
how to apply a m-c committed patch to a release branch<br />
=============================================================<br />
    hg qimport http://hg.mozilla.org/mozilla-central/raw-rev/<changesetid><br />
    hg qpush<br />
    hg qref -e # add approval information<br />
    hg qfin .<br />
    hg push
</p></blockquote>
<p>What I did was basically the same thing, with a few shortcuts (insert your favorite story about how cutting corners can cause harm).</p>
<p>Basically I started out with a bug report.  It has the information about what it fixed, who reviewed it, who approved it, etc.  The first thing to do is verify that it all checks out and is a reasonable thing to do.  In the bug, there usually a comment with the hg changeset information.  Here was my first shortcut; I copied the url to the html version of the changeset from the bug, and run the qimport command.  `hg qimport` has no problem with importing that patch (which should probably generate an error, but anywayz).  What this did was imported a big html file &#8212; not what I wanted at all.</p>
<p>I then jumped over the `hg qref -e` command.  This would have allowed me to see the changeset&#8217;s original comment.  I would have been able to see that the qimport terribly failed.  Also, this is a good idea to do so that you can add the appropriate a=foopy approval flag(s).</p>
<p>The last shortcut I took was I didn&#8217;t do a sanity check by running `hg out -p` which would have shown me what I was pushing.  This is always a good idea to see what you are pushing.  Sure reliance on the tools is fine and dandy, but actually seeing what hg thinks it is going to push doesn&#8217;t hurt and only takes a few seconds.</p>
<p>3 shortcuts resulted in a skidmark on the 191 push log:</p>
<p><a href="http://hg.mozilla.org/releases/mozilla-1.9.2/rev/739c7a69d412">http://hg.mozilla.org/releases/mozilla-1.9.2/rev/739c7a69d412</a><br />
<a href="http://hg.mozilla.org/releases/mozilla-1.9.2/rev/1898753917d5">http://hg.mozilla.org/releases/mozilla-1.9.2/rev/1898753917d5</a></p>
<p>Sure there are worse things (e.g. patch bomb, pushing without testing, breaking trees), but I thought I would write this up both for clarification of how I messed up as well as a warning. <img src='http://dougt.org/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/09/how-i-made-the-192-pushlog-ugly/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CoreLocation in 10.6</title>
		<link>http://dougt.org/wordpress/2009/09/corelocation/</link>
		<comments>http://dougt.org/wordpress/2009/09/corelocation/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 17:56:43 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[mozilla]]></category>
		<category><![CDATA[10.6]]></category>
		<category><![CDATA[cocoa]]></category>
		<category><![CDATA[CoreLocation]]></category>
		<category><![CDATA[geolocation]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=488</guid>
		<description><![CDATA[I took a really quick look at the built-in location services on Mac 10.6.  I wanted to determine what sort of accuracy the feature had out-of-the-box, and what the API looked like.
The code is pretty simple.  Just something like:
CLLocationManager* locationManager = [[CLLocationManager alloc] init];
locationManager.delegate                = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
The delagate is just two functions:
- (void)locationManager: [...]]]></description>
			<content:encoded><![CDATA[<p>I took a really quick look at the built-in location services on Mac 10.6.  I wanted to determine what sort of accuracy the feature had out-of-the-box, and what the API looked like.</p>
<p>The code is pretty simple.  Just something like:</p>
<blockquote><p>CLLocationManager* locationManager = [[CLLocationManager alloc] init];<br />
locationManager.delegate                = self;<br />
locationManager.desiredAccuracy = kCLLocationAccuracyBest;<br />
[locationManager startUpdatingLocation];</p></blockquote>
<p>The delagate is just two functions:</p>
<blockquote><p>- (void)locationManager: (CLLocationManager *)manager<br />
didUpdateToLocation: (CLLocation *)newLocation<br />
fromLocation: (CLLocation *)oldLocation<br />
{<br />
}</p>
<p>- (void)locationManager: (CLLocationManager *)manager<br />
didFailWithError: (NSError *)error<br />
{<br />
}</p></blockquote>
<p>If you put this in your code, you magically get a prompt that looks like this.  &#8220;Untitled&#8221; is the name of my application.</p>
<div id="attachment_486" class="wp-caption aligncenter" style="width: 439px"><a rel="attachment wp-att-486" href="http://dougt.org/wordpress/2009/09/corelocation/screen-shot-2009-09-21-at-10-23-19-am/"><img class="size-full wp-image-486" title="Location Request for &quot;Untitled&quot; application" src="http://dougt.org/wordpress/wp-content/uploads/Screen-shot-2009-09-21-at-10.23.19-AM.png" alt="Location Request for &quot;Untitled&quot; application" width="429" height="188" /></a><p class="wp-caption-text">Location Request for &quot;Untitled&quot; application</p></div>
<p>Clicking on the Help icon, you get the following:</p>
<div id="attachment_487" class="wp-caption aligncenter" style="width: 749px"><a rel="attachment wp-att-487" href="http://dougt.org/wordpress/2009/09/corelocation/screen-shot-2009-09-21-at-10-23-38-am/"><img class="size-full wp-image-487" title="Help screenshot" src="http://dougt.org/wordpress/wp-content/uploads/Screen-shot-2009-09-21-at-10.23.38-AM.png" alt="Help screenshot" width="739" height="234" /></a><p class="wp-caption-text">Help screenshot</p></div>
<p>The network requests goes to mac-services.apple.com.  The good news is that it is over a secure network channel.  The bad news is that the content is also hidden from inspection.  (eg.  since this is close source, Apple could be passing anything.  The thing that worries me is that it might be passing the application name which would give unfair Apple insight into what applications are popular).</p>
<p>The accuracy is pretty good &#8212; it places me at the building I am working from.  Now where is the support for Geolocation in Safari?  <img src='http://dougt.org/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/09/corelocation/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using CoreWLAN on MacOS 10.5</title>
		<link>http://dougt.org/wordpress/2009/09/usingcorewlan/</link>
		<comments>http://dougt.org/wordpress/2009/09/usingcorewlan/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 20:13:28 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[10.6]]></category>
		<category><![CDATA[CoreWlan]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[MacOS]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=481</guid>
		<description><![CDATA[When Apple&#8217;s OS X version 10.6 shipped, they broke compatibility will all 3rd party geolocation applications.  This wasn&#8217;t entirely unexpected as we all were using a private framework which wasn&#8217;t documented.  So, Firefox 3.5 and Gears, and probably Skyhook, are busted right now on OS X 10.6.
Apple has provided, with limited documentation, a new public [...]]]></description>
			<content:encoded><![CDATA[<p>When Apple&#8217;s OS X version 10.6 shipped, they broke compatibility will all 3rd party geolocation applications.  This wasn&#8217;t entirely unexpected as we all were using a private framework which wasn&#8217;t documented.  So, Firefox 3.5 and Gears, and probably Skyhook, are busted right now on OS X 10.6.</p>
<p>Apple has provided, with limited documentation, a new public framework called CoreWLAN.  It looks pretty easy to use.  To do a scan of the WIFI access points, you can simply do:</p>
<blockquote><p>#import &lt;Cocoa/Cocoa.h&gt;<br />
#import &lt;CoreWLAN/CoreWLAN.h&gt;</p>
<p>NSError *err = nil;<br />
NSDictionary *params = nil;</p>
<p>NSArray* scan = [NSMutableArray arrayWithArray:[[CWInterface interface] scanForNetworksWithParameters:params error:&amp;err]];</p></blockquote>
<p>This is all fine and dandy.  However, Firefox uses 10.5, and so using the above code will not compile using the old SDK.  Unfortunately, Apple didn&#8217;t provide any C apis &#8211; only exposing this objective-C API.  So, what I had to do was some objective-c magic.  Check out the reference (http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html)</p>
<p>Basically, we needed to be able to dynamically load the CoreWLAN library, that is simple enough:</p>
<blockquote><p>void *corewlan_library = dlopen(&#8220;/System/Library/Frameworks/CoreWLAN.framework/CoreWLAN&#8221;,  RTLD_LOCAL);</p></blockquote>
<p>Now that this library has been loaded, we want to simulate the objective-c call &#8220;[CWInterface interface]&#8220;.</p>
<blockquote><p>// get the class<br />
Class CWI_class = objc_getClass(&#8220;CWInterface&#8221;);<br />
// register the selector name<br />
SEL interfaceSel = sel_registerName(&#8220;interface&#8221;);<br />
// make the call<br />
id interface = objc_msgSend(CWI_class, interfaceSel);</p></blockquote>
<p>This mess above is the same as:</p>
<blockquote><p>id interface = [CWInterface interface];</p></blockquote>
<p>As you probably can see, it isn&#8217;t that hard to do this, just it is syntactically nasty.  Here is the source to the little application I was testing with:</p>
<blockquote><p>#include &lt;mach-o/dyld.h&gt;<br />
#include &lt;dlfcn.h&gt;<br />
#include &lt;unistd.h&gt;</p>
<p>#include &lt;objc/objc.h&gt;<br />
#include &lt;objc/objc-runtime.h&gt;</p>
<p>Class CWI_class = objc_getClass(&#8220;CWInterface&#8221;);<br />
printf(&#8220;cwi class %x\n&#8221;, CWI_class);</p>
<p>SEL interfaceSel = sel_registerName(&#8220;interface&#8221;);<br />
printf(&#8220;sel: %x\n&#8221;, interfaceSel);</p>
<p>SEL scanSel = sel_registerName(&#8220;scanForNetworksWithParameters:error:&#8221;);<br />
printf(&#8220;scanSel: %x\n&#8221;, interfaceSel);</p>
<p>id interface = objc_msgSend(CWI_class, interfaceSel);<br />
printf(&#8220;interface: %x\n&#8221;, interface);</p>
<p>id scanResult = objc_msgSend(interface, scanSel, 0, 0);<br />
printf(&#8220;scanResult: %x\n&#8221;, scanResult);</p></blockquote>
<p>Hope this helps.  Please let me know of an easier way, if one exists.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/09/usingcorewlan/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Orientation Update&#8230;</title>
		<link>http://dougt.org/wordpress/2009/08/orientation-update/</link>
		<comments>http://dougt.org/wordpress/2009/08/orientation-update/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 16:27:42 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[device api]]></category>
		<category><![CDATA[MozOrientation]]></category>
		<category><![CDATA[orientation]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=469</guid>
		<description><![CDATA[A few days ago, I blogged about orientation support in Firefox.  I am happy to report that linux patches landed over the weekend.  (We also have Window Mobile and Thinkpads running Windows patches in the review process.)
If you a linux laptop and have a few minutes, please download one of the Firefox Trunk nightly builds [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, I blogged about <a href="http://dougt.org/wordpress/2009/08/orientation/">orientation support in Firefox</a>.  I am happy to report that <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=512345">linux patches landed</a> over the weekend.  (We also have <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=513183">Window Mobile</a> and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=513233">Thinkpads running Windows</a> patches in the review process.)</p>
<p>If you a linux laptop and have a few minutes, please download one of the <a href="http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-mobile-trunk/">Firefox Trunk nightly builds</a> and try out orientation!</p>
<p><strong>What to try?</strong></p>
<p><a href="http://people.mozilla.org/~dougt/ori.html">http://people.mozilla.org/~dougt/ori.html</a></p>
<p>Let it run for a little bit, then shake your laptop (<em>not responsible for any damage <img src='http://dougt.org/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </em>).  After you have a couple dozen responses, send me the results including what distro and laptop you are using.</p>
<p><strong>Demos!</strong></p>
<p>While you are testing things out, check out the demo Michael Ventnor (m.ventnor at gmail.com) put together:</p>
<p><a href="http://dougt.org/random/orientationdemo/index.xhtml"><img class="alignnone" title="Orientation Demo" src="http://dougt.org/random/orientationdemo/demo-preview.png" alt="" width="507" height="453" /></a><br />
<a href="http://dougt.org/random/orientationdemo/index.xhtml">http://dougt.org/random/orientationdemo/index.xhtml</a></p>
<p><a href="http://twitter.com/dolske">Justin Dolske</a> has a few demos too:</p>
<ul>
<li><a href="https://people.mozilla.com/~dolske/tmp/seismo.html">Seismometer</a></li>
<li><a href="https://people.mozilla.com/~dolske/tmp/awesome.html">No idea, but it&#8217;s awesome</a></li>
</ul>
<p><span><a href="http://twitter.com/jruderman">Jesse Ruderman</a> also cleaned up the &#8220;ball&#8221; demo that I created making the animation <a href="http://www.squarefree.com/smoother-orientation-demo.html">smoother</a>.<br />
</span></p>
<p><strong>Help Wanted</strong></p>
<p>There are still other platforms that I would like to support.  I specifically would like to see Windows support using their Sensor API.  If you are interested in helping, file a bug, cc me, and take a look at the other implementations.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/08/orientation-update/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Orientation in Firefox and beyond</title>
		<link>http://dougt.org/wordpress/2009/08/orientation/</link>
		<comments>http://dougt.org/wordpress/2009/08/orientation/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 03:24:02 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[accelerometer]]></category>
		<category><![CDATA[device api]]></category>
		<category><![CDATA[htc]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[MozOrientation]]></category>
		<category><![CDATA[orientation]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=452</guid>
		<description><![CDATA[One of the coolest apps I saw when the iPhone came out was the wooden balance game Labyrinth.  You basically tilt your phone to move a ball around the screen, avoiding holes, and trying to get the ball to a goal.  It made use of a feature of many modern devices &#8212; accelerometers.
Obviously clear that [...]]]></description>
			<content:encoded><![CDATA[<p>One of the coolest apps I saw when the iPhone came out was the wooden balance game <a href="http://en.wikipedia.org/wiki/Labyrinth_%28game%29">Labyrinth</a>.  You basically tilt your phone to move a ball around the screen, avoiding holes, and trying to get the ball to a goal.  It made use of a feature of many modern devices &#8212; accelerometers.</p>
<p>Obviously clear that there should be a webapp for doing just that.  What was missing was a javascript API.</p>
<p>In recent Mozilla trunk builds, I have added support for an orientation event.  This new event will allow you to build applications and listen for changes in orientation.  (note, the first platform to support such an event is any MacBook Pro.  Others will follow).</p>
<p><strong>Simple Call:</strong></p>
<p>To use this new event, you will add an event listener as you normally would:</p>
<p>window.addEventListener(&#8220;MozOrientation&#8221;, orientationChange, true);</p>
<p>Your callback will be called, when there is a change in acceleration, passing the current orientation:</p>
<p>function orientationChange(o) {</p>
<p>}</p>
<p><strong>Simple Result:</strong></p>
<p>The passed object has 3 attributes &#8211; &#8220;x&#8221;, &#8220;y&#8221; and &#8220;z&#8221;.  Each value is between -1 and 1 where zero is the &#8220;balance point&#8221;.  For example, suppose you device is a MacBook Pro and it is sitting on a desk that is perfectly level, you would expect to see:</p>
<p>x = 0<br />
y = 0<br />
z = 1</p>
<p>x is the axis in the direction from the left side of the keyboard to the right side of the keyboard (basically the axis that is along the home row keys) is level.  If I lift up the left side of the keyboard, x will increase.  if I lift up the right side, x will decrease.</p>
<p>y is the axis in the direction from the front of the laptop (where the mouse is) to the back of the laptop.  If I lift up the front of the laptop (the side closest to me), y will decrease.  If I left the back towards the front, y will increase.</p>
<p>Got that?  Yeah, physics is pretty hard. <img src='http://dougt.org/wordpress/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>x and y can easily be visualized.  If you have a recent trunk build for the Mac, try loading this demo page:</p>
<p><a href="http://people.mozilla.org/~dougt/ball.html">http://people.mozilla.org/~dougt/ball.html</a></p>
<p>z basically will tell you that the laptop is sitting right side up.  if z was -1, you would know that the laptop (probably closed) and is sitting on its screen.  Of course the value will change as you rotate the laptop / device in this direction.</p>
<p>Right now, there is only support for the Macbook Pro.  It is pretty easy to add support for different OSs.  We have code for Samsung Windows Mobile devices, and for the HTC Windows Mobile devices.  We still need support for linux and for Windows.  If you are interested in adding support file a bug and start looking at <a href="http://mxr.mozilla.org/mozilla-central/source/widget/public/nsIAccelerometer.idl">http://mxr.mozilla.org/mozilla-central/source/widget/public/nsIAccelerometer.idl</a></p>
<p>The API isn&#8217;t fixed and may change.  I do invite you to comment.  Keep in mind that we want a really simple and straight forward API to expose orientation events to web developers.  If your response has either &#8220;RDF&#8221; or &#8220;DCCI&#8221; in it, please reread the last sentence.  <img src='http://dougt.org/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Thanks again and hope you enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/08/orientation/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>Geolocation Address</title>
		<link>http://dougt.org/wordpress/2009/07/geolocation-address/</link>
		<comments>http://dougt.org/wordpress/2009/07/geolocation-address/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 17:25:45 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>
		<category><![CDATA[device api]]></category>
		<category><![CDATA[geo]]></category>
		<category><![CDATA[geolocation]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=440</guid>
		<description><![CDATA[Last week, I pushed a change that will enable tomorrow&#8217;s trunk Firefox builds (Minefield) to access user-readable position information.
For example, instead only being able to work with:
37.3882005, -122.0834553
You can see the physical address as:
650 Castro St, Mountain View, California, 94041, US
This should help aide the many people that already know their physical address in familiar [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, I pushed a change that will enable tomorrow&#8217;s trunk Firefox builds (Minefield) to access user-readable position information.</p>
<p>For example, instead only being able to work with:</p>
<p>37.3882005, -122.0834553</p>
<p>You can see the physical address as:</p>
<p>650 Castro St, Mountain View, California, 94041, US</p>
<p>This should help aide the many people that already know their physical address in familiar terms.</p>
<p>To access address elements, you simply do what you have been doing.  The only modification is to test to see if there is an address associated with the position, and if so, access it:</p>
<pre>
navigator.geolocation.watchPosition(successCallback)
function successCallback(position)
{
    if (position.address)
        alert(position.address.postalCode);
}
</pre>
<p>Other fields on the address object are:</p>
<pre>
address.streetNumber
address.street
address.premises
address.city
address.region
address.county
address.countryCode
address.postalCode
</pre>
<p>Please let me know what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/07/geolocation-address/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>all moved over&#8230;</title>
		<link>http://dougt.org/wordpress/2009/07/all-moved-over/</link>
		<comments>http://dougt.org/wordpress/2009/07/all-moved-over/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 23:52:00 +0000</pubDate>
		<dc:creator>dougt</dc:creator>
				<category><![CDATA[mozilla]]></category>

		<guid isPermaLink="false">http://dougt.org/wordpress/?p=412</guid>
		<description><![CDATA[all moved over to the dougt.org domain.  I hope I didn&#8217;t lose too much along the away.  I think some of the media didn&#8217;t make it through the conversation, but C&#8217;est la vie!
]]></description>
			<content:encoded><![CDATA[<p>all moved over to the <a href="http://dougt.org">dougt.org</a> domain.  I hope I didn&#8217;t lose too much along the away.  I think some of the media didn&#8217;t make it through the conversation, but C&#8217;est la vie!</p>
]]></content:encoded>
			<wfw:commentRss>http://dougt.org/wordpress/2009/07/all-moved-over/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
