<?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>Sergio Panagia Blog</title>
	<atom:link href="http://www.panaghia.it/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.panaghia.it</link>
	<description></description>
	<lastBuildDate>Mon, 14 Jan 2013 19:22:16 +0000</lastBuildDate>
	<language>it-IT</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>“Scusate il ritardo”</title>
		<link>http://www.panaghia.it/2012/scusate-il-ritardo/</link>
		<comments>http://www.panaghia.it/2012/scusate-il-ritardo/#comments</comments>
		<pubDate>Mon, 10 Sep 2012 22:23:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Free speech / topical]]></category>
		<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://www.panaghia.it/?p=1506</guid>
		<description><![CDATA[The shaming thing of this post is that is the first one of year 2012. It&#8217;s been a intense year. I made by switch from a work approach with low level detail on things (hand on code everyday, everywhere), to a wider view on the whole production process. Suddenly, I realized that sometimes details are [...]]]></description>
				<content:encoded><![CDATA[<p>The shaming thing of this post is that is the first one of year 2012.</p>
<p>It&#8217;s been a intense year. I made by switch from a work approach with low level detail on things (hand on code everyday, everywhere), to a wider view on the whole production process. Suddenly, I realized that sometimes details are not so important.</p>
<p>This bunch of philosophical words translate themselves into my everyday life by confirming the idea that was raising inside my head in last year: technology changes, if your priority is an obsessive quality of your product and a great user experience, then you will always be on track: no-matter-what.</p>
<p>It&#8217;s been a year of change. Primary it&#8217;s been about talking with people and trying to reach the closest approximation to the impossibile. I&#8217;m working with persons very different from who I&#8217;ve been used to work with. Some of them reveled to be really awesome human beings and professionals. The run is long, be patient and don&#8217;t try to connect the dots too early.</p>
<p>One thing that I learned is that time is really valuable. As every thing in life It&#8217;s not so important how much sweat you spend on processes and proposals, the only important thing is to finalize. Is to sell. Is to make one step further.</p>
<p>But now let&#8217;s back to the web: from my latest post, actually, nothing really changed.</p>
<ul>
<li>NodeJS and SSJS didn&#8217;t became the killer pattern for develop web applications, even if I still believe this technology has a bright future.</li>
<li>WebGL and HTML5 graphics are still slow to be adopted for mainstream users. ThreeJS remains a project to follow with attention.</li>
<li>Everything is moving toward responsive design, embracing mobile users. This include layout optimization and &#8211; finally &#8211; mobile-compilant videos as a must to be adopted all over the web. Responsive grid systems are becoming more and more popular.</li>
<li>Freelancers marketplaces give huge opportunities for both contractors and clients. But don&#8217;t think that quality comes at 3 USD per hour from a developer of the other side of the planet. The mass adoption of jQuery (plugins) led to many working-hours saved and an average raise of web products quality by gaining advantages from UI standardization. On the other hand jQuery and JS frameworks really lowered the average quality of developers out there that offers their services as Web Developers. So be careful when you outsource to contractors on a freelance marketplace and you have rigid deadlines: always test your developer and, if possibile, delegate the hire/selection process to a technical manager.</li>
</ul>
<p>The last point of the list reminds me of a quote that, increasingly often, came to my mind in this last year:  <strong>&#8220;These days man knows the price of everything, but the value of nothing”</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.panaghia.it/2012/scusate-il-ritardo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web apps or PhoneGap: SQL local storage + iUI. A live Demo.</title>
		<link>http://www.panaghia.it/2011/web-apps-or-phonegap-sql-local-storage-iui-a-live-demo/</link>
		<comments>http://www.panaghia.it/2011/web-apps-or-phonegap-sql-local-storage-iui-a-live-demo/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 08:00:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Demos]]></category>
		<category><![CDATA[Apple Dev]]></category>
		<category><![CDATA[io]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iui]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile dev]]></category>
		<category><![CDATA[phonegap]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.panaghia.it/?p=1483</guid>
		<description><![CDATA[Some month ago I posted an article named Into PhoneGap: an example of API-aware native iPhone app with HTML5 and SQL local database and several readers asked me for the full source code of the example app. In this post I would like to do more. In recent times I had to chance to work a lot [...]]]></description>
				<content:encoded><![CDATA[<p>Some month ago I posted an article named <a href="http://www.panaghia.it/2011/into-phonegap-an-example-of-api-aware-native-iphone-app-with-html5-and-sql-local-database/">Into PhoneGap: an example of API-aware native iPhone app with HTML5 and SQL local database</a> and several readers asked me for the full source code of the example app.</p>
<p>In this post I would like to do more. In recent times I had to chance to work a lot on mobile apps based on web technologies, so I came in iUI framework.<br />
<span id="more-1483"></span></p>
<p>iUI is a small javascript+css library that aims to provide iOs native-like basic UI / behavior. It&#8217;s quite nice as it comes with a basic HTML knowledge. Becomes awesome if integrated with some advanced JavaScript and CSS skills. Then we come to PhoneGap, we all know what it does, right? basically a wrapper of your web app into an iOS application, with &#8211; of course &#8211; support for some native functions.</p>
<p>The topic of the article is about using webkit local database for storing information. SQL db becomes very useful when dealing with relational-based data. However, in this example, we will see how to use SQL database for storing basically username and password to retrieve the current Tumblr Dashboard via official API. Note that, in this sense, sometimes a good replacement for SQL db is localStorage (which replaces cookies).</p>
<p>We begin from the default iUI app folder, there are some library files but the starting point, for us, is just index.html: I decided to use mainly native JavaScript with just a function of SnackJS framework that makes JSONP call a piece of cake.</p>
<p>First, iUI development paradigm lets to create your app pages just in one place, our index.html, by creating div blocks. So in our app we will include the possibility to set username and password for Tumblr, and one for reading dashboard via API.</p>
<p>The basic structure should look this way:</p>
<pre class="brush:html">
<body>
   <div class="toolbar"></div>
   <div id="home" class="panel" title="Home" selected="true"></div>
   <div id="dashboard" class="panel" title="Dashboard"></div>
   <div id="login" class="panel" title="Login"></div>
</body>
</pre>
<p>&nbsp;<br />
At this point, from the home section, we link other pages via iUI syntax, setting anchor&#8217;s href to the corresponding div&#8217;s id:</p>
<pre class="brush:html">
<div id="home" class="panel" title="Home" selected="true">
   <a href="#login">Tumblr Login</a>
   <a href="#dashboard">Tumblr Dashboard</a>
</div>
</pre>
<p>If you are new to iUI read the official <a href="http://www.iui-js.org/documentation/0.50/getting-started.html">getting started</a> page.<br />
&nbsp;<br />
The amazing thing of iUI is that you might detect when user&#8217;s comes into a certain page by attaching a simple <em>focus</em> event on relative element.<br />
This means that detecting when user lands into dashboard page is extremely simple:</p>
<pre class="brush:javascript">
document.getElementById('dashboard').addEventListener('focus', function(e)
{
   //code here
}, false);
</pre>
<p>Into this event listener we&#8217;ll check if we already have username and password and file, otherwise, we&#8217;ll show a link to login page.<br />
iUI usage is the only big difference between this example and my previous one (<a href="http://www.panaghia.it/2011/into-phonegap-an-example-of-api-aware-native-iphone-app-with-html5-and-sql-local-database/">Into PhoneGap: an example of API-aware native iPhone app with HTML5 and SQL local database</a>), where code is explained step after step. </p>
<p>The other difference is that I&#8217;m releasing source code. Enjoy and have a good hacking.</p>
<p>(remember that username/password authentication is not tested in this demo, should be implemented after user inserts credentials in login div with an ajax call).</p>
<p><a class="pbutton" href="http://www.panaghia.it/dev/db_example.zip" title="webkit sql live demo download">Download</a><a class="button" href="http://www.panaghia.it/dev/db_example_demo/" title="webkit sql live demo">Demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.panaghia.it/2011/web-apps-or-phonegap-sql-local-storage-iui-a-live-demo/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Digressione su sorrisi d&#8217;intesa fuori luogo</title>
		<link>http://www.panaghia.it/2011/digressione-su-sorrisi-dintesa-fuori-luogo/</link>
		<comments>http://www.panaghia.it/2011/digressione-su-sorrisi-dintesa-fuori-luogo/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 16:04:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Free speech / topical]]></category>
		<category><![CDATA[debito pubblico]]></category>
		<category><![CDATA[economia]]></category>
		<category><![CDATA[italia]]></category>

		<guid isPermaLink="false">http://www.panaghia.it/?p=1435</guid>
		<description><![CDATA[La crisi economica affonda la sua scure sul nostra paese dal 2008. Per la maggior parte della popolazione la prospettiva di una recessione, o comunque di una crescita tendente allo zero, è sembrata a lungo un miraggio. A volte, poi, sembra che la presa coscienza della gravità di certe situazioni debba necessariamente avvenire in concomitanza con [...]]]></description>
				<content:encoded><![CDATA[<p>La crisi economica affonda la sua scure sul nostra paese dal 2008. Per la maggior parte della popolazione la prospettiva di una recessione, o comunque di una crescita tendente allo zero, è sembrata a lungo un miraggio.</p>
<p><span id="more-1435"></span></p>
<p>A volte, poi, sembra che la presa coscienza della gravità di certe situazioni debba necessariamente avvenire in concomitanza con eventi che ci riguardano in qualche modo, come perdere il lavoro o trovarsi, improvvisamente, inermi di fronte all&#8217;evidenza di non poter pagare il mutuo.</p>
<p>I primi sintomi di un sistema che iniziava a perdere colpi furono curati con la riforma del lavoro nel lontano 2003; le imprese italiane furono galvanizzate con l&#8217;introduzione del cosiddetto <em>lavoro flessibile</em>. Esaltate dalla prospettiva di un facile licenziamento, impazzava una sorta di caccia al fannullone: le aziende si giustificavano delle assunzioni a brevissimo termine dichiarando di tutelarsi da scelte di assunzione sbagliate. La compressione dei costi del lavoro sarebbe dovuta servire come una sorta di doping momentaneo, permettendo le assunzioni con contratti flessibili che sarebbero stati riconvertiti, in seguito, a modalità <em>indeterminata</em>. È certamente risaputa la difficoltà, una volta compressi i costi, di tornare ad espanderli. La grande riconversione e il ritorno ai contratti tradizionali non c&#8217;è stata.</p>
<p>Per quanto rigaurda la finanza pubblica, per qualche strana coincidenza, non è stato attuato nessun piano per risanare quell&#8217;enorme falla che è il terzo debito pubblico a livello globale. Il 2008, poi, ha solo peggiorato le cose.  Il 2011 e i bilanci truccati della Grecia sono stati poi accompagnati da continui siparietti politici, ultimo il cabaret tra il presidente francese Nicolas Sarkozy e il cancelliere tedesco Angela Merkel, inciampati in una risata di scherno di fronte ad una platea di giornalisti che chiedevano quali rassicurazioni avesse fornito la politica italiana riguardo le prossime riforme.</p>
<p>Ed è un peccato. Non tanto perché certi avvenimenti, troppo spesso, sono un argomento per tanti giovani italiani solo per farsi quattro risate con gli amici durante l&#8217;aperitivo (non avremo la pensione, non potremo accendere un mutuo, ma all&#8217;aperitivo non rinunciamo mai), piuttosto perché questa situazione costringe giovani che si danno da fare, con moltissime ambizioni, a partire e cambiare vita senza volerlo. Persone come Simone e Silvia, due amici che sono partiti per Londra: seguo con piacere i loro <a href="http://www.callinglondon.info/">post</a> in cui si sorprendono delle piccole-grandi cose che funzionano nella loro nuova città: gli uffici postali efficienti e l&#8217;ambiente lavorativo professionale e la grande quantità di donne in posizioni dirigenziali. E mi chiedo che cosa manchi a noi italiani che viviamo in Italia. Se è vero che il parlamento è niente di più e niente di meno che lo specchio di tutti noi 60 milioni di italiani. Il problema è che a volte, questi giovani, sono persone che resterebbero molto volentieri in Italia: che non vorrebbero abbandonare familiari e affetti. Costretti a partire a causa dell&#8217;immobilismo di questa politica e stroncati da un mercato del lavoro che non offre nessuna solidità, una pressione fiscale[1] e processi burocratici che non incentivano in nessun modo l&#8217;avvio di impresa.</p>
<div id="attachment_1440" class="wp-caption aligncenter" style="width: 643px"><a href="http://www.panaghia.it/wp-content/uploads/2011/10/Schermata-10-2455860-alle-16.58.12.png"><img class="size-full wp-image-1440    " title="sarkozy &amp; merkel" src="http://www.panaghia.it/wp-content/uploads/2011/10/Schermata-10-2455860-alle-16.58.12.png" alt="" width="633" height="454" /></a><p class="wp-caption-text">Immagine tratta da economist.com (http://www.economist.com/blogs/charlemagne/2011/10/italy-and-euro-zone)</p></div>
<p>note:</p>
<p>[1] &#8220;L’aliquota totale sui profitti delle imprese è pari al 68,5 per cento&#8221; - (Not) doing business 2012; <a href="http://www.chicago-blog.it/2011/10/22/not-doing-business-2012/">http://www.chicago-blog.it/2011/10/22/not-doing-business-2012/</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.panaghia.it/2011/digressione-su-sorrisi-dintesa-fuori-luogo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transiting from native iOs apps to webapps: 5 top design patterns</title>
		<link>http://www.panaghia.it/2011/transiting-from-native-ios-apps-to-webapps-5-top-design-patterns/</link>
		<comments>http://www.panaghia.it/2011/transiting-from-native-ios-apps-to-webapps-5-top-design-patterns/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 06:55:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apple Dev]]></category>
		<category><![CDATA[User Experience Design]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[user experience]]></category>

		<guid isPermaLink="false">http://www.panaghia.it/?p=1352</guid>
		<description><![CDATA[Web apps optimized for mobile devices may now count on specific, advanced functions offered by a cross synergy commitment between new W3 specifications, browsers vendors and hardware producer: I&#8217;m talking about HTML5, low-level events implementation for touchable surfaces. This gives designers huge opportunities to create new products based on web technologies, often replicating native app [...]]]></description>
				<content:encoded><![CDATA[<div>Web apps optimized for mobile devices may now count on specific, advanced functions offered by a cross synergy commitment between new W3 specifications, browsers vendors and hardware producer: I&#8217;m talking about HTML5, low-level events implementation for touchable surfaces.</div>
<div>This gives designers huge opportunities to create new products based on web technologies, often replicating native app UI.</div>
<div><span id="more-1352"></span></div>
<div>Anyway, system like iOs assumed some rigorous interaction design guidelines when using native components; therefore, by replicating this elements for mobile web apps, risks for a incorrect conceptual models arise.</div>
<div>I&#8217;ve listened some iOs UI elements that are commonly  begin adopted by web-apps, and are often subject to misconception.</div>
<h3>Navigation Bar</h3>
<p>Is one of the first thought of most customer when they require a mobile app, the fixed header section. It serves for three main reasons, consistently with the generic number of sub-elements contained (as shown in Figure 1)</p>
<div id="attachment_1357" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.panaghia.it/wp-content/uploads/2011/09/ui_navbar.jpg"><img class="size-medium wp-image-1357" title="ui_navbar" src="http://www.panaghia.it/wp-content/uploads/2011/09/ui_navbar-300x42.jpg" alt="" width="300" height="42" /></a><p class="wp-caption-text">Figure 1 - Apple common navigation bar for native apps.</p></div>
<p>&nbsp;</p>
<ul>
<li><strong>Go back, step by step</strong>: the common back-button should show the label of the previous location (not just a &#8220;<em>back</em>&#8221; label).</li>
<li><strong>Explain context</strong>: it answers the question &#8220;Where am I?&#8221;, the title should always reflect the location of the current view.</li>
<li><strong>Contextual buttons</strong>: Apple guidelines defines this as &#8220;content-specific control&#8221;, to directly manage contents in the current screen. It&#8217;s generally contextual to the current view, so it&#8217;s common to see a button to add an entry on a list with a &#8220;+&#8221; button on the right side of the navigation bar.</li>
</ul>
<p>Due to technical restriction imposed by Apple, fixed position of the navigation bar (always visible in the viewport while body content is scrolling) is obtained, before iOS 5, via a workaround in JavaScript by simulating native scroll on the body of the application (see iScroll4). In complex applications (E.g., G+) that may not be so efficient as native webkit scrolling. So consider the option to wait iOs 5 and your header to remain at the top of the page (and not the viewport) while user scrolls.</p>
<p style="text-align: left;">The temptation of an high level of brandization of this element may bring designers to lack some of these points.</p>
<p style="text-align: left;">An example is the wall-mart website mobile version,in Figure 2 showing a section called &#8220;Value of the Day&#8221;. In this example, designers preferred to show a relative <em>big</em> logo of the company instead of the title of the current page, shifted in the grey area below with a small font size. Moreover, they omitted to implement the classical back button. The three icons on the right side of the navigation area covers the function of <em>contextual buttons</em>, though they are not contextual the current view, it can&#8217;t be strictly considered as an error  because of the natural of a mobile-optimized website.</p>
<div id="attachment_1359" class="wp-caption aligncenter" style="width: 210px"><a href="http://www.panaghia.it/wp-content/uploads/2011/09/wallmart.png"><img class="size-medium wp-image-1359 " title="wallmart-mobile-app" src="http://www.panaghia.it/wp-content/uploads/2011/09/wallmart-200x300.png" alt="" width="200" height="300" /></a><p class="wp-caption-text">Figure 2 - Wall-mart mobile version. In the picture the view for a specific product. Lacks of back button and title in the main area of the application.</p></div>
<h3>Selectbox vs Tableview: make them choose</h3>
<p>One of the most usable paradigm to make a user select an option, on a desktop website, is the classic html &lt;select&gt; element.</p>
<p>On iPhone or recent smartphones the choice is implemented via <em>tableview </em>(Figure 3): a list of elements. This method works excellently especially when user has to make multiple, hierarchal choices via two or more tableviews; this paradigm is successfully implementable in web-apps with the classic iOs left-to-right animation between a tableview and another, thanks to mobile safari&#8217;s support for hardware-accelerated transformation (<a title="webkit project site - transform 3d" href="http://www.webkit.org/blog/386/3d-transforms/">read</a> the blog post on webkit site).</p>
<div id="attachment_1367" class="wp-caption aligncenter" style="width: 225px"><a href="http://www.panaghia.it/wp-content/uploads/2011/09/choose-tableview.png"><img class="size-full wp-image-1367" title="choose-tableview" src="http://www.panaghia.it/wp-content/uploads/2011/09/choose-tableview.png" alt="" width="215" height="192" /></a><p class="wp-caption-text">Figure 3 - a tableview example</p></div>
<p>Select-boxes in web-apps are still used, but Apple guidelines about <em><a title="apple guidelines picker" href="http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/mobilehig/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW4">pickers</a></em> becomes more and more valuable:</p>
<ul>
<li>use <strong><em>picker</em></strong> for <strong>well-known choices</strong> options (E.g., sex).</li>
<li>use a <strong><em>tableview</em></strong>, instead, for <strong>large lists of options</strong>.</li>
</ul>
<p>Consider the example above in Figure 4: the image shows a snapshot of Meridiana Fly web-app. All choices are implemented via html select-box elements. Departure element, if tapped shows the webkit native picker with 40 options:<strong>only 4 of them are visible per time</strong> (Figure 5).</p>
<div id="attachment_1371" class="wp-caption aligncenter" style="width: 233px"><a href="http://www.panaghia.it/wp-content/uploads/2011/09/meridiana-fligh-search.png"><img class="size-full wp-image-1371 " title="meridiana-fligh-search" src="http://www.panaghia.it/wp-content/uploads/2011/09/meridiana-fligh-search.png" alt="" width="223" height="337" /></a><p class="wp-caption-text">Figure 4 - Meridiana flight search; all user selections has been implemented via select-boxes html elements.</p></div>
<p>&nbsp;</p>
<div id="attachment_1372" class="wp-caption aligncenter" style="width: 212px"><a href="http://www.panaghia.it/wp-content/uploads/2011/09/meridiana-departure.png"><img class="size-medium wp-image-1372" title="meridiana-departure" src="http://www.panaghia.it/wp-content/uploads/2011/09/meridiana-departure-202x300.png" alt="" width="202" height="300" /></a><p class="wp-caption-text">Figure 5 - selectbox generates a pick element that shows up to 4 items per time in the viewport.</p></div>
<p style="text-align: center;">&nbsp;</p>
<p>Often we have to deal with complex data structure. In this case, lack of a native multi-column picker suggests to design an hybrid solution, dividing user choices depending on options contents. Figure 6 shows an alternative mockup in this sense.</p>
<div id="attachment_1373" class="wp-caption aligncenter" style="width: 248px"><a href="http://www.panaghia.it/wp-content/uploads/2011/09/meridiana-mock.png"><img class="size-full wp-image-1373" title="meridiana-mock" src="http://www.panaghia.it/wp-content/uploads/2011/09/meridiana-mock.png" alt="" width="238" height="285" /></a><p class="wp-caption-text">Figure 6 - example mockup for flight search booking: divides long lists and not-known options in tableviews and keep others in select-boxes.</p></div>
<p>Another note about tableviews is about convention in symbolism: if you are building a web-app with multiple, hierarchical tableview choices that lead to a certain final page, consider that you can count on those iOs guidelines:</p>
<p><a href="http://www.panaghia.it/wp-content/uploads/2011/09/disclosure.jpg"><img class="alignleft size-full wp-image-1378" title="disclosure" src="http://www.panaghia.it/wp-content/uploads/2011/09/disclosure.jpg" alt="" width="10" height="13" /></a> The simple arrow indicates that, if tapped, the element will bring you to another tableview (another choice)</p>
<p><a href="http://www.panaghia.it/wp-content/uploads/2011/09/detail_disclosure.jpg"><img class="alignleft size-full wp-image-1379" title="detail_disclosure" src="http://www.panaghia.it/wp-content/uploads/2011/09/detail_disclosure.jpg" alt="" width="29" height="29" /></a> the circle arrow indicates that, when tapped, will bring you to a <em>detail</em> page contextual to your choice.</p>
<p>&nbsp;</p>
<h3>Search.</h3>
<p>10+ years of usability in web design suggest to include Search feature in our digital products, and keep it visible and consistent in every section.</p>
<p>iOs native apps tends to include search launcher in the tab-bar at the bottom of the viewport, and display a modal, quick interface with the input box at the top of the screen on the following step, search results are indexed in a list below.</p>
<p>Replicating this feature on web apps might lead to compromises. Fixed tab-bar, at the bottom of the screen (iOs native&#8217;s like), may not results very usable because of the small screen available considering the standard Safari toolbar (unless user adds the web-app to his home screen). Therefor there&#8217;s a trend in including search launcher at the top of the screen, in the navigation bar. That may result a good strategy because search icon will be evident in any section of the site, but may take possession of a place reserved, theoretically , to interact with page content elements.</p>
<p>Once landed in search section, one of the most important thing is optimize the small screen available by dividing the viewport in the <em>header</em> section and the <em>results </em>section, as tradition set in iOs native apps. In Figure 7 there is an example of that implementation with a standard DHTML technique: Facebook mobile web-app. Asynchronous calls to server injects new data while user types; an improvement version of a search feature includes local indexed data to serve data instantly. This result may be acquired by integrating local database support as part of the web storage HTML5 capabilities (<a title="w3 html5 web storage" href="http://dev.w3.org/html5/webstorage/">view</a> document by W3).</p>
<p style="text-align: center;">&nbsp;</p>
<div id="attachment_1386" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.panaghia.it/wp-content/uploads/2011/09/search_modal.jpg"><img class="size-medium wp-image-1386 " title="search_modal" src="http://www.panaghia.it/wp-content/uploads/2011/09/search_modal-300x223.jpg" alt="" width="300" height="223" /></a><p class="wp-caption-text">Figure 7 - Facebook mobile app uses a modal search.</p></div>
<h3>Launch Image</h3>
<p>One of the most misunderstood UI element is the launch image. It&#8217;s the splash page to display while app (or web app) is loading.</p>
<p>Several designers insert a page with a logo and custom graphics (as shown in Figure 8). What it really should contain is a minimal, high quality picture representing the real UI of the application: it covers the waiting time by decreasing launch-timing perception.</p>
<p>A custom launch image, that has nothing to do with the app UI, has simply no sense. Despite indications and guidelines about this feature, there is a huge number of native apps that abuse <em>launch image</em> with stunning graphics and logos.</p>
<p>In Web-apps is it possible to add a launch-image and it will be shown only if user will add the app on the home screen.</p>
<div id="attachment_1406" class="wp-caption aligncenter" style="width: 426px"><a href="http://www.panaghia.it/wp-content/uploads/2011/09/launch-image.png"><img class="size-full wp-image-1406 " title="launch-image comparison" src="http://www.panaghia.it/wp-content/uploads/2011/09/launch-image.png" alt="" width="416" height="307" /></a><p class="wp-caption-text">Figure 8 - A comparison between two apps&#39; launch image. Instagram (on the left) shows a minimal version of its UI. F1.com prefers a logo and a label &quot;Loading&quot;.</p></div>
<p>&nbsp;</p>
<h3>Tab bar</h3>
<p>The black, bottom-sided menu list with fixed position relative to user&#8217;s viewport. It represents common UI element for native-iOs applications. By Apple specifications it should flattern the navigation system by subdividing different conceptual areas of the application. While it&#8217;s highly recommended to make it accessible from anywhere in the app, many use to design this element as a sub navigation menu, avoiding usage of segmented controls (the ones ideated for this purpose).</p>
<p>Implementing a tab bar menu in webapps may be achieved, again, by emulating native scroll keeping fixed a portion of the page. Is one of the rarer design pattern taken from iOs native apps to web-apps, due to non-optimal experience obtained by simulating native scroll, especially on older devices like iPhone 3G. Despite that, in a near future with native, fixed positioned elements usage of a tab bar might be a successful choice to address app navigation in a simple, flat way.</p>
<p>&nbsp;</p>
<h3>Conclutions</h3>
<p>With current and future mobile browsers enhancements, the phrase (and excuse) &#8220;it&#8217;s just a mobile-optimized version of our site&#8221; shall loose any sense. All potentials of iPhone (and Android devices as well) lead to a new generation of mobile, web-based applications. Some design patterns and guidelines could be taken from the well-tested native iOs ground; but there&#8217;s still a wide, empty space for imagination and continuos improvements. If the era of web designers seems over, new gates are opening by both sides of designers and developers; it&#8217;s the era of technical specialists. Mobile development requires an highly skilled profile because of limited screen availability, environment distractions and requirements of new paradigm of interaction never tested before. By the other hand, a skilled web developer has to face the limitations of mobile devices memory, optimizing code without  falling back to huge JavaScript frameworks that are not optimized for mobile specific browsers.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.panaghia.it/2011/transiting-from-native-ios-apps-to-webapps-5-top-design-patterns/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Introducing Slideup: An iOs-like panel built for iUI framework</title>
		<link>http://www.panaghia.it/2011/introducing-slideup-an-ios-like-panel-built-for-iui-framework/</link>
		<comments>http://www.panaghia.it/2011/introducing-slideup-an-ios-like-panel-built-for-iui-framework/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 16:08:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apple Dev]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[mobile dev]]></category>

		<guid isPermaLink="false">http://www.panaghia.it/?p=1331</guid>
		<description><![CDATA[Mobile web application libraries are dividing in two main groups: lightweight libraries and complex and (often heavy) application framework with extended UI support. Introduction A good point of balance is iUI &#8211; a web UI framework for mobile devices. It offers a really basic, but very functional, navigation system between pages (the classic left-to-right and [...]]]></description>
				<content:encoded><![CDATA[<p>Mobile web application libraries are dividing in two main groups: lightweight libraries and complex and (often heavy) application framework with extended UI support.</p>
<h3>Introduction</h3>
<p>A good point of balance is iUI &#8211; a web UI framework for mobile devices. It offers a really basic, but very functional, navigation system between pages (the classic left-to-right and right-to-left swipe effect when transiting page). At this time is still a beta and there is some work to be done.<br />
<span id="more-1331"></span><br />
It&#8217;s deliberately delivered without support for various type of transition and effects like jQuery Mobile or jQTouch in order to stay light. And that&#8217;s really a good strategy; but the more you rely on pure javascript, the less developers will be attracted. Why? well, because JavaScript is hard comparing to jQuery or any other library. But for mobile applications, with their low- hardware performances, a good programming disposition might be the key to build a successful user experience.</p>
<h3>Slideup, a full-screen -iOs like &#8211; javascript powered dialog</h3>
<p>I built Slideup with iUI in mind, but it works everywhere, since has been written in pure javascript. That&#8217;s a really small plugin to generate the classic slide effect (down-to-top and top-to-down).</p>
<p>Just build a html panel inside a page (see iUI paradigm), with an element to activate and deactivate dialog.</p>
<pre class="brush:html" >
<div id="index" title="Main page">
 <button id="openDialog">Show dialog</button>
 <div id="dialogPanel" class="slideup">
  <div class="toolbar">
  <button id="closeDialog">Close</button>
  </div>
 </div>
</div> 
</pre>
<p>At this point just declare an instance of Slideup:</p>
<pre class="brush:javascript">
var myDialog = new Slideup('openDialog', 'closeDialog', 'dialogPanel');
</pre>
<p>&nbsp;</p>
<p>Slideup constructor takes 3+1 argoments:</p>
<ul>
<li>id of element designed to open dialog</li>
<li>id of element designer to close dialog</li>
<li>id of dialog element</li>
<li>a function fired when user closes dialog (optional)</li>
</ul>
<p>See more, download &#038; demo:<br />
<a href="https://github.com/panaghia/Slideup" title="github slideup">Slideup on GitHub</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.panaghia.it/2011/introducing-slideup-an-ios-like-panel-built-for-iui-framework/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>GeoSuggester JS &#8211; A pure JavaScript Autocomplete plugin for geo input forms</title>
		<link>http://www.panaghia.it/2011/geosuggester-js-a-pure-javascript-autocomplete-plugin-for-geo-input-forms/</link>
		<comments>http://www.panaghia.it/2011/geosuggester-js-a-pure-javascript-autocomplete-plugin-for-geo-input-forms/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 07:30:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[autocompleter]]></category>
		<category><![CDATA[autosuggester]]></category>
		<category><![CDATA[geosuggester]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[google maps api]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://www.panaghia.it/?p=1295</guid>
		<description><![CDATA[GeoSuggester let you obtain full geographic data from a single input string provided by user, thanks to geocoding functionalities offered by Google Maps API services.]]></description>
				<content:encoded><![CDATA[<p>I initially wrote GeoSuggester  as a MooTools plugin, now I made it finally available as a <em>framework-agnostic</em> script, written in <strong>pure JavaScript</strong>.<br />
<span id="more-1295"></span></p>
<h2>The goal</h2>
<p>Is known that time is gold on the Internet: geographic location-related data is often a pain to fill into common forms.<br />
So, GeoSuggester let you obtain full geographic data from a single input string provided by user, thanks to geocoding functionalities offered by Google Maps API services.</p>
<h2>How</h2>
<p>An input element is provided of a suggest-box with geographic image feedback, once the user press <em>enter</em> or <em>tab</em>, GeoSuggester will give back all information related to displayed location in a callback function.<br />
<iframe src="http://player.vimeo.com/video/15781504?title=0&#038;byline=0&#038;portrait=0" width="450" height="253" frameborder="0"></iframe></p>
<p>Or check the <a title="geosuggesterjs demo" href="http://geosuggester.panaghia.it/pure/Demo">Demo</a>.</p>
<h2>Syntax</h2>
<p>Syntax for constructor is simple:</p>
<pre class="brush:js">new GeoSuggester(elementId [, options]);</pre>
<p>But an example worth a thousand words:</p>
<pre class="brush:js">var geo = new GeoSuggester("myInput",
    {
        canvasHeight: 400,
        onSelect: function()
        {
            //returns selected data
            console.log(this.selected.postalCode);
            /*
            this.selected.route;
            this.selected.streetNumber;
            this.selected.adminArea1;
            this.selected.locality;
            this.selected.latitude+ " "+this.selected.longitude;
            */
        }
    });</pre>
<p>GeoSuggester will automatically calculate dimensions of the auto-suggest box, amyway you can manually set width as an instance variable <em>canvasHeight</em>.</p>
<p><em>onSelect</em> function is the callback called when user will press enter/tab. Geographic data is stored inside <em>selected</em> structure.</p>
<p>GeoSuggester  is released under MIT STYLE license, code is hosted on GitHub.</p>
<p>Links:</p>
<ul>
<li><a title="github code for geosuggesterJS" href="https://github.com/panaghia/GeoSuggesterJS">GitHub Repository</a></li>
<li><a title="geosuggesterjs minisite" href="http://geosuggester.panaghia.it/pure">Official mini-site</a></li>
<li><a title="geosuggesterjs demo" href="http://geosuggester.panaghia.it/pure/Demo">Demo</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.panaghia.it/2011/geosuggester-js-a-pure-javascript-autocomplete-plugin-for-geo-input-forms/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Into PhoneGap: an example of API-aware native iPhone app with HTML5 and SQL local database</title>
		<link>http://www.panaghia.it/2011/into-phonegap-an-example-of-api-aware-native-iphone-app-with-html5-and-sql-local-database/</link>
		<comments>http://www.panaghia.it/2011/into-phonegap-an-example-of-api-aware-native-iphone-app-with-html5-and-sql-local-database/#comments</comments>
		<pubDate>Mon, 30 May 2011 07:30:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Apple Dev]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[local database]]></category>
		<category><![CDATA[native app]]></category>
		<category><![CDATA[phonegap]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[tumblr]]></category>

		<guid isPermaLink="false">http://www.panaghia.it/?p=1239</guid>
		<description><![CDATA[These days I had the opportunity to test PhoneGap, an open source framework for creating native mobile apps with web standards. So, first things came to mind when you think about HTML5, is that even if mobile browsers are very fast to implement new features, you cannot truly count on &#8220;standards&#8221; but on &#8220;drafts&#8221;. The [...]]]></description>
				<content:encoded><![CDATA[<p>These days I had the opportunity to test PhoneGap, an open source framework for creating native mobile apps with web standards.</p>
<p>So, first things came to mind when you think about HTML5, is that even if mobile browsers are very fast to implement new features, you cannot truly count on &#8220;standards&#8221; but on &#8220;drafts&#8221;. The consequences are worse documentation and hard-times in finding help in topics and discussions over the web.<br />
<span id="more-1239"></span><br />
Anyway, I wanted to test difficulties in implementing a real-world prototype for a web, mobile, application.</p>
<h1>The object: A Tumblr dashboard reader for iOs</h1>
<p>PhoneGap says it supports six platforms, it represents a truly advantage to products to deploy on different devices such as iOs, Android or BlackBerry.</p>
<p>The prototype for this example wants to test iOs environment with PhoneGap, to build a native application with two basics functionalities within Tumblr API:</p>
<ul>
<li>Login / Authentication system.</li>
<li>Dashboard read.</li>
</ul>
<p>To accomplish these tasks, on a common native iOs app, programmers store login credentials on local SQLite3 db. In PhoneGap there does not seem to interact this way, meanwhile we may use the webkit-powered database announced with HTML5 storage capabilities.</p>
<h2>Xcode &amp; setup</h2>
<p>Installing PhoneGap on OSX is a piece of cake, after the process launch Xcode and choose &#8220;Create a New Xcode project&#8221;.</p>
<div id="attachment_1242" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.panaghia.it/wp-content/uploads/2011/05/phonegap_pro.png"><img class="size-medium wp-image-1242" title="phonegap_project" src="http://www.panaghia.it/wp-content/uploads/2011/05/phonegap_pro-300x281.png" alt="" width="300" height="281" /></a><p class="wp-caption-text">Choose PhoneGap template</p></div>
<p>From that point, the content of WWW folder will be our working directory where we&#8217;re gonna place our files.</p>
<p>If you want to emulate iOs UI and behavior you should put your hands on CSS coding and consider implementing <a title="iscroll by cubiq" href="http://cubiq.org/iscroll-4">iScroll4</a> by <a title="cubiq on twitter" href="https://twitter.com/cubiq">Cubiq</a>. This plugin comes in help to a problem with webkit rendering engine that does not allow position of fixed contents like top headers and bottom menus, typical of iOs apps.</p>
<p>So include a custom stylesheet and javascript libraries as a resources in Xcode and locate them in the www folder. If you are wondering about performance with mobile browsers, no doubt at all they are. I tested some jQtouch application on my 3G iPhone and experience was not satisfactory.</p>
<p>Anyway, a bit of help in JavaScript might let you save some time, so take a look at <a title="microjs for tiny JavaScript" href="http://microjs.com/">micro.js</a> to realize what&#8217;s the library best suited for your needs. For the purposes of this prototype, <a title="xui javascript" href="http://xuijs.com/">xui</a> or <a title="snackjs javascript library" href="http://snackjs.com/">snackjs</a> are good solutions.</p>
<h2>UI &amp; Behavior</h2>
<p>So you need a header, a footer and a wrapper in which user may scroll content with touch interaction. For details about how to set up iScroll see Cubiq <a href="http://cubiq.org/iscroll-4">official page</a>.</p>
<p>First, include your JavaScript libraries in HEAD section:</p>
<pre class="brush:js">&lt;script type="text/javascript" charset="utf-8" src="iscroll.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" charset="utf-8" src="xui.js"&gt;&lt;/script&gt;</pre>
<p>Modify CSS stylesheet to emulate iOs UI elements (see full stylesheet in iScroll <a title="iscroll download" href="https://nodeload.github.com/cubiq/iscroll/tarball/master">demo</a>):</p>
<pre class="brush:css">#header {
	position:absolute; z-index:2;
	top:0; left:0;
	width:100%;
	height:45px;
	line-height:45px;
	background-image:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0, #96D9FF), color-stop(0.05, #189AD6), color-stop(1, #0A577A));
	padding:0;
	color:#eee;
	font-size:20px;
	text-align:center;
}

#footer {
	position:absolute; z-index:2;
	bottom:0; left:0;
	width:100%;
	height:48px;
	background-image:-webkit-gradient(linear, 0 0, 0 100%, color-stop(0, #999), color-stop(0.02, #666), color-stop(1, #222));;
	padding:0;
	border-top:1px solid #444;
}

#wrapper {
	position:absolute; z-index:1;
	top:45px; bottom:48px; left:0;
	width:100%;
	background:#aaa;
	overflow:auto;
}</pre>
<p>Modify CSS until your app is similar to the one in figure.</p>
<div id="attachment_1245" class="wp-caption aligncenter" style="width: 169px"><a href="http://www.panaghia.it/wp-content/uploads/2011/05/iscroll.png"><img class="size-medium wp-image-1245" title="iscroll-app" src="http://www.panaghia.it/wp-content/uploads/2011/05/iscroll-159x300.png" alt="" width="159" height="300" /></a><p class="wp-caption-text">Our app powered by iScroll4</p></div>
<p>This will be the basic structure to show and inject dashboard items (posts from Tumblr) into our application. Basically an HTML LIST structure.</p>
<p>The first thing to do now is to add gain user credentials in order to use Tumblr API.</p>
<p>We said we will implement this with HTML5 database, so the alghoritm is quite simple: once app is started</p>
<ul>
<li>Open local database</li>
<li>Try to grab (select) username and password from table &#8220;auth&#8221;</li>
<li>If a an error raises (table not found) means we have no auth info on file, so create table and load a &#8220;login&#8221; section</li>
<li>Else if we got data on file, let&#8217;s start with the Tumblr API request</li>
</ul>
<p>&nbsp;</p>
<h2>Store email/password in webkit SQL database</h2>
<p>First, open (or create) local database:</p>
<pre class="brush:js">try
{
   var shortName = 'tapp';
   var version = '1.0';
   var displayName = 'Tumblr App Database';
   var maxSize = 65536;
   db = openDatabase(shortName, version, displayName,  maxSize);
}
catch(e)
{
   console.log(e);
}</pre>
<p><a name="getUserData" href="#">[1]</a>Now, try to get user&#8217;s tumblr authentication data from this database:</p>
<pre class="brush:applescript">try
{
	db.transaction(
	function(transaction)
	{
		transaction.executeSql('SELECT user, passwd FROM auth', [], authDataHandler, errorHandler);
	});

}
catch(e)
{
	alert(e.message);
	return;
}</pre>
<p>At this point, we are doing a SQL select on our previously opened db, delegating function authDataHandler to respond to success db call, errorHandler to respond if troubles occurred.</p>
<p>First case: table does not exists, sql transaction raises error code 1 (<strong>edit: in Safari 5.1 error code is 5. Be sure to check out the right code</strong); we have to create auth table and push user to a "login" screen.</p>
<pre class="brush:js">errorHandler = function(transaction, error)
{
	if(error.code == 1) //table auth does not exists
	{
		try
		{
			db.transaction(
				function(transaction) //create auth table
				{
					transaction.executeSql(&#8216;CREATE TABLE IF NOT EXISTS auth(user text primary key, passwd text);&#8217;, [], nullDataHandler, errorHandler);
					//load login screen with xhr call (xui library)
					x$(&#8216;#scroller&#8217;).xhr(&#8216;inner&#8217;, &#8216;login.html&#8217;);
				});
		}
		catch(e)
		{

		}
	}
	return true;
}</pre>
<p>At this point we load a login page with a form and  (submit) event management:</p>
<pre class="brush:xml">&lt;div id="login"&gt;
	&lt;form id="inputForm"&gt;
		&lt;ul&gt;
			&lt;li&gt;&lt;input type="text" id = "username" placeholder = "username" /&gt;&lt;/li&gt;
			&lt;li&gt;&lt;input type="password" id = "password" placeholder = "password" /&gt;&lt;/li&gt;
			&lt;li&gt;&lt;input type="submit" id = "saveAuth" value = "Save" /&gt; &lt;/li&gt;
		&lt;/ul&gt;
	&lt;/form&gt;
&lt;/div&gt;</pre>
<p>And attached event for submit operation:</p>
<pre class="brush:js">document.getElementById('inputForm').addEventListener("submit",function(e)
{

	e.preventDefault();

	var email = document.getElementById('username').value;
	var passwd = document.getElementById('password').value;

	var req = snack.request({
		method: 'post',
		url: 'http://www.tumblr.com/api/authenticate',
		data: {
			email: email,
			password: passwd
		}
		},function(err, res)//the callback
		{
			if(err)
			{
				err == '403' ? alert('wrong login/password.') : alert('Sorry unable to process request.');
				return;
			}
			else
			{
				that.saveAuthData(email, passwd);
				return;
			}
		});

		return false;
}, false);</pre>
<p>In this snippet of code we are listening to <em>submit</em> event, once triggered we grap username and password inside the form and make basic authentication request to Tumblr API service. In this code example I used Snack function to make the Ajax call. SnackJS has a really nice Request implementation similar to MooTools one.</p>
<p>If errors occurred, we give advice to user, otherwise login credentials are accepted and we proceed to store in the local database for further use.</p>
<p>In the callback section, once tested user credentials, we pass email and password to <em>saveAuthData</em> function: now we have to make a sql <em>CREATE TABLE </em>and <em>INSERT INTO</em> operation trough a sql-transaction:</p>
<pre class="brush:js">function saveAuthData(email, passwd)
{
	try
	{
		db.transaction(
		function(transaction)
		{
			transaction.executeSql('CREATE TABLE IF NOT EXISTS auth(user text primary key, passwd text);', [], nullDataHandler, errorHandler);
			transaction.executeSql('INSERT INTO auth(user, passwd) VALUES("'+email+'", "'+passwd+'");', [], loginNullDataHandler, errorHandler); 

		});
	}
	catch(e)
	{
		console.log(e.message);
	}

	function loginNullDataHandler()//data has been saved in db
	{
		location.href = "index.html";
	}

}</pre>
<p>&nbsp;</p>
<h2>Requesting Tumblr Dashboard via JSONP</h2>
<p>Now we've got user auth info on local database, and we're back to index.html page. Next time user will access to our application, the process will begin from <a href="#getUserData">[1]</a> getting user's authentication data from local database.</p>
<p>We previously declared the case in which there was no table to pull data from, we need to specify the successful one: <em>authDataHandler()</em></p>
<p><em> </em></p>
<p><em> </em></p>
<p><em> </em></p>
<p><em> </em></p>
<p><em> </em></p>
<p><em> </em></p>
<p><em> </em></p>
<p><em></p>
<pre class="brush:js">authDataHandler = function(transaction, results)
{
	//just check, for security reasons if there are data in db
	if(results.rows.length == 0)
	{
		x$('#scroller').xhr('inner', 'login.html');
	}
	else if(results.rows.length &gt; 0)
	{
		that.userEmail = results.rows.item(0).user;
		that.userPassword = results.rows.item(0).passwd;
		var params =
		{
			url: 'http://www.tumblr.com/api/dashboard/json',
			data:{
				email: that.userEmail,
				password: that.userPassword
			},
			key: 'callback'
		}

		var req = snack.JSONP(params,
			function(data)//the callback
			{
				that.getDashboard(data);

			});

	}
}</pre>
<p></em></p>
<p>&nbsp;</p>
<p>Once obtained user email and password from local database, we make a JSONP request via SnackJS making an authentication request for user's dashboard. In the callback function, we pass returning data to a function <em>getDashboard</em> that we're going to define in next lines of code; basically we will navigate trough JSON structure and fetch single posts from the dashboard making a check on the type (E.g., Audio, Photo, Regular):</p>
<pre class="brush:js">function getDashboard(data)
{

	for(var i=0; i&lt; data.posts.length; i++)
	{
		var post = data.posts[i];
		//check post type and inject content into [ul] element
		else if(post.type == "regular")
		{
			var body = post["regular-body"];
			var title = post["regular-title"];
			var author = post.tumblelog["name"];

			var el = document.createElement('li');
			el.innerHTML = "&lt;h1&gt;"+author+"&lt;/h1&gt;&lt;h2&gt;"+title+"&lt;/h2&gt;&lt;p&gt;"+body+"&lt;/p&gt;";
			document.getElementById('thelist').appendChild(el);
		}
		else if(post.type == "photo")
		{
			console.log("photo");
			var photoLink = post["photo-url-250"];
			var el = document.createElement('li');
			el.innerHTML = "&lt;img src="+photoLink+" /&gt;";
			document.getElementById('thelist').appendChild(el);
		}
[..]</pre>
<p>Next time user will launch this app, authentication will be skipped (until user won't erase mobile safari database).</p>
<p>The example ends here but it should be clear how to proceed in further operations in order to add new functionalities like writing a post or uploading a picture.</p>
<h2>Conclusions</h2>
<p>Local database is an amazing feature, with native apps wrapped into PhoneGap its potentials are event wider.</p>
<p>Despite usage of web standards, developing on mobile devices is not like on common desktops: you have to seriously pay much attention in performance. If you can write <em>native</em> apps for iPhone with HTML5 this doesn't mean it's the jQuery's  amateur developer party. Developing on mobile devices is a real discriminating proof if you want to test your implementation's skills. So a few suggestions:</p>
<ul>
<li>Try to use native javascript as much as you can.</li>
<li>Obviously avoid javascript-based animation (and count on hardware accelerated CSS transform properties).</li>
<li>Avoid heavy libraries, take a look at <a title="microjs" href="http://microjs.com">microjs.com</a>.</li>
<li>jQuery basics functions may easily replaced with pure javascript implementations.</li>
</ul>
<h2>Example App video</h2>
<p><iframe src="http://player.vimeo.com/video/24217241?byline=0&amp;portrait=0" width="247" height="500" frameborder="0"></iframe></p>
<div>
<p>Update: a live demo of a similar app is available for <a href="http://www.panaghia.it/2011/web-apps-or-phonegap-sql-local-storage-iui-a-live-demo/">download</a>.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.panaghia.it/2011/into-phonegap-an-example-of-api-aware-native-iphone-app-with-html5-and-sql-local-database/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>No need to jQuery: managing events</title>
		<link>http://www.panaghia.it/2011/no-need-to-jquery-managing-events/</link>
		<comments>http://www.panaghia.it/2011/no-need-to-jquery-managing-events/#comments</comments>
		<pubDate>Tue, 24 May 2011 08:06:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[events]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile dev]]></category>
		<category><![CDATA[nojquery]]></category>

		<guid isPermaLink="false">http://www.panaghia.it/?p=1275</guid>
		<description><![CDATA[A very important topic in web development it&#8217;s about Events. jQuery offers a nice syntax with functions like element.click(), MooTools -instead-  tries to remain closer to natural JavaScript implementation with element.addEvent(&#8216;onclick&#8217;, fn). Modern browsers have really no problem with this, the syntax is simple: el.addEventListener("click", eventTriggered, false); function eventTriggered() { //do your stuff }]]></description>
				<content:encoded><![CDATA[<p>A very important topic in web development it&#8217;s about Events.</p>
<p>jQuery offers a nice syntax with functions like element.click(), MooTools -instead-  tries to remain closer to natural JavaScript implementation with element.addEvent(&#8216;onclick&#8217;, fn).</p>
<p>Modern browsers have really no problem with this, the syntax is simple:</p>
<pre class="brush:js">el.addEventListener("click", eventTriggered, false);

function eventTriggered()
{
   //do your stuff
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.panaghia.it/2011/no-need-to-jquery-managing-events/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No need to jQuery: element selectors</title>
		<link>http://www.panaghia.it/2011/no-need-to-jquery-element-selectors/</link>
		<comments>http://www.panaghia.it/2011/no-need-to-jquery-element-selectors/#comments</comments>
		<pubDate>Mon, 23 May 2011 08:32:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[dom elements]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mobile dev]]></category>
		<category><![CDATA[nojquery]]></category>

		<guid isPermaLink="false">http://www.panaghia.it/?p=1272</guid>
		<description><![CDATA[I&#8217;m going to write some premise-posts to my recent experience with a native app for iPhone wrapped with PhoneGap. Before to reach that point, I would like to focus on how, in certain circumstances (E.g., mobile development), there is no need to include heavy libraries like jQuery, causing often poor performance especially on less recent [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m going to write some premise-posts to my recent experience with a native app for iPhone wrapped with PhoneGap. Before to reach that point, I would like to focus on how, <strong>in certain circumstances (E.g., mobile development), there is no need to include heavy libraries like jQuery</strong>, causing often poor performance especially on less recent devices like iPhone 3G.</p>
<p>The first appointment of this series of quick posts talks about element selectors. If you cannot use jQuery, you can replace the popular <em>dollar</em> $(element) function with:</p>
<pre class="brush:js">document.getElementById('idOfElement');</pre>
<p>If you need to select a collection of elements there are two main methods:</p>
<pre class="brush:js">document.getElementsByClassName('class_name');
//or
document.querySelectorAll('div.class_name');</pre>
<p>Last one is a more recent <a title="queryselectorall" href="https://developer.mozilla.org/en/DOM/Document.querySelectorAll">implementation</a>, as MDC defines:</p>
<blockquote><p>Returns a list of the elements within the document (using depth-first pre-order traversal of the document&#8217;s nodes) that match the specified group of selectors.</p></blockquote>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.panaghia.it/2011/no-need-to-jquery-element-selectors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Placeholder with Javascript: hide on first key pressed</title>
		<link>http://www.panaghia.it/2011/advanced-placeholder-with-javascript-hide-on-first-key-pressed/</link>
		<comments>http://www.panaghia.it/2011/advanced-placeholder-with-javascript-hide-on-first-key-pressed/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 08:09:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Demos]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[placeholder]]></category>
		<category><![CDATA[user experience]]></category>

		<guid isPermaLink="false">http://www.panaghia.it/?p=1210</guid>
		<description><![CDATA[MooTools Quick DemojQuery Quick Demo Common design patterns about Placeholder hide labels on focus event, so when user select the input box. Another technique hides the label after user&#8217;s focus, precisely it does on first letter typed (it&#8217;s the case of new twitter welcome-page). First, let&#8217;s create the placeholder element by finding input box position in [...]]]></description>
				<content:encoded><![CDATA[<p><a class="pbutton" href="/dev/adv_placeholder/mootools_placeholder.html" title="quick demo mootools">MooTools Quick Demo</a><a class="pbutton" href="/dev/adv_placeholder/jquery_placeholder.html" title="quick demo jquery">jQuery Quick Demo</a></p>
<p>
Common design patterns about Placeholder hide labels on focus event, so when user select the input box.
</p>
<p>Another technique hides the label after user&#8217;s focus, precisely it does on first letter typed (it&#8217;s the case of new twitter welcome-page).</p>
<p><span id="more-1210"></span></p>
<p>First, let&#8217;s create the placeholder element by finding input box position in absolute terms, considering we have an input element with id = &#8220;name&#8221;</p>
<h3>jQuery JS</h3>
<pre class="brush:js">
//grab input element
var field = jQuery('name');
//now create a new element to serve as placeholder
var cover = jQuery('<div class="_placeholder">name</div>');
jQuery('#wrap').add(cover).appendTo(document.body);
cover.css({
	'position':'absolute',
	'top': field.offset().top,
	'left': field.offset().left,
	'padding-left': field.css('padding-left'),
	'padding-right': field.css('padding-right'),
	'padding-top': field.css('padding-top'),
	'padding-bottom': field.css('padding-bottom'),	
	'font-size': field.css('font-size')	
});
</pre>
<p>So now we created the placeholder and placed over the input box by copying some style attributues, remember to update this element position on window resize:</p>
<pre class="brush:js">
jQuery(window).resize(function()
{
	cover.css({
	'top': field.offset().top,
	'left': field.offset().left
	});
});
</pre>
<p>And now let&#8217;s manage the other events:</p>
<pre class="brush:js">
//placeholder covers the input box,
//so if the user clicks it, give focus to the element below
cover.click(function()
{
	field.focus();
});
</pre>
<p>On user&#8217;s first key press, apply a nice effect on placeholder text:</p>
<pre class="brush:js">
field.keydown(function()
{
	if(!this.value.length)
	{
		cover.animate({fontSize: "0"},100);	
	}
});
</pre>
<p>On input box blur (when user escapes from input-box), restore placeholder:</p>
<pre class="brush:js">
field.blur(function()
{
	if(!this.value.length)
	{
		cover.animate({fontSize: "3em"},300);
		field.value = "";	
	}
});
</pre>
<p>I included a MooTools version too, below.<br />
Just remember you can add your desired effects on <code>field.focus()</code> function (css transitions etc).</p>
<p><a class="pbutton" href="/dev/adv_placeholder/mootools_placeholder.html" title="demo mootools">MooTools Demo</a><a class="pbutton" href="/dev/adv_placeholder/jquery_placeholder.html" title="demo jquery">jQuery Demo</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.panaghia.it/2011/advanced-placeholder-with-javascript-hide-on-first-key-pressed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
