<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>bjarlestam</title>
	<atom:link href="http://bjarlestam.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://bjarlestam.wordpress.com</link>
	<description></description>
	<lastBuildDate>Mon, 28 Nov 2011 20:55:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='bjarlestam.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/e19719393b426184dd5810c371d7f665?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>bjarlestam</title>
		<link>http://bjarlestam.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://bjarlestam.wordpress.com/osd.xml" title="bjarlestam" />
	<atom:link rel='hub' href='http://bjarlestam.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Devise &#8211; Taking care of your users</title>
		<link>http://bjarlestam.wordpress.com/2011/03/23/devise-taking-care-of-your-users/</link>
		<comments>http://bjarlestam.wordpress.com/2011/03/23/devise-taking-care-of-your-users/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 22:02:00 +0000</pubDate>
		<dc:creator>bjarlestam</dc:creator>
				<category><![CDATA[rails]]></category>
		<category><![CDATA[web tech]]></category>
		<category><![CDATA[devise]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[shrug]]></category>
		<category><![CDATA[slideshare]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://bjarlestam.wordpress.com/?p=263</guid>
		<description><![CDATA[After working with ruby and rails for the last couple of months I must say it is a true pleasure to work with. So when we hosted the local Ruby User Group (SHRUG) at the Valtech office I thought I should contribute with a lightningtalk. The presentation I did was about Devise a really nice authentication [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=263&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After working with ruby and rails for the last couple of months I must say it is a true pleasure to work with. So when we hosted the local <a title="Rails.se" href="http://www.rails.se">Ruby User Group (SHRUG)</a> at the <a title="SHRUG@Valtech" href="http://www.valtechlabs.se/stockholm-ruby-user-group-pa-valtech">Valtech office</a> I thought I should contribute with a lightningtalk. The presentation I did was about <a title="Devise" href="https://github.com/plataformatec/devise">Devise</a> a really nice authentication solution for Rails applications that fixes all the basic stuff you need to have users logging in to your site. It was mostly live coding, which may not have been such a good idea ater all. Hope some of you found it amusing at least. Anyway here are the slides:</p>
<iframe src='http://www.slideshare.net/slideshow/embed_code/7003854' width='450' height='369'></iframe>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjarlestam.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjarlestam.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjarlestam.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjarlestam.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjarlestam.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjarlestam.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjarlestam.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjarlestam.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjarlestam.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjarlestam.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjarlestam.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjarlestam.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjarlestam.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjarlestam.wordpress.com/263/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=263&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjarlestam.wordpress.com/2011/03/23/devise-taking-care-of-your-users/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72dea68d4842520ca1c50b7beb9426f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjarlestam</media:title>
		</media:content>
	</item>
		<item>
		<title>Context in live events in jQuery 1.4</title>
		<link>http://bjarlestam.wordpress.com/2010/01/10/context-in-live-events-in-jquery-14/</link>
		<comments>http://bjarlestam.wordpress.com/2010/01/10/context-in-live-events-in-jquery-14/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 20:28:55 +0000</pubDate>
		<dc:creator>bjarlestam</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[web tech]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://bjarlestam.wordpress.com/?p=199</guid>
		<description><![CDATA[Performance tests continued In my previous post I measured how the performance of a web application is impacted by jQuery live events. The conclusion was that live events will normally not have a big performance impact, but in complex applications with lots of events it can be a problem. An important factor that I didn&#8217;t [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=199&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Performance tests continued</h3>
<p>In <a title="Performance of jQuery Live events" href="http://bjarlestam.wordpress.com/2009/11/30/performance-of-jquery-live-events/" target="_self">my previous post</a> I measured how the performance of a web application is impacted by jQuery live events. The conclusion was that live events will normally not have a big performance impact, but in complex applications with lots of events it can be a problem. An important factor that I didn&#8217;t cover very well is the level of nesting in the dom-tree. I have created a test case that demonstrates better how the performance impact changes with a more nested dom-tree.</p>
<pre style="line-height:10px;font-size:9px;">&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;

  &lt;head&gt;
    &lt;title&gt;jQuery 1.4a2 nested live tester&lt;/title&gt;
  &lt;/head&gt;

  &lt;body&gt;
    &lt;div id="result1"&gt;waiting for results...&lt;/div&gt;
    &lt;div id="result2"&gt;waiting for results...&lt;/div&gt;
    &lt;div id="result3"&gt;waiting for results...&lt;/div&gt;
    &lt;div id="result4"&gt;waiting for results...&lt;/div&gt;
    &lt;div id="result5"&gt;waiting for results...&lt;/div&gt;
    &lt;div id="result6"&gt;waiting for results...&lt;/div&gt;
    &lt;div id="result7"&gt;waiting for results...&lt;/div&gt;

    &lt;script type="text/javascript" src="jquery-1.4a2.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;

    /*&lt;![CDATA[*/

      jQuery(document).ready(function(){

        function measureClick(target, output, text) {
          target = jQuery(target);
          var count = 1;
          var start = new Date();
          for(var i=0; i&lt;count; i++) {
            target.click();
          }
          var stop = new Date();
          jQuery(output).html(text + ((stop.getTime() - start.getTime())/count) + 'ms');
        }

        function addEvents(count, selector) {
          for(var i=0; i&lt;count; i++) {
            jQuery(selector + i).live('click', function() {});
          }
        }

        //Add nested DOM-tree
        var element = jQuery('body');
        for(var i=1; i&lt;=30; i++) {
          element = jQuery('&lt;div id="level'+i+'"&gt;level'+i+'&lt;/div&gt;').appendTo(element);
        }

        addEvents(100, '.garbage');

        measureClick('#level1', '#result1', 'click at level 1: ');

        measureClick('#level5', '#result2', 'click at level 5: ');

        measureClick('#level10', '#result3', 'click at level 10: ');

        measureClick('#level15', '#result4', 'click at level 15: ');

        measureClick('#level20', '#result5', 'click at level 20: ');

        measureClick('#level25', '#result6', 'click at level 25: ');

        measureClick('#level30', '#result7', 'click at level 30: ');
      });

    /*]]&gt;*/

    &lt;/script&gt;

  &lt;/body&gt;

&lt;/html&gt;</pre>
<p>In this test we have a dom-tree with 30 nested div&#8217;s and we register 100 live events. We then trigger a click event on different levels of the tree and measure the time required to process it. On my macbook I get the following result:</p>
<div id="result1">
<div id="_mcePaste">click at level 1: 24ms</div>
<div id="_mcePaste">click at level 5: 54ms</div>
<div id="_mcePaste">click at level 10: 91ms</div>
<div id="_mcePaste">click at level 15: 130ms</div>
<div id="_mcePaste">click at level 20: 174ms</div>
<div id="_mcePaste">click at level 25: 210ms</div>
<div id="_mcePaste">click at level 30: 253ms</div>
</div>
<p>We see that the performance impact of the live events is greater on clicks that are made deep down a nested dom-tree.</p>
<h3>Can the context help?</h3>
<p>In <a href="http://bjarlestam.wordpress.com/2009/11/30/performance-of-jquery-live-events/" target="_self">my previous post on performance in jquery live events</a> I proposed that it would be a good improvement to support a scope for the live events, so that the performance impact can be limited to a specific part in the dom-tree. One way to implement this  could be through the context parameter in the core jQuery() object constructor.  When live events were introduced they did not support the use of a context parameter, but the coming jQuery 1.4 release is supposed to support it. More details about this can be found at <a title="Working with Events, Part 3: More Event Delegation with jQuery" href="http://www.learningjquery.com/2009/09/working-with-events-part-3-more-event-delegation-with-jquery">learningjquery.com</a>. I was curious to se how this context was being used and if it would allow me to limit the impact of the live events to a specific part of dom-tree. To investigate this I modified the above test so that a context is provided when registering the live events. Note that in the previous test as well as this one i use the latest <a href="http://blog.jquery.com/2009/12/18/jquery-14-alpha-2-released/">jQuery 1.4 alpha 2</a> release.</p>
<pre style="line-height:10px;font-size:9px;">&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;

  &lt;head&gt;
    &lt;title&gt;jQuery 1.4a2 nested live tester with context&lt;/title&gt;
  &lt;/head&gt;

  &lt;body&gt;
    &lt;div id="level"&gt;current level...&lt;/div&gt;
    &lt;div id="result1"&gt;waiting for results...&lt;/div&gt;
    &lt;div id="result2"&gt;waiting for results...&lt;/div&gt;
    &lt;div id="result3"&gt;waiting for results...&lt;/div&gt;
    &lt;div id="result4"&gt;waiting for results...&lt;/div&gt;
    &lt;div id="result5"&gt;waiting for results...&lt;/div&gt;
    &lt;div id="result6"&gt;waiting for results...&lt;/div&gt;
    &lt;div id="result7"&gt;waiting for results...&lt;/div&gt;

    &lt;script type="text/javascript" src="jquery-1.4a2.min.js"&gt;&lt;/script&gt;
    &lt;script type="text/javascript"&gt;

    /*&lt;![CDATA[*/

      jQuery(document).ready(function(){

        function measureClick(target, output, text) {
          target = jQuery(target);
          var count = 1;
          var start = new Date();
          for(var i=0; i&lt;count; i++) {
            target.click();
          }
          var stop = new Date();
          jQuery(output).html(text + ((stop.getTime() - start.getTime())/count) + 'ms');
        }

        function addEvents(count, selector) {
          for(var i=0; i&lt;count; i++) {
            <span style="color:#ff9900;">jQuery(selector + i, jQuery('.context')).live('click', function() {});</span>
          }
        }

        //Add nested DOM-tree
        var element = jQuery('body');
        for(var i=1; i&lt;=30; i++) {
          element = jQuery('&lt;div id="level'+i+'"&gt;level'+i+'&lt;/div&gt;').appendTo(element);
        }

<span style="color:#ff9900;">        var level = '20';
        jQuery('#level').html('context set at level ' + level);
        jQuery('#level' + level).addClass('context');</span>

        addEvents(100, '.garbage');

        measureClick('#level1', '#result1', 'click at level 1: ');

        measureClick('#level5', '#result2', 'click at level 5: ');

        measureClick('#level10', '#result3', 'click at level 10: ');

        measureClick('#level15', '#result4', 'click at level 15: ');

        measureClick('#level20', '#result5', 'click at level 20: ');

        measureClick('#level25', '#result6', 'click at level 25: ');

        measureClick('#level30', '#result7', 'click at level 30: ');
      });

    /*]]&gt;*/

    &lt;/script&gt;

  &lt;/body&gt;

&lt;/html&gt;</pre>
<p>In this test we use one of the nested divs as context. I was hoping that jQuery takes advantage of this context so that we don&#8217;t get any performance impact on events triggered above the context element, only events on elements inside the context should get the performance impact. However when I run the tests I get the following result:</p>
<div id="level">
<div id="level">context set at level 20</div>
<div id="result1">click at level 1: 30ms</div>
<div id="result2">click at level 5: 66ms</div>
<div id="result3">click at level 10: 113ms</div>
<div id="result4">click at level 15: 160ms</div>
<div id="result5">click at level 20: 207ms</div>
<div id="result6">click at level 25: 255ms</div>
<div id="result7">click at level 30: 305ms</div>
</div>
<p>We see that the resulting figures are similar to the results where no context was used. The live events even has slightly bigger performance impact now. Events on all elements in the dom-tree gets the performance impact regardless of which context we specify. So the context did not help us here. This is probably due to that jQuery attaches the delegating event on the document instead of the context element. We can verify that jQuery puts the events on the document element with a simple check in firebug. By opening firebug, reloading the test, and then invoking the following command in the console</p>
<pre> jQuery(document).data('events').live</pre>
<p>We see that the live events are stored on the document and not on the context element. In my view it would be bad if this behavior is kept in the final release of jQuery 1.4 unless the context is still unsupported like in 1.3. Once the functionality is released it can not be changed without breaking some applications that rely on the current behavior. I guess the idea could be that live events should be kept even if you remove the context element and that you should be able to load the context element dynamically. But I think that it would be more valuable to be able to limit the performance impact by putting the delegating event on the context. It would also provide an easy way to control the lifetime of live events by simply removing the context element.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjarlestam.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjarlestam.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjarlestam.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjarlestam.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjarlestam.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjarlestam.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjarlestam.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjarlestam.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjarlestam.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjarlestam.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjarlestam.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjarlestam.wordpress.com/199/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjarlestam.wordpress.com/199/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjarlestam.wordpress.com/199/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=199&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjarlestam.wordpress.com/2010/01/10/context-in-live-events-in-jquery-14/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72dea68d4842520ca1c50b7beb9426f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjarlestam</media:title>
		</media:content>
	</item>
		<item>
		<title>Performance of jQuery Live events</title>
		<link>http://bjarlestam.wordpress.com/2009/11/30/performance-of-jquery-live-events/</link>
		<comments>http://bjarlestam.wordpress.com/2009/11/30/performance-of-jquery-live-events/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 20:00:25 +0000</pubDate>
		<dc:creator>bjarlestam</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[web tech]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://bjarlestam.wordpress.com/?p=117</guid>
		<description><![CDATA[Live events is a new feature in jQuery 1.3. It could be used as an alternative to traditional event delegation techniques. It provides a convenient way to implement event delegation. The following code will bind an event handler to the document. When events bubble up jQuery will check if any ancestor of the original target has the class [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=117&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">
<p><span style="font-family:Times;line-height:normal;font-size:small;"> </span></p>
<div style="background-image:initial;background-repeat:initial;background-attachment:initial;background-color:#ffffff;font:normal normal normal 13px/19px Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;background-position:initial initial;margin:0;padding:.6em;">
<div id="_mcePaste">Live events is a new feature in jQuery 1.3. It could be used as an alternative to traditional <a title="Robert Nyman - Event delegation with JavaScript" href="http://robertnyman.com/2008/05/04/event-delegation-with-javascript/">event delegation techniques</a>. It provides a convenient way to implement event delegation. The following code will bind an event handler to the document. When events bubble up jQuery will check if any ancestor of the original target has the class myButton and delegate the event accordingly.</div>
<div><code>jQuery('.myButtton').live('click', function(){ //do stuff });</code></div>
<div>This is very convenient when your markup is loaded through ajax or created on the fly by JavaScript. The <a title="jQuery docs" href="http://docs.jquery.com/Events/live">jQuery documentation</a> provides some more info on how it works.</div>
<h3>Performance</h3>
<div>Anytime the user clicks anywhere on the document an event will be triggered and jQuery needs to determine if it should delegate it or not.</div>
<div>jQuery will of course need some cpu time to do this check which could potentially result in sluggish behaviour when the user clicks on the page.</div>
<h3>Testcases</h3>
<div>To help me understand what performance tradeoff I make when using live events, I have set up a few test cases.</div>
<pre style="line-height:10px;font-size:9px;">
<div>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"</div>
<div>"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;</div>
<div>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;</div>
<div>&lt;head&gt;</div>
<div>    &lt;title&gt;jQuery live tester&lt;/title&gt;</div>
<div>&lt;/head&gt;</div>
<div>&lt;body&gt;</div>
<div>    &lt;div id="result1"&gt;waiting for results...&lt;/div&gt;</div>
<div>    &lt;div id="result2"&gt;waiting for results...&lt;/div&gt;</div>
<div>    &lt;div id="result3"&gt;waiting for results...&lt;/div&gt;</div>
<div>    &lt;div id="result4"&gt;waiting for results...&lt;/div&gt;</div>
<div>    &lt;div id="result5"&gt;waiting for results...&lt;/div&gt;</div>
<div>    &lt;div id="result6"&gt;waiting for results...&lt;/div&gt;</div>
<div>    &lt;div id="result7"&gt;waiting for results...&lt;/div&gt;</div>
<div>    &lt;div id="button"&gt;Button&lt;/div&gt;</div>
<div>    &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt;</div>
<div>    &lt;script type="text/javascript"&gt;</div>
<div>    /*&lt;![CDATA[*/</div>
<div>    jQuery(document).ready(function(){</div>
<div>        function measureClick(output, text) {</div>
<div>            var target = jQuery('#button');</div>
<div><span style="white-space:pre;">            var count = 10;</span></div>
<div><span style="white-space:pre;"> </span></div>
<div><span style="white-space:pre;">        <span style="white-space:pre;">    </span>var start = new Date();</span></div>
<div>            for(var i=0; i&lt;count; i++) {</div>
<div>                target.click();</div>
<div>            }</div>
<div>            var stop = new Date();</div>
<div>            output.html(text + ((stop.getTime() - start.getTime())/count));</div>
<div>        }</div>
<div>        function addEvents(count, selector, context) {</div>
<div>            context = context || document;</div>
<div>            for(var i=0; i&lt;count; i++) {</div>
<div>                jQuery(selector + i, context).live('click', function() {});</div>
<div>            }</div>
<div>        }</div>
<div>        function removeEvents(count, selector) {</div>
<div>            for(var i=0; i&lt;count; i++) {</div>
<div>                jQuery(selector + i).die('click');</div>
<div>            }</div>
<div>        }</div>
<div>        jQuery('#button').bind('click', function() {});</div>
<div>        measureClick(jQuery('#result1'), 'without live events: ');</div>
<div>        addEvents(10, '.garbage');</div>
<div>        measureClick(jQuery('#result2'), 'with 10 live events: ');</div>
<div>        removeEvents(10, '.garbage');</div>
<div>        addEvents(100, '.garbage');</div>
<div>        measureClick(jQuery('#result3'), 'with 100 live events: ');</div>
<div>        removeEvents(100, '.garbage');</div>
<div>        addEvents(200, '.garbage');</div>
<div>        measureClick(jQuery('#result4'), 'with 200 live events: ');</div>
<div><span style="white-space:pre;">	</span>//Add large DOM-tree</div>
<div>        for(var i=0; i&lt;500; i++) {</div>
<div>            jQuery('&lt;div class="garbage' + i+'"&gt;garbage&lt;/div&gt;').appendTo('body');</div>
<div>        }</div>
<div>        measureClick(jQuery('#result5'), 'with 200 live events and large dom: ');</div>
<div>        removeEvents(200, '.garbage');</div>
<div>        addEvents(100, '#garbage');</div>
<div>        measureClick(jQuery('#result6'), 'with 100 live events with id selector: ');</div>
<div>        removeEvents(100, '#garbage');</div>
<div>        addEvents(100, '#something div.garbage td tr div div.test');</div>
<div>        measureClick(jQuery('#result7'), 'with 100 live events with complex selector: ');</div>
<div>        removeEvents(100, '#something div.garbage td tr div div.test');</div>
<div>    });</div>
<div>    /*]]&gt;*/</div>
<div>    &lt;/script&gt;</div>
<div>&lt;/body&gt;</div>
<div>&lt;/html&gt;</div>
</pre>
<h3>Test results</h3>
<table style="border:solid 1px grey;font-size:10px;">
<tbody>
<tr style="background:#ddd;">
<th>test</th>
<th>Firefox 3.5</th>
<th>IE8</th>
<th>IE7</th>
<th>Chrome</th>
<th>Safari 4</th>
</tr>
<tr>
<td>without live events</td>
<td>0.3</td>
<td>1.6</td>
<td>0.5</td>
<td>0.2</td>
<td>0.3</td>
</tr>
<tr style="background:#eee;">
<td>with 10 live events</td>
<td>4.9</td>
<td>9.4</td>
<td>15.6</td>
<td>2.1</td>
<td>3.4</td>
</tr>
<tr>
<td>with 100 live events</td>
<td>45</td>
<td>93.8</td>
<td>143.8</td>
<td>21.5</td>
<td>20.5</td>
</tr>
<tr style="background:#eee;">
<td>with 200 live events</td>
<td>94.2</td>
<td>201.6</td>
<td>306.2</td>
<td>36.6</td>
<td>40.6</td>
</tr>
<tr>
<td>with 200 live events and large dom</td>
<td>92.2</td>
<td>201.6</td>
<td>306.2</td>
<td>36.9</td>
<td>41.7</td>
</tr>
<tr style="background:#eee;">
<td>with 100 live events with id selector</td>
<td>50.4</td>
<td>90.6</td>
<td>157.8</td>
<td>17.2</td>
<td>19.7</td>
</tr>
<tr>
<td>with 100 live events with complex selector</td>
<td>109.1</td>
<td>231.3</td>
<td>373.4</td>
<td>46.9</td>
<td>48.4</td>
</tr>
</tbody>
</table>
<div style="font-size:9px;">The tests were performed using jQuery v1.3.2 on a Pentium4 2.8GHz with 2GB RAM running win xp</div>
<h3>Explanation of tests</h3>
<div>Basically the tests are done by registering a number of live events and one normal event. We measure the time it takes to process the normal event to see how it gets impacted by the live events. First we measured the time it takes to handle the normal event without any live events registered. This is just to have something to compare against. The result is just a fraction of a millisecond. Next we add 10 live events to see how this impacts the performance. The event now takes 4.9 milliseconds to process in FireFox 3.5. To push it a bit we add more live events. We then see that 100 live events results in ca 45 milliseconds and 200 live events results in ca 94.2 milliseconds. It seem like the performance impact is approximately linear when adding more live events. What about dom size? In the first tests the markup is very simple with a very small dom-tree. A bigger dom-tree might have some impact on the performance. To test this we simply add 500 div&#8217;s to the dom and test again. This is what test no 5 does. Surprisingly we see that the performance impact of the live events does not get worse when the dom size increases. What about different types of selectors? One might also suspect that the performance is depending on the type of selector used. In test 3 a simple class selector was used. Test 6 instead uses an id selector and test 7 uses a more complext selector. We see that there is no big performance difference between a simple id selector and a simple class selector. However when using more complex selector the performance impact seems to be worse.</div>
<h3>Conclusion</h3>
<div>The tests show that adding live events will have some performance impact. As long as the number of registered live events is small the impact is not significant. However if you have a complex site with many events you may run into trouble, especially if you need to support browsers with poor JavaScript performance.</div>
<h3>What could be done to improve this?</h3>
<div>In my view it would have been better if jQuery would let you somehow define what element you want to register the delegating event on, so that the impact is limited to a specific context. The default could still be to add it to the document. This could be done in at least two different ways. One option could be to add the delegating event to the context given in the core <code>jQuery(expression, context)</code> function. I dont know enough about the internals of jQuery to say how feasible this is.</div>
<div>Another option could be to redefine the live method as follows:</div>
<div><code>jQuery('&lt;where_to_attach_the_event&gt;').live( '&lt;delegation_selector&gt;', eventType, eventHandler);</code></div>
<div>so the current live behaviour would be achieved by</div>
<div><code>jQuery('document').live('&lt;delegation_selector', eventType, eventHandler)</code></div>
<h3>Update:</h3>
<p>After a comment from <a href="http://jqueryminute.com/">Jonathan Sharp</a> I added some more tests to see how a more nested dom-tree affects the performance. When adding 30 nested divs we can see that a click deep down the tee will be affected more by the live events.</p>
<pre style="line-height:10px;font-size:10px;">var button = jQuery('&lt;div id="button"&gt;button&lt;div&gt;').appendTo('body');
button.bind('click', function() {});
addEvents(100, '.garbage');
//Add nested DOM-tree
var element = jQuery('body');
for(var i=0; i&lt;30; i++) {
    element = jQuery('&lt;div&gt;&lt;/div&gt;').appendTo(element);
}

measureClick(jQuery('#result1'), 'click outside of nested elements: ');
button.appendTo(element);
measureClick(jQuery('#result2'), 'click inside of nested elements: ');</pre>
<p>In this test I add 30 nested divs to the dom-tree and I add 100 live events. In firefox the output of this test is:</p>
<p>click outside of nested elements: 27.2<br />
click inside of nested elements: 251.9</p>
<p>This shows that when I click on an element that is a direct child of the body, the performance is ok, but when I click an element deep down the nested divs the performance impact is much worse.</p>
<p>This makes it even more desirable to be able to define the context when registering a live event.</p>
<h3>Update 2 &#8211; jQuery 1.4a1</h3>
<p>On request I have run the same tests as above on the same machine but with the new alpha release of jQuery 1.4. The results are as follows:</p>
<table style="border:solid 1px grey;font-size:10px;">
<tbody>
<tr style="background:#ddd;">
<th>test</th>
<th>Firefox 3.5</th>
<th>IE8</th>
<th>Chrome</th>
<th>Safari 4</th>
</tr>
<tr>
<td>without live events</td>
<td>0.3</td>
<td>1.6</td>
<td>0.2</td>
<td>0.3</td>
</tr>
<tr style="background:#eee;">
<td>with 10 live events</td>
<td>4.5</td>
<td>9.4</td>
<td>2.1</td>
<td>2.7</td>
</tr>
<tr>
<td>with 100 live events</td>
<td>38.5</td>
<td>79.8</td>
<td>19.6</td>
<td>19.9</td>
</tr>
<tr style="background:#eee;">
<td>with 200 live events</td>
<td>73.9</td>
<td>162.7</td>
<td>40.8</td>
<td>39.6</td>
</tr>
<tr>
<td>with 200 live events and large dom</td>
<td>79.5</td>
<td>167.3</td>
<td>42.2</td>
<td>39.9</td>
</tr>
<tr style="background:#eee;">
<td>with 100 live events with id selector</td>
<td>37.7</td>
<td>90.7</td>
<td>18.9</td>
<td>20.1</td>
</tr>
<tr>
<td>with 100 live events with complex selector</td>
<td>91.2</td>
<td>172</td>
<td>31.8</td>
<td>45.7</td>
</tr>
</tbody>
</table>
<p>The test are not very precise. Running the tests twice will not produce the exact same results. It is clear though that the performance has been improved slightly.</p>
</div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjarlestam.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjarlestam.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjarlestam.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjarlestam.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjarlestam.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjarlestam.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjarlestam.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjarlestam.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjarlestam.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjarlestam.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjarlestam.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjarlestam.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjarlestam.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjarlestam.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=117&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjarlestam.wordpress.com/2009/11/30/performance-of-jquery-live-events/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72dea68d4842520ca1c50b7beb9426f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjarlestam</media:title>
		</media:content>
	</item>
		<item>
		<title>RESTful Web Services the easy way with JAX-RS</title>
		<link>http://bjarlestam.wordpress.com/2009/09/15/introduction-to-jax-rs/</link>
		<comments>http://bjarlestam.wordpress.com/2009/09/15/introduction-to-jax-rs/#comments</comments>
		<pubDate>Tue, 15 Sep 2009 06:36:33 +0000</pubDate>
		<dc:creator>bjarlestam</dc:creator>
				<category><![CDATA[web tech]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javaforum]]></category>
		<category><![CDATA[jax-rs]]></category>
		<category><![CDATA[jaxrs]]></category>
		<category><![CDATA[jsr311]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[restful]]></category>
		<category><![CDATA[slides]]></category>

		<guid isPermaLink="false">http://bjarlestam.wordpress.com/?p=109</guid>
		<description><![CDATA[Here are the slides that I have prepared for my talk at JavaForum this evening. It took me some time to cut it down to 34 slides and then still many of them had to become extra spare slides. I had to realize that 30 minutes is really not much time. On the other hand [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=109&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here are the slides that I have prepared for my talk at <a href="http://www.javaforum.se">JavaForum</a> this evening. It took me some time to cut it down to 34 slides and then still many of them had to become extra spare slides. I had to realize that 30 minutes is really not much time. On the other hand I&#8217;ve seen many 10 minute lightning talks where the speaker manages to deliver the essence of a pretty complicated topic, so I shouldn&#8217;t really complain.</p>
<iframe src='http://www.slideshare.net/slideshow/embed_code/1994766' width='450' height='369'></iframe>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjarlestam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjarlestam.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjarlestam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjarlestam.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjarlestam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjarlestam.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjarlestam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjarlestam.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjarlestam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjarlestam.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjarlestam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjarlestam.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjarlestam.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjarlestam.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=109&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjarlestam.wordpress.com/2009/09/15/introduction-to-jax-rs/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72dea68d4842520ca1c50b7beb9426f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjarlestam</media:title>
		</media:content>
	</item>
		<item>
		<title>REST presentation</title>
		<link>http://bjarlestam.wordpress.com/2009/06/16/rest-presentation/</link>
		<comments>http://bjarlestam.wordpress.com/2009/06/16/rest-presentation/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 12:45:27 +0000</pubDate>
		<dc:creator>bjarlestam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[web tech]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[jax-rs]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://bjarlestam.wordpress.com/?p=104</guid>
		<description><![CDATA[I have put together some slides about the basic principles in REST. The real presentation is actually implemented as a JAX-RS application. I started out with a django version, but I needed a Java-angle on it so I had to switch to JAX-RS.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=104&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have put together some slides about the basic principles in REST. The real presentation is actually implemented as a JAX-RS application. I started out with a django version, but I needed a Java-angle on it so I had to switch to JAX-RS.</p>
<iframe src='http://www.slideshare.net/slideshow/embed_code/1568077' width='450' height='369'></iframe>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjarlestam.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjarlestam.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjarlestam.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjarlestam.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjarlestam.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjarlestam.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjarlestam.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjarlestam.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjarlestam.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjarlestam.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjarlestam.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjarlestam.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjarlestam.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjarlestam.wordpress.com/104/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=104&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjarlestam.wordpress.com/2009/06/16/rest-presentation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72dea68d4842520ca1c50b7beb9426f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjarlestam</media:title>
		</media:content>
	</item>
		<item>
		<title>Some reflections from Agile Sweden 2009</title>
		<link>http://bjarlestam.wordpress.com/2009/06/10/some-reflections-from-agile-sweden-2009/</link>
		<comments>http://bjarlestam.wordpress.com/2009/06/10/some-reflections-from-agile-sweden-2009/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 08:30:21 +0000</pubDate>
		<dc:creator>bjarlestam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[agila sverige]]></category>
		<category><![CDATA[agila sverige 2009]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[as09]]></category>
		<category><![CDATA[conference]]></category>
		<category><![CDATA[kanban]]></category>
		<category><![CDATA[lean]]></category>
		<category><![CDATA[scrum]]></category>
		<category><![CDATA[sweden]]></category>

		<guid isPermaLink="false">http://bjarlestam.wordpress.com/?p=82</guid>
		<description><![CDATA[It&#8217;s been two days of interesting talks and discussions at Agila Sverige 2009. These are some of my reflections from the event: Bring back the simplicity There was a lot of talk about bringing back simplicity as one of the cornerstones in agile development. XP was all about communication, simplicity, feedback and courage. Somehow the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=82&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been two days of interesting talks and discussions at Agila Sverige 2009. These are some of my reflections from the event:</p>
<h3>Bring back the simplicity</h3>
<p>There was a lot of talk about bringing back simplicity as one of the cornerstones in agile development. XP was all about communication, simplicity, feedback and courage. Somehow the principle of using the simplest solution has been lost when we standardize on agile methods. Many of the talks were about simplicity, for example <a href="http://johan-lind.blogspot.com/">Johan</a> talked about &#8220;Standards vs. <a href="http://en.wikipedia.org/wiki/Cargo_cult">Cargo cult</a>&#8220;, <a href="http://neverspace.net/">Niklas</a> talked about &#8220;Simplicity as means, opportunity as goal&#8221; and <a href="http://marcus.ahnve.net/">Marcus</a> asked &#8220;Where did the simplest working solution go?&#8221;. All very good presentations. A somewhat related presentation was about allowing variation to facilitate evolution (variation + selection = evolution). The advice was to bring in some variation in each project and select the working solutions. When I think of it, that is usually how I work as well.</p>
<h3>Kanban and Scrum</h3>
<p>Another hot topic was Scrum and Kanban. Kanban is of course the new and trendy thing to talk about. <a href="http://www.crisp.se/henrik.kniberg">Henrik</a> gave a good talk where he managed to describe the similarities and differences in just 10 minutes. There were also some good presentations about how to apply Kanban and how Kanban and Scrum can be combined.</p>
<h3>Is Scrum the new RUP?</h3>
<p>I don&#8217;t remember who it was, but someone asked the question whether Scrum is the new RUP. The Agile movement was a reaction on stiff processes being forced down from upper management, but today we see the same thing happening with Scrum. Anna Herting for example described that to solve their problem with prioritizing maintenance activities they used Kanban, but still had to call it Scrum to satisfy the managers. In my view it is always bad to just apply a process methodology without thinking about what the needs are. You also want to continuously improve on the process and extend it with new ways of working. What you need is some principles to follow that will take you in the right direction and simple tools to choose from and use as inspiration.</p>
<h3>People, Teams and how we behave</h3>
<p>Many of the talks were about how to behave as responsible developers and how to create good team cultures. For example <a href="http://www.plaxo.com/directory/profile/8590666902/be1447b2/%C3%85ke/Helgstrand">Åke</a> made a talk about self-learning and asking good questions, asking them at the right time and asking <a href="http://en.wikipedia.org/wiki/Lagom">lagom</a> many questions. We also got the good advice from <a href="http://jockeholm.wordpress.com/">Jocke</a> to promise behavior instead of results. He explained that promises are tools to gain trust, synchronize with people and create motivation. <a href="http://www.hedgate.net/">Chris</a> talked about the different stages of learning. How you go from unconsciously incompetent -&gt; consciously incompetent -&gt; consciously competent -&gt; unconsciously competent. The unconsciously incompetent needs inspiration while the unconsciously competent needs reflection. Lots of talk about creating openness and trust in teams, for example by establishing common team values.</p>
<p>All in all I had a great time. I really enjoyed the open and interactive format with Lightning Talks and Open Space sessions.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjarlestam.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjarlestam.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjarlestam.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjarlestam.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjarlestam.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjarlestam.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjarlestam.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjarlestam.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjarlestam.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjarlestam.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjarlestam.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjarlestam.wordpress.com/82/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjarlestam.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjarlestam.wordpress.com/82/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=82&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjarlestam.wordpress.com/2009/06/10/some-reflections-from-agile-sweden-2009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72dea68d4842520ca1c50b7beb9426f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjarlestam</media:title>
		</media:content>
	</item>
		<item>
		<title>A wave of new HTML5 stuff from Google</title>
		<link>http://bjarlestam.wordpress.com/2009/06/01/a-wave-of-new-html5-stuff-from-google/</link>
		<comments>http://bjarlestam.wordpress.com/2009/06/01/a-wave-of-new-html5-stuff-from-google/#comments</comments>
		<pubDate>Mon, 01 Jun 2009 14:17:12 +0000</pubDate>
		<dc:creator>bjarlestam</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[web tech]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[wave]]></category>

		<guid isPermaLink="false">http://bjarlestam.wordpress.com/?p=75</guid>
		<description><![CDATA[Google is pushing rather hard for HTML5 now with Google Wave, the new flash free HTML 5 version of YouTube and more HTML5 support in Chrome . It&#8217;s nice that someone is pushing for open standards instead of proprietary stuff (read Silverlight, Flex, JavaFX).<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=75&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Google is pushing rather hard for HTML5 now with <a href="http://wave.google.com/">Google Wave</a>, the new flash free <a href="http://www.youtube.com/html5">HTML 5 version of YouTube </a> and <a href="http://blog.internetnews.com/skerner/2009/05/google-chrome-3-adds-html5.html">more HTML5 support in Chrome </a>. It&#8217;s nice that someone is pushing for open standards instead of proprietary stuff (read Silverlight, Flex, JavaFX).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjarlestam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjarlestam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjarlestam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjarlestam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjarlestam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjarlestam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjarlestam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjarlestam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjarlestam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjarlestam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjarlestam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjarlestam.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjarlestam.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjarlestam.wordpress.com/75/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=75&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjarlestam.wordpress.com/2009/06/01/a-wave-of-new-html5-stuff-from-google/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72dea68d4842520ca1c50b7beb9426f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjarlestam</media:title>
		</media:content>
	</item>
		<item>
		<title>Simple JavaScript AOP framework</title>
		<link>http://bjarlestam.wordpress.com/2009/05/27/simple-javascript-aop-framework/</link>
		<comments>http://bjarlestam.wordpress.com/2009/05/27/simple-javascript-aop-framework/#comments</comments>
		<pubDate>Wed, 27 May 2009 14:32:54 +0000</pubDate>
		<dc:creator>bjarlestam</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[web tech]]></category>
		<category><![CDATA[aop]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">http://bjarlestam.wordpress.com/?p=64</guid>
		<description><![CDATA[Here&#8217;s a simple JavaScript AOP framework for aspect oriented programming that I have been playing with: /** * AOP framework for aspect oriented programming in JavaScript */ var AOP = AOP &#124;&#124; function() { //Private methods function toArray(iterable) { if (!iterable) return []; if (iterable.toArray) return iterable.toArray(); var length = iterable.length &#124;&#124; 0, results = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=64&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a simple JavaScript AOP framework for aspect oriented programming that I have been playing with:</p>
<pre>/**
 * AOP framework for aspect oriented programming in JavaScript
 */

 var AOP = AOP || function() {

     //Private methods

     function toArray(iterable) {
         if (!iterable) return [];
         if (iterable.toArray) return iterable.toArray();
         var length = iterable.length || 0, results = new Array(length);
         while (length--) results[length] = iterable[length];
         return results;
     }

     //Public methods

     var public = {
         around: function(obj, fname, advice) {
             var oldFunc = obj[fname];
             obj[fname] = function() {
                 var args = [oldFunc].concat(toArray(arguments));
                 return advice.apply(this, args);
             };
         },

         before: function(obj, fname, advice) {
             var oldFunc = obj[fname];
             obj[fname] = function() {
                 var args = [oldFunc].concat(toArray(arguments));
                 advice.apply(this, args);
                 return oldFunc.apply(this, arguments);
             };
         },

         after: function(obj, fname, advice) {
             var oldFunc = obj[fname];
             obj[fname] = function() {
                 var args = [oldFunc].concat(toArray(arguments));
                 oldFunc.apply(this, arguments);
                 return advice.apply(this, args);
             };
         },

         callMethod: function(args) {
             var argsArray = toArray(args);
             return argsArray[0].apply(this, argsArray.slice(1));
         }
     };

     return public;
 }();</pre>
<p>You can try it out with the following test code:</p>
<pre>function logBeforeAndAfter() {
	console.log("before");
	AOP.callMethod(arguments);
	console.log("after");
}

function logAfter(f) {
	console.log("after ...");
	if(arguments[1] == "world") {
		console.log("its world");
	}
}

testObject = {
	hello: function(who) {
		console.log("hello " + who);
	}
}

AOP.around(testObject, "hello", logBeforeAndAfter);

//	AOP.before(testObject, "hello", function() {console.log("before");})

//	AOP.after(testObject, "hello", logAfter);

testObject.hello("world");</pre>
<p>Maybe not so useful yet, but a nice exercise anyway.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjarlestam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjarlestam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjarlestam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjarlestam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjarlestam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjarlestam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjarlestam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjarlestam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjarlestam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjarlestam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjarlestam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjarlestam.wordpress.com/64/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjarlestam.wordpress.com/64/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjarlestam.wordpress.com/64/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=64&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjarlestam.wordpress.com/2009/05/27/simple-javascript-aop-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72dea68d4842520ca1c50b7beb9426f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjarlestam</media:title>
		</media:content>
	</item>
		<item>
		<title>Learn JavaScript and learn it properly</title>
		<link>http://bjarlestam.wordpress.com/2009/02/25/learn-javascript-and-learn-it-properly/</link>
		<comments>http://bjarlestam.wordpress.com/2009/02/25/learn-javascript-and-learn-it-properly/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 23:56:10 +0000</pubDate>
		<dc:creator>bjarlestam</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[web tech]]></category>
		<category><![CDATA[ecmascript]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[resources]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://bjarlestam.wordpress.com/?p=48</guid>
		<description><![CDATA[JavaScript is the global web version of the unix shell script, simply increadibly useful. With tools like ubiquity and greasemonkey you can do lots of cool stuff. Also all the nice frameworks, GUI components and the JSON APIs makes it a very useful language. So to help you learn JavaScript and for my own reference [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=48&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>JavaScript is the global web version of the unix shell script, simply increadibly useful. With tools like <a title="Ubiquity" href="http://labs.mozilla.com/projects/ubiquity/" target="_blank">ubiquity</a> and <a title="Greasemonkey" href="https://addons.mozilla.org/en-US/firefox/addon/748" target="_blank">greasemonkey</a> you can do lots of cool stuff. Also all the nice frameworks, GUI components and the JSON APIs makes it a very useful language.</p>
<p>So to help you learn JavaScript and for my own reference I have listed some really good resources</p>
<p>The JavaScript Programming Language<br />
<a href="http://video.yahoo.com/watch/111593/1710507" target="_blank">http://video.yahoo.com/watch/111593/1710507</a><br />
<a href="http://video.yahoo.com/watch/111594/1710553" target="_blank">http://video.yahoo.com/watch/111594/1710553</a><br />
<a href="http://video.yahoo.com/watch/111595/1710607" target="_blank">http://video.yahoo.com/watch/111595/1710607</a><br />
<a href="http://video.yahoo.com/watch/111596/1710658" target="_blank">http://video.yahoo.com/watch/111596/1710658</a></p>
<p>Advanced JavaScript<br />
<a href="http://video.yahoo.com/watch/111585/1027823" target="_blank">http://video.yahoo.com/watch/111585/1027823</a><br />
<a href="http://video.yahoo.com/watch/111586/1027832" target="_blank">http://video.yahoo.com/watch/111586/1027832</a><br />
<a href="http://video.yahoo.com/watch/111587/1027854" target="_blank">http://video.yahoo.com/watch/111587/1027854</a></p>
<p>JavaScript &#8211; The Good Parts<br />
<a href="http://video.yahoo.com/watch/630959/2974197" target="_blank">http://video.yahoo.com/watch/630959/2974197</a></p>
<p>Interactive tutorial by John Resig:<br />
<a href="http://ejohn.org/apps/learn/" target="_blank">http://ejohn.org/apps/learn/</a></p>
<p>JavaScript best practices<br />
<a href="http://www.slideshare.net/cheilmann/javascript-best-practices-1041724" target="_blank">http://www.slideshare.net/cheilmann/javascript-best-practices-1041724</a></p>
<p>Blogs:<br />
<a href="http://www.robertnyman.com/">http://www.robertnyman.com/</a><br />
<a href="http://www.wait-till-i.com/">http://www.wait-till-i.com/</a><br />
<a href="http://remysharp.com/">http://remysharp.com/</a><br />
<a href="http://frontendbook.com/">http://frontendbook.com/</a><br />
<a href="http://mattsnider.com/" target="_blank">http://mattsnider.com/</a><br />
<a href="http://ejohn.org/">http://ejohn.org/</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjarlestam.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjarlestam.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjarlestam.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjarlestam.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjarlestam.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjarlestam.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjarlestam.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjarlestam.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjarlestam.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjarlestam.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjarlestam.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjarlestam.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjarlestam.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjarlestam.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=48&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjarlestam.wordpress.com/2009/02/25/learn-javascript-and-learn-it-properly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72dea68d4842520ca1c50b7beb9426f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjarlestam</media:title>
		</media:content>
	</item>
		<item>
		<title>Shouldn&#8217;t the web be location aware by now?</title>
		<link>http://bjarlestam.wordpress.com/2009/01/04/shouldnt-the-web-be-location-aware-by-now/</link>
		<comments>http://bjarlestam.wordpress.com/2009/01/04/shouldnt-the-web-be-location-aware-by-now/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 22:21:02 +0000</pubDate>
		<dc:creator>bjarlestam</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[web tech]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[eeepc]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[gears]]></category>
		<category><![CDATA[geode]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[location]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[positioning]]></category>
		<category><![CDATA[skyhook]]></category>
		<category><![CDATA[w3c]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://bjarlestam.wordpress.com/?p=8</guid>
		<description><![CDATA[These are my findings from researching the options currently available for making web sites aware of the users geographical location. <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=8&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>More and more devices come with built in GPS and mobile browsing has become more popular with the iPhone and all the ultra mobile laptops such as the Asus EEEPC. So, mow it seems to be the right time to start building websites that adapt themselves to your current location.</p>
<p>To make the web applications location aware we need to get the location from somewhere. The most obvious way would be that the web browser makes it available by retrieving it from a GPS, mobile cell information, WiFi access point etc. It can provide the information to the web applications through a JavaScript API.</p>
<h3><strong>What is available?</strong></h3>
<p>Unfortunately there is no standard that is supported by all the major browsers yet, but there are some really interesting things ongoing.</p>
<p>For Firefox you have the <a href="http://labs.mozilla.com/2008/10/introducing-geode/">Geode</a> plugin that provides access to location information via a JavaScript API. The location information in Geode is based on <a href="http://en.wikipedia.org/wiki/Skyhook_Wireless">Skyhook</a> which calculates it from nearby WiFi access points. Skyhook has a database with MAC addresses of <a href="http://www.skyhookwireless.com/howitworks/coverage.php">access points, mostly in USA and Canada</a>.</p>
<p>The Firefox 3.1 beta release includes out of the box support for a JavaScript API. Firefox 3.1 will allow the user to choose a geolocation service provider, which can either be a peripheral device like a GPS, or a web-based service provider. The API is based on the W3C draft described below.</p>
<p>Google has done quite some work to location enable the web. As announced in <a href="http://google-code-updates.blogspot.com/2008/08/two-new-ways-to-location-enable-your.html">their code blog</a> they provide an <a href="http://code.google.com/apis/ajax/documentation/#ClientLocation">AJAX API</a> that lets you get a rough location based on the ip-address. Google Gears also supports a <a href="http://code.google.com/apis/gears/api_geolocation.html">location API</a> very similar to the W3C draft and with Google as editor in W3C I think the chance of conformance is rather good. Google Gears can use GPS, mobile cell id or <a href="http://google-code-updates.blogspot.com/2008/10/introducing-gears-geolocation-api-for.html">WiFi access point</a> to determine the location. As you probably know Gears is available as a plugin for Safari, Firefox and IE and of course comes built in to Chrome. Also <a href="http://code.google.com/apis/gears/mobile.html">Windows Mobile 5 and 6 devices are supported</a> and of course it comes pre-installed on Anrdoid phones.</p>
<p>The IPhone does currently not provide any JavaScript API for location information and it does not support Google Gears. There is however an <a href="http://lbs.tralfamadore.com/">application</a> available for Jailbroken IPhones that implements the W3C draft API described below.</p>
<h3><strong>The W3C Geolocation JavaScript API draft<br />
</strong></h3>
<p>Google has submitted a simplified version of their Google Gears API to W3C. This <a href="http://dev.w3.org/geo/api/spec-source.html">draft specification</a> is currently worked on in the <a href="http://www.w3.org/2008/geolocation/">Geolocation Working Group in W3C</a>. The working group plans to have an official recommendation ready by end of 2009.</p>
<p>The current draft version of this API includes a method for getting location information and another to get periodic updates of location information.</p>
<div class="example">
<p>Example of a &#8220;one-shot&#8221; position request.</p>
<pre>    // Callback function
    function showMap(position) {
      // Show a map centered at
      // (position.coords.latitude, position.coords.longitude).
    }

    // One-shot position request.
    navigator.geolocation.getCurrentPosition(showMap);</pre>
</div>
<div class="example">
<p>Example of requesting repeated position updates.</p>
<pre>    // Callback function
    function scrollMap(position) {
      // Scroll the map so that it is centered at
      // (position.coords.latitude, position.coords.longitude).
    }

    // Request repeated updates.
    var watchId = navigator.geolocation.watchPosition(scrollMap);

    function buttonClickHandler() {
      // Cancel the updates when the user clicks a button.
      navigator.geolocation.clearWatch(watchId);
    }</pre>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bjarlestam.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bjarlestam.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bjarlestam.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bjarlestam.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/bjarlestam.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/bjarlestam.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/bjarlestam.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/bjarlestam.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bjarlestam.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bjarlestam.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bjarlestam.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bjarlestam.wordpress.com/8/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bjarlestam.wordpress.com/8/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bjarlestam.wordpress.com/8/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bjarlestam.wordpress.com&amp;blog=5745629&amp;post=8&amp;subd=bjarlestam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://bjarlestam.wordpress.com/2009/01/04/shouldnt-the-web-be-location-aware-by-now/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/72dea68d4842520ca1c50b7beb9426f2?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">bjarlestam</media:title>
		</media:content>
	</item>
	</channel>
</rss>
