<?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>Uxebu.com - the Ajax and JavaScript Experts</title>
	<atom:link href="http://uxebu.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://uxebu.com/blog</link>
	<description>Web, Dojo, news</description>
	<lastBuildDate>Sun, 06 Jun 2010 22:28:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SWDC 2010 Stockholm</title>
		<link>http://uxebu.com/blog/2010/06/07/swdc-2010-stockholm/</link>
		<comments>http://uxebu.com/blog/2010/06/07/swdc-2010-stockholm/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 22:12:28 +0000</pubDate>
		<dc:creator>Wolfram Kriesing</dc:creator>
				<category><![CDATA[dojo]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[html5apps]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[uxebu]]></category>
		<category><![CDATA[w3c widgets]]></category>
		<category><![CDATA[swdc]]></category>

		<guid isPermaLink="false">http://uxebu.com/blog/?p=1217</guid>
		<description><![CDATA[Thanks to Peter Peter Svensson for organizing and making SWDC 2010 in Stockholm happen and especially thanks for inviting us to speak there. We had a blast. A crowd of about 100 people saw some very interesting talks, ranging from Node.js, YQL, Chrome extensions, HTML5 to PhoneGap, I guess everybody heard something new and interesting.

The [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to Peter Peter Svensson for organizing and making <a href="http://www.swdc-central.com/">SWDC 2010</a> in Stockholm happen and especially thanks for inviting us to speak there. We had a blast. A crowd of about 100 people saw some very interesting talks, ranging from Node.js, YQL, Chrome extensions, HTML5 to PhoneGap, I guess everybody heard something new and interesting.<br />
<span id="more-1217"></span></p>
<p><a href="http://twitter.com/cramforce/statuses/15327628835" target="_blank" style="float:right;"><img src="http://blog.uxebu.com/wp-content/uploads//2010/06/Twitter-_-Malte-Ubl.jpg" alt="mobile rulez" title="Twitter _ Malte Ubl" width="305" height="154" class="aligncenter size-full wp-image-1221" /></a>The second day was mainly focused around mobile topics. Nikolai showed us how to think out of the box (which is your phone in this case) by talking about <a href="http://www.slideshare.net/nonken/human-apis" target="_blank">&#8220;Human APIs &#8211; expanding the mobile web&#8221;</a>. I tried to give an overview about how to use web technologies for mobile apps by talking about <a href="">&#8220;App vs. Widget &#8211; HTML5 Apps&#8221;</a>. And as it seems we had hit a sweet spot there as the tweet proves. It seems we had found our slots there. It was fun to see that.<br />
Find our slides below.</p>
<p><a href="http://picasaweb.google.com/psvensson/SWDC2010?feat=content_notification#5479008498447913298" target="_blank" style="float:left"><img src="http://blog.uxebu.com/wp-content/uploads//2010/06/whatuxebudoes.jpg" alt="what uxebu does" title="whatuxebudoes" width="265" height="210" align="center" style="padding:0 5px 5px 0" /></a>It was great to see Sony Ericcson show their PhoneGap based strategy. Since that is also part of our direction it is very encouraging to see that there is company on going this route. They showed a webbased build tool, which allows for a simple creation of runnable apps based on PhoneGap and also interesting ideas around native APIs and the security concept. A lot of triggers that made a lot of people think. Great input.<br />
<a href="http://twitter.com/creationix">@creationix</a> showed a cool demo using node.js, where we could all interact with his app. <a href="http://twitter.com/divineprog">@divineprog</a> showed DroidScript, which basically was a Smalltalk inspired realtime Rhino-based JavaScript runtime, that allows using native Android resources. We learned a lot around geo data, their handling and optimization in use from <a href="http://twitter.com/tablackmore">@tablackmore</a>. Those are just some of the talks, they all were of high quality, so be sure to see them live next time.</p>
<p>At the mobile day we also heard talks about </p>
<ul>
<li>The New Mobile Web &#8211; A Web of Scripted Applications by <a href="http://twitter.com/divineprog">@divineprog</a></li>
<li>How to avoid the latency trap by <a href="http://twitter.com/sh1mmer">@sh1mmer</a></li>
<li>Handling spatial data on the web by <a href="http://twitter.com/tablackmore">@tablackmore</a></li>
<li>HTML5 gives you wings by <a href="http://twitter.com/mahemoff">@mahemoff</a></li>
<li>The phone in the cloud by Claes Nilsson and Thomas Bailey</li>
<li>node.JS powered mobile apps by <a href="http://twitter.com/creationix">@creationix</a></li>
</ul>
<p>All in all it was a great conference, I will look forward to be coming back next year.</p>
<div style="width:425px;" id="__ss_4401063"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/nonken/human-apis" title="Human APIs, the future of mobile">Nikolai Onken: Human APIs &#8211; expanding the mobile web</a></strong><object id="__sse4401063" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=humanapis-100603080239-phpapp01&#038;stripped_title=human-apis" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse4401063" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=humanapis-100603080239-phpapp01&#038;stripped_title=human-apis" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/nonken">Nikolai Onken</a>.</div>
</div>
<div style="width:425px" id="__ss_4405271"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/wolframkriesing/html5-apps-cross-platform-swdc2010" title="Html5 apps   cross platform - SWDC2010">Wolfram Kriesing: HTML5 apps   cross platform &#8211; SWDC2010</a></strong><object id="__sse4405271" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=html5apps-crossplatform-swdc2010-100603192006-phpapp02&#038;stripped_title=html5-apps-cross-platform-swdc2010" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse4405271" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=html5apps-crossplatform-swdc2010-100603192006-phpapp02&#038;stripped_title=html5-apps-cross-platform-swdc2010" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/wolframkriesing">wolframkriesing</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2010/06/07/swdc-2010-stockholm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Forgotten tricks for iPhones Safari</title>
		<link>http://uxebu.com/blog/2010/04/28/forgotten-tricks-for-iphones-safari/</link>
		<comments>http://uxebu.com/blog/2010/04/28/forgotten-tricks-for-iphones-safari/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 14:18:21 +0000</pubDate>
		<dc:creator>Nikolai Onken</dc:creator>
				<category><![CDATA[frontend engineering]]></category>
		<category><![CDATA[html5apps]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://uxebu.com/blog/?p=1171</guid>
		<description><![CDATA[Safari om the iPhone is an incredible powerful browser and comes with a whole bunch of features.
Besides the amazing support for CSS3, a superfast rendering engine and great JavaScript support, there are a few hidden gems I want to explain in this (and maybe following) blogposts. If you are interested in mobile web development, maybe [...]]]></description>
			<content:encoded><![CDATA[<p>Safari om the iPhone is an incredible powerful browser and comes with a whole bunch of features.<br />
Besides the amazing support for CSS3, a superfast rendering engine and great JavaScript support, there are a few hidden gems I want to explain in this (and maybe following) blogposts. If you are interested in mobile web development, maybe you will find a few features you haven&#8217;t seen before.</p>
<h2>Making your web app iPhone ready</h2>
<p>Note: <a href="http://static.uxebu.com/~nonken/a/safariGems">you can visit the example used in this blog post from your iPhone here.</a></p>
<p><object width="500" height="344"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=11241853&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=11241853&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="344"></embed></object><br />
<span id="more-1171"></span><br />
The most well-known and really most important meta tag you need to know about is the viewport meta-tag. It allows you to define the minimum and maximum zoom-level and whether or not the user is allowed to zoom into the view. You disable zooming by setting the minimum-scale to the same value as maximum-scale. At the same time you can define the viewport width and height by setting the &#8220;device-width&#8221; or &#8220;device-height&#8221; properties. If you have a website with a width of 960px and you want it to be zoomed in to fit exactly that width, all you need to do is to set width to 960. Since your website should run on several devices though with different resolutions it is not recommended to set an absolute width and instead use the predefined device-width and device-height values. This ensures that your viewport has exactly the size supported by the device.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>meta <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;viewport&quot;</span> content<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;width=device-width,minimum-scale=1.0,maximum-scale=1.0&quot;</span><span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>Now lets get to the juicy part. When creating an HTML5 app for the iPhone you can define an icon which you will see on the start screen of your iPhone. Once you set this meta tag, the user won&#8217;t be able to see a difference between a native application and a web application on your iPhones homescreen.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;apple-touch-icon&quot;</span> href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;/yourIcon.png&quot;</span><span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>To add even another level of detail you can define a startup screen for your application. This is especially useful when your application supports offline mode using cache manifests.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;apple-touch-startup-image&quot;</span> href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;/startupImage.png&quot;</span><span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>All of those features wouldn&#8217;t be complete if you couldn&#8217;t hide the browsers chrome once you start your application from the homescreen. To disable the chrome just insert following tag:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>meta <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;apple-mobile-web-app-capable&quot;</span> content<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;yes&quot;</span><span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Now after you have added this meta tag you want to be able to differenciate between the user launching the app from the homescreen of the browser.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// navigator.standalone</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;standalone&quot;</span> <span style="color: #000066; font-weight: bold;">in</span> navigator<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>navigator.<span style="color: #660066;">standalone</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Started from homescreen&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Started in browser&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Not supporting standalone property&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Last but not least you can even control the look and feel of the status bar on the top. You can either use the default status bar or a black status bar or a semi translucent status bar:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>meta <span style="color: #000066;">name</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;apple-mobile-web-app-status-bar-style&quot;</span> content<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;black/default/black-translucent&quot;</span> <span style="color: #339933;">/&gt;</span></pre></td></tr></table></div>

<p>These are the most important things you need to know to make a simple website be HTML5 app ready on your iPhone (note: this only works on the iPhone but won&#8217;t hurt other devices and platforms). A &#8220;normal&#8221; user won&#8217;t be able to differentiate between a native or a HTML5 app anymore. Do you know of similar features of other phones? Do you think we should standardize the discussed features? (Some are already). </p>
<p>If you need support getting your website or web application HTML5 app ready, feel free to <a href="http://uxebu.com/contact">contact us</a>.</p>
<p>Enjoy</p>
<h2>Dowload</h2>
<ul>
<li>
<a href="http://static.uxebu.com/~nonken/a/safariGems/safariGems.tgz">Source</a>
</li>
<li><a href="http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/ConfiguringWebApplications/ConfiguringWebApplications.html">Docs</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2010/04/28/forgotten-tricks-for-iphones-safari/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>TouchScroll, a scrolling layer for WebKit mobile [update]</title>
		<link>http://uxebu.com/blog/2010/04/27/touchscroll-a-scrolling-layer-for-webkit-mobile/</link>
		<comments>http://uxebu.com/blog/2010/04/27/touchscroll-a-scrolling-layer-for-webkit-mobile/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 14:24:27 +0000</pubDate>
		<dc:creator>David Aurelio</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://uxebu.com/blog/?p=1195</guid>
		<description><![CDATA[Dion Almaer was faster than me blogging about TouchScroll. Here is what you are waiting for – the “official” blog post about TouchScroll and the link to the repository.
Here it is: TouchScroll, our scrolling layer for WebKit Mobile. It is JavaScript/CSS 3 based and allows for fixed elements like headers and toolbars on web pages [...]]]></description>
			<content:encoded><![CDATA[<p>Dion Almaer was faster than me <a href="http://ajaxian.com/archives/touchscroll-implementing-scroll-physics-in-js-and-css">blogging about TouchScroll</a>. Here is what you are waiting for – the “official” blog post about TouchScroll and the link to the repository.</p>
<p>Here it is: TouchScroll, our scrolling layer for WebKit Mobile. It is JavaScript/CSS 3 based and allows for fixed elements like headers and toolbars on web pages when viewed on the iPhone or on Android. It works on the iPad, too. Check out the <a href="http://static.uxebu.com/~david/touchscroll/">demo</a> (short URL: <a href="http://u.nu/8uvg8">http://u.nu/8uvg8</a>) to see it in action – it works in Desktop Safari (at least kind of) or WebKit Nightly (very good), but I recommend you have a look at it on your iPhone, iPad, or Android based device.</p>
<p><span id="more-1195"></span></p>
<h2>Motivation</h2>
<p>While Safari Mobile features native scrolling, there are two reasons to re-implement scrolling with JavaScript: The original scrolling behavior is rather slow – we were looking for a solution that feels more fluid. And the viewport behavior of Mobile Safari and other mobile browsers using WebKit doesn’t allow for fixed positioned elements. It is optimized for document reading, not for building interfaces.</p>
<p>Our goal is to be able to deploy application interfaces to browsers of handheld devices that feel as familiar as possible for the user. TouchScroll enables developers to use fixed interface elements like headers and toolbars.</p>
<p>We also use <a href="http://www.phonegap.com/">PhoneGap</a> a lot to deploy <a href="http://uxebu.com/blog/2010/02/15/eventninja-a-mobile-cross-platform-app/">cross-platform applications</a> onto smartphones, and we think that web based apps don’t need to feel like aliens for users. And we weren’t satisfied with existing solutions.</p>
<h2>Usage</h2>
<p>To add a scrolling capabilities to an element, that element must have a fixed size. Have a look at the demo for an elegant approach using <code>display: -webkit-box</code>.</p>
<p>HTML:</p>
<pre><code>&lt;div class="scroller"&gt;&lt;!-- some great contents --&gt;&lt;/div&gt;</code></pre>
<p>JavaScript:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> scrollNode <span style="color: #339933;">=</span> document.<span style="color: #660066;">querySelector</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.scroller&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> options <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> scroller <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> TouchScroll<span style="color: #009900;">&#40;</span>scrollNode<span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>At the moment, the only known option is <em>elastic.</em> Use <code>{elastic: true}</code> as second parameter to add the bouncing effect to the scroller.</p>
<h2>Get it!</h2>
<p>TouchScroll is available <a href="http://github.com/davidaurelio/TouchScroll">on github</a>. Feel free to fork it and send patches back. You can also <a href="http://github.com/davidaurelio/TouchScroll/downloads">get a minimized file</a> that includes the css-bezier library that TouchScroll depends on.</p>
<h2>How is it done?</h2>
<p>TouchScroll uses a combination of JavaScript and CSS 3. All animations are done with CSS transitions – no JavaScript intervals.</p>
<p>The elasticity effect when crossing the scroller bounds is achieved by dividing the bezier curve (used as timing function) into two sub-curves using my (yet to be finished) <a href="http://github.com/davidaurelio/css-beziers">CSS Bezier library for JavaScript</a>.</p>
<h2>Customization/Configuration</h2>
<p>TouchScroll allows you to customize many aspects of the scrolling behaviour: Have a look at the <code>config</code> object at the top of the source file.</p>
<p>Customizable properties include bouncing behaviour and deceleration animation. Feel free to experiment. I know that scrolling is not as close to <em>&lt;insert device of choice&gt;</em> as possible. If you think you’ve found better values, just let me know.</p>
<p>Configurable properties include:</p>
<ul>
<li>Scrolling threshold: The minimum pixel amount needed to begin scrolling</li>
<li>Flicking behavior: flicking threshold, friction, and deceleration animation.</li>
<li>The elasticity/bouncing effect: factor and maximum bounce length.</li>
<li>Snap back behavior: timing function and default duration.</li>
</ul>
<h2>Goodies</h2>
<p>After instanciation, each TouchScroll scroller re-adapts to its contents after <code>orientationchange</code> and <code>resize</code> events on <code>window</code> as well as after <code>DOMSubtreeModified</code> events on the scroller itself. That means, the scroller adapts to content additions and deletions.</p>
<h2>Limitations</h2>
<p>TouchScroll is meant to be used with touch-based devices and also works well with a stylus (tested with a Wacom tablet). Don’t use it for desktop browsers and the like. Simply add <code>overflow: auto</code> to the scroller element for these cases. Zero-cost compatibility.</p>
<h3>Hiding and Showing</h3>
<p>If a scroller is instanciated with an layer that is not beeing displayed, it needs to be refreshed manually after making it visible. Simply use the <code>setupScroller</code> method.</p>
<h3>Styling</h3>
<p>TouchScroll inserts two more <code>&lt;div&gt;</code> elements to the outer scroller container, that wrao the prior contents. That means, that the outer scroller element <em>must not have padding.</em> The CSS child selector (<code>a &gt; b</code>) won’t work any more after instancing TouchScroll on an element for the same reason.</p>
<h3>Android</h3>
<p>Android has several problems that need to be solved. If you have solutions, please keep in mind that TouchScroll should remain compatible with WebKit as found on Android 1.5 and send us a patch.</p>
<ul>
<li>When not preventing the default action of the initial <em>touchstart</em> event on Android, the following <em>touchmove</em> events <strong>queue up</strong> and fire just before the eventual <em>touchend</em> event. That makes scrolling impossible.Cancelling the <em>touchstart</em> event results in other problems: It prevents tapped elements from beeing focused or clicked. The current workaround – dispatching a synthesized <em>click</em> event – hides the focus rectangle and makes the focussing of form elements nearly impossible, which is even worse.That means: at the moment it is <em>not possible to use TouchScroll in conjunction with forms on Android.</em>I’d like to know whether there is a solution that eliminates the need to prevent the default action of <em>touchstart.</em></li>
<li>Due to the lack of hardware acceleration, the <strong>rendering performance</strong> on Android isn’t nearly as good as on the Apple’s devices. We already invested a lot of work to achieve good performance. If you can do better, send us a patch!</li>
<li>Support for <code>-webkit-transform: matrix(…)</code> is <strong>broken</strong> in Android &lt; v2.0. That affects reading the computed style of elements. We already worked around that issue using a regex-based parsing function for those devices.</li>
</ul>
<h3>Other Devices</h3>
<p>The browser of <strong>S60 devices</strong> is based on WebKit, too. However, apart from the fact that TouchScroll does not work on those devices, you should simply set the overflow style of the scroll container to <code>overflow: auto</code> for these devices and benefit from native scrolling. The same goes for <em>Nokia WRT</em> apps.</p>
<p>I’ve done a quick test on the <strong>Palm Pre</strong>. Unfortunately, TouchScroll does not work in the browser of webOS. Moreover, I’m not sure whether it actually <em>makes sense</em> in this particular browser, as its overlays would lie directly on top of fixed elements at the bottom. In webOS apps you should probably use the native scroller anyway. Maybe I’ll do a short tutorial on how to instanciate TouchScroll on iPhone/Android and the webOS scroller when deploying a cross platform app to all of those devices.</p>
<p>What other devices are relevant? Let us know!</p>
<h2>To Do</h2>
<p>The official to-do-list:</p>
<ul>
<li>Keep the scrollbars round while bouncing – I already know how to do this, so you can expect the solution in the next days.</li>
<li>Add an option to completely switch off scrollbars.</li>
<li>Find a solution to the event problems on Android – help greatly appreciated!</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2010/04/27/touchscroll-a-scrolling-layer-for-webkit-mobile/feed/</wfw:commentRss>
		<slash:comments>99</slash:comments>
		</item>
		<item>
		<title>One var statement for one variable!</title>
		<link>http://uxebu.com/blog/2010/04/02/one-var-statement-for-one-variable/</link>
		<comments>http://uxebu.com/blog/2010/04/02/one-var-statement-for-one-variable/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 16:15:12 +0000</pubDate>
		<dc:creator>Wolfram Kriesing</dc:creator>
				<category><![CDATA[frontend engineering]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[style guide]]></category>
		<category><![CDATA[var statement]]></category>

		<guid isPermaLink="false">http://uxebu.com/blog/?p=1135</guid>
		<description><![CDATA[JavaScript allows to comma-separate multiple variable declarations, like so: var i=0, j=1. Declaring multiple variables using one var-statement accross multiple lines is a NO GO! I consider this evil. And I learned it the hard way. It might look pretty nice, looks like less code and more efficient. But it definitely is not so when [...]]]></description>
			<content:encoded><![CDATA[<p>JavaScript allows to comma-separate multiple variable declarations, like so: <code>var i=0, j=1</code>. Declaring multiple variables using one var-statement accross multiple lines is a NO GO! I consider this evil. And I learned it the hard way. It might look pretty nice, looks like less code and more efficient. But it definitely is not so when writing code. If it results in more speed let your build tool, compressor or compiler do it. But don&#8217;t write code which spreads multiple variable declarations in var-statement across multiple lines!<br />
PERIOD.<br />
<span id="more-1135"></span></p>
<p>This article is quite long for such a simple topic, but anyways I just feel like writing it down, since this is how I initially used <a href="http://wolfram.kriesing.de/blog">my previous blog</a> and I must say it was very helpful for me to look up things again but obviously also for others to find information. I also feel that showing what coding guide lines to use and the reasoning behind it is really important especially also for those who have to apply them.</p>
<h2>Good and Bad</h2>
<p>Let me just quickly show examples for DOs and DON&#8217;Ts.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// DONT</span>
<span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span>
    y <span style="color: #339933;">=</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">,</span>
    z <span style="color: #339933;">=</span> <span style="color: #CC0000;">3</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>The above looks pretty slick. But not always! Especially when working in a team and when you will rewrite or touch the later code again, which basically is the case with all the useful code out there. The second and the third line depend on the first line. That means if a coworker comes along and pastes in his variable from his awesome and dead-simple code</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// DONT</span>
<span style="color: #003366; font-weight: bold;">var</span> y0 <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span>
    y1 <span style="color: #339933;">=</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>into my code above. We might get the following:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// DONT</span>
<span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span>
    y <span style="color: #339933;">=</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">,</span>
    y1 <span style="color: #339933;">=</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span>
    z <span style="color: #339933;">=</span> <span style="color: #CC0000;">3</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>And ouch, we have a global variable &#8220;z&#8221;. Of course he should change the trailing semicolon to a comma when pasting in his code. But his IM beeped, phone rang, coffee was done or he simply felt more like skiing and stopped hacking &#8211; and he forgot :). You know what I mean!<br />
If the code hadn&#8217;t contained multiline variable declarations it wouldn&#8217;t have happened, like here:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// DO</span>
<span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> y <span style="color: #339933;">=</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> y1 <span style="color: #339933;">=</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> z <span style="color: #339933;">=</span> <span style="color: #CC0000;">3</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Though there are cases when I still think that listing multiple variable declarations is ok, like the following. But just not on multiple lines!</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// DO</span>
<span style="color: #003366; font-weight: bold;">var</span> x <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> y <span style="color: #339933;">=</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">,</span> z <span style="color: #339933;">=</span> <span style="color: #CC0000;">3</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> l<span style="color: #339933;">=</span>arr.<span style="color: #660066;">length</span><span style="color: #339933;">,</span> k<span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>l<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<h2>Real Life Examples</h2>
<p>Let me show you three examples where I really felt the pain of the described problem, which finally triggered me to write this article. Those are real life examples, exactly the code I experienced the problem with. And at some point it was just enough.<br />
The first example shows that a pretty complex piece of code is just not as easy to validate by humans. There is no bug in it, it is just hard to read code.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// DONT</span>
<span style="color: #003366; font-weight: bold;">var</span> g <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">getObject</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;group.name&quot;</span><span style="color: #339933;">,</span> test<span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> groupName<span style="color: #339933;">,</span>
    <span style="color: #006600; font-style: italic;">// Trim and replace all special chars, to have a proper test ID.</span>
    group <span style="color: #339933;">=</span> g.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/^\s*/</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s*$/</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
             .<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[^0-9a-zA-Z]/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;_&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    <span style="color: #006600; font-style: italic;">// Replace multiple underscores with just one.</span>
    ret <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ID_&quot;</span> <span style="color: #339933;">+</span> group<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/_+/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;_&quot;</span><span style="color: #009900;">&#41;</span>
            .<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[_]+$/</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>You can see on line 3 no comma is needed, because I just split up the chained calls for better readability. This may mislead the one who wants to understand the code. On the next line though a comma has to end the line because it is the end of the variable declaration. Additionally the code above has a comment after each variable declaration, which makes it easy to read and can be understood faster. If that was not the case it would be much harder to read the code. Just remember the one reading the code doesn&#8217;t want to read every line carefully, this is just very very time consuming. Therefore following certains rules can help to make this easier.<br />
Another issue this code shows very well is that you first have to scan the code and understand the indentions, this sometimes means reading all the way up to the first variable declaration. It&#8217;s just unnecessary brain work.<br />
So let&#8217;s make the source code easier to read, use a var statement for every variable:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// DO</span>
<span style="color: #003366; font-weight: bold;">var</span> g <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">getObject</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;group.name&quot;</span><span style="color: #339933;">,</span> test<span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> groupName<span style="color: #339933;">,</span>
<span style="color: #006600; font-style: italic;">// Trim and replace all special chars, to have a proper test ID.</span>
<span style="color: #003366; font-weight: bold;">var</span> group <span style="color: #339933;">=</span> g.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/^\s*/</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s*$/</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span>
             .<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[^0-9a-zA-Z]/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;_&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #006600; font-style: italic;">// Replace multiple underscores with just one.</span>
<span style="color: #003366; font-weight: bold;">var</span> ret <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ID_&quot;</span> <span style="color: #339933;">+</span> group<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/_+/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;_&quot;</span><span style="color: #009900;">&#41;</span>
             .<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[_]+$/</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This also makes understanding the indentions much easier. Doesn&#8217;t it? I just looked at the draft of this blog article and thought that the &#8220;wrong&#8221; source code above was wrong formatted because I didn&#8217;t understand the indention just by looking at the code (without thinking too much). Looking at the &#8220;fixed&#8221; source made my brain not start to think, it just looked all very clear to me.</p>
<p>In another real life example it took me three hours (three fucking hours) to find the bug. It was the following code in the dojo-mobile <a href="http://github.com/wolframkriesing/dojo-mobile/blob/eae475575b0b1991fa66597c4faed94513e4a14c/build/build.js#L25">build script you can find on github</a>. And I was debugging the code, reading it over and over again. I just didn&#8217;t find the bug. Try the following, scan the code quickly just once and read on.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// DONT</span>
<span style="color: #003366; font-weight: bold;">var</span> parts <span style="color: #339933;">=</span> feature.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;-&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ns <span style="color: #339933;">=</span> parts<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// The namespace of the feature, like &quot;oo&quot; in &quot;oo&quot; or &quot;oo-declare.</span>
    f <span style="color: #339933;">=</span> parts.<span style="color: #660066;">length</span><span style="color: #339933;">&gt;</span><span style="color: #CC0000;">1</span> <span style="color: #339933;">?</span> parts<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// The exact feature if given (&quot;oo-declare&quot;).</span>
    ret <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span>
    data <span style="color: #339933;">=</span> globals.<span style="color: #660066;">profileData</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Did you see it on first sight? Scan the code again. Believe me I read the code over and over again, I even thought there might be a variable declaration issue. But since my return variables are always named &#8220;ret&#8221; and my code was heavily asynchronously programmed I didn&#8217;t find out which declaration was the faulty one. It is fixed now (<a href="http://github.com/wolframkriesing/dojo-mobile/blob/master/tools/build.js">on github</a>)!</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// DO</span>
<span style="color: #003366; font-weight: bold;">var</span> parts <span style="color: #339933;">=</span> feature.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;-&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> ns <span style="color: #339933;">=</span> parts<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// The namespace of the feature, like &quot;oo&quot; in &quot;oo&quot; or &quot;oo-declare.</span>
<span style="color: #003366; font-weight: bold;">var</span> f <span style="color: #339933;">=</span> parts.<span style="color: #660066;">length</span><span style="color: #339933;">&gt;</span><span style="color: #CC0000;">1</span> <span style="color: #339933;">?</span> parts<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// The exact feature if given (&quot;oo-declare&quot;).</span>
<span style="color: #003366; font-weight: bold;">var</span> ret <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> data <span style="color: #339933;">=</span> globals.<span style="color: #660066;">profileData</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Yet another example. This one actually just proved again that I definitely have to forget about the old way. You can also <a href="http://github.com/wolframkriesing/dojo-mobile/blob/eae475575b0b1991fa66597c4faed94513e4a14c/build/build.js#L67">find it on github</a> and feel free to follow the path of commits. My learning curve, if you will :).</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// DONT</span>
<span style="color: #003366; font-weight: bold;">var</span> depsData <span style="color: #339933;">=</span> _depsDataStack.<span style="color: #660066;">pop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
    dir <span style="color: #339933;">=</span> depsData.<span style="color: #660066;">directory</span><span style="color: #339933;">;</span>
    file <span style="color: #339933;">=</span> depsData.<span style="color: #660066;">file</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This one was not so hard to find, I agree. But still it was a bastard and stole my time. By sticking to a better convention I could have avoided it. Lesson learned.</p>
<h2>Closing Thoughts</h2>
<p>Just when preparing this article (which was supposed to be much shorter) I read through Douglas Crockford&#8217;s <a href="http://www.JSLint.com/lint.html">JSLint rules</a> and funnily I found this one in there:</p>
<blockquote><p>It is recommended that a single var statement be used per function.</p></blockquote>
<p>I can say I disagree and I guess I gave some reasoning.</p>
<p>Though on the other hand <a href="http://javascript.crockford.com/code.html">I found this</a> on the Crockford pages :)</p>
<blockquote><p>It is preferred that each variable be given its own line and comment. They should be listed in alphabetical order.</p></blockquote>
<p>Performance-wise, as stated above, I would leave the task to a compiler or alike tool to concatenate multiple variable statements into one, if it has an effect at all. The productivity and happiness of the programmers and not to loose time which could have been saved by just sticking to a simple convention is worth a lot more than pre-optimized code.<br />
I am looking forward to feedback.</p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2010/04/02/one-var-statement-for-one-variable/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Developing Widgets for Bada Devices</title>
		<link>http://uxebu.com/blog/2010/03/25/developing-widgets-for-bada-devices/</link>
		<comments>http://uxebu.com/blog/2010/03/25/developing-widgets-for-bada-devices/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 11:06:36 +0000</pubDate>
		<dc:creator>Wolfram Kriesing</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Tumbles]]></category>
		<category><![CDATA[development tools]]></category>
		<category><![CDATA[frontend engineering]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[w3c widgets]]></category>
		<category><![CDATA[bada]]></category>
		<category><![CDATA[widgets]]></category>

		<guid isPermaLink="false">http://uxebu.com/blog/2010/03/25/developing-widgets-for-bada-devices/</guid>
		<description><![CDATA[Developing Widgets for Bada Devices
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.badadev.com/developing-widgets-for-bada-devices/">Developing Widgets for Bada Devices</a></p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2010/03/25/developing-widgets-for-bada-devices/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mobile Web – does the adult industry point the way (again)?</title>
		<link>http://uxebu.com/blog/2010/02/26/mobile-web-%e2%80%93-does-the-adult-industry-point-the-way-again/</link>
		<comments>http://uxebu.com/blog/2010/02/26/mobile-web-%e2%80%93-does-the-adult-industry-point-the-way-again/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 12:35:31 +0000</pubDate>
		<dc:creator>Nikolai Onken</dc:creator>
				<category><![CDATA[business]]></category>
		<category><![CDATA[frontend engineering]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[uxebu]]></category>
		<category><![CDATA[w3c widgets]]></category>
		<category><![CDATA[app stores]]></category>
		<category><![CDATA[cross-platform]]></category>

		<guid isPermaLink="false">http://uxebu.com/blog/?p=1054</guid>
		<description><![CDATA[During a very intense week at the Mobile World Congress in Barcelona and a lot of very interesting meetings, discussions and talks, one incident surprisingly stuck out. At one of the evening events, I randomly met the folks behind http://www.yourappshop.com, a platform which allows you to distribute iPhone applications through other means than the official [...]]]></description>
			<content:encoded><![CDATA[<p>During a very intense week at the Mobile World Congress in Barcelona and a lot of very interesting meetings, discussions and talks, one incident surprisingly stuck out. At one of the evening events, I randomly met the folks behind <a href="http://www.yourappshop.com">http://www.yourappshop.com</a>, a platform which allows you to distribute iPhone applications through other means than the official Apple app store – you don’t need a jailbroken iPhone as you need when using alternative app stores such as <a href="http://cydia.saurik.com/">Cydia</a>. But before I explain in more detail what they are doing lets have a look at the current app store hype.<br />
<span id="more-1054"></span></p>
<h2>Is the app store concept flawed?</h2>
<p>Lately I have been reading <a href="http://www.spiegel.de/netzwelt/web/0,1518,679750,00.html">more</a> and <a href="http://www.spiegel.de/netzwelt/netzpolitik/0,1518,679959,00.html">more</a> articles, <a href="http://twitter.com/tomiahonen/status/9580847661">tweets</a> and <a href="http://www.quirksmode.org/blog/archives/2010/02/the_iphone_obse.html">blogposts</a> stating their concerns about the fact that Apple almost randomly removes applications and that people for some reason have distorted views of the mobile application and app store reality.</p>
<p>I am not in favor of allowing any kind of application into an app store by default, there is no reason why you should have to do that (a bakery also selects which producs it wants to sell). The problem really is though, that Apple is running the only official app store for the iPhone. One app store controlling the entire market for a device is plainly wrong!</p>
<p>Not only does it cripple innovation but it also shows one major flaw of Apples strategy – the factor of competence. How on earth does Apple, a hardware and software manufacturer think it has the competence to judge whether an application should be admitted or not? Maybe in these days when mobile applications don’t go further than simple games or information display/exchange – but what if applications are starting to come with real security implications?</p>
<p><strong>An example:</strong><br />
Imagine you are writing an application reading your heartrate and writing an ECG (This is not too far fetched, <a href="http://uxebu.com/blog/2010/01/25/humanapi-the-browser-in-the-real-world/">look at our research project HumanApi</a>). Is Apple seriously trying to tell that they can judge whether such an app should make it into the app store or not? They by far don’t have the competence of the medical industry, no way!</p>
<p>A much more interesting app store concept would be to have certified stores by companies I trust (or community driven in other application use-cases). Looking at the medical example, wouldn’t it make much more sense if companies like Siemens, Phillips, and other medical device manufacturers start an alliance and run their own store, so I can trust the apps I am using, so that as a developer, I know that qualified people are judging my application? Not only would this guarantee much higher quality but it also would foster competition which we are lacking here.</p>
<h2>Companies == lemmings?</h2>
<p>Where does this &#8220;I need an app as well&#8221; come from? Why do people care so much when their application gets rejected by the Apple app store?</p>
<p><strong>An example:</strong><br />
On february 23rd, large German online publisher <a href="http://www.spiegel.de/netzwelt/web/0,1518,679750,00.html">Spiegel Online</a> wrote an article about the fact that Apple might disapprove an application of the famous yellow press publisher &#8220;<a href="http://bild.de">Bild</a>&#8220;. On february 24th they <a href="http://www.spiegel.de/netzwelt/netzpolitik/0,1518,679959,00.html">posted another front-page article</a> questioning whether legal means would be the only way to go?!?</p>
<p>Now that is insane, not only will it cost those folks a lot of money to run law suits against Apple, on top of that they are forcing their way into technology without future – already today, the Apple app store is not the only way to legally distribute your applications to the iPhone! Apple is a new player in the mobile industry and albeit its amazing achievements, <a href="http://communities-dominate.blogs.com/brands/2010/02/phone-market-shares-for-year-of-2009-and-last-quarter-2009.html">never forget looking at marketshares</a>.</p>
<p>To summarize: For whatever kind of reason, one of the biggest German online newspaper sees Apple rejecting applications as being threatening enough to write an article – how more blatantly can the reality be distorted?</p>
<h2>What can and should we do?</h2>
<p>Back to the surprising incident I was mentioning earlier: When the folks behind <a href="http://www.yourappshop.com/">http://www.yourappshop.com</a> showed me their application store – for the iPhone! – one thought came to my mind &#8220;Does the Adult Industry point the way (again)?&#8221;  (whether you and I approve adult content or not is a different discussion, what we need to take out of this is the fact that they are showing a very viable way to go).</p>
<p>YourAppShop developed an app store entirely based on web technologies (lots of HTML5 which is supported by the iPhone browser and many many more devices) – which allows you to download web based applications to your homescreen, watch image slideshows, even videos. Everything works off- and online. To the well traveled mobile web developer all of this is nothing new, it is all part of HTML5. The folks of YourAppStore though were creative enough to build it so that the end-user does not feel the difference between a real native app (from the Apple store) and an application based on web technologies, payment for the service included! </p>
<p>Why don’t people (especially the folks in decision making positions) see that you can write amazing applications for the iPhone based on technology which also will work on other phones and which does not have to pass the QA of Apple? </p>
<p>If you are not too bothered about adult content (NSFW) take a look at <a href="http://www.yourappshop.com">http://www.yourappshop.com</a> from within your iPhone browser and visit one of their stores – the way they have set up a viable ecosystem using web technologies will give you a new impression of what we actually are able to do today.</p>
<p>As much as people might have concerns with the adult industry, they are showing us how we can get out of the app store restrictions – technology of today can be used to write successful applications and you can be monetizing the potential (more than 8.000.000 downloads for YourAppShop should say enough), Now that sounds great doesn’t it <a href="http://twitter.com/bild_aktuell">@Bild.de</a> and <a href="http://twitter.com/spiegel_alles">@Spiegel.de</a>?</p>
<p>And as if its not enough, Apple itself is showing a great example of the potential of web applications running on the iPhone with their online help: <a href="http://help.apple.com/iphone">http://help.apple.com/iphone</a> &#8211; go visit their site, and add the application to your homescreen by clicking on the &#8220;+&#8221; button in the bottom toolbar (Not to mention the fact that iPhone applications where meant to be build using the web stack in the first place). </p>
<p>As an application developer/creator, your goal should not be to only run on one platform, unless you don’t care about having sustainable and solid business case or unless your target-group is only the group of iPhone users (which I can’t believe is ever true).</p>
<p><a href="http://uxebu.com/blog/2010/02/15/eventninja-a-mobile-cross-platform-app/">We showed that there is technology which allows you to write applications for more than one platform</a>, technology which works whether there is an app store in between or not, technology which has a future, technology the web is built with – HTML/JavaScript/CSS or better, HTML5 apps. Use it and stop wasting time being afraid that Apple will ruin your business because they are rejecting an application – you shouldn’t have to care less!!</p>
<h2>Conclusion</h2>
<p>Jumping into the &#8220;We need to have an iPhone app&#8221; mantra without any second thought is very dangerous, its not good for your business. Analyze your requirements and check carefully if you can’t cover your needs with an application based on web technologies (which <a href="http://uxebu.com/blog/2010/02/15/eventninja-a-mobile-cross-platform-app/">as we proved still can make it into the Apple store</a> if they approve of your content). The advantage of applications based on web technology is overwhelming:</p>
<ul>
<li>Standardized technology stack (HTML5)</li>
<li>HTML5 apps work in mobile browsers, can be distributed over app stores or even can be integrated into traditional websites.</li>
<li>Much lower development costs.</li>
<li>Huge amount of target platforms</li>
</ul>
<p>Of course there are application cases where you need to access the devices hardware in ways the browser doesn&#8217;t yet allow you to (games or applications with extreme performance requirements for example) &#8211; but especially publishers and content driven apps should think twice.</p>
<p>If you are looking into building a mobile application and are not sure whether you should go for the native iPhone, native Android or any other native platform (and spend tons of money on it) or whether you should build on top of the much more open technology stack of the web, <a href="/contact">feel free to contact us and we can take a closer look at your requirements</a>.</p>
<p>Back to the <a href="http://www.vdz.de">folks who are planning to sue Apple (VDZ)</a> – start putting your apples into the right basket, build a web based application store as you can see with YourAppShop and you will have complete freedom over what you want to sell and what not. Your customers won’t feel the difference, they might even like it more because you can offer better prices (no profit sharing with Apple). Sueing Apple won’t help a thing, don’t waste your money and time.</p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2010/02/26/mobile-web-%e2%80%93-does-the-adult-industry-point-the-way-again/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>EventNinja &#8211; A Mobile Cross Platform App</title>
		<link>http://uxebu.com/blog/2010/02/15/eventninja-a-mobile-cross-platform-app/</link>
		<comments>http://uxebu.com/blog/2010/02/15/eventninja-a-mobile-cross-platform-app/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 12:40:35 +0000</pubDate>
		<dc:creator>Wolfram Kriesing</dc:creator>
				<category><![CDATA[business]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[frontend engineering]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[uxebu]]></category>
		<category><![CDATA[w3c widgets]]></category>

		<guid isPermaLink="false">http://blog.uxebu.com/?p=934</guid>
		<description><![CDATA[Lately we have been quite active around a mobile app, which you can find in multiple app stores for multiple platforms. The app runs on iPhone, Android, Palm&#8217;s WebOS, Blackberry, Windows Mobile, Nokia S60, Vodafone 360 phones and we are still adding to the list. But the most interesting fact is: it&#8217;s all the same [...]]]></description>
			<content:encoded><![CDATA[<p>Lately we have been quite active around a <strong>mobile app</strong>, which you can find in <strong>multiple app stores for multiple platforms</strong>. The app runs on iPhone, Android, Palm&#8217;s WebOS, Blackberry, Windows Mobile, Nokia S60, Vodafone 360 phones and we are still adding to the list. But the most interesting fact is: <strong>it&#8217;s all the same code, just one and the same app</strong>. For making it work on all the platforms we just had to wrap, build, deploy and package it using the right combination of tools for the right platform. By adding a bit of UI sugar (mostly CSS) the app looks native and can reach a much wider audience for a much lower cost than ever possible before.</p>
<div  style="align: center;">
<a href="http://blog.uxebu.com/wp-content/uploads//2010/02/allphones.jpg"><img src="http://blog.uxebu.com/wp-content/uploads//2010/02/allphones-1024x255.jpg" alt="" title="allphones" width="512" height="128" class="alignnone size-large wp-image-1006" style="border: 1px solid #333" /></a></div>
<p><span id="more-934"></span></p>
<h2>What is EventNinja?</h2>
<p>EventNinja is our little ninja that goes out and collects events :-). Seriously: we had started uxebu with the high goal of playing with the best and knew from the beginning that we can reach out to the interested and passionate crowd just by meeting up with them personally, at the various real-life events. So we just needed to show up at the WebMondays and BarCamps around us. We started keeping track of them in a Google Calendar, which is publicly shared (you can find it here <a href="http://bit.ly/webdev-events">http://bit.ly/webdev-events</a>), because we know that we are not the only ones interested in upcoming developer events. During a very busy phase during the summer of 2009, where a lot of dojo.beers took place around the world, the calendar already was of big use. We started to write a small web site widget to embed the calendar in our site. We had a very focused and content-oriented use case and after coming across W3C Widgets, we quickly decided to port the web site widget over to a W3C widget &#8211; the same night we had it also running on an iPhone. This got the ball rolling and we realized that we should start porting this widget to even more platforms. From thereon we felt confident that we are on the right track. And we shall be proofen to be right.</p>
<h2>The base of it all: HTML (and W3C Widgets)</h2>
<p>The web stack is the widest spread and most widely used technology stack. The <a href="http://bit.ly/webdev-jobtrends">number of developers</a> using the web stack is just unbeaten. Now that the mobile phones are coming around the corner, we see that the diversity (others call it fragmentation) is just huge. The iPhone proved, that even a good browser on mobile phones done right, can be fun. So the web stack is coming to our phones. Browsers are a standard on the phone. And the potential is gigantic. &#8220;The mobile industry has now 4.6 Billion active subscriptions.&#8221; and &#8220;71% of all phones have a modern xTML web browser.&#8221; says Tomi Ahonen in <a href="http://communities-dominate.blogs.com/brands/2010/02/the-big-picture-stats-view-to-mobile-industry-2010-edition.html">The Big Picture &#8220;All the Stats&#8221; Total View to Mobile Industry, 2010 Edition</a>. Enough to justify HTML as the future standard for mobile apps!</p>
<p><a href="http://blog.uxebu.com/wp-content/uploads//2010/02/BlackBerry-Device.png" class="floatLeft imgFloatLeft"><img class="alignleft size-medium wp-image-943" title="BlackBerry-Device" src="http://blog.uxebu.com/wp-content/uploads//2010/02/BlackBerry-Device-178x300.png" alt="" width="88" height="150" /></a>So we can surf the web. But what about app development? The iPhone requires you to learn Objective C, Android wants Java, Nokia S60 a flavour of C++, and so on. This sounds no fun. So just sum up one and one. Let&#8217;s use the web stack (HTML, CSS, JavaScript) that all the platforms bring along &#8211; since they all have a browser &#8211; and reuse this stack to build your native apps. It&#8217;s not as much magic as it sounds. There is even a specification for it, <a href="http://www.w3.org/2008/webapps/wiki/WidgetSpecs">the family of W3C Widgets</a>. W3C Widgets are self-contained mini-apps, consisting of HTML, CSS and JavaScript. Just as we know it from websites. If the widget requires no resources from the web it can even run offline. You have all the power at hand: JavaScript, AJAX, Canvas and depending on the platform you even get SVG.<br />
But how many platforms do support W3C Widgets? In plain numbers: 4. But the number is growing. <strong>Vodafone360</strong>, <strong>Vodafone&#8217;s Nokia S60</strong>, the latest <strong>Blackberry</strong> and <strong>Windows Mobile</strong>. But that&#8217;s not all as I will explain later.<br />
The biggest hype is made by Vodafone, definitely. They are also expressing strongly that they are supporting the open W3C Widgets standard. And it is true, take a real W3C Widget throw it on any of the newer Nokia S60 (Series 5) phones or the Vodafone360 phones and it just works. The next closest is Windows Mobile. For getting it onto a Blackberry you need to additionally sign the widget.</p>
<h2>More devices: PhoneGap</h2>
<p>Supporting just those four platforms would be a bit boring. But here comes the great open source project <a href="http://phonegap.com">PhoneGap</a> onto the stage. PhoneGap opens up all the other platforms. Among them, probably the one most people look for, is the iPhone. PhoneGap provides a web runtime which we just wrap around our widget and package it and we have a native app. PhoneGap even allows to access the native functionalities like Camera, Contacts, Acceleromter, GPS, etc. If there is something missing in the list, you are free to write the according adaptor. And the big advantage, since you are deploying the runtime with your app, you can even hook onto any kind of native interface available on the phone. This is very nicely shown in the <a href="http://?????????">ECG app</a> <a href="http://twitter.com/nonken">@nonken</a> has written in our uxebu labs. This app connects a heart rate monitoring device to your iPhone, all done through PhoneGap.</p>
<h2>Porting EventNinja</h2>
<p><a href="http://blog.uxebu.com/wp-content/uploads//2010/02/iPhone-Device.png" class="floatLeft imgFloatLeft"><img class="alignleft size-medium wp-image-944" title="iPhone-Device" src="http://blog.uxebu.com/wp-content/uploads//2010/02/iPhone-Device-172x300.png" alt="" width="86" height="150" /></a>So we ported EventNinja to the <strong>iPhone</strong> using PhoneGap. It was a pleasure to use all the features one of the most modern browsers support, stuff like CSS transitions and alike. And since a lot of people asked, I will answer the question before it comes up: &#8220;Yes, you need the iPhone SDK and therefore a Mac OS X machine&#8221;. But we will see what the future brings.</p>
<div class="floatRight imgFloatRight"><a href="http://blog.uxebu.com/wp-content/uploads//2010/02/PalmPre.png"><img class="alignright size-medium wp-image-950" title="PalmPre" src="http://blog.uxebu.com/wp-content/uploads//2010/02/PalmPre-200x300.png" alt="" width="100" height="150" style="border: 1px solid #333; margin-right: 5px;" /></a><a href="http://blog.uxebu.com/wp-content/uploads//2010/02/Android-Device.png"><img class="alignright size-medium wp-image-942" title="Android-Device" src="http://blog.uxebu.com/wp-content/uploads//2010/02/Android-Device-175x300.png" alt="" width="87" height="150" style="border: 1px solid #333" /></a></div>
<p>With EventNinja, we have also proven that such an app can be ported to the <strong>Android</strong> platform. We have tested it on Android version 1.6 through 2.1, among them HTC Magic, Motorola Droid, Nexus One. Android was the easiest platform to port it to, we &#8220;threw&#8221; the iPhone version onto an Android phone and it just worked, first as a simple website. Later, thanks to <a href="http://dschini.org">Manfred Weber</a> as a native app and finally, as you can find it now in the Android Market, as a PhoneGap-based app.<br />
For the <strong>Palm Pre</strong> we adjusted the style to look as native as possible. To our surprise Palm&#8217;s operating system WebOS, which itself is web technology based, has some very strange, proprietary touches which made it less fun than expected (read more in <a href="http://blog.uxebu.com/2009/12/02/mobile-cross-platform-development-palm-pre/">Mobile Cross-Platform Development: Palm Pre</a>). From a bird eyes&#8217; view it looks like porting to WebOS would not require anything, no PhoneGap, just wrapping the widget properly. Unfortunately it was more work than that. The proprietary concept of stages and scenes requires some workarounds to finally get the app running.</p>
<h2>Cross Platform Advantages</h2>
<p>Besides the simple obvious reasons, like easy porting, lower development costs, and that the web stack technologies are our core business at uxebu, there are other reasons that make cross platform attractive. Let me scratch the surface by mentioning some of them.</p>
<p><strong>Easy prototyping</strong>. Using HTML, JavaScript and CSS a prototype can be created in no time, iterations, reconsidering various issues is way cheaper and quicker than doing it with other technologies. We can use the browser window, just size it down to match a phone&#8217;s screen size. We can debug and fix things without costly redeployment cycles and this entire process can happen remotely, it all works over the web. Not to mention that this is the easiest way to distribute your app, but that is a topic of it&#8217;s own.</p>
<p><strong>Largest Reach, synchronously</strong>. We can reach multiple types of mobile handsets virtually at the same time. By reducing the need to redevelop the app for multiple devices, we can roll out to multiple stores and devices at the same time. We are basically limitted by the time that it takes the stores to run the app through their internal QA.<br />
As the numbers in the <a href="http://metrics.admob.com/2010/01/december-2009-mobile-metrics-report/">December 2009 Mobile Metrics Report</a> show we are covering the biggest smartphone platforms well. The iPhone is definitely the leading one (on admob) but we all know that Android is picking up speed, as shown in the <a href="http://metrics.admob.com/2010/01/metrics-update-android/">Metrics Update: Android</a>.</p>
<p><strong>Multi Channel Distribution</strong>. A very interesting though still underestimated channel of distribution is what taptu called <a href="http://blog.taptu.com/2010/02/03/touchfriendlywebreport/">the mobile touch web</a>. The app works natively in the browser, so there is no need to even install it locally (if no access to native phone ressources is required). This opens up the opportunity for other apps or (mobile) web sites to directly link to and still allow for a (close to) native experience for the user. If you have an iPhone, Android or just a WebKit-based browser (even on your desktop) you can try out the EventNinja web app at <a href="http://eventninja.net/webkit">http://eventninja.net/webkit</a>.</p>
<h2>The App Store Experience</h2>
<p>Above I listed some cross platform advantages. And I would like to pick yet another one and focus a bit on it. The various App Stores. They do not only bring the burden to have separate upload and QA processes for each (which to solve could imho serve as a business model itself) but they also allow the user on the various device to find the app. What do I mean by that? Well, simple: The app store is a very prominent way to find very focused, use-case-centered information, services, in short: apps, for your phone. It could also be seen as the pre-installed search engine and payment gateway on your phone. All the handset manufacturers, operators and a lot of service providers are setting up or already running their own App Store, their portal into the world of apps. And deploying your app to many of them, allows to create multiple ways to retreive your app, across multiple networks, stores and devices.</p>
<p>Sounds crazy? Yes, it is. I am not a fan of all the App Stores, but that is the current trend. Let&#8217;s ride the wave, and be prepared for the next one, which will hopefully be the pure web apps, running in the browser without the App Stores inbetween. We are prepared. And a little band aid, to make it easier to put up with the multiple stores: there are services that will leverage this problem and aggregate the statistics from the various stores.</p>
<div style="text-align:center; margin-bottom: 20px;">
<img src="http://blog.uxebu.com/wp-content/uploads/2010/02/matrix.png" alt="App Stores and tested devices" style="width: 100%"/>
</div>
<h2>Conclusion</h2>
<p>With this article we are showing very important aspects of the mobile web and that all this is no dream but reality. Go to your store and download EventNinja to see it yourself! </p>
<p>If you want to bring your product or website to several mobile platforms to gain most possible reach, <a href="/contact">feel free to contact</a> us to discuss your specific needs.</p>
<p>Disclaimer: We are working for Vodafone in their Widgets Department.</p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2010/02/15/eventninja-a-mobile-cross-platform-app/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>HumanApi &#8211; the browser in the real world</title>
		<link>http://uxebu.com/blog/2010/01/25/humanapi-the-browser-in-the-real-world/</link>
		<comments>http://uxebu.com/blog/2010/01/25/humanapi-the-browser-in-the-real-world/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 14:32:06 +0000</pubDate>
		<dc:creator>Nikolai Onken</dc:creator>
				<category><![CDATA[frontend engineering]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[uxebu]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[humanapi]]></category>

		<guid isPermaLink="false">http://blog.uxebu.com/?p=922</guid>
		<description><![CDATA[During the Oredev speakers dinner last November, I was having an interesting discussion about the car industry and how Google in one swipe mangled up the turn-to-turn navigation market. During this discussion and other interesting conversations at the following JsConf, it it became more and more clear that we (web developers) should be able to [...]]]></description>
			<content:encoded><![CDATA[<p>During the <a href="http://www.oredev.org" target="_blank">Oredev</a> speakers dinner last November, I was having an interesting discussion about the car industry and how Google in one swipe mangled up the turn-to-turn navigation market. During this discussion and other interesting conversations at the following <a href="http://jsconf.eu">JsConf</a>, it it became more and more clear that we (web developers) should be able to write applications for instance for cars, write applications for phones we can plug into cars, and write those applications using web technologies &#8211; meaning JavaScript, HTML and CSS. </p>
<p><span id="more-922"></span></p>
<p>Since that discussion, the idea developed further and after some time, things started to take shape. </p>
<p>Lets take a look at the first prototype of a web based application (is this the first JavaScript ECG ever?) which reads your heart rate, sends it to the mobile phone via bluetooth and displays it in a native application driven by PhoneGap, meaning &#8211; the actual application is written using JavaScript, HTML(5), CSS.</p>
<div style="text-align: center; margin: 40px; 0">
<object width="500" height="375"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8915705&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=8915705&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="375"></embed></object>
</div>
<p>Because the quality of the above video isn&#8217;t that good I have recorded a screencast from the iPhone simulator. This video only shows the applications look and feel since the simulator is not connected to the Polar hardware via Bluetooth.</p>
<div style="text-align: center; margin: 40px; 0">
<object width="300" height="514"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8849502&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=8849502&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="300" height="514"></embed></object>
</div>
<p><a href="http://humanapi.org/category/videos/">More videos are available here</a></p>
<p>After I got a first prototype running, the thoughts of what this could potentially mean would not stop popping up in my mind &#8211; the consequences for the web-development community are immense and the challenges we as web developers can face are broadened in a way that tons of exciting new things are lying ahead of us.</p>
<p>In this blogpost I will give you a quick outline the features of this prototype and the components I used.</p>
<h2>Setup</h2>
<p>To get the HumanApi ECG running I used following components:</p>
<ul>
<li><a href="http://phonegap.com">PhoneGap</a></li>
<li><a href="http://apple.com/iphone">iPhone</a></li>
<li><a href="http://www.polarusa.com/us-en/products/accessories/T31_coded_Transmitter">Polar T31</a></li>
<li><a href="http://arduino.cc/en/Main/ArduinoBoardBluetooth">Arduino BT</a></li>
<li><a href="http://danjuliodesigns.com/sparkfun/sparkfun.html">HRMI</a></li>
<li><a href="http://code.google.com/p/btstack/">btstack</a></li>
<li>little stuff</li>
</ul>
<p>Lets take a quick look at each of the components:</p>
<h2>PhoneGap</h2>
<p><a href="http://phonegap.com">PhoneGap</a> is one of the really cool projects out there. It not only allows you to deploy JS, HTML and CSS based applications on a range of mobile phones but it also gives you great APIs to access features of the phone. Because the iPhone SDK allows us to evaluate JavaScript from within Objective C it is relatively simple to execute JavaScript calls within the webkit webview. This essentially allows you to communicate with for instance bluetooth. If more widget runtimes would give us possibilities to inject APIs into the runtime (W3C?) and make available in JavaScript we would be able to write very cool apps! (More on that in a different blogpost soon).</p>
<h2>iPhone</h2>
<p>besides the fact that Apple is blocking certain functionality of the phone (bluetooth for instance), it is an amazing device and allows you to do all kinds of stuff (e.g. inject JS into the webkit view). Its performance is very good as well and therefor makes a great prototyping device. To get this HumanApi prototype running I unfortunately had to jailbreak the device. We are slowly reaching a point in time where blocking device functionality will hurt Apple and other manufacturers/operators, they are locking their devices out from an amazing amount of possible application usecases.</p>
<h2>Polar T31</h2>
<p><a href="http://www.polarusa.com/us-en/products/accessories/T31_coded_Transmitter">The Polar T31</a> is a simple heart rate transmitter which you can use to monitor your heart rate when doing sports. This device is perfect for our prototype because we indirectly can send the data to our iPhone.</p>
<h2>Arduino BT</h2>
<p>Because I can not communicate between the iPhone and the Polar T31 directly I had to create a bridge using the <a href="http://arduino.cc/en/Main/ArduinoBoardBluetooth">Arduino BT</a>. Essentially the Arduino receives the heart rate (using the HRMI) from the T31 and sends it to my iPhone via bluetooth.</p>
<h2>HRMI</h2>
<p>The <a href="http://danjuliodesigns.com/sparkfun/sparkfun.html">human heart rate interface</a> is a great little project by Dan Julio, who developed this hardware to receive the heart rate signal from the T31. Furthermore you can easily connect the HRMI to the Arduino BT and therefore send the heart rate to your iPhone via bluetooth.</p>
<h2>btstack</h2>
<p>As I wrote before, Apple does not allow to access the full bluetooth stack on the device &#8211; even though the hardware is available. Luckily <a href="http://code.google.com/p/btstack/">Matthias Ringwald</a> has developed a library for the iPhone which lets you access the different bluetooth profiles &#8211; without his amazing work this HumanApi prototype never would have been able to exist.</p>
<h2>Your own HumanApi</h2>
<p>If you want to develop your own application accessing hardware, feel free to contribute to the HumanApi project. There would be nothing more amazing than seeing for instance the ECG app running on Andriod and other platforms. </p>
<p>A good start are the <a href="http://humanapi.org">articles on humanapi.org</a>, the <a href="http://groups.google.com/group/humanapi">forum</a>, the <a href="http://github.com/nonken/humanapi">GIT repository</a> or these folks on twitter: <a href="http://twitter.com/nonken">@nonken</a>, <a href="http://humanapi.org">@humanapi</a>, <a href="http://twitter.com/uxebu">@uxebu</a>. </p>
<h2>Conclusion</h2>
<p>Essentially we are at a point where we as JavaScript developers could be writing applications we never thought of a few years ago. It is to us and to the industry now to demand that we get better and more access to the devices hardware &#8211; there is no reason why JavaScript developers get &#8220;discriminated&#8221; over native developers in the way how we can access device features</p>
<p><strong>I want to close this article with a short comparison:</strong></p>
<p>Often mobile developers, using web technologies, are compared to native developers on the example of games. &#8220;Ohhh but you can not write amazing 3D games using JavaScript&#8221; &#8211; funnily enough I even hear JavaScript developers trying to &#8220;defend&#8221; themselves agreeing to the above stated fact &#8211; &#8220;Yes we can&#8217;t write games, but phones are getting better so one day we will&#8221;. </p>
<p>We don&#8217;t need to make these kind of comparisons and should start demanding better access to the devices hardware. What stops us from saying &#8220;We don&#8217;t have to develop games, we can write home automation systems, medical applications (<a href="http://twitter.com/#search?q=mhealth">#mhealth</a>), apps for the cars industry and so much more amazing stuff &#8211; and we can do it cross platform! (And WebGL is on its way btw. ;) )&#8221;? </p>
<p>Right now it is not the language which is stopping us. App store policies, manufacturers and operators are stopping us because we have to hack our way into the devices! </p>
<p>Enjoy hacking</p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2010/01/25/humanapi-the-browser-in-the-real-world/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>dojo.connect({after:dojo.beer});</title>
		<link>http://uxebu.com/blog/2010/01/21/dojoconnectafterdojobeer/</link>
		<comments>http://uxebu.com/blog/2010/01/21/dojoconnectafterdojobeer/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 15:35:15 +0000</pubDate>
		<dc:creator>Tobias Klipstein</dc:creator>
				<category><![CDATA[dojo]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.uxebu.com/?p=902</guid>
		<description><![CDATA[It’s been quite some time since the last dojo.beer() event took place in Germany and a lot of things have changed within the Dojo Toolkit with the release of 1.4.0. This is why we would like to invite everyone who is interested in Dojo, or who would like to talk to other Dojo developers, to [...]]]></description>
			<content:encoded><![CDATA[<p>It’s been quite some time since the last <a href="http://dojo.beer.mixxt.de/">dojo.beer()</a> event took place in Germany and a lot of things have changed within the Dojo Toolkit with the release of 1.4.0. This is why we would like to invite everyone who is interested in Dojo, or who would like to talk to other Dojo developers, to the next dojo.beer() event in Munich:</p>
<table border="0">
<tr>
<td style="vertical-align: top; width: 150px;">Date: 	</td>
<td style="font-weight: bold">Friday, 12.02.2010</td>
</tr>
<tr>
<td style="vertical-align: top">Time: 	</td>
<td style="font-weight: bold">3:00 PM &#8211; 11:00 PM GMT+1</td>
</tr>
<tr>
<td style="vertical-align: top">Seats: 	</td>
<td style="font-weight: bold">about 80</td>
</tr>
<tr>
<td style="vertical-align: top">Language: 	</td>
<td style="font-weight: bold">English</td>
</tr>
<tr>
<td style="vertical-align: top">Location: 	</td>
<td>
EineWeltHaus<br />
Schwanthalerstr. 80<br />
80336 München<br />
<a href="http://www.einewelthaus.de">http://www.einewelthaus.de</a>
</td>
</tr>
</table>
<p>You can signup here:</p>
<p><a href="http://dojoconnectmunich.eventbrite.com/"><img src="http://eventbrite-s3.s3.amazonaws.com/static/images/logo/powered_by_eventbrite_new.png" alt="dojoconnectmunich on EventBrite" /></a></p>
<p><span id="more-902"></span></p>
<p>This time we combine the official “Dojo Developer Day”, that is held online, with an on-site event in Munich.</p>
<p>The “Dojo Developer Day” is the last day of the first Dojo conference called <a href="http://widespreadconferences.com/">dojo.connect()</a> that will be happening 100% online. So if you want to get some deep insight and want to learn from the Dojo pros I just can recommend to <a href="http://widespreadconferences.com/">signup for that conference</a>.</p>
<div id="attachment_905" class="wp-caption alignnone" style="width: 510px"><a href="http://widespreadconferences.com/"><img class="size-full wp-image-905" title="dc-banner-bg" src="http://blog.uxebu.com/wp-content/uploads//2010/01/dc-banner-bg.png" alt="dojo.connect (February 10-12, 2010)" width="500" /></a><p class="wp-caption-text">dojo.connect (February 10–12, 2010)</p></div>
<p>Additionally, at the event in Munich you’ll have the chance to meet Dylan Schiemann (co-founder of Dojo and CEO of <a href="http://sitepen.com">Sitepen</a>), other european Dojo developers, and of course the whole uxebu team in person. During the event we will connect to all other worldwide spreaded Dojo developers via videoconference and you can participate in the discussion about the future of Dojo.</p>
<p>Because the “Dojo Developer Day” mainly takes place in the US, the on-site event in Munich will be from 3pm to 11pm. You would help us with the organization, <a href="http://dojoconnectmunich.eventbrite.com/">if you signed up to the event through EventBrite</a>. You can sign up to the event for free or for a small fee of € 30,– to support the Dojo Foundation. You can choose :)</p>
<p>Thanks to <a href="http://twitter.com/kojote">Nils Hitze</a> for organizing the event and the <a href="http://einewelthaus.de">EineWeltHaus</a> for providing the room and food for all the Dojo enthusiasts.</p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2010/01/21/dojoconnectafterdojobeer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript: Variable declarations and scope</title>
		<link>http://uxebu.com/blog/2010/01/09/variable-declarations-and-scope/</link>
		<comments>http://uxebu.com/blog/2010/01/09/variable-declarations-and-scope/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 22:35:02 +0000</pubDate>
		<dc:creator>Wolfram Kriesing</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.uxebu.com/?p=864</guid>
		<description><![CDATA[In a lot of programming languages, I would even say in most programming languages, the following looks awkward and does surely not work. One of those languages is C. But JavaScript is sometimes a miracle and like a box of jewelery, ready to be discovered. And if you are new to it, it is loaded [...]]]></description>
			<content:encoded><![CDATA[<p>In a lot of programming languages, I would even say in most programming languages, the following looks awkward and does surely not work. One of those languages is C. But JavaScript is sometimes a miracle and like a box of jewelery, ready to be discovered. And if you are new to it, it is loaded with surprises. Read on to get a tiny glimpse into some of them. JavaScript has some really interesting things waiting.<br />
<span id="more-864"></span></p>
<h2>Get started</h2>
<p>The first one serves as an eye opener. If you are a long-time and experienced JavaScript hacker you will know how this works.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>Infinity<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>i<span style="color: #339933;">==</span><span style="color: #CC0000;">47</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span>
console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// 47</span></pre></td></tr></table></div>

<p>In line 4 the number 47 is printed into the console. Even though the variable &#8220;i&#8221; has been declared inside the for-loop. Yes, it does, believe me. There is only one thing in JavaScript that creates a scope, it&#8217;s the function (in strict mode in ECMAScript5 there are more ways though). The code you put inside function(){&#8230;} does get it&#8217;s own scope, though with the access to it&#8217;s surrounding scope. Btw, this is also why you very often see the &#8220;self = this&#8221; quirk.</p>
<h2>The actual &#8220;problem&#8221;</h2>
<p>But let&#8217;s get to the actual code, that lead me to write this blog article. I love those tricky things, that give you insight into the language and sometimes make you read the specification. I guess JavaScript is the language where the ratio of &#8220;just-users&#8221; to &#8220;people who really understand the entire language&#8221;, is very high. I would not consider myself to understand the language entirely.</p>
<p>Consider the following code.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">47</span><span style="color: #339933;">;</span>
console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// 47</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// undefined</span>
  i <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span>
  console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// 1</span>
  console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>window.<span style="color: #660066;">i</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// 47</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// 47</span></pre></td></tr></table></div>

<p>Note: Testing this will only work in the browser, not in the console, since &#8220;window&#8221; is only declared in the browser context!</p>
<p>The most interesting part is definitely line 5. I will dive into it deeper later. Line 7 and 8 show that we are operating on two different variables, both with the name &#8220;i&#8221;. The one printed out in line 7 and the one printed in line 8. The variable referred to by &#8220;window.i&#8221; is the one we declared in line 1, this is no suprise. But that the assignment in line 6 didn&#8217;t override the value of it with 1 is interesting though, right?<br />
Let&#8217;s break it down a bit further.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// undefined</span>
  <span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This is the essence of the code above. Even though the variable declaration takes place in line 4, after the console.log() call, the variable is already declared when console.log() is called. It is not referencing the global variable with the value 1 though!<br />
After reading through various parts of the ECMAScript specification, this might be the one that indirectly says that this is specified as stated above:</p>
<blockquote><p>
For each VariableDeclaration and VariableDeclarationNoIn d in code, in source text order do &#8230;
</p></blockquote>
<p><a href="http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf">ECMAScript Spec (version 5)</a>, section 10.5, page 59.<br />
This is from the section that explains how to setup bindings and knowing that a VariableDeclaration is &#8220;var i&#8221; this can be understood as: upon creating a function do just the variable declarations found in <i>code</i>.</p>
<p>What the heck? Ok, let&#8217;s approach from another angle, which I find even more interesting. It is the fact, that the statement &#8220;var i = 0&#8243; is effectively broken apart in the following code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// undefined</span>
  <span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>On line 3 it will still print out &#8220;undefined&#8221;, because the interpreter did find the variable declaration in line 4. We know that because it prints &#8220;undefined&#8221; and not 1. But it did not do the variable assignment, which is also contained in line 4. So it actually broke apart the code on line 4 &#8220;var i = 0&#8243; into 1) &#8220;var i&#8221; which it executes when creating the function and 2) the assignment &#8220;i = 0&#8243; when the execution comes to line 4.<br />
The <a href="http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf">ECMAScript Spec (version 5)</a> states the separation of those two cycles explicitly too, page 87:</p>
<blockquote><p>
A variable with an Initialiser is assigned the value of its AssignmentExpression when the VariableStatement is executed, not when the variable is created.
</p></blockquote>
<h2>Get trapped</h2>
<p>In our actual example above we had another nicety, which I will try to dissect in the  following examples:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// ReferenceError: Can't find variable: i</span></pre></td></tr></table></div>

<p>This will throw an error &#8220;ReferenceError: Can&#8217;t find variable: i&#8221;. Though</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// undefined</span>
<span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>will not throw an error, it will print &#8220;undefined&#8221; peacefully, we know that and have learned that before and read that in the spec too. (Just wanted to make it clear again :-))</p>
<p>But if we do the following</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// undefined</span>
i <span style="color: #339933;">=</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>we still get &#8220;undefined&#8221; in line 1. Ooops. Did you expect that? Does the &#8220;if&#8221; in line 3 not nest the variable declaration and create it only inside the scope of the &#8220;if&#8221;? No it doesn&#8217;t. As mentioned before, there is only one thing that creates scope, that is a function. So even, this meaningless condition is relevant here.<br />
It would be interesting to test what JavaScript compilers, like <a href="http://dojotoolkit.org/docs/shrinksafe">shrinksafe</a> and <a href="http://code.google.com/intl/de/closure/compiler/docs/overview.html">Google&#8217;s closure</a> make out of it. If the removed the code from line 3 through line 5 than this would change the semantics of this code dramatically.</p>
<p>Have fun playing around with this code and twisting your brain.</p>
<h2>Testing on the console</h2>
<p>Please note! Watch when just copy+pasting the code above into the console of your browser, they have each different behavior depending on which browser you are using. If you always wrap the code in an extra (function(){&#8230;})() you will be save, but otherwise the console will give you differing results. Or, the best way, is to put the examples in a website to test it.</p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2010/01/09/variable-declarations-and-scope/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
