<?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>Fri, 26 Feb 2010 12:35:31 +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>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>0</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>1</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>2</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>1</slash:comments>
		</item>
		<item>
		<title>Mobile Cross-Platform Development: Palm Pre</title>
		<link>http://uxebu.com/blog/2009/12/02/mobile-cross-platform-development-palm-pre/</link>
		<comments>http://uxebu.com/blog/2009/12/02/mobile-cross-platform-development-palm-pre/#comments</comments>
		<pubDate>Wed, 02 Dec 2009 07:22:50 +0000</pubDate>
		<dc:creator>David Aurelio</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.uxebu.com/?p=728</guid>
		<description><![CDATA[Porting a W3C widget to webOS should not take a lot of effort, should it? webOS is built on top of web technologies, and in my mind the web is tagged “#universal”. But unfortunately, webOS isn’t universal. It’s different. I’m going to show you which differences you need to be aware of when doing cross-platform [...]]]></description>
			<content:encoded><![CDATA[<p>Porting a <a href="http://www.quirksmode.org/blog/archives/2009/04/introduction_to.html">W3C widget</a> to <a href="http://en.wikipedia.org/wiki/WebOS">webOS</a> should not take a lot of effort, should it? webOS is built on top of web technologies, and in my mind the web is tagged “#universal”. But unfortunately, webOS isn’t universal. It’s different. I’m going to show you which differences you need to be aware of when doing cross-platform development and your application is supposed to run on webOS.<span id="more-728"></span></p>
<h4>Background</h4>
<p>Developing applications for mobile devices using HTML, CSS, and JavaScript is possible through different runtimes and frameworks. On Nokia devices, you can use the <a href="http://widget.vodafone.com/dev/">Vodafone Apps Manager</a> (a runtime for W3C widgets) as well as <a href="http://www.forum.nokia.com/Technology_Topics/Web_Technologies/Web_Runtime/">Nokia Web Runtime (Nokia WRT)</a>. <a href="http://phonegap.com/">PhoneGap</a> is a framework that allows building of applications for iPhone, Android, Blackberry, Windows Mobile, and Nokia WRT with web technologies. On all of this platforms you basically throw in a base HTML file (e.g. index.html) that contains references to scripts and stylesheets. Easy, isn’t it? But not on webOS …</p>
<h4>webOS</h4>
<p>webOS uses a concept of <a href="http://developer.palm.com/index.php?option=com_content&amp;view=article&amp;id=1603#ApplicationBasics-StagesandScenes">stages and scenes</a>. A “stage” represents a card (similar to a window in desktop operating systems), whereas a “scene” can be imagined as a layer on a stage. Each stage consists of a stack containing at least one scene.  While I really like this concept, I am of the opinion that using this model shouldn’t be obligatory. It provides an elegant possibility to develop webOS based GUIs, but gets in your way as soon as you want to deploy your app on different platforms. All porting issues pointed out in this post arise from the stage/scene model.</p>
<h4>First Try</h4>
<p>When trying to repackage a W3C widget for webOS for the first time, I used the <code>palm-generate</code> command line tool to create an empty app skeleton and copied the source code into it. After packaging with <code>palm-package</code> and deploying on the emulator I was happy to see that everything seemed to work just fine. Far from it!</p>
<h4>Issue: Scrolling</h4>
<p>When simply converting a W3C widget (or any browser-based application) to a native webOS app you will notice that everything works fine except for scrolling. If the contents of the application are longer than the viewport, they are simply cut off, and scrolling isn’t possible.  To enable scrolling in webOS it is necessary to make use of a <a href="http://www.weboshelp.net/webos-mojo-development-resources/ui-widget-list/311-scroller"><code>mojo-scroller </code>Element</a> (“Mojo” is the name of palm’s framework). The easiest way to achieve that is to “push a scene onto the stack”:</p>
<ol>
<li>Include the mojo framwork into your HTML file by adding a script tag before you include any other scripts or stylesheets:
<pre><code>&lt;script src="/usr/palm/frameworks/mojo/mojo.js" type="text/javascript" x-mojo-version="1"&gt;&lt;/script&gt;</code></pre>
<p>Mojo will add a whole bunch of webOS-specific stylesheets to your application. If you like, you can use the classes defined there to achieve a more “native” feeling by <a href="http://www.weboshelp.net/webos-mojo-development-resources/palm-css-style-reference">using palm-specific classes</a>.</li>
<li>If you created the app skeleton with palm-generate you will find the constructor <code>StageAssistant</code> in the file <code>app/assistants/stage-assistant.js</code>. An instance of <code>StageAssistant</code> will be generated automatically on application start, and its setup method will be called. Add the call <code>this.controller.pushScene("main");</code> to the empty <code>setup</code> method of the prototype. This will create a new scene called “main” (which is a set of <code>div</code>-Elements inserted into <code>document.body</code>).</li>
<li>Generate the scene skeleton using <code>palm-generate</code>:
<pre><code>palm-generate -t new_scene -p "name=main" &lt;app-dir&gt;</code></pre>
<p>When “pushing” a scene, the corresponding assistant is being instantiated, and the contents of the scene’s main view file are made visible (while everything else is hidden behind the newly created scroller). The two files are <code>app/assistants/main-assistant.js</code>. and  <code>app/views/main-scene.html</code>.</li>
<li>The last step is to transfer the DOM/HTML of your application into the scene. My approach is to remove all DOM nodes from <code>document.body</code> and reinsert them into the scene element. It is also possible to use <code>innerHTML</code>, but already registered event handlers will be lost. Change the <code>setup</code> method of <code>StageController</code> to:

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">StageAssistant.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">setup</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> body <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">controller</span>.<span style="color: #660066;">body</span><span style="color: #339933;">,</span>
	    fragment <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">controller</span>.<span style="color: #660066;">document</span>.<span style="color: #660066;">createDocumentFragment</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span>body.<span style="color: #660066;">firstChild</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		fragment.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>body.<span style="color: #660066;">firstChild</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">controller</span>.<span style="color: #660066;">pushScene</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;main&quot;</span><span style="color: #339933;">,</span> fragment<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The second parameter passed to <code>pushScene</code> will be passed to <code>MainAssistant</code> as soon as it is instantiated.</p>
<p>To reinsert the nodes into the DOM change <code>main-assistant.js</code> to:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> MainAssistant<span style="color: #009900;">&#40;</span>nodes<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">nodes</span> <span style="color: #339933;">=</span> nodes<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
MainAssistant.<span style="color: #660066;">prototype</span>.<span style="color: #660066;">setup</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">controller</span>.<span style="color: #660066;">sceneElement</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">nodes</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">nodes</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;">// unset to release references</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This way, your original nodes are transferred to the visible and scrollable “main” scene. Don’t forget that any CSS selector like <code>body &gt; .foo</code> will stop working as intended, because your DOM is wrapped by two additional div elements!</li>
</ol>
<p>After these steps, scrolling finally works in apps ported to webOS. The code shown here is very generic. It can be used for every application. You should be aware that scrolling via window.pageYOffset is not possible, because the scrollable element is the mojo scroller, not the body element.</p>
<h4>Event listeners</h4>
<p>Developers who like registering event listeners on <code>document.body</code> will notice that those quit working after cut’n’pasting the DOM nodes to the scene elements. The reason is simple: in webOS, events only bubble up to the scene element (the inner one of the DIVs mentioned above). Simply don’t do that. And if you are using <a href="http://docs.jquery.com/Events/live">jQuery’s <code>live()</code></a>, stop using it. Sorry. Don’t blame it on me.</p>
<h4>Scrolling, Part Ⅱ</h4>
<p>Everything seems to work pretty well now, right? Well, there’s one more thing …</p>
<p>When you scroll (or drag) your app, and stop dragging above a clickable element, that element will be clicked. It took me quite some time to figure out the reason, because the same HTML/JavaScript will work flawlessly in the browser built into webOS. You need to listen for the “mojo-tap” event rather than for the “click” event. The “click” event will be fired after a drag has ended, but the tap event will only be fired when a “true” tap has taken place. I really can’t understand why it has to be that way, and if it wouldn’t have been easier <strong>not to alter the default behavior</strong> of WebKit.</p>
<p>The method I’m using is to have a variable containing the name of the event to bind to. That way, an application can still run on different platforms:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> myapp <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> CLICK_EVENT <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;click&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> Mojo <span style="color: #339933;">!=</span> <span style="color: #3366CC;">&quot;undefined&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	myapp.<span style="color: #660066;">CLICK_EVENT</span> <span style="color: #339933;">=</span> Mojo.<span style="color: #660066;">Event</span>.<span style="color: #660066;">tap</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// contains &quot;mojo-tap&quot;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009966; font-style: italic;">/* snip */</span>
somElm.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span>myapp.<span style="color: #660066;">CLICK_EVENT</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #009966; font-style: italic;">/* … */</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h4>Why?</h4>
<p>When I was hearing about webOS for the first time, I really looked forward to have “it [the Web] as <em>the</em> SDK” of the OS (quote from <a href="http://almaer.com/blog/iphone-developers-are-not-arrogant-and-stupid">Dion Almaer</a>). And while the SDK offers some nice features – like the stage/scene architecture – it really gets in your way as soon as you don’t want to code exclusively for it. Unfortunately, you don’t have any choice, say some sort of “compatibility mode” to the web (couldn’t resist this one). You have to bend to webOS and stick to its rules.</p>
<p>Apparently Palm is working on better compatibility. On Ajaxian you can find <a href="http://ajaxian.com/archives/webos-developer-event-roundup">an article</a> stating that “The company [Palm] is involved with the BONDI and W3C widgets standardisation effort” (quoting Ben Galbraith and Dion Almaer). Honestly: Shouldn’t somebody have considered that in the first place?</p>
<p>To me, the web is a universal platform. We’ve had many issues with proprietary “solutions” in the past millennium and still have them. I don’t like seeing proprietary features being introduced once more. It is obvious that functionality of the operating systems must be accessible in some way. But does that imply breaking things that have worked before?</p>
<p>I would love to see the possibility of making simple applications run on webOS without too much efforts. At least it should be possible to run W3C widgets without big hassles.</p>
<p>Sometimes one might be supposed to think that Palm isn’t really interested in compatibility. The <a href="http://developer.palm.com/index.php?option=com_content&amp;view=article&amp;id=1796">acceptance criteria of their “App Catalog”</a> state that “They [the applications] need to be written specifically for webOS and not delivered through the browser.” Whatever that may mean.</p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2009/12/02/mobile-cross-platform-development-palm-pre/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>CSS 3 Support in Mobile Runtimes</title>
		<link>http://uxebu.com/blog/2009/11/27/css3-support-in-mobile-runtimes/</link>
		<comments>http://uxebu.com/blog/2009/11/27/css3-support-in-mobile-runtimes/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 21:49:20 +0000</pubDate>
		<dc:creator>David Aurelio</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[frontend engineering]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://blog.uxebu.com/?p=663</guid>
		<description><![CDATA[In a recent project a client asked for boxes with rounded corners and filled with a gradient; within an application targeted at smartphones.
On mobile devices it is important to keep things simple, for instance to keep the number of DOM nodes low. That rules out using additional elements for the corners. On the other hand, many [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.uxebu.com/wp-content/uploads//2009/11/box-rounded-corners-gradient.png"><img class="alignright size-full wp-image-732" title="Box with rounded corners and filled with a gradient" src="http://blog.uxebu.com/wp-content/uploads//2009/11/box-rounded-corners-gradient.png" alt="Box with rounded corners and filled with a gradient" width="224" height="224" /></a>In a recent project a client asked for boxes with rounded corners and filled with a gradient; within an application targeted at smartphones.</p>
<p>On mobile devices it is important to keep things simple, for instance to keep the number of DOM nodes low. That rules out using additional elements for the corners. On the other hand, many mobile devices are featuring recent versions of web rendering engines. Dive into CSS 3.</p>
<p>Modern web development techniques offer a lot of possibilities to render boxes with rounded corners: e.g. border-radius, border-image, or SVG used as background. In this post I’m going to explore the support for them across different devices and runtime environments. <a href="/2009/11/27/css3-support-in-mobile-runtimes/#result-table">You can skip to the results table</a> if all you want is a quick overview.</p>
<p>As stated above, I want to achieve a box with rounded corners and a gradient that reaches from top to bottom, scaling to the height of the box. The example might be simple, but it is representing a common design goal.</p>
<p><span id="more-663"></span></p>
<h4>State of affairs</h4>
<p>As of today, several possibilities exist to develop applications for mobile devices using web technologies. Besides Palms <a href="http://en.wikipedia.org/wiki/WebOS">webOS</a>, <a href="http://phonegap.com/">PhoneGap</a> permits to develop cross-platform applications with JavaScript, HTML, and CSS for the iPhone, Android, Blackberry, Windows Mobile, and Nokia WRT (support for webOS is upcoming). On Nokia devices there are two frameworks to create applications with web technologies: the built-in <a href="http://www.forum.nokia.com/Technology_Topics/Web_Technologies/Web_Runtime/">Nokia Web Runtime Widgets</a> (Nokia WRT) and Opera-based <a href="http://widget.vodafone.com/dev/">Vodafone Apps Manager</a>, which provides a runtime for <a href="http://www.quirksmode.org/blog/archives/2009/04/introduction_to.html">W3C Widgets</a> (heads up! Vodafone Apps Manager is WebKit-based on the Vodafone 360 H1/M1 devices, to complicate development a little bit).</p>
<p>While these runtimes provide the means to build applications using well-known technology to web developers, they also bring well-known problems to the mobile sphere: inconsistencies between rendering engines. Even though most of those runtimes are WebKit-based (with the exception of Vodafone Apps Manager), <a href="http://www.quirksmode.org/blog/archives/2009/10/there_is_no_web.html">there is no [single] Webkit on Mobile</a>, as PPK has pointed out. <a href="http://www.quirksmode.org/webkit.html">His comparison table</a> shows the results of testing for various JavaScript and CSS features.</p>
<p>Freed from the burden of “making things work in IE” we can start using advanced CSS features to build interfaces for mobile applications – but hold on, it’s not as easy as desired. Due to the differences in capabilities of rendering engines and their versions, using CSS 3 features needs a lot of testing.</p>
<h4>Test Setup</h4>
<p>To keep things simple in the beginning, I’ve tested on two devices: a <em>Nokia 5800 XpressMusic</em> and a <em>Nokia N97 </em>(it might have played a role that I had those two at hand when writing the article ;-)</p>
<p><em></em>Both devices support Nokia WRT apps natively and W3C Widgets via Vodafone Apps Manager. <a href="http://static.uxebu.com/~david/css-support-in-mobile-runtimes/">The HTML file</a> consists of boxes with different set of CSS properties. I’ve uploaded the packaged <a href="http://static.uxebu.com/~david/css-support-in-mobile-runtimes/css3.wgz">Nokia WRT Widget</a> and the <a href="http://static.uxebu.com/~david/css-support-in-mobile-runtimes/css3.wgt">W3C Widget</a>, too. You can test them for yourself on your Nokia, if you like.</p>
<p>On the <em>5800,</em> Nokia WRT is based on WebKit build 413 (which correlates roughly to Safari 2.0), the installed Vodafone Apps Manager uses Opera Mobile build 1265. The <em>N97</em> uses Webkit build 525 (introduced with Safari 3) and Opera Mobile build 1360.</p>
<p>Because the two devices show no differences in rendering (with one exception), all screenshots have been taken on the N97 with the exception of one rendering bug found on the 5800. All other rendering differences are existing between runtimes only.</p>
<h4>Test Results</h4>
<h5>Result table</h5>
<p>The result table provides a quick overview about the tested features and platforms. Detailed descriptions of the single tests can be found below.</p>
<table id="result-table" border="0">
<thead>
<tr>
<td></td>
<th scope="row">Nokia WRT</th>
<th scope="row">Vodafone Apps Manager</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">border-radius</th>
<td>yes, but not useful *</td>
<td>no</td>
</tr>
<tr>
<th scope="row">border-image</th>
<td>yes</td>
<td>no</td>
</tr>
<tr>
<th scope="row">CSS gradients</th>
<td>no</td>
<td>no</td>
</tr>
<tr>
<th scope="row">SVG background images</th>
<td>no</td>
<td>yes, with rendering bug **</td>
</tr>
<tr>
<th scope="row">box-shadow</th>
<td>no</td>
<td>no</td>
</tr>
<tr>
<th scope="row">opacity</th>
<td>no</td>
<td>yes</td>
</tr>
<tr>
<th scope="row">CSS transitions</th>
<td>no</td>
<td>no</td>
</tr>
</tbody>
</table>
<p><small>* background overlaps border, blurry border on the N97, circular artifacts on the 5800</small><br />
<small>** SVG backgrounds stop being rendered after the corresponding element is scrolled out of the viewport</small></p>
<h5>Cases 1/2: Simple Box</h5>
<div class="wp-caption aligncenter" style="width: 550px"><a href="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000002.png"><img class="size-medium wp-image-683 " title="Boxes 1 and 2 on Nokia WRT" src="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000002-168x300.png" alt="Boxes 1 and 2 on Nokia WRT" width="168" height="300" /></a> <a href="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000007.png"><img class="size-medium wp-image-688 " title="Boxes 1 and 2 on Vodafone Apps Manager" src="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000007-168x300.png" alt="Boxes 1 and 2 on Vodafone Apps Manager" width="168" height="300" /></a><p class="wp-caption-text">Boxes 1 and 2 on Nokia WRT/Vodafone Apps Manager</p></div>
<p><em>Case 1</em> simply uses a <code>border</code> and a <code>background-image</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#b0b0b0</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">box.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #993333;">no-repeat</span> <span style="color: #993333;">scroll</span> <span style="color: #933;">-15px</span> <span style="color: #933;">-1px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#4a4a4a</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>This renders equally well on both platforms, but is not very similar to what I want to achieve: The background gradient is barely visible, because the image used is fairly high and does not scale with the height of the box.</p>
<p><em>Case 2</em> is a little bonus, as it does not relate to box styling: it tests for support of CSS transitions. By clicking the box, the class “clicked” is added or removed. In rendering engines supporting CSS transition the width of the box will be changed smoothly. Neither Nokia WRT nor Vodafone Apps Manager support them, though.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.transition</span> <span style="color: #00AA00;">&#123;</span>
	transition-property<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">;</span>
	transition-duration<span style="color: #00AA00;">:</span> 250ms<span style="color: #00AA00;">;</span>
	-webkit-transition-property<span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">;</span>
	-webkit-transition-duration<span style="color: #00AA00;">:</span> 250ms<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.transition</span><span style="color: #6666ff;">.clicked</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#0f0</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">270px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<h5>Cases 3/4: border-radius and border-image</h5>
<div class="wp-caption aligncenter" style="width: 550px"><a href="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000003.png"><img class="size-medium wp-image-684" title="Boxes 3 and 4 on Nokia WRT" src="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000003-168x300.png" alt="Boxes 3 and 4 on Nokia WRT" width="168" height="300" /></a> <a href="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000008.png"><img class="size-medium wp-image-689" title="Boxes 3 and 4 on Vodafone Apps Manager" src="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000008-168x300.png" alt="Boxes 3 and 4 on Vodafone Apps Manager" width="168" height="300" /></a> <a href="http://blog.uxebu.com/wp-content/uploads//2009/11/5800-border-radius.jpg"><img class="size-medium wp-image-697  " title="border-radius on the Nokia 5800 XpressMusic" src="http://blog.uxebu.com/wp-content/uploads//2009/11/5800-border-radius-300x245.jpg" alt="border-radius on the Nokia 5800 XpressMusic" width="180" height="147" /></a><p class="wp-caption-text">Boxes 3 and 4 on Nokia WRT/Vodafone Apps Manager,border-radius on the Nokia 5800 XpressMusic</p></div>
<p>The <em>third test</em> adds <code>border-radius</code> to the CSS declaration. This comes closer to the styling goal, but is not usable on both platforms: While it’s not rendered at all in the Opera-based Vodafone Apps Manager, the older WebKit engines of the 5800’s Nokia WRT adds circular artifacts to the corner, and the background overlaps the border on the N97. In addition, the border drawing is blurry on the N97 as soon as <code>border-radius</code> is added to the declarations.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
-webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
-moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span></pre></div></div>

<p><em>Case 4</em> uses the same background image, but as <code>border-image</code>. Again, Opera doesn’t support the property, but the WebKit-based Nokia WRT displays the box as intended: Sharp border, rounded corners, gradient from top to bottom. (Note: in contrast to the label on the box, the background property is set to white in this example).</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.border-img</span> <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">border-width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span>
	border-image<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">box.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #cc66cc;">15</span> stretch<span style="color: #00AA00;">;</span>
	-webkit-border-image<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">box.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #cc66cc;">15</span> stretch<span style="color: #00AA00;">;</span>
	-moz-border-image<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">box.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #cc66cc;">15</span> stretch<span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Interestingly, the WRT application crashes, when the combined offset/border-width syntax (e.g. <code>-webkit-border-image: url(box.png) 15/15px stretch</code>).</p>
<h5>Cases 5/6: Gradients and SVG</h5>
<div class="wp-caption aligncenter" style="width: 550px"><a href="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000004.png"><img class="size-medium wp-image-685" title="Boxes 5 and 6 on Nokia WRT" src="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000004-168x300.png" alt="Boxes 5 and 6 on Nokia WRT" width="168" height="300" /></a> <a href="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000009.png"><img class="size-medium wp-image-690" title="Boxes 5 and 6 on Vodafone Apps Manager" src="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000009-168x300.png" alt="Boxes 5 and 6 on Vodafone Apps Manager" width="168" height="300" /></a><p class="wp-caption-text">Boxes 5 and 6 on Nokia WRT/Vodafone Apps Manager</p></div>
<p>The <em>fifth box</em> uses a different approach for styling the box: It uses a browser-rendered gradient (<code><a href="http://webkit.org/blog/175/introducing-css-gradients/">-webkit-gradient</a></code>) for the background:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">red</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">,</span> from<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#666661</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> to<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#b0b0b0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> -webkit-gradient<span style="color: #00AA00;">&#40;</span>linear<span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">,</span> <span style="color: #000000; font-weight: bold;">left</span> <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">,</span> from<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#666661</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">,</span> to<span style="color: #00AA00;">&#40;</span><span style="color: #cc00cc;">#b0b0b0</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>Support for gradients in WebKit was introduced in april 2008, but is not supported on the Nokias. As expected, it doesn’t work in opera, either.</p>
<p><em>Case 6</em> uses a SVG as background-image which always scales to the available width and height. <a href="http://dev.opera.com/articles/view/new-development-techniques-using-opera-k/">This technique has been described more than two years ago for Opera</a>, and works well in Opera based environments. Even though this example doesn’t make use of CSS 3 , only Opera seems to be able to use SVG graphics as background images as of today. This holds true for browsers with built-in SVG rendering capabilities, too.</p>
<h5>Cases 7/8/9: Cross-Platform Solution and Advanced Features</h5>
<div class="wp-caption aligncenter" style="width: 550px"><a href="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000005.png"><img class="size-medium wp-image-686" title="Boxes 7 and 8 on Nokia WRT" src="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000005-168x300.png" alt="Boxes 7 and 8 on Nokia WRT" width="168" height="300" /></a> <a href="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000010.png"><img class="size-medium wp-image-691" title="Boxes 7 and 8 on Vodafone Apps Manager" src="http://blog.uxebu.com/wp-content/uploads//2009/11/screen000010-168x300.png" alt="Boxes 7 and 8 on Vodafone Apps Manager" width="168" height="300" /></a><p class="wp-caption-text">Boxes 7 and 8 on Nokia WRT/Vodafone Apps Manager</p></div>
<p><em>Examples 7 and 8</em> represent the attempt to combine the approaches from boxes #4 and #6: They use an <a href="http://static.uxebu.com/~david/css-support-in-mobile-runtimes/box.svg">SVG</a> <code>background-image</code> and a <a href="http://static.uxebu.com/~david/css-support-in-mobile-runtimes/box.png">pixel graphic</a> as <code>border-image</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">box.svg</span><span style="color: #00AA00;">&#41;</span> <span style="color: #933;">-15px</span> <span style="color: #933;">-15px</span> <span style="color: #993333;">repeat</span><span style="color: #00AA00;">;</span>
border-image<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">box.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #cc66cc;">15</span> stretch<span style="color: #00AA00;">;</span>
-webkit-border-image<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">box.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #cc66cc;">15</span> stretch<span style="color: #00AA00;">;</span>
-moz-border-image<span style="color: #00AA00;">:</span> <span style="color: #993333;">url</span><span style="color: #00AA00;">&#40;</span><span style="color: #ff0000; font-style: italic;">box.png</span><span style="color: #00AA00;">&#41;</span> <span style="color: #cc66cc;">15</span> stretch<span style="color: #00AA00;">;</span></pre></div></div>

<p>Because both WebKit and Presto (Opera’s rendering engine) only support <em>one</em> of the approaches, the box renders fine in both engines (also, border images always lay on top background images).</p>
<p>This would be a perfect cross-platform solution, if Vodafone Apps Manager wouldn’t show a nasty bug: The first time boxes with an SVG background are scrolled into the viewport, they are rendered properly. As soon as all boxes using the same SVG are scrolled out of the viewport, and then scrolled in again, the SVG won’t display any longer. I’ve added a video showing this behavior.</p>
<p><object width="500" height="281" data="http://vimeo.com/moogaloop.swf?clip_id=7814078&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"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://vimeo.com/moogaloop.swf?clip_id=7814078&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1" /></object></p>
<p><em>Case 8</em> just adds <code>opacity</code> to the boxes, which is only supported in Opera, but slows down scrolling noticeable. <em>Case 9</em> tests for support of <code>box-shadow</code>, which is not supported by any of the runtimes used in this test.</p>
<h4>Conclusion</h4>
<p>In our small test, we actually found a solution that runs in both WebKit and Presto. Sadly, this solution is only viable if the box <strong>isn’t ever scrolled out of the viewport.</strong> The rendering problems affecting the solution can only be found in mobile versions of the rendering engines tested.</p>
<p>That means, support of a certain feature in the desktop version of a browser does not imply bug-free support in mobile versions. Drawing can be fuzzy or faulty. Examples are <code>border-radius</code> in older Nokia WRT releases or the SVG rendering bug in Vodafone Apps Manager.</p>
<p>Despite the fact we don’t have to deal with “legacy rendering engines” on mobile devices, it is not possible to rely on modern features like SVG graphics or CSS 3 yet. Due to many forks of WebKit, and Operas restraint in implementing CSS 3 features, each usage of such features should be <strong>thoroughly tested</strong> across all different target platforms. Write code your device can handle, don’t try to bend the browser.</p>
<p>Another problem are slow rendering speeds on mobile devices. It might be impossible  to use certain features, just because animations and scrolling get choppy, thus killing the snappiness of the user interface.</p>
<h4>The Future</h4>
<p>The newest version of Operas rendering engine, Presto 2.4 is already in beta state for mobile devices with <a href="http://dev.opera.com/articles/view/opera-mobile-10-beta-developers-introduction/">Opera Mobile 10</a> (while the newest desktop version still uses Presto 2.2), and <a href="http://www.opera.com/docs/specs/presto23/">adds support for many CSS 3 features</a> like border-radius, border-image, background-size, and CSS transitions. This will enable us to use all of the techniques that have been shown for WebKit in this post (border images, border radius, and box shadow). Using a combination of background-image, background-size, and border-image could provide a solution that degrades gracefully on older devices.</p>
<p>Also, CPU and rendering power of mobile devices will increase in the next years, providing faster rendering of HTML/CSS with smooth animations.</p>
<p>Thanks to the fact that developers don’t have to account for the market leader, the mobile browser/rendering engine market evolves way faster than the desktop browser market does. I am excited about the possibilities we have today and looking forward to the possibilities we’re going to have after the next releases of browsers an built-in rendering engines.</p>
<h4>To Do</h4>
<p>The plan is to make the tests more complete. One the one hand that means adding tests (e.g. the current test series lacks a test for -webkit-/-o-background-size, which would allow to scale the background image with the size of the box). Another interesting topic is support for CSS transitions.</p>
<p>On the other hand I would like to deploy the tests on as many platforms as possible. The next steps could cover packaging for platforms supported through PhoneGap and webOS.</p>
<p>If you would like to see a certain feature tested, I would appreciate a comment very much. <a href="http://twitter.com/void_0">Follow me on Twitter (void_0)</a> to be kept up-to-date about my random findings in the mobile web dev sphere.</p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2009/11/27/css3-support-in-mobile-runtimes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Make evaled script more useable in Firebug</title>
		<link>http://uxebu.com/blog/2009/11/10/make-evaled-script-more-useable-in-firebug/</link>
		<comments>http://uxebu.com/blog/2009/11/10/make-evaled-script-more-useable-in-firebug/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 08:41:40 +0000</pubDate>
		<dc:creator>Wolfram Kriesing</dc:creator>
				<category><![CDATA[Tumbles]]></category>
		<category><![CDATA[development tools]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[frontend engineering]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.uxebu.com/?p=661</guid>
		<description><![CDATA[Make evaled script more useable in Firebug
]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.getfirebug.com/2009/08/11/give-your-eval-a-name-with-sourceurl/">Make evaled script more useable in Firebug</a></p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2009/11/10/make-evaled-script-more-useable-in-firebug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git SVN Workflow</title>
		<link>http://uxebu.com/blog/2009/10/21/git-svn-workflow/</link>
		<comments>http://uxebu.com/blog/2009/10/21/git-svn-workflow/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 15:41:43 +0000</pubDate>
		<dc:creator>Wolfram Kriesing</dc:creator>
				<category><![CDATA[Tumbles]]></category>
		<category><![CDATA[development tools]]></category>

		<guid isPermaLink="false">http://blog.uxebu.com/?p=659</guid>
		<description><![CDATA[Git SVN Workflow
]]></description>
			<content:encoded><![CDATA[<p><a href="http://andy.delcambre.com/2008/03/04/git-svn-workflow.html">Git SVN Workflow</a></p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2009/10/21/git-svn-workflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why front-end developers are so important</title>
		<link>http://uxebu.com/blog/2009/09/27/why-front-end-developers-are-so-important/</link>
		<comments>http://uxebu.com/blog/2009/09/27/why-front-end-developers-are-so-important/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 11:04:32 +0000</pubDate>
		<dc:creator>Tobias Klipstein</dc:creator>
				<category><![CDATA[Tumbles]]></category>

		<guid isPermaLink="false">http://blog.uxebu.com/?p=657</guid>
		<description><![CDATA[Why front-end developers are so important
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.paulcarvill.com/2009/09/why-front-end-developers-are-so-important-to-the-future-of-businesses-on-the-web/">Why front-end developers are so important</a></p>
]]></content:encoded>
			<wfw:commentRss>http://uxebu.com/blog/2009/09/27/why-front-end-developers-are-so-important/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
