<?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>Marcelo Emmerich IT Consulting</title>
	<atom:link href="http://www.em-motion.mobi/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.em-motion.mobi</link>
	<description>Mobile software development and web technologies</description>
	<lastBuildDate>Tue, 15 Mar 2011 18:34:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>On-device JavaScript Debugging: Opera</title>
		<link>http://www.em-motion.mobi/2010/11/20/on-device-javascript-debugging-opera/</link>
		<comments>http://www.em-motion.mobi/2010/11/20/on-device-javascript-debugging-opera/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 18:56:06 +0000</pubDate>
		<dc:creator>Marcelo</dc:creator>
				<category><![CDATA[Mobile web technology]]></category>
		<category><![CDATA[dragonfly]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[remote javascript debugging]]></category>

		<guid isPermaLink="false">http://www.em-motion.mobi/?p=254</guid>
		<description><![CDATA[In this article I will follow up on the introductory post about mobile on-device debugging. I will describe how to set up a remote debugging session between Opera Mobile and Opera's Dragonfly on the desktop. ]]></description>
			<content:encoded><![CDATA[<p>What you need:</p>
<ul>
<li>a mobile phone running Opera Mobile 9.7 or higher</li>
<li>a desktop computer running Opera Desktop 9.5 or higher</li>
<li>WiFi must be enabled on the mobile phone</li>
<li>the IP of the desktop computer must be reachable from the mobile phone</li>
</ul>
<p>If you can meet the requisites mentioned above, you are ready to go. On your desktop computer, launch Opera and select <strong>&#8220;Tools &gt; Advanced &gt; Opera Dragonfly&#8221;</strong>. This will Show the Dragonfly UI at the bottom of the Opera window. Klick on <strong>&#8220;Settings&#8221;</strong> to open up Dragonfly&#8217;s settings dialog. Scroll down until you see an entry called <strong>&#8220;Remote debugging&#8221;</strong>. Enable the setting by ticking the box and set the port number you want to use.</p>
<p><em>Note: the menu entries and the locations of the UI elements might be different on your system. The UI and the menu navigation is slightly different across versions and platforms.</em></p>
<p>Keep Opera running, it is now waiting for connection from remote debuggers on the port you specified.</p>
<p>Next, launch Opera Mobile on your phone and enter <strong>&#8220;opera:debug&#8221; </strong>in the URL box. Enter the IP address of your desktop computer and the port you configured Opera desktop to wait for connections on, and click <strong>&#8220;connect&#8221;</strong>.</p>
<p>If all went well, you should see a message below the connect button in Opera Mobile saying that it is connected to the IP and port you set.</p>
<p>In order to actually remotely debug a page, you have to open a new tab in Opera Mobile and direct the browser to the page. Then, in Dragonfly on the desktop, you have to click on the dragonfly logo to select the tab to debug.</p>
<p>Again, if all went well so far you should be able to use the full potential of Opera Dragonfly for debugging mobile HTML pages and WebApps on a real device, from your desktop computer.</p>
<p>Of curse, this works with Opera only, so stay tuned for further posts in which I will talk about other platforms and the options available there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.em-motion.mobi/2010/11/20/on-device-javascript-debugging-opera/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Compile QT 4.7.1 on Ubuntu 10.10 for OpenVG</title>
		<link>http://www.em-motion.mobi/2010/11/14/compile-qt-4-7-1-on-ubuntu-10-10-for-openvg/</link>
		<comments>http://www.em-motion.mobi/2010/11/14/compile-qt-4-7-1-on-ubuntu-10-10-for-openvg/#comments</comments>
		<pubDate>Sat, 13 Nov 2010 23:50:27 +0000</pubDate>
		<dc:creator>Marcelo</dc:creator>
				<category><![CDATA[Cross-platform development]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[openvg]]></category>
		<category><![CDATA[qt]]></category>

		<guid isPermaLink="false">http://www.em-motion.mobi/?p=247</guid>
		<description><![CDATA[For a new project that I am working on I wanted to get the latest QT version (4.7.1 at the time of this writing) to compile with OpenVG support on my virtual Ubuntu 10.10. I installed ShivaVG 0.2.1 as my OpenVG implementation, but ran into problems during the QT compilation process. Read on to see how I got it solved.]]></description>
			<content:encoded><![CDATA[<p>I am working on a new project that involves determining the available options for fast and smooth user interface implementation on an embedded, linux-based platform. The target platform supports <a href="http://www.khronos.org/openvg/" target="_blank">OpenVG</a>, so I went to check the OpenVG support in <a href="http://qt.nokia.com/products/" target="_blank">QT</a>. It turns out that OpenVG is supported by QT, however you have to compile QT with OpenVG support yourself, as it is not enabled by default in the official binaries.</p>
<p>In order to quickly start testing, I looked for a way to compile and execute QT apps with OpenVG support on the desktop. (desktop means my Ubuntu 10.10 running in a parallels VM). After some time googling around I concluded that I needed to install <a href="http://shivavg.sourceforge.net/" target="_blank">ShivaVG</a> first, then build QT with OpenVG support.</p>
<p>ShivaVG is an open source OpenVG implementation built on top of OpenGL. Installing it was as easy the usual <strong>configure/make/make install</strong>. After that it was the time to build and install QT with OpenVG support. Calling up <strong>configure </strong>did automatically find ShivaVG and recognized it as the OpenVG implementation. Unfortunately, during the actual build process, compilation stopped with different compiler and linker errors.</p>
<p>After some search, I could boil down the source of the errors I got to two things: missing variables for ShivaVG include directories and missing patch in QT regarding VGFont usage. Let&#8217;s see what these mean.</p>
<p>The first problem was that qmake was not finding the ShivaVG include and lib directories. In order to inform qmake about these settings, you need to find the right configuration file and manually add a couple of variables to it. QT stores platform specific configuration files in the mkspecs directory. I was building for an x86 linux system with a 64bit processor (remember, Ubuntu 10.10 running on virtual machine on Macbook Pro), so my configuration file is called <strong>mkspecs/linux-g++-64/qmake.conf</strong>. I added the following variables to that file before the <strong>load(qt_config)</strong> directive:</p>
<div id="_mcePaste"><strong>QMAKE_LIBDIR_OPENVG   = /usr/local/lib</strong></div>
<div id="_mcePaste"><strong>QMAKE_INCDIR_OPENVG   = /usr/local/include</strong></div>
<p>This solved the first bunch of compilation issues. However, I was still receiving strange error messages about VGFont not being found by the compiler. After another google session I learned that ShivaVG does not support VGFont. Fortunately, after yet another, much lengthier searching episode I found <a href="http://qt.gitorious.org/~sharky/qt/sharkys-qt/commit/ef7df41b11c4f5e026b85ca9b02a9c05b427a301?diffmode=sidebyside#src/openvg/qvg_p.h" target="_blank">this</a> patch on gitorious. What it does is to comment out the VGFont stuff from some files in the QT distribution. To my surprise, I was able to finish building QT from source with OpenVG support using ShivaVG after applying this patch.</p>
<p>What I experienced when actually running some QT examples and also my own demos with ShivaVG will be the subject of a future post. I&#8217;ll keep you posted <img src='http://www.em-motion.mobi/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.em-motion.mobi/2010/11/14/compile-qt-4-7-1-on-ubuntu-10-10-for-openvg/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>rettungsdienst.de</title>
		<link>http://www.em-motion.mobi/2010/10/14/rettungsdienst-de/</link>
		<comments>http://www.em-motion.mobi/2010/10/14/rettungsdienst-de/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 22:21:03 +0000</pubDate>
		<dc:creator>Marcelo</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://www.em-motion.mobi/?p=265</guid>
		<description><![CDATA[rettungsdienst.de is a leading german portal for emergency personnel. The App displays full articles from the portals news feed, also storing the articles on the device for offline reading. Visit the iTunes AppStore page for rettungsdienst.de to purchase your copy.]]></description>
			<content:encoded><![CDATA[<div>
<p><a href="http://www.rettungsdienst.de" target="_blank">rettungsdienst.de</a> is a leading german portal for emergency personnel. The App displays full articles from the portals news feed, also storing the articles on the device for offline reading.</p>
<p>Visit the <a href="http://itunes.apple.com/de/app/rettungsdienst-de/id375925081?mt=8" target="_blank">iTunes AppStore page for rettungsdienst.de</a> to purchase your copy.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.em-motion.mobi/2010/10/14/rettungsdienst-de/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On-device JavaScript Debugging: Intro</title>
		<link>http://www.em-motion.mobi/2010/10/12/on-device-javascript-debugging-intro/</link>
		<comments>http://www.em-motion.mobi/2010/10/12/on-device-javascript-debugging-intro/#comments</comments>
		<pubDate>Tue, 12 Oct 2010 08:52:23 +0000</pubDate>
		<dc:creator>Marcelo</dc:creator>
				<category><![CDATA[Mobile web technology]]></category>

		<guid isPermaLink="false">http://www.em-motion.mobi/?p=199</guid>
		<description><![CDATA[When compared to its native counterpart, the development of mobile Web Apps is still in its infancy. HTML5 and CSS3 support is still disparate across browsers, there is little IDE integration, poor tool support and a lack of true application programming frameworks to choose from. 
One of the aspects of software development that web (-app) developers have long put envious eyes on their native counterparts is on-device debugging. 
In this article I present some promising projects that might lead to a wide availability of mobile on-device debugging.
]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">As I wrote in my <a href="http://www.em-motion.mobi/?p=191" target="_blank">previous post</a>, a paradigm shift is going on in Web-App development. The understanding that Web-App development is as complex as native App development is slowly cementing in the minds of developers, managers and development software companies.</div>
<div>The logical consequence of this understanding is that Web-App developers require the same kind of support that their native counterparts do. This means powerful application frameworks, IDE integration, and tool support.</div>
<div>In the native dev world, on-device debugging has been available for a long time. Every native App developer knows that it is not sufficient to develop on a device emulator. Differences in capabilities, performance, hardware and memory availability make things difficult.</div>
<div>Let&#8217;s take a look at what the web-app world has to offer. In this introductory post I will focus on the low level protocols/tools that either are available today or will be available soon. I will get into details of setting up and actually doing on-device debugging in a later post.</div>
<h2>Google V8 debugger protocol</h2>
<p>V8 is Google&#8217;s open source JavaScript engine. It has support for debugging the JavaScript code running in it. From the V8 wiki:</p>
<blockquote><p>There are two API&#8217;s for this a function based API using JavaScript objects and a message based API using a JSON based protocol. The function based API can be used by an in-process debugger agent, whereas the message based API can be used out of process as well.</p></blockquote>
<p>Check <a href="http://code.google.com/p/v8/wiki/DebuggerProtocol" target="_blank">Google V8 debugger protocol</a> for more details.</p>
<h2 style="font-size: 1.5em;">Google Chrome Developer Tools Protocol</h2>
<p>The main motivation behind this extended protocol was to be able to use TCP/IP sockets as a remote debugging transport. From my perspective this is where things start to get interesting. From the ChromeDevToolsProtocol wiki:</p>
<blockquote><p>The existing V8 Debugger Protocol is not sufficient to provide Google Chrome, Chromium, or any other browser that supports the protocol, with the capability of remote debugging via TCP/IP sockets. The V8 Debugger protocol covers only JavaScript debugging operations, and only within a single V8 virtual machine (VM). In reality, there can be one or more separate V8 VMs inside a Google Chrome instance, residing in different renderer processes. Also, retrieving URLs loaded in the browser tabs, inspecting or modifying the DOM tree are not covered by JavaScript operations.</p></blockquote>
<p>Check <a href="http://code.google.com/p/v8/wiki/DebuggerProtocol" target="_blank">Google Chrome Dev Tools Protocol</a> for more details.</p>
<p>But Google is not the only party seriously involved in mobile on-device debugging. Let&#8217;s see what others are doing:</p>
<h2 style="font-size: 1.5em;">Opera Scope Transfer Protocol</h2>
<p>The fine folks at Opera have been supporting this for quite some time. All that is required is a copy of Opera Desktop 9.5 or higher (which includes the Dragonfly developer tools per default) and a device running Opera Mobile 9.7 or higher. Check <a href="http://dev.opera.com/articles/view/remote-debugging-with-opera-dragonfly/" target="_blank">Remote debugging with Opera Dragonfly</a> for further details.</p>
<p>Opera&#8217;s protocol used for debugging is called Scope Transfer Protocol (STP/0) and is also open source. STP/1 is in the works and will be available soon.</p>
<h2 style="font-size: 1.5em;">Android Debug Bridge (ADB)</h2>
<p>If you are into Android development (with Java) you probably know that adb is your friend. For the rest of you, adb is a command line tool that comes with the Android SDK and has a lot of nice functions to offer. A good overview is presented here: <a href="http://developer.android.com/guide/developing/tools/adb.html" target="_blank">Android Debug Bridge</a>.</p>
<p>Adb has an option to redirect the device&#8217;s debug log to the console. This log output contains the output of console.log(). So with just a bit of regex magic you can have your console.log() output on your local console.</p>
<h2 style="font-size: 1.5em;">iPhone Console Redirection</h2>
<p>I am aware of two options for the iPhone. One is to use <a href="http://www.joehewitt.com/blog/firebug_for_iph.php" target="_blank">Joe Hewitt&#8217;s Firebug for iPhone</a>, which contains a small web server that acts as a bridge between mobile Safari and Firebug. The other one is the <a href="http://bugabooapp.com/" target="_blank">Bugaboo App</a>. This App basically displays a WebView and also has a built-in web server that you can access with your desktop browser to send JavaScript statements to it.</p>
<h2 style="font-size: 1.5em;">Summary and Outlook</h2>
<p>All this looks very promising. But does this mean you can launch your favorite IDE, connect your device, hit &#8220;Debug&#8221; and you can start browsing the DOM, setting breakpoints and stepping through the code? The answer is: maybe. It depends on the device and the browser in question. Some browsers allow a full desktop-like debugging experience, others are limited to console redirection and yet others have to stick to the good old alert() debugger for the time being.</p>
<p>In follow-up articles I will get into details of how to accomplish several &#8220;levels&#8221; of remote on-device debugging on mobiles.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.em-motion.mobi/2010/10/12/on-device-javascript-debugging-intro/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The WebApp developer paradigm</title>
		<link>http://www.em-motion.mobi/2010/07/19/the-webapp-developer-paradigm/</link>
		<comments>http://www.em-motion.mobi/2010/07/19/the-webapp-developer-paradigm/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 10:06:47 +0000</pubDate>
		<dc:creator>Marcelo</dc:creator>
				<category><![CDATA[Mobile web technology]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[phonegap]]></category>
		<category><![CDATA[sencha]]></category>
		<category><![CDATA[webapp]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://www.em-motion.mobi/?p=191</guid>
		<description><![CDATA[With the adoption of HTML5 and CSS3 in mobile browsers, WebApp development is a serious alternative to native App development.  I have spoken about this topic with many people with different backgrounds; native app developers, web developers, server developers, marketing and project managers, etc. One alleged advantage of the adoption of WebApp development that gets mentioned very often is that existing web development know-how can be leveraged. 
I believe this is mostly not the case. Read on to discover why. ]]></description>
			<content:encoded><![CDATA[<p>With the adoption of HTML5 and CSS3 in mobile browsers, WebApp development is a serious alternative to native App development.  I have spoken about this topic with many people with different backgrounds; native app developers, web developers, server developers, marketing and project managers, etc. One alleged advantage of the adoption of WebApp development that gets mentioned very often is that existing web development know-how can be leveraged. I believe this is a myth, and I&#8217;ll explain why:</p>
<h1>Web Application vs Web Page</h1>
<p>What is the difference between a web application and a web page? The boundaries between web apps and web pages are sometimes blurry, however I believe it is safe to use the following definition:</p>
<blockquote><p>A web application focuses on functionality, whereas the web page focuses on content presentation.</p></blockquote>
<p>From a development perspective these are fundamentally different approaches. A [mobile] web page focuses on content presentation. Normally, the logic of the web site it is part of is implemented on the server. The web page contains JavaScript, but it is used mostly for UI effects, input validation and asynchronous data loading. Tasks are mostly form based and often split across several pages.</p>
<p>A [mobile] web app follows a different approach, it is designed to provide a certain functionality. It uses JavaScript to implement the main applications logic on the client side, uses a different set of UI elements, and does client/server communication only to send/retrieve raw data. The more a web app is tailored to handle one specific task optimally the better.</p>
<h1>JavaScript Is Not Easy</h1>
<p>As mentioned above, the use of JavaScript in traditional web pages is often reduced to small code snippets that handle input validation, dynamically manipulate the DOM in order to create nicer UI effects, or doing AJAX calls to load asynchronous data. Most of these tasks can be made even easier to the web page developer with the use of a JavaScript framework like Dojo or jQuery.</p>
<p>All this has led to the assumption that JavaScript is easy. After all, you can do cool stuff with just a couple of lines of code. While this might be true for web page development, it certainly is not for web app development. In order to understand why not, I will analyze a couple of concepts that are deemed to be important and state-of-the art in professional software development.</p>
<ol>
<li>Object Orientation. It is a widely accepted fact that object orientation helps reusing code, applying patterns and generally making software development faster. Also, less code has to be written in comparison to non-OO languages, so it also increases productivity while it helps improving quality. JavaScript supports <a href="http://en.wikipedia.org/wiki/Prototype-based_programming" target="_blank">class-free, prototypal object orientation</a>. This kind of OO is quite different from traditional OO like the one found in Java and C++. Traditional web developers will have a steep learning curve when learning OO from scratch. Existing developers used to traditional OO will have to learn how prototypal OO works. Getting into the details of prototypal object orientation is far beyond this article. I suggest following the link above for an introduction to the subject at wikipedia.</li>
<li>JavaScript is loosely typed. This means that you don&#8217;t have to specify the data type you are working with. The JavaScript interpreter (i.e. the browser) automatically converts between data types during the script&#8217;s execution as it sees fit. For developers used to Java/C++ this is quite a paradigm shift. For web developers, this feature will seem to reduce complexity in the beginning. However, lose typing is error-prone and forces you to learn the conversion rules by heart.</li>
<li>Special features. JavaScript has a couple of special features that might seem cumbersome to both traditional OO developers and web developers. With scoping and closures being two prominent examples. I will not get into the details of these two, instead, please check the following links to get a clearer picture:<br />
<a href="http://www.smashingmagazine.com/2009/08/01/what-you-need-to-know-about-javascript-scope/" target="_blank">What You Need To Know About JavaScript Scope</a><br />
<a href="http://www.jibbering.com/faq/notes/closures/" target="_blank">JavaScript Closures</a></li>
<li>Browser differences. If you have been doing web development for a while you will know what this is about. Each browser implements JavaScript with slight differences. These differences can make life very hard to JavaScript developers. Sometimes there is no way around some of these problems other than providing separate program flows for different browsers. Please visit <a href="http://www.quirksmode.org/" target="_blank">quirksmode.org</a> for details of browser differences.</li>
</ol>
<p>As I hope to have proven in the points above, JavaScript is not an easy language for neither web nor native app developers. Both groups will have a steep learning curve to take before being able to develop real-world applications in JavaScript, making use of it&#8217;s features.</p>
<h1>The UI Problem</h1>
<p>One last thing I&#8217;d like to point out is the UI problem. Let&#8217;s get back to our definition of a web app and a web page. Web pages are designed for presentation. Web apps are designed for functionality. If you think about a web page and it&#8217;s elements, you will most probably think about concepts like navigation, links, tables and forms. If you do the same with an app, you will probably come up with buttons, panels, textfields, toolbars and menus. Can you see the difference? A UI concept for information presentation is quite different than the concept for task-oriented functionality.</p>
<p>Traditional developers are less affected by this problem, as the platform they develop for most probably already offers a consistent UI framework. (SWING for Java, WPF for C#, Cocoa for objective-C, to name a few). The same applies for web developers. HTML defines a set of elements that web pages can render. A lot of libraries exist for the server part of a web page to handle these elements.</p>
<p>There is no standard web app UI framework that works like a native, object oriented UI framework as of today. However, there are very promising projects that a web app developer can use today, two of which I&#8217;d like to point out:</p>
<p><a href="http://qooxdoo.org/" target="_blank">qooxdoo</a></p>
<p><a href="http://www.sencha.com/" target="_blank">Sencha Touch</a></p>
<p>While qooxdoo is rather targeted at desktop web app development, Sencha Touch was made specifically for mobile devices. Both are good choices for web app development. However, they impose another hurdle in the already steep learning curve for potential web app developers. A certain familiarity with JavaScript is also required for both frameworks in order to understand the concepts and make the best possible use of them.</p>
<h1>Conclusion</h1>
<p>As I have shown above, web app development cannot be taken lightly. It is not safe to assume that existing web development know-how can be leveraged in a short time. Web app development has its own profile, which both web developers and native app developers do not entirely fulfill. There is a steep learning curve associated with becoming a web app developer, regardless of the developers background. However, I believe it is worth the effort. Web app development is certainly to become a key skill, especially with the adoption of HTML5 and CSS3 in more and more desktop and mobile browsers. With rich and native-like JavaScript frameworks like Sencha Touch and qooxdoo, web app development has already done a huge step in the right direction. I&#8217;m looking forward to seeing a lot of great web apps come up in the near future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.em-motion.mobi/2010/07/19/the-webapp-developer-paradigm/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Feuerwehrmagazin</title>
		<link>http://www.em-motion.mobi/2010/06/17/feuerwehrmagazin/</link>
		<comments>http://www.em-motion.mobi/2010/06/17/feuerwehrmagazin/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 22:46:08 +0000</pubDate>
		<dc:creator>Marcelo</dc:creator>
				<category><![CDATA[Portfolio]]></category>

		<guid isPermaLink="false">http://www.em-motion.mobi/?p=279</guid>
		<description><![CDATA[feuerwehrmagazin.de is a leading german portal dedicated to firefighting. It provides news, and reports about firefighting vehicles, advanced training, products and technology. With the printed magazine, the iPhone App completes the multimedia offering of Feuerwehr Magazin. Visit the iTunes AppStore page for feuerwehrmagazin.de to purchase your copy.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.feuerwehrmagazin.de/" target="_blank">feuerwehrmagazin.de</a> is a leading german portal dedicated to firefighting. It provides news, and reports about firefighting vehicles, advanced training, products and technology. With the printed magazine, the iPhone App completes the multimedia offering of Feuerwehr Magazin.</p>
<p>Visit the <a href="http://itunes.apple.com/ca/app/feuerwehr-magazin/id376530506?mt=8#" target="_blank">iTunes AppStore page for feuerwehrmagazin.de</a> to purchase your copy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.em-motion.mobi/2010/06/17/feuerwehrmagazin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone/PHP Encryption</title>
		<link>http://www.em-motion.mobi/2010/05/09/iphonephp-encryption/</link>
		<comments>http://www.em-motion.mobi/2010/05/09/iphonephp-encryption/#comments</comments>
		<pubDate>Sun, 09 May 2010 14:26:05 +0000</pubDate>
		<dc:creator>Marcelo</dc:creator>
				<category><![CDATA[iPhone development]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://www.em-motion.mobi/?p=139</guid>
		<description><![CDATA[In this article I will show how to send encrypted data from a server running PHP to an iPhone.  The data is encrypted using 128bit AES.]]></description>
			<content:encoded><![CDATA[<h1>The Server</h1>
<p>The server part is slightly less complex than the iPhone part. Let&#8217;s get started. The code below shows how to take a string and encrypt it using the Mcrypt PHP package. Of course, you should use a more random kind of key as the one used here:</p>
<pre name="code" class="php:nogutter">
    $str = 'I am an encrypted piece of data';
    $secret_key   = "a16byteslongkey!";
    $iv = "0000000000000000";

    $str = mcrypt_encrypt( MCRYPT_RIJNDAEL_128,
                         $secret_key,
                         $str,
                         MCRYPT_MODE_ECB,
                         $iv);
</pre>
<p>It is important to note that I am using ECB mode in this example. If you are into security and encryption, you will know that ECB is less secure than CBC or PCBC. The reason for choosing ECB is that it does not have padding issues, so it is easier to understand and follow the code. The use of ECB is not recommended for real-world applications!<br/><br />
That being said, let&#8217;s get on with our example.</p>
<h1>The iPhone Client</h></p>
<h2>Setup</h2>
<p>First of all, you will need to add Security.framework to your project. Go to Frameworks -> Add -> Existing Frameworks and select Security.framework from the list.<br />
Next, you will need a copy of SecKeyWrapper.h and SecKeyWrapper.m. You can get those files from Apple sample code, for example <a href="http://developer.apple.com/iphone/library/samplecode/CryptoExercise/Listings/Classes_SecKeyWrapper_h.html" target="_blank">here</a>. Note that it is not absolutely required to use SecKeyWrapper. However it makes things easier by letting you focus on the task at hand instead of diving into the depths of iPhone&#8217;s security methods.<br />
Add the SecKeyWrapper files to your project. If you added the framework correctly it should compile without warnings. <br/></p>
<h2>The Code</h2>
<pre name="code" class="c#:nogutter">
    // assume the encrypted data is in responseData, which is a NSMutableData*
    char * key = "a16byteslongkey!";
    NSData * symmetricKey = [NSData dataWithBytes:key length:16];

    CCOptions pad = kCCOptionECBMode;

    NSData *d = [[SecKeyWrapper sharedWrapper] doCipher:responseData
											   key:symmetricKey
											   context:kCCDecrypt
											   padding:&#038;pad];
    [responseData autorelease];

    // if the data was a string, you can get the decrypted string like this
    responseString =[[NSString alloc] initWithData:d
                                          encoding:NSASCIIStringEncoding];
</pre>
<h1>Final Thoughts and Considerations</h1>
<h2>Simulator Issues</h2>
<p>Encryption does not work on the iPhone simulator. Actually, the framework is just not available for the simulator. So currently the only way of testing encryption stuff is to debug on device using USB.</p>
<h2>AppStore Submission</h2>
<p>When submitting an App to the iTunes Store you will be asked whether your application makes use of encryption or not. Using encryption might lengthen the review process, as you will have to declare that you are using encryption. Chances are you will have to create and upload a CCATS form and wait for Apple to review it before your app will go up for sale. Fortunately, I submitted an App that uses AES encryption and did not have to fill in any form, but then again, I am located in Germany. <br/><br />
Anyway, I recommend reading up on CCATS in the iTunes Connect Developer Guide.<br/></p>
<h2>A Word on Security</h2>
<p>I am not a security expert. The code shown here is for educational purposes only. In a real-world implementation, you might want to use a longer key (256bit) and a better block cipher mode than ECB. Also, the approach presented here is a symmetrical one, which means both client and server need to know the key used to encrypt the data beforehand. This is by definition less secure than an asymmetric method. Asymmetric encryption is out of the scope of this article though. <br/><br />
Last but not least, security is always relative. AES encryption is heavy on the CPU load on both client and server. The right security approach is always dependent on what you want to encrypt, how big the data to be encrypted is and how important the data is, i.e. how many resources you can afford to use for securing it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.em-motion.mobi/2010/05/09/iphonephp-encryption/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Adding SmartFox SDK to iPhone project</title>
		<link>http://www.em-motion.mobi/2010/05/07/adding-smartfox-sdk-to-iphone-project/</link>
		<comments>http://www.em-motion.mobi/2010/05/07/adding-smartfox-sdk-to-iphone-project/#comments</comments>
		<pubDate>Fri, 07 May 2010 12:18:57 +0000</pubDate>
		<dc:creator>Marcelo</dc:creator>
				<category><![CDATA[iPhone development]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[SmartFox]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://www.em-motion.mobi/?p=126</guid>
		<description><![CDATA[The SmartFox Server is a popular massive multiplayer platform. With the release of RC3 of their iPhone SDK, you can now seamlessly develop iPhone client for multiplayer games. However, there are still some pitfalls in the process. One of them being getting the SDK to compile when added to an existing iPhone project. In this article I will how to get around those compilation problems.]]></description>
			<content:encoded><![CDATA[<p>In this article I will assume you are using the RC3 of the SmartFox iPhone API, which is the latest available at the time of writing this article. You can get it <a href="http://www.smartfoxserver.com/labs/API/">here</a>. Also I will assume you have a decently up-to-date iPhone SDK (i.e. 3.0 or higher).</p>
<p>Download the SDK and extract the ZIP file where it best suits you. You should be presented with the following directory structure:</p>
<p><a href="http://www.em-motion.mobi/wp-content/uploads/2010/05/smartfox_iphone_structure.png"><img class="size-full wp-image-127 alignnone" style="margin-left: 10px; margin-right: 10px;" title="smartfox_iphone_structure" src="http://www.em-motion.mobi/wp-content/uploads/2010/05/smartfox_iphone_structure.png" alt="" width="359" height="280" /></a></p>
<p>We are looking for what&#8217;s in the &#8220;<strong>Header</strong>&#8221; and &#8220;<strong>Source</strong>&#8221; directories. Go ahead and drag those two directories to your XCode project. Once that is done you will need to add some libraries and frameworks for the code to compile.</p>
<h2>CFNetwork.framework</h2>
<p>This step should be nothing new to you, just right-klick on the Frameworks group in your XCode project, and select Add &gt;&gt; Existing Frameworks. From the list, choose CFNetwork.framework.</p>
<h2>xmllib</h2>
<p>Now comes the tricky part. The SmartFox SDK relies heavily on XML and therefore on xmllib. Libs can be added to a project using the same step as above, but choosing a .dylib file from the list instead. The problem is this won&#8217;t work for SmartFox on all configurations. What you need to do is find the location of the right version of xmllib on your Mac and manually add it to the project&#8217;s build settings.</p>
<p>If you have been developing iPhone Apps for more than a month or two, chances are you have more than one iPhone SDK on your Mac. Assuming you have several 3.x versions, we will use 3.0 as the baseline for this article.</p>
<p>Let&#8217;s add the xmllib library to your project. In XCode&#8217;s main menu, go to &#8220;Project&#8221; &gt;&gt; &#8220;Edit Project Settings&#8221;. In the page that pops up, locate the &#8220;<strong>Other Linker Flags</strong>&#8221; entry. Add these two flags: &#8220;<strong>-ObjC</strong>&#8221; and &#8220;<strong>-lxml2</strong>&#8220;.</p>
<p>Next, locate the entry called &#8220;<strong>Header Search Paths</strong>&#8220;, and add the following path to it:</p>
<p><strong>/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include/libxml2/</strong></p>
<p>The last step is to add the actual framework path so that XCode can actually find the library. Locate the entry called &#8220;<strong>Framework Search Paths</strong>&#8221; and add &#8220;<strong>/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include</strong>&#8221;</p>
<p>Make sure youre base SDK is iPhone 3.0 aswell so that it is all compatible and nice.</p>
<p>Close the project settings pane and rebuild your project. It should compile without complaining.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.em-motion.mobi/2010/05/07/adding-smartfox-sdk-to-iphone-project/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>iPhone AJAX form submission</title>
		<link>http://www.em-motion.mobi/2010/05/01/iphone-ajax-form-submission/</link>
		<comments>http://www.em-motion.mobi/2010/05/01/iphone-ajax-form-submission/#comments</comments>
		<pubDate>Sat, 01 May 2010 14:57:09 +0000</pubDate>
		<dc:creator>Marcelo</dc:creator>
				<category><![CDATA[Mobile web technology]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://www.em-motion.mobi/?p=71</guid>
		<description><![CDATA[Submitting forms that issue an AJAX request without reloading or navigating away from the current page is a well-known problem in the desktop world. Some of the most widely spread JavaScript libraries like jQuery have built-in support for AJAX form submission. However, in the mobile world things look a bit different. Read on to learn from my experiences in a real-world project developed for the iPhone as a WebApp with Phonegap.  ]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In this article, I will describe how to build an AJAX form submission that is triggered on the iPhone&#8217;s mobile Safari browser whenever the keyboard is dismissed. I applied the technique described here in the Knausermeister App. If you are interested in the Knausermeister App, please read <a href="http://www.em-motion.mobi/?p=1">this</a> article.</p>
<h2>The iPhone keyboard in web-apps</h2>
<p>One of the mandatory requirements for the Knausermeister app was simplicity of use. This means that the click distance from entering a product name to seeing a list of results had to be as small as possible. Let&#8217;s have a look at the default keyboard of iPhone&#8217;s Safari Mobile:<br />
<a href="http://www.em-motion.mobi/wp-content/uploads/2010/04/iphone-safari-keyboard.png"><img class="alignleft size-medium wp-image-19" style="margin-left: 10px; margin-right: 10px;" title="Safari Mobile Keyboard" src="http://www.em-motion.mobi/wp-content/uploads/2010/04/iphone-safari-keyboard-300x244.png" alt="" width="210" height="171" /></a>As you can see, the keyboard has both a &#8220;Done&#8221; and a &#8220;Go&#8221; button. The difference between these buttons is that the &#8220;Done&#8221; button just dismisses the keyboard dialog, whereas the &#8220;Go&#8221; button simulates pressing Enter on the current input element.</p>
<p>Now, the Knausermeister app consists of just one HTML page. The idea was to enter the search term into an input field and then load the results asynchronously via AJAX. No need for a second page to be the target of the form&#8217;s submit action. All this should happen as soon as the keyboard is dismissed, regardless whether the &#8220;Done&#8221; or the &#8220;Go&#8221; button is pressed.</p>
<p>The first part of the above requirements, starting the search when the keyboard is dismissed using the &#8220;Done&#8221; button, is easy: assuming a search() method that carries out the AJAX based search, all there is to do is to add an onBlur() method to the input element and call the search() function from it.</p>
<p>The second requirement though, although a no-brainer at first, turned out to be quite tricky. As stated above, one main goal of the app was to reduce the click distance between entering a product name and receiving results. The customer is supposed to enter something into the input element, then press the &#8220;Done&#8221; or &#8220;Go&#8221; button, and receive results after the keyboard has automatically dismissed itself. In other words, there is no room for a dedicated submit button.</p>
<p>Let&#8217;s see how this could look like in it&#8217;s simplest form:</p>
<pre name="code" class="html:nogutter">&lt;input maxlength="100" type="text" /&gt;</pre>
<p><img class="alignleft size-full wp-image-18" style="margin-top: 0px; margin-bottom: 0px; margin-left: 10px; margin-right: 10px;" title="Safari Mobile Input" src="http://www.em-motion.mobi/wp-content/uploads/2010/04/iphone-input1.png" alt="" width="224" height="181" /></p>
<p>Tapping on this input element displays the keyboard shown in the screenshot on the left. Note that there is no &#8220;Go&#8221; button, just a &#8220;return&#8221; one. The reason for this is that we do not have a form element around the input element. So let&#8217;s add a form around the input element, as shown in the code snippet below:</p>
<pre name="code" class="html:nogutter">&lt;form&gt;
  &lt;input type="text" maxlength="100" value="" /&gt;
&lt;/form&gt;</pre>
<p>If we now reload our test page and tap into the input field again, we will see that now the &#8220;Go&#8221; button appears, as we expected. However, pressing it reloads the page. This is highly undesirable, since the whole application consists of just one page that uses AJAX to retrieve search results. For this reason, reloading the page needs to be suppressed. Remember, this is a web app and there is no web server serving the page.  So the natural action here would be to add a javascript function to be called when the form&#8217;s action is carried out:</p>
<pre name="code" class="html:nogutter">&lt;form action="javascript:alert('search')"&gt;
  &lt;input type="text" maxlength="100" value="" /&gt;
&lt;/form&gt;</pre>
<div>As expected, tapping on the &#8220;Go&#8221; button displays the alert. However, the keyboard still stays open on the screen. So the question is how can the form be submitted programmatically and the keyboard be dismissed at the same time? Let&#8217;s get back to the &#8220;normal&#8221; case where we do have a submit button:</div>
<pre name="code" class="html:nogutter">&lt;form action="javascript:alert('search')"&gt;
  &lt;input type="text" maxlength="100" value="" /&gt;
  &lt;input type="submit" /&gt;
&lt;/form&gt;</pre>
<p>If you try this out you will see that it works like a charm when you tap on the submit button. The javascript is called and the keyboard is dismissed. However, tapping on the &#8220;Go&#8221; button still does not make the keyboard go away.  The (cumbersome) reasoning behind this is that submitting a form should reload the page or load a completely new page. The problem is that this does not work with AJAX based applications where the form submission &#8220;just&#8221; triggers a javascript function that loads it&#8217;s data asynchronously.  So why does the keyboard disappear when using a submit button and does stay on the screen when just pressing the &#8220;Go&#8221; button with a javascript target? The answer is <strong>not at all</strong>. When another element in the document gains the focus, the keyboard disappears, as the browser registers a change in focus. However, this only works for focusable elements like buttons or anchors. Non-focusable elements like paragraphs or spans do not work, as they don&#8217;t trigger a change in the focus.</p>
<h2>The solution</h2>
<p>So we&#8217;ve seen that we need to force a focus change after the customer has pressed the &#8220;Go&#8221; button and submit the form at the same time. Here is the solution I came up with:</p>
<p>First, I added an anchor with no content inside the form. This anchor will just be used to force a focus change. Leaving the contents of the anchor empty prevents the user from accidentally tapping on it. Next, I added an onKeyPress handler to the text input element that programmatically submits the form and sets the focus to the anchor. The onKeyPress only reacts to pressing the enter and return keys, which is what happens when the &#8220;Go&#8221; button is pressed.</p>
<p>Here is the code:</p>
<pre name="code" class="html:nogutter">&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
  &lt;head&gt;
  &lt;meta name="viewport" content="width=320; user-scalable=no" /&gt;
  &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8"&gt;
  &lt;title&gt;Safari Mobile input test page&lt;/title&gt;
  &lt;script&gt;
  function handleKeyPress(e)
  {
    var key;
    if(window.event)
      key = window.event.keyCode;
    else
      key = e.which;

    if(key == 13 || key == 10)
    {
      document.forms[0].submit()
      document.getElementById('testLink').focus();
      return false;
    }
    else
      return true;
  }
  &lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;form action="javascript:alert('search')"&gt;
      &lt;input type="text"
         onKeyPress="return handleKeyPress(event)"
          maxlength="100"
                   value="" /&gt;
      &lt;a href="#" id="testLink"&gt;&lt;/a&gt;
    &lt;/form&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.em-motion.mobi/2010/05/01/iphone-ajax-form-submission/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Developing Knausermeister with Phonegap</title>
		<link>http://www.em-motion.mobi/2010/04/26/hello-world/</link>
		<comments>http://www.em-motion.mobi/2010/04/26/hello-world/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 12:28:22 +0000</pubDate>
		<dc:creator>Marcelo</dc:creator>
				<category><![CDATA[Mobile web technology]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[phonegap]]></category>

		<guid isPermaLink="false">http://em-motion.mobi/?p=1</guid>
		<description><![CDATA[<p>In this article I will share my experiences developing the Knausermeister mobile app using phonegap. Read on to discover why I chose phonegap and how I set up the projects for both iPhone and Android. Also I will discuss some of the problems I ran into and how I got around them.</p>]]></description>
			<content:encoded><![CDATA[<h2>Introduction to Knausermeister</h2>
<div>Knausermeister is a price comparison engine and browser plugin provider. You can check out their website <a href="http://www.knausermeister.de" target="_blank">here</a>. The Knausermeister browser plugin is pretty cool actually; whenever you are browsing a product page on an online shop, the plugin will check it&#8217;s product database in the background and alert you if the product is available at a better price elsewhere. I was also involved in the design of this automatic product identification algorithm, but that&#8217;s another story.</div>
<p>Knausermeister provided me with an easy to use interface for querying products. The return is an XML file containing all the fields you would expect (product name, price, shipping fee, shop url, etc.)</p>
<h2>Why phonegap?</h2>
<p><a href="http://www.phonegap.com" target="_blank">Phonegap</a> is an open source development tool for building mobile apps with web technologies (HTML, CSS and JavaScript). Basically it provides a native application for each platform it supports (currently iPhone, Android and BlackBerry). This native app instantiates an embedded web browser component. Your web technology app is then executed inside this embedded web browser component. The advantages of such a solution are:</p>
<div>
<ul>
<li>The actual application is written once and can be deployed on different platforms with a relatively low effort.</li>
<li>Existing web technology know-how can be leveraged.</li>
<li>Developers do not necessarily need to get into the details of each platform&#8217;s native SDK.</li>
</ul>
</div>
<p>However, it also has a couple of drawbacks:</p>
<ul>
<li>Debugging is tricky. How do you debug JavaScript code running inside an embedded web browser control in a native application on the iPhone/Android? The answer is <strong>not at all</strong>. At the time of writing this article the best way to debug phonegap apps is to use the debugger built into the latest versions of desktop safari/webkit. However, as anyone involved in mobile web development should know, <a href="http://www.quirksmode.org/blog/archives/2009/10/there_is_no_web.html">webkit does not equal webkit</a>. The mobile version of the iPhone browser behaves differently than it&#8217;s desktop counterpart. For simple applications like Knausermeister, this was not a problem though.</li>
<li>Building the final native app is still done in the respective development environment. This means, if you developed a phonegap app and want to deploy it to iPhone devices, you need to use XCode. If you then want to deploy the same app to the Android Marketplace, you need to use eclipse with the Android toolchain.</li>
<li>There is no phonegap UI API. If you don&#8217;t want your app to look and behave like a web page, you will have to use a third party UI library.</li>
</ul>
<div>The drawbacks mentioned above have little or no impact on the Knausermeister application. Debugging was not a risk as the application is extremely simple. I already have all the XCode, eclipse, BlackBerry JDE, etc. in place and properly set up. Finally, Knausermeister did not mind having a minimalistic, web-page oriented UI.</div>
<h2>Why not a &#8220;normal&#8221; web app?</h2>
<div>You might be asking yourself why I needed phonegap at all. After all, the Knausermeister app does not utilize any of the device APIs provided by phonegap (e.g. location, contacts, etc.) The answer is simple: <strong>marketing</strong>. A web-app cannot be submitted to the AppStore. The whole point of the app is to extend the reach of the Knausermeister to as many people as possible. In order to utilize the marketing power of the AppStore, the app has to be a native app that can be submitted as any other native app.</div>
<h2>Conclusion</h2>
<p>This article demonstrated how leveraging web technologies can help reducing development efforts significantly. The Knausermeister app was developed in one person/day, and the most effort went into finding the solution to the AJAX form submission/keyboard problem. Porting the app to Android and submitting to both the AppStore and the Android Market took about half a day. The iPhone version of the app was accepted by Apple 24 hours after submission.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.em-motion.mobi/2010/04/26/hello-world/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

