<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>CTO Insights</title>
	<atom:link href="http://ctoinsights.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ctoinsights.wordpress.com</link>
	<description>Agile software development</description>
	<lastBuildDate>Wed, 15 Feb 2012 15:33:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ctoinsights.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/3de35116b4168cc7a1ca7624444329c4?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>CTO Insights</title>
		<link>http://ctoinsights.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ctoinsights.wordpress.com/osd.xml" title="CTO Insights" />
	<atom:link rel='hub' href='http://ctoinsights.wordpress.com/?pushpress=hub'/>
		<item>
		<title>What Technical Skills Are In Demand In 2012?</title>
		<link>http://ctoinsights.wordpress.com/2012/02/14/what-technical-skills-are-in-demand-in-2012/</link>
		<comments>http://ctoinsights.wordpress.com/2012/02/14/what-technical-skills-are-in-demand-in-2012/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 05:29:27 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software skills]]></category>
		<category><![CDATA[technology skills]]></category>

		<guid isPermaLink="false">http://ctoinsights.wordpress.com/?p=554</guid>
		<description><![CDATA[Article first published as And the most in-demand tech skills of 2012 are … on VentureBeat. One way to find out is by looking at the job posts. I decided to analyze recent craigslist San Francisco Bay Area job ads. It is a good proxy for the local demand. Bay Area is often a trend setter, and technologies [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=554&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><em>Article first published as </em><a title="Permalink to And the most in-demand tech skills of 2012 are …" href="http://venturebeat.com/2012/02/14/most-in-demand-tech-skills-2012/" rel="bookmark">And the most in-demand tech skills of 2012 are …</a> <em>on VentureBeat</em>.</p>
<p>One way to find out is by looking at the job posts. I decided to analyze recent craigslist San Francisco Bay Area job ads. It is a good proxy for the local demand. Bay Area is often a trend setter, and technologies which become popular here frequently gain broader adoption. The findings can therefore also be viewed as a leading indicator for other geographies.</p>
<p>Here are the key insights:</p>
<ul style="padding-left:20px;">
<li>&#8220;Mobile&#8221; appears in 30% of all ads winning popularity (or hype?) contest.</li>
<li>Java continues to lead the pack among the development languages followed by Ruby, Python and PHP.</li>
<li>MySQL is by far the most commonly mentioned relational database.</li>
<li>NoSQL is featured prominently. Hadoop is first on the list of NoSQL databases followed by Cassandra, Redis and MongoDB.</li>
<li>Linux has little contest among the operating systems. Ubuntu is mentioned more frequently than CentOS.</li>
<li>Android is mentioned slightly more often than iOS/iPhone.</li>
<li>jQuery is the most commonly mentioned JavaScript framework.</li>
<li>Spring continues to be the most commonly mentioned Java framework.</li>
<li>git outranks subversion among the source code management systems.</li>
<li>Selenium is the most frequently mentioned testing tool.</li>
<li>Drupal is the most often mentioned CMS tool.</li>
</ul>
<p>I run <a title="Technical Skills In Demand - 2011" href="http://ctoinsights.wordpress.com/2011/03/19/technical-skills-in-demand/">similar analysis a year ago</a>. For the most part results were similar. There are a few notable differences:</p>
<ul style="padding-left:20px;">
<li>Demand for mobile skills is accelerating. &#8220;Mobile&#8221; and &#8220;social&#8221; had similar mention frequency last year. This year &#8220;mobile&#8221; mentions are far ahead of &#8220;social&#8221;.</li>
<li>NoSQL skills requests increased significantly.</li>
<li>PHP mentions went down, Ruby went  up.</li>
<li>git overtook subversion.</li>
<li>Flash/ActionScript mentions went down.</li>
</ul>
<p>List of the top 50 skills most commonly featured in the job ads is shown below.</p>
<p style="text-align:center;"><a href="http://ctoinsights.files.wordpress.com/2012/02/top50skills20122.png"><img class=" wp-image-562 aligncenter" title="Top50Skills2012" src="http://ctoinsights.files.wordpress.com/2012/02/top50skills20122.png?w=513&#038;h=936" alt="Top 50 Skills" width="513" height="936" /></a></p>
<p style="text-align:center;">Fig 1. Top 50 Technical Skills in Demand</p>
<h4 style="padding-top:30px;">Methodology:</h4>
<ul>
<li>I run a term frequency analysis on job posts which appeared on craigslist in the SF Bay Area Internet Engineering category between 1st and 31st of January 2012.</li>
<li>Count reflects number of posts a term appears in. Multiple mentions of the same term in a single post count as one.</li>
</ul>
<br /> Tagged: <a href='http://ctoinsights.wordpress.com/tag/programming/'>programming</a>, <a href='http://ctoinsights.wordpress.com/tag/software-development/'>software development</a>, <a href='http://ctoinsights.wordpress.com/tag/software-skills/'>software skills</a>, <a href='http://ctoinsights.wordpress.com/tag/technology-skills/'>technology skills</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctoinsights.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctoinsights.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctoinsights.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctoinsights.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctoinsights.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctoinsights.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctoinsights.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctoinsights.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctoinsights.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctoinsights.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctoinsights.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctoinsights.wordpress.com/554/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctoinsights.wordpress.com/554/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctoinsights.wordpress.com/554/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=554&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctoinsights.wordpress.com/2012/02/14/what-technical-skills-are-in-demand-in-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f52276f8d9db1d7c6577deb16eef9e0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ctoinsights</media:title>
		</media:content>

		<media:content url="http://ctoinsights.files.wordpress.com/2012/02/top50skills20122.png" medium="image">
			<media:title type="html">Top50Skills2012</media:title>
		</media:content>
	</item>
		<item>
		<title>Our startup is among OnMedia 100 top emerging companies</title>
		<link>http://ctoinsights.wordpress.com/2012/02/07/our-startup-is-among-onmedia-100-top-emerging-companies/</link>
		<comments>http://ctoinsights.wordpress.com/2012/02/07/our-startup-is-among-onmedia-100-top-emerging-companies/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 01:12:11 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[startup]]></category>

		<guid isPermaLink="false">http://ctoinsights.wordpress.com/?p=575</guid>
		<description><![CDATA[Here is Always On announcement: Announcing the 2012 OnMedia 100 Top Private Companies And here is more information: 500friends, Inc. Selected by AlwaysOn as OnMedia Top 100 Winner &#160; Tagged: startup<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=575&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here is Always On announcement:</p>
<h4><a href="http://alwayson.goingon.com/AOStory/Announcing-2012-OnMedia-100-Top-Private-Companies">Announcing the 2012 OnMedia 100 Top Private Companies</a></h4>
<p>And here is more information:</p>
<h4><a href="http://finance.sfgate.com/hearst.sfgate/news/read/20572876/500friends">500friends, Inc. Selected by AlwaysOn as OnMedia Top 100 Winner</a></h4>
<p>&nbsp;</p>
<br /> Tagged: <a href='http://ctoinsights.wordpress.com/tag/startup/'>startup</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctoinsights.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctoinsights.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctoinsights.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctoinsights.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctoinsights.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctoinsights.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctoinsights.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctoinsights.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctoinsights.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctoinsights.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctoinsights.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctoinsights.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctoinsights.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctoinsights.wordpress.com/575/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=575&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctoinsights.wordpress.com/2012/02/07/our-startup-is-among-onmedia-100-top-emerging-companies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f52276f8d9db1d7c6577deb16eef9e0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ctoinsights</media:title>
		</media:content>
	</item>
		<item>
		<title>Rails 3.2 has been released</title>
		<link>http://ctoinsights.wordpress.com/2012/01/22/rails-3-2-has-been-released/</link>
		<comments>http://ctoinsights.wordpress.com/2012/01/22/rails-3-2-has-been-released/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 16:44:55 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[heroku]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://ctoinsights.wordpress.com/?p=549</guid>
		<description><![CDATA[Rails 3.2.0 was released last Friday. I thought I would try it out so, as a small weekend project, I upgraded one of my applications from Rails 3.1 and Rails 3.2. The process went very smoothly &#8211; including deployment on Heroku. The release includes primarily a set of smaller enhancements and fixes. Major new features [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=549&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Rails 3.2.0 was <a href="http://weblog.rubyonrails.org/2012/1/20/rails-3-2-0-faster-dev-mode-routing-explain-queries-tagged-logger-store">released last Friday</a>. I thought I would try it out so, as a small weekend project, I upgraded one of my applications from Rails 3.1 and Rails 3.2. The process went very smoothly &#8211; including deployment on Heroku.</p>
<p>The release includes primarily a set of smaller enhancements and fixes. Major new features &#8211; faster development mode &amp; routing, explain queries and tagged logger &#8211; will benefit in particular larger applications.</p>
<p>&nbsp;</p>
<h2></h2>
<br /> Tagged: <a href='http://ctoinsights.wordpress.com/tag/heroku/'>heroku</a>, <a href='http://ctoinsights.wordpress.com/tag/programming/'>programming</a>, <a href='http://ctoinsights.wordpress.com/tag/ruby-on-rails/'>ruby on rails</a>, <a href='http://ctoinsights.wordpress.com/tag/software-development/'>software development</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctoinsights.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctoinsights.wordpress.com/549/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctoinsights.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctoinsights.wordpress.com/549/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctoinsights.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctoinsights.wordpress.com/549/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctoinsights.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctoinsights.wordpress.com/549/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctoinsights.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctoinsights.wordpress.com/549/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctoinsights.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctoinsights.wordpress.com/549/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctoinsights.wordpress.com/549/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctoinsights.wordpress.com/549/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=549&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctoinsights.wordpress.com/2012/01/22/rails-3-2-has-been-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f52276f8d9db1d7c6577deb16eef9e0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ctoinsights</media:title>
		</media:content>
	</item>
		<item>
		<title>Continuous Integration in the Cloud</title>
		<link>http://ctoinsights.wordpress.com/2012/01/10/continuous-integration-in-the-cloud/</link>
		<comments>http://ctoinsights.wordpress.com/2012/01/10/continuous-integration-in-the-cloud/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 14:10:49 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[qa]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[saas]]></category>
		<category><![CDATA[software qa]]></category>
		<category><![CDATA[startup]]></category>
		<category><![CDATA[test execution]]></category>

		<guid isPermaLink="false">http://ctoinsights.wordpress.com/?p=417</guid>
		<description><![CDATA[Continuous Integration (CI) is a practice of frequently integrating developers work and verifying each integration using an automated build and test process. You can find more at Continuous Integration by Martin Fowler. A number of tools such as CruiseControl, Integrity, Jenkins, Bamboo, BuildMaster, or Teamcity can help you in implementing a CI process. We are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=417&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Continuous Integration (CI) is a practice of frequently integrating developers work and verifying each integration using an automated build and test process. You can find more at <a href="http://martinfowler.com/articles/continuousIntegration.html">Continuous Integration</a> by Martin Fowler.</p>
<p>A number of tools such as <a href="http://cruisecontrol.sourceforge.net/">CruiseControl</a>, <a href="http://integrityapp.com/">Integrity</a>, <a href="http://jenkins-ci.org/">Jenkins</a>, <a href="http://www.atlassian.com/software/bamboo/overview">Bamboo</a>, <a href="http://inedo.com/">BuildMaster</a>, or <a href="http://www.jetbrains.com/teamcity/">Teamcity</a> can help you in implementing a CI process.</p>
<p>We are a Ruby on Rails shop and recently we started using <a href="https://www.tddium.com/">tddium</a>, a hosted test and CI service.</p>
<p>Benefits of using a SaaS CI product include:</p>
<ul style="padding-left:20px;">
<li>simple and quick configuration &#8211; short time to get CI going</li>
<li>low costs &#8211; pay for only what you need</li>
<li>faster test execution &#8211; tests run in parallel on multiple instances</li>
</ul>
<p>Configuration of tddium is very straightforward. There is no need to acquire, setup and maintain a CI server. Providing you have test suites available, a few simple commands described at <a href="https://www.tddium.com/support/">https://www.tddium.com/support/</a> is all what is required.</p>
<p>The resultant workflow is outlined below:</p>
<ol style="padding-left:20px;">
<li>Developer commits a code change to github source code repository</li>
<li>Test run is automatically triggered</li>
<li>Upon test completion a notification is sent to developers indicating how many tests have passed and how many failed (if any)</li>
<li>Notification includes a link to a dashboard where test failures can be examined in more details</li>
</ol>
<h3 style="padding-top:30px;">Related Posts</h3>
<p><a href="http://ctoinsights.wordpress.com/2011/05/14/do-you-need-a-software-qa-team/">Do you need a Software QA Team?</a></p>
<p><a href="http://ctoinsights.wordpress.com/2010/11/21/to-saas-or-not-to-saas/">To Saas or not to Saas</a></p>
<p><a href="http://ctoinsights.wordpress.com/2010/11/14/why-ruby-on-rails-is-a-good-fit-for-a-startup/">Why Ruby on Rails is a good fit for a startup</a></p>
<br /> Tagged: <a href='http://ctoinsights.wordpress.com/tag/agile/'>agile</a>, <a href='http://ctoinsights.wordpress.com/tag/cloud/'>cloud</a>, <a href='http://ctoinsights.wordpress.com/tag/continuous-integration/'>continuous integration</a>, <a href='http://ctoinsights.wordpress.com/tag/qa/'>qa</a>, <a href='http://ctoinsights.wordpress.com/tag/ruby-on-rails/'>ruby on rails</a>, <a href='http://ctoinsights.wordpress.com/tag/saas/'>saas</a>, <a href='http://ctoinsights.wordpress.com/tag/software-development/'>software development</a>, <a href='http://ctoinsights.wordpress.com/tag/software-qa/'>software qa</a>, <a href='http://ctoinsights.wordpress.com/tag/startup/'>startup</a>, <a href='http://ctoinsights.wordpress.com/tag/test-execution/'>test execution</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctoinsights.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctoinsights.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctoinsights.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctoinsights.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctoinsights.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctoinsights.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctoinsights.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctoinsights.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctoinsights.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctoinsights.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctoinsights.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctoinsights.wordpress.com/417/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctoinsights.wordpress.com/417/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctoinsights.wordpress.com/417/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=417&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctoinsights.wordpress.com/2012/01/10/continuous-integration-in-the-cloud/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f52276f8d9db1d7c6577deb16eef9e0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ctoinsights</media:title>
		</media:content>
	</item>
		<item>
		<title>HTML5 versus Native Apps: Which Platform To Choose For Your Next Mobile App</title>
		<link>http://ctoinsights.wordpress.com/2012/01/05/html5-versus-native-apps-which-platform-to-choose-for-your-next-mobile-app/</link>
		<comments>http://ctoinsights.wordpress.com/2012/01/05/html5-versus-native-apps-which-platform-to-choose-for-your-next-mobile-app/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 15:00:40 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[product development]]></category>

		<guid isPermaLink="false">http://ctoinsights.wordpress.com/?p=390</guid>
		<description><![CDATA[Selecting a development platform is a big decision with significant implications on both short term and long term viability of a product. Probably the most interesting, current, development platform discussion is the HTML5 versus native mobile apps debate. A high level comparison of the two options is outlined below: Native Applications HTML5 Functionality Ability to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=390&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Selecting a development platform is a big decision with significant implications on both short term and long term viability of a product. Probably the most interesting, current, development platform discussion is the HTML5 versus native mobile apps debate.</p>
<p>A high level comparison of the two options is outlined below:</p>
<table class="c6" style="margin-bottom:20px;" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="c0" width="20%"></td>
<td class="c0" align="center" width="40%">
<p class="c2 c7"><span class="c5"><strong>Native Applications</strong></span></p>
</td>
<td class="c0" align="center" width="40%">
<p class="c2 c7"><span class="c5"><strong>HTML5</strong></span></p>
</td>
</tr>
<tr>
<td class="c3">
<p class="c2"><span class="c4">Functionality</span></p>
</td>
<td class="c3">
<p class="c2"><span class="c4">Ability to leverage all device capabilities</span></p>
</td>
<td class="c3">
<p class="c2"><span class="c4">Many limitations in access to hardware functionality. Frameworks, such as <a href="http://www.phonegap.com">PhoneGap</a>, can be used to access device capabilities not supported by HTML5.</span></p>
</td>
</tr>
<tr>
<td class="c3">
<p class="c2"><span class="c4">Performance</span></p>
</td>
<td class="c3">
<p class="c2"><span class="c4">Superior performance</span></p>
</td>
<td class="c3">
<p class="c2"><span class="c4">Good enough for many applications</span></p>
</td>
</tr>
<tr>
<td class="c3">
<p class="c2"><span class="c4">Development effort</span></p>
</td>
<td class="c3">
<p class="c2"><span class="c4">Separate coding effort for each mobile platform</span></p>
</td>
<td class="c3">
<p class="c2"><span class="c4">Build once, deploy (almost) anywhere</span></p>
</td>
</tr>
<tr>
<td class="c3">
<p class="c2"><span class="c4">Learning curve</span></p>
<p class="c1">
</td>
<td class="c3">
<p class="c2"><span class="c4">Need to master each mobile platform separately</span></p>
</td>
<td class="c3">
<p class="c2"><span class="c4">Relatively short learning curve for web developers</span></p>
</td>
</tr>
<tr>
<td class="c3">
<p class="c2"><span class="c4">Distribution mechanism</span></p>
</td>
<td class="c3">
<p class="c2"><span class="c4">App stores</span></p>
</td>
<td class="c3">
<p class="c2"><span class="c4">Search</span></p>
<p class="c2"><span class="c4">Can be packaged for app stores</span></p>
</td>
</tr>
<tr>
<td class="c3">
<p class="c2"><span class="c4">Upgrades</span></p>
</td>
<td class="c3">
<p class="c2"><span class="c4">Required on each device</span></p>
</td>
<td class="c3">
<p class="c2"><span class="c4">Not required. Users always have access to the latest functionality.</span></p>
</td>
</tr>
<tr>
<td class="c3">
<p class="c2"><span class="c4">Maturity</span></p>
</td>
<td class="c3">
<p class="c2"><span class="c4">Significantly more mature</span></p>
</td>
<td class="c3">
<p class="c2"><span class="c4">Gaining traction</span></p>
</td>
</tr>
</tbody>
</table>
<p>From my perspective, what it boils down to is this:</p>
<ol style="margin-left:20px;">
<li>If functional and performance requirements of your app can be supported by HTML5, go with HTML5. Smaller development effort and a shorter learning curve will result in lower overall costs and a faster time to market.</li>
<li>If you are relying heavily on the hardware features, require performance beyond what HTML5 can offer, or are building a complex application where maturity of technology is a significant factor, go native.</li>
<li>It is likely that the boundary between the two options will gradually shift in favor of HTML5.</li>
</ol>
<h3 style="margin-top:30px;">Other posts on this topic</h3>
<ul style="margin-left:20px;">
<li><a href="http://www.anubavam.com/blogs/html5-vs-native-apps-winning-mobile-app-strategy" target="_blank">HTML5 vs Native Apps: A Winning Mobile App Strategy</a></li>
<li><a href="http://www.guardian.co.uk/technology/blog/2011/nov/03/will-html5-replace-native-apps" target="_blank">Will HTML5 replace native apps? It might: here&#8217;s how to figure out when</a></li>
<li><a href="http://www.fiercedeveloper.com/story/html5-versus-native-apps-truth-you-need-know/2011-10-27" target="_blank">HTML5 versus Native Apps: The truth you need to know</a></li>
<li><a href="http://www.html5rocks.com/en/mobile/nativedebate.html" target="_blank">HTML5 vs Native: The Mobile App Debate</a></li>
</ul>
<h3 style="margin-top:30px;">Historical Footnote</h3>
<p>Five years ago I wrote the <a href="http://mobilesoftdev.blogspot.com/2006/12/what-technology-platform-to-choose-for.html">What technology platform to choose for development of mobile applications?</a> post. It talks about J2ME, BREW, Symbian. Android and iOS are not mentioned &#8211; they had not been released yet at that time. Any guesses on what will be a preferred mobile development platform five years from now?</p>
<h3 style="margin-top:30px;">Related Posts</h3>
<p><a href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-i-static-pages/">jQuery Mobile Tutorial Part I – Static Pages</a></p>
<p><a href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-ii-dynamic-pages/">jQuery Mobile Tutorial Part II – Dynamic Pages</a></p>
<p><a href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/">jQuery Mobile Tutorial Part III – Managing Data</a></p>
<br /> Tagged: <a href='http://ctoinsights.wordpress.com/tag/android/'>Android</a>, <a href='http://ctoinsights.wordpress.com/tag/html5/'>HTML5</a>, <a href='http://ctoinsights.wordpress.com/tag/ios/'>iOS</a>, <a href='http://ctoinsights.wordpress.com/tag/mobile/'>mobile</a>, <a href='http://ctoinsights.wordpress.com/tag/product-development/'>product development</a>, <a href='http://ctoinsights.wordpress.com/tag/software-development/'>software development</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctoinsights.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctoinsights.wordpress.com/390/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctoinsights.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctoinsights.wordpress.com/390/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctoinsights.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctoinsights.wordpress.com/390/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctoinsights.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctoinsights.wordpress.com/390/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctoinsights.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctoinsights.wordpress.com/390/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctoinsights.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctoinsights.wordpress.com/390/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctoinsights.wordpress.com/390/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctoinsights.wordpress.com/390/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=390&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctoinsights.wordpress.com/2012/01/05/html5-versus-native-apps-which-platform-to-choose-for-your-next-mobile-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f52276f8d9db1d7c6577deb16eef9e0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ctoinsights</media:title>
		</media:content>
	</item>
		<item>
		<title>jQuery Mobile Tutorial Part I &#8211; Static Pages</title>
		<link>http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-i-static-pages/</link>
		<comments>http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-i-static-pages/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 15:51:38 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery mobile]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://ctoinsights.wordpress.com/?p=420</guid>
		<description><![CDATA[If you are interested in learning jQuery Mobile, you made the right choice. It is one of the top frameworks for development of mobile sites and applications. The framework has a comprehensive and well written documentation. This tutorial complements framework resources. Many people learn well by example and in this tutorial you will build a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=420&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you are interested in learning <a href="http://jquerymobile.com/">jQuery Mobile</a>, you made the right choice. It is one of the top frameworks for development of mobile sites and applications. The framework has a comprehensive and well written documentation. This tutorial complements framework resources. Many people learn well by example and in this tutorial you will build a simple but fully functional mobile application.</p>
<p>The application allows you to maintain a list of your favorite website and share sites from the list with other mobile users through <a href="http://en.wikipedia.org/wiki/QR_code">QR codes</a>. While building the application you will cover framework features such as creation of pages, forms, lists, dialog boxes, style themes. You will also create dynamic pages and manage data using local storage.</p>
<p>The tutorial assumes knowledge of HTML and JavaScript. No backend coding is required.</p>
<p>The tutorial source code is available at <a href="https://github.com/rtekie/shareqr" target="_blank">https://github.com/rtekie/shareqr</a>.&nbsp;To keep things simple you can test the code locally using a desktop Chrome or Safari browser. Testing using a mobile emulator is another option. You can also access working application at <a href="http://rtekie.heroku.com/shareqr.html" target="_blank">http://rtekie.heroku.com/shareqr.html</a>&nbsp;and try it on your mobile phone.</p>
<p>Part I of the tutorial covers framework basics &#8211; creation of static pages. <a title="jQuery Mobile Tutorial Part II – Dynamic&nbsp;Pages" href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-ii-dynamic-pages/">Part II</a> introduces dynamic pages. In <a title="jQuery Mobile Tutorial Part III – Managing&nbsp;Data" href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/">Part III</a> you will add data management features &#8211; ability to add, store and delete records &#8211; and complete the application.</p>
<h2>Part I &#8211; Static Pages</h2>
<h3 style="padding-top:20px;">1.1 Your first page</h3>
<p>jQuery Mobile provides a&nbsp;<a href="http://jquerymobile.com/demos/1.0/docs/pages/page-anatomy.html">basic page template</a>&nbsp;which can be used as a starting point. The template is very well documented so we will dive right into the source code:</p>
<p><pre class="brush: xml;">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Share QR&lt;/title&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css&quot; /&gt;
  &lt;script src=&quot;http://code.jquery.com/jquery-1.6.4.min.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
  &lt;div data-role=&quot;page&quot; id=&quot;home&quot;&gt;
    &lt;div data-role=&quot;header&quot;&gt;
      &lt;h1&gt;Share QR&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;p&gt;Hello world!&lt;/p&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot;&gt;
      &lt;h4&gt;Footer&lt;/h4&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre></p>
<p>Things to note are:</p>
<ol>
<li>jQuery Mobile relies on HTML5. Hence the <a href="http://www.w3schools.com/html5/tag_doctype.asp">HTML5 doctype declaration</a>.</li>
<li>jQuery Mobile requires jQuery and you need to include not only mobile framework files (jquery.mobile-1.0.min.js and jquery.mobile-1.0.min.css) but also the regular jQuery framework (jquery-1.6.4.min.js).</li>
<li>Viewport meta tag is used to initialize page dimensions and zoom level.</li>
<li>jQuery Mobile uses extensively HTML5 data- attributes to control page elements&#8217; look and behavior. The first attribute introduced by this tutorial is data-role which is used to identify pages and page structure elements &#8211; header, content area and footer.</li>
</ol>
<div>As you can see, with just a few lines of code you can create a robust, skeleton page.</div>
<h3 style="padding-top:20px;">1.2 Adding a style</h3>
<p>jQuery Mobile includes <a href="http://jquerymobile.com/demos/1.0/docs/pages/pages-themes.html">five pre-defined style themes</a>. If no style is specified, the default theme is used.&nbsp;Let&#8217;s change header and footer color to blue. It is as simple as adding a <code>data-theme="b"</code> attribute to the header and footer. Here is the updated code:</p>
<p><pre class="brush: xml;">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Share QR&lt;/title&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;		
  &lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css&quot; /&gt;
  &lt;script src=&quot;http://code.jquery.com/jquery-1.6.4.min.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
	
&lt;body&gt;
  &lt;div data-role=&quot;page&quot; id=&quot;home&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot;&gt;
      &lt;h1&gt;Share QR&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;p&gt;Hello world!&lt;/p&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; data-theme=&quot;b&quot;&gt;
      &lt;h4&gt;Footer&lt;/h4&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre></p>
<h3 style="padding-top:20px;">1.3 Adding a second page and page navigation</h3>
<p>Web pages designed for desktop are typically displayed by loading their own, separate html files. In the mobile world, pages are typically small and connectivity slower and sometimes problematic. Hence there are advantages of packaging multiple pages into a single html file. A file is loaded once and all pages contained within the file can be displayed without any additional network requests.</p>
<p>Page packaging is one of the features of jQuery Mobile.</p>
<p>To add a second page, first insert the page code into the html file containing your first page. We will add About as the second page:</p>
<p><pre class="brush: xml;">
  &lt;div data-role=&quot;page&quot; id=&quot;about&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;home&quot; data-iconpos=&quot;notext&quot;&gt;Home&lt;/a&gt;
      &lt;h1&gt;About&lt;/h1&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;arrow-l&quot; data-rel=&quot;back&quot;&gt;Back&lt;/a&gt; 
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;p&gt;Share your favorite URLs with other mobile phone users through QR codes.&lt;/p&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
      &lt;a href=&quot;#about&quot; data-icon=&quot;info&quot;&gt;About&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
</pre></p>
<p>Next we will add page navigation. Links to pages rely on page id, which has to be unique for each page. Home page has id=&#8221;home&#8221; hence a link to the home page will use href=&#8221;#home&#8221;. Similarly the About page has id=&#8221;about&#8221; and a link to it will use href=&#8221;#about&#8221;.<br />
Let&#8217;s add a link to the About page in the footer of both pages:</p>
<pre><code>&lt;a href="#about"&gt;About&lt;/a&gt;</code>
<code> </code></pre>
<p>The link is automatically rendered as a button. It can be further improved by adding an icon. jQuery Mobile includes a number of <a href="http://jquerymobile.com/test/docs/buttons/buttons-icons.html">icons you can choose from</a>. We will use the info icon.</p>
<pre><code>&lt;a href="#about" data-icon="info"&gt;About&lt;/a&gt;</code>
<code> </code></pre>
<p>By default footer does not have any padding around buttons. To include &nbsp;padding we&#8217;ll add&nbsp;<code>class="ui-bar"</code>to the footer. We&#8217;ll also add <code>data-position="fixed"</code> and <code>data-id="footer"</code> to persist footer and keep it at fixed vertical position between page transitions. Here is the updated footer code:</p>
<pre><code>&lt;div data-role="footer" class="ui-bar"&nbsp;data-theme="b" data-position="fixed" data-id="footer"&gt;</code>
<code> </code></pre>
<p>You can find out more about jQuery Mobile footer features at the&nbsp;<a href="http://jquerymobile.com/test/docs/toolbars/docs-footers.html">Footer configuration page</a>.</p>
<p>Now let&#8217;s add a link to the Home page in the header of both pages:</p>
<pre><code>&lt;a href="#home" data-icon="home"&gt;Home&lt;/a&gt;</code>
<code> </code></pre>
<p>This time we would like to see an icon only button, and to accomplish that we will add a <code>data-iconpos</code> attribute.</p>
<pre><code>&lt;a href="#home" data-icon="home" data-iconpos="notext"&gt;Home&lt;/a&gt;</code>
<code> </code></pre>
<p>There is one more button to add &#8211; a Back button in the header of the About page:</p>
<pre><code>&lt;a href="#home" data-icon="arrow-l" data-rel="back"&gt;Back&lt;/a&gt;</code>
<code> </code></pre>
<p>Here we are using <code>data-rel="back"</code> attribute to indicate that the button should mimic behavior of a browser Back button.</p>
<p>You can find out more about jQuery Mobile header features at the <a href="http://jquerymobile.com/demos/1.0/docs/toolbars/docs-headers.html">Header bars page</a>.</p>
<p>The complete code for Part I of the tutorial is shown below:</p>
<p><pre class="brush: xml;">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Share QR&lt;/title&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css&quot; /&gt;
  &lt;script src=&quot;http://code.jquery.com/jquery-1.6.4.min.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;

  &lt;div data-role=&quot;page&quot; id=&quot;home&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;home&quot; data-iconpos=&quot;notext&quot;&gt;Home&lt;/a&gt;
      &lt;h1&gt;Share QR&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;p&gt;Hello world!&lt;/p&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
      &lt;a href=&quot;#about&quot; data-icon=&quot;info&quot;&gt;About&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;div data-role=&quot;page&quot; id=&quot;about&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;home&quot; data-iconpos=&quot;notext&quot;&gt;Home&lt;/a&gt;
      &lt;h1&gt;About&lt;/h1&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;arrow-l&quot; data-rel=&quot;back&quot;&gt;Back&lt;/a&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;p&gt;Share your favorite URLs with other mobile phone users through QR codes.&lt;/p&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
      &lt;a href=&quot;#about&quot; data-icon=&quot;info&quot;&gt;About&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre></p>
<p>This completes Part I. You can access work in progress application on your mobile phone at <a href="http://rtekie.heroku.com/shareqr1.3.html" target="_blank">http://rtekie.heroku.com/shareqr1.3.html</a>. Screen shots are shown below:</p>
<p><a href="http://ctoinsights.files.wordpress.com/2012/01/shareqr1-31.png"><img class="aligncenter size-full wp-image-487" title="shareqr1.3" src="http://ctoinsights.files.wordpress.com/2012/01/shareqr1-31.png?w=575&#038;h=380" alt="" width="575" height="380" /></a></p>
<p>So far &nbsp;we covered basic framework features and built two simple, static pages. In <a title="jQuery Mobile Tutorial Part II – Dynamic&nbsp;Pages" href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-ii-dynamic-pages/">Part II</a> we will add dynamic content and in <a title="jQuery Mobile Tutorial Part III – Managing&nbsp;Data" href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/">Part III</a> data management capabilities.</p>
<br /> Tagged: <a href='http://ctoinsights.wordpress.com/tag/html5/'>HTML5</a>, <a href='http://ctoinsights.wordpress.com/tag/javascript/'>JavaScript</a>, <a href='http://ctoinsights.wordpress.com/tag/jquery/'>jquery</a>, <a href='http://ctoinsights.wordpress.com/tag/jquery-mobile/'>jquery mobile</a>, <a href='http://ctoinsights.wordpress.com/tag/mobile/'>mobile</a>, <a href='http://ctoinsights.wordpress.com/tag/programming/'>programming</a>, <a href='http://ctoinsights.wordpress.com/tag/software-development/'>software development</a>, <a href='http://ctoinsights.wordpress.com/tag/tutorial/'>tutorial</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctoinsights.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctoinsights.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctoinsights.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctoinsights.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctoinsights.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctoinsights.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctoinsights.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctoinsights.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctoinsights.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctoinsights.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctoinsights.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctoinsights.wordpress.com/420/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctoinsights.wordpress.com/420/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctoinsights.wordpress.com/420/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=420&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-i-static-pages/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f52276f8d9db1d7c6577deb16eef9e0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ctoinsights</media:title>
		</media:content>

		<media:content url="http://ctoinsights.files.wordpress.com/2012/01/shareqr1-31.png" medium="image">
			<media:title type="html">shareqr1.3</media:title>
		</media:content>
	</item>
		<item>
		<title>jQuery Mobile Tutorial Part II &#8211; Dynamic Pages</title>
		<link>http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-ii-dynamic-pages/</link>
		<comments>http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-ii-dynamic-pages/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 15:41:30 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery mobile]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://ctoinsights.wordpress.com/?p=446</guid>
		<description><![CDATA[This is part two of a three parts jQuery Mobile Tutorial. For introduction to the Tutorial please refer to Part I. In Part I we developed simple static pages which form a foundation of the application we are building. In this part, we will start adding dynamic functionality. The application will allow you to maintain [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=446&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is part two of a three parts jQuery Mobile Tutorial. For introduction to the Tutorial please refer to <a title="jQuery Mobile Tutorial Part I – Static Pages" href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-i-static-pages/">Part I</a>.</p>
<p>In <a title="jQuery Mobile Tutorial Part I – Static Pages" href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-i-static-pages/">Part I</a> we developed simple static pages which form a foundation of the application we are building. In this part, we will start adding dynamic functionality.</p>
<p>The application will allow you to maintain a list of your favorite websites and share sites from the list with other mobile users through <a href="http://en.wikipedia.org/wiki/QR_code">QR codes</a>.</p>
<h3 style="padding-top:20px;">2.1 Adding a list</h3>
<p>Let&#8217;s continue by adding a list of sites to the Home page. jQuery Mobile has a very strong <a href="http://jquerymobile.com/demos/1.0/docs/lists/docs-lists.html">list view capability</a>. In <a title="jQuery Mobile Tutorial Part III – Managing Data" href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/">Part III</a> we will add ability to maintain the site list. For now let&#8217;s use a static, hardcoded list. Let&#8217;s start by replacing content area of the Home page with this:</p>
<p><pre class="brush: xml;">
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;ul data-role=&quot;listview&quot;&gt;
        &lt;li&gt;&lt;a href=&quot;#qrcode&quot;&gt;ctoinsights.wordpress.com&lt;/a&gt;&lt;/li&gt;		  
        &lt;li&gt;&lt;a href=&quot;#qrcode&quot;&gt;www.book-current.com&lt;/a&gt;&lt;/li&gt;	
      &lt;/ul&gt;
    &lt;/div&gt;
</pre></p>
<p>Feel free to use any websites you like instead of the two included above.</p>
<p>Next we will add a page which will display QR code of a site:</p>
<p><pre class="brush: xml;">
  &lt;div data-role=&quot;page&quot; id=&quot;qrcode&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;home&quot; data-iconpos=&quot;notext&quot;&gt;Home&lt;/a&gt;
      &lt;h1&gt;QR Code
      &lt;a href=&quot;#home&quot; data-icon=&quot;arrow-l&quot; data-rel=&quot;back&quot;&gt;Back&lt;/a&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
    &lt;a href=&quot;#about&quot; data-icon=&quot;info&quot;&gt;About&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
</pre></p>
<p>At this point navigation between the Home page and QR Code page should be working. We are ready to start adding dynamic functionality.</p>
<h3 style="padding-top:20px;">2.2 Your first dynamic page</h3>
<p>We will pass a site to be displayed on the QR Code page as a url parmeter. Let&#8217;s make one more change to the content of the Home page:</p>
<p><pre class="brush: xml;">
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;ul data-role=&quot;listview&quot;&gt;
        &lt;li&gt;&lt;a href=&quot;#qrcode?url=http%3A%2F%2Fctoinsights.wordpress.com&quot;&gt;ctoinsights.wordpress.com&lt;/a&gt;&lt;/li&gt;		  
        &lt;li&gt;&lt;a href=&quot;#qrcode?url=http%3A%2F%2Fwww.book-current.com&quot;&gt;www.book-current.com&lt;/a&gt;&lt;/li&gt;	
      &lt;/ul&gt;
    &lt;/div&gt;
</pre></p>
<p>Parameters are encoded. In <a title="jQuery Mobile Tutorial Part III – Managing Data" href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/">Part III</a> we will handle encoding in the application code. For now, since we are hardcoding the site list, we are manually encoding the url parameters.</p>
<p>jQuery Mobile by default ignores url parameters. To handle them we need to start writing JavaScript code.</p>
<p>jQuery Mobile offers a number of custom <a href="http://jquerymobile.com/demos/1.0/docs/api/events.html">events</a>. One of them is pagebeforechange event. It can be used to capture requests to display the QR Code page and dynamically inject page content before presenting it to the user. Documented JavaScript code is shown below:</p>
<p><pre class="brush: jscript;">
// Listen for any attempts to call changePage().
$(document).bind(&quot;pagebeforechange&quot;, function(e, data) {
	// We only want to handle changePage() calls where the caller is asking to load a page by URL.
	if (typeof data.toPage === &quot;string&quot;) {
		// We only want to handle #qrcode url.
		var u = $.mobile.path.parseUrl(data.toPage);
		var qrcode = /^#qrcode/;
		if (u.hash.search(qrcode) !== -1) {
			// Display QR code for the selected URL.
			showQRCode(u, data.options);
			e.preventDefault();
		}
	}
});

// Load the QR Code for a specific url passed in as a parameter.
// Generate markup for the page, and then make that page the current active page.
function showQRCode(urlObj, options) {
	// Get the url parameter
	var qrUrl = decodeURIComponent(urlObj.hash.replace(/.*url=/, &quot;&quot;));

	// The page we use to display QR code is already in the DOM.
	// The id of the page we are going to write the content into is specified in the hash before the '?'.
	var	pageSelector = urlObj.hash.replace(/\?.*$/, &quot;&quot;);

	if (qrUrl) {
		// Get the page we are going to write content into.
		var $page = $(pageSelector);

		// Get the header for the page.
		var $header = $page.children(&quot;:jqmData(role=header)&quot;);

		// Find the h1 element in the header and inject the hostname from the url.
		$header.find(&quot;h1&quot;).html(getHostname(qrUrl));

		// Get the content area element for the page.
		var $content = $page.children(&quot;:jqmData(role=content)&quot;);

		// The markup we are going to inject into the content area of the page.
		var markup = &quot;&lt;img class='center' src=https://chart.googleapis.com/chart?chs=200x200&amp;cht=qr&amp;chl=&quot; + qrUrl + &quot; alt=&quot; + qrUrl + &quot; /&gt;&quot;;

		// Inject the QR code markup into the content element.
		$content.html(markup);

		// Make sure the url displayed in the the browser's location field includes parameters
		options.dataUrl = urlObj.href;

		// Now call changePage() and tell it to switch to the page we just modified.
		$.mobile.changePage($page, options);
	}
}

// Extract hostname from a url.
function getHostname(url) {
	return decodeURIComponent(url).replace(/.*\/\//, &quot;&quot;).replace(/\/.*$/, &quot;&quot;);
}
</pre></p>
<p>We are using <a href="http://code.google.com/apis/chart/image/">Google Chart API</a> to display the QR code. Please also note the use of :jqmData selectors. Here is a paragraph from the <a href="http://jquerymobile.com/demos/1.0/docs/api/methods.html">jQuery Mobile Documentation</a> explaining the selectors:</p>
<p><em>&#8220;When finding elements by their jQuery Mobile data attribute, please use the custom selector <code>:jqmData()</code>, as it automatically incorporates namespaced data attributes into the lookup when they are in use. For example, instead of calling <code>$("div[data-role='page']")</code>, you should use <code>$("div:jqmData(role='page')")</code>, which internally maps to <code>$("div[data-"+ $.mobile.ns +"role='page']")</code> without forcing you to concatenate a namespace into your selectors manually.&#8221;</em></p>
<p>To find out more about dynamically injected pages please click <a href="http://jquerymobile.com/demos/1.0/docs/pages/page-dynamic.html">here</a>.</p>
<p>Complete HTML code to be used in conjunction with the JavaScript code we have just covered is shown below:</p>
<p><pre class="brush: xml;">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Share QR&lt;/title&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;		
  &lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css&quot; /&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;shareqr2.2.css&quot; /&gt;
  &lt;script src=&quot;http://code.jquery.com/jquery-1.6.4.min.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;shareqr2.2.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
	
&lt;body&gt;

  &lt;div data-role=&quot;page&quot; id=&quot;home&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;home&quot; data-iconpos=&quot;notext&quot;&gt;Home&lt;/a&gt;
      &lt;h1&gt;Share QR&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;ul data-role=&quot;listview&quot;&gt;
        &lt;li&gt;&lt;a href=&quot;#qrcode?url=http%3A%2F%2Fctoinsights.wordpress.com&quot;&gt;ctoinsights.wordpress.com&lt;/a&gt;&lt;/li&gt;		  
        &lt;li&gt;&lt;a href=&quot;#qrcode?url=http%3A%2F%2Fwww.book-current.com&quot;&gt;www.book-current.com&lt;/a&gt;&lt;/li&gt;	
      &lt;/ul&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
      &lt;a href=&quot;#about&quot; data-icon=&quot;info&quot;&gt;About&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;div data-role=&quot;page&quot; id=&quot;qrcode&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;home&quot; data-iconpos=&quot;notext&quot;&gt;Home&lt;/a&gt;
      &lt;h1&gt;QR Code&lt;/h1&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;arrow-l&quot; data-rel=&quot;back&quot;&gt;Back&lt;/a&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
    &lt;a href=&quot;#about&quot; data-icon=&quot;info&quot;&gt;About&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;div data-role=&quot;page&quot; id=&quot;about&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;home&quot; data-iconpos=&quot;notext&quot;&gt;Home&lt;/a&gt;
      &lt;h1&gt;About&lt;/h1&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;arrow-l&quot; data-rel=&quot;back&quot;&gt;Back&lt;/a&gt; 
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;p&gt;Share your favorite URLs with other mobile phone users through QR codes.&lt;/p&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
      &lt;a href=&quot;#about&quot; data-icon=&quot;info&quot;&gt;About&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre></p>
<p>We also added a small css file to center display of the QR code.</p>
<p><pre class="brush: css;">
img.center {
	display: block;
	margin-left: auto;
	margin-right: auto;
}
</pre></p>
<p>This completes Part II of the Tutorial. You can access work in progress application on your mobile phone at <a href="http://rtekie.heroku.com/shareqr2.2.html" target="_blank">http://rtekie.heroku.com/shareqr2.2.html</a>. Screen shots are shown below:</p>
<p><a href="http://ctoinsights.files.wordpress.com/2012/01/shareqr2-2.png"><img class="aligncenter size-full wp-image-495" title="shareqr2.2" src="http://ctoinsights.files.wordpress.com/2012/01/shareqr2-2.png?w=575&#038;h=380" alt="" width="575" height="380" /></a></p>
<p>In <a title="jQuery Mobile Tutorial Part III – Managing Data" href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/">Part III</a> we will add site list management capabilities and complete the application.</p>
<br /> Tagged: <a href='http://ctoinsights.wordpress.com/tag/html5/'>HTML5</a>, <a href='http://ctoinsights.wordpress.com/tag/javascript/'>JavaScript</a>, <a href='http://ctoinsights.wordpress.com/tag/jquery/'>jquery</a>, <a href='http://ctoinsights.wordpress.com/tag/jquery-mobile/'>jquery mobile</a>, <a href='http://ctoinsights.wordpress.com/tag/mobile/'>mobile</a>, <a href='http://ctoinsights.wordpress.com/tag/programming/'>programming</a>, <a href='http://ctoinsights.wordpress.com/tag/software-development/'>software development</a>, <a href='http://ctoinsights.wordpress.com/tag/tutorial/'>tutorial</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctoinsights.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctoinsights.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctoinsights.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctoinsights.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctoinsights.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctoinsights.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctoinsights.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctoinsights.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctoinsights.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctoinsights.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctoinsights.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctoinsights.wordpress.com/446/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctoinsights.wordpress.com/446/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctoinsights.wordpress.com/446/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=446&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-ii-dynamic-pages/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f52276f8d9db1d7c6577deb16eef9e0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ctoinsights</media:title>
		</media:content>

		<media:content url="http://ctoinsights.files.wordpress.com/2012/01/shareqr2-2.png" medium="image">
			<media:title type="html">shareqr2.2</media:title>
		</media:content>
	</item>
		<item>
		<title>jQuery Mobile Tutorial Part III &#8211; Managing Data</title>
		<link>http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/</link>
		<comments>http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 15:35:28 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jquery mobile]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://ctoinsights.wordpress.com/?p=457</guid>
		<description><![CDATA[This is the last part of a three parts jQuery Mobile Tutorial. For introduction to the Tutorial please refer to Part I. The Tutorial walks you through a process of building an application which will allow you to maintain a list of your favorite websites and share sites from the list with other mobile users [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=457&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This is the last part of a three parts jQuery Mobile Tutorial. For introduction to the Tutorial please refer to <a title="jQuery Mobile Tutorial Part I – Static Pages" href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-i-static-pages/">Part I</a>.</p>
<p>The Tutorial walks you through a process of building an application which will allow you to maintain a list of your favorite websites and share sites from the list with other mobile users through <a href="http://en.wikipedia.org/wiki/QR_code">QR codes</a>. In <a title="jQuery Mobile Tutorial Part II – Dynamic Pages" href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-ii-dynamic-pages/">Part II</a> we implemented functionality to display QR codes for sites from a static, hardcoded list. In this part we will add ability to maintain the list of sites.</p>
<h3 style="padding-top:20px;">3.1 List storage</h3>
<p>Before we start adding and deleting list items we need to have a mechanism to store a list. We will use <a href="http://www.w3schools.com/html5/html5_webstorage.asp">HTML5 local storage</a>.</p>
<p>Let&#8217;s start by adding a function to retrieve a list from the local storage. It will also initialize the list using defaults if a list cannot be found in the local storage.</p>
<p><pre class="brush: jscript;">
// Retrieve a list of URLs from the local storage.
// Use defaults if storage has not been initialized yet.
// URLs are serialized using JSON for storage.
function getMyUrls() {
	var myUrls;
	var storedUrls = localStorage.getItem(&quot;myUrls&quot;);
	if (storedUrls) {
		// Deserialize URLs
		myUrls = JSON.parse(storedUrls);
	}
	else {
		// Initialize defaults
		myUrls = [encodeURIComponent(&quot;http://ctoinsights.wordpress.com&quot;), encodeURIComponent(&quot;http://www.book-current.com&quot;)];
		localStorage.setItem(&quot;myUrls&quot;, JSON.stringify(myUrls));
	}
	return myUrls;
}
</pre></p>
<p>You can of course use your preferred sites to initialize the list.</p>
<p>Now we can use the list to update cotent of the Home page:</p>
<p><pre class="brush: jscript;">
// Display a list of urls you want to share.
function showUrlList(urlObj, options) {
	// Get list of urls
	var myUrls = getMyUrls();

	// Get the page we are going to write our content into.
	var $page = $(&quot;#home&quot;);
	// Get the content area element for the page.
	var $content = $page.children(&quot;:jqmData(role=content)&quot;);

	// Build the list of urls.
	var markup = &quot;&lt;ul data-role='listview'&gt;&quot;;
  for (var i=0; i&lt;myUrls.length; i++) {
		markup = markup + &quot;&lt;li&gt;&lt;a href='#qrcode?url=&quot; + myUrls[i] + &quot;'&gt;&quot; + getHostname(myUrls[i]) + &quot;&lt;/a&gt;&lt;/li&gt;&quot;;
  }
	markup = markup + &quot;&lt;/ul&gt;&quot;;
	// Inject the list markup into the content element.
	$content.html(markup);

	// Pages are lazily enhanced. We call page() on the page
	// element to make sure it is always enhanced before we
	// attempt to enhance the listview markup we just injected.
	$page.page();

	// Enhance the listview we just injected.
	$content.find( &quot;:jqmData(role=listview)&quot; ).listview();

	// Now call changePage() and tell it to switch to the page we just modified.
	$.mobile.changePage($page, options);
}
</pre></p>
<p>Next we have to modify pagebeforechange event handler to catch requests to display the Home page in addition to the previously implemented code handling QR Code page display requests:</p>
<p><pre class="brush: jscript;">
// Listen for any attempts to call changePage().
$(document).bind( &quot;pagebeforechange&quot;, function(e, data) {
	// We only want to handle changePage() calls where the caller is asking us to load a page by URL.
	if (typeof data.toPage === &quot;string&quot;) {
		// We only want to handle a subset of URLs.
		var u = $.mobile.path.parseUrl(data.toPage);
		var home = /^#home/;
		var qrcode = /^#qrcode/;
		if (u.hash.search(home) !== -1) {
			// Display a list of URLs.
			showUrlList(u, data.options);
			e.preventDefault();
		}
		else if (u.hash.search(qrcode) !== -1) {
			// Display QR code for the selected URL.
			showQRCode(u, data.options);
			e.preventDefault();
		}
	}
});
</pre></p>
<p>Finally we have to make sure that the Home page is properly populated when loaded for the first time.</p>
<p><pre class="brush: jscript;">
// Refresh home page using dynamic url list.
$(document).ready(function() {
	$.mobile.changePage(&quot;#home&quot;);
});
</pre></p>
<p>This replicates functionality developed in <a title="jQuery Mobile Tutorial Part II – Dynamic Pages" href="http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-ii-dynamic-pages/">Part II</a> except that the site list is now pulled from the local storage instead of being hardcoded.</p>
<h3 style="padding-top:20px;">3.2 Adding sites</h3>
<p>To be able to add a site, first we will create an additional page with a <a href="http://jquerymobile.com/demos/1.0/docs/forms/docs-forms.html">form</a> to capture a site url.</p>
<p><pre class="brush: xml;">
  &lt;div data-role=&quot;page&quot; id=&quot;addurl&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;home&quot; data-iconpos=&quot;notext&quot;&gt;Home&lt;/a&gt;
      &lt;h1&gt;Add URL&lt;/h1&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;arrow-l&quot; data-rel=&quot;back&quot;&gt;Back&lt;/a&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;form action=&quot;#home&quot; method=&quot;POST&quot; name=&quot;addurl&quot; id=&quot;addurl&quot;&gt;
        &lt;div data-role=&quot;fieldcontain&quot;&gt;
          &lt;label for=&quot;url&quot;&gt;URL:&lt;/label&gt;
          &lt;input type=&quot;url&quot; name=&quot;url&quot; id=&quot;url&quot; value=&quot;http://&quot; /&gt;
          &lt;button&gt;Add&lt;/button&gt;
        &lt;/div&gt;
      &lt;/form&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
      &lt;a href=&quot;#about&quot; data-icon=&quot;info&quot;&gt;About&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
</pre></p>
<p>Next we will add a a link to the Add URL page on the Home page header.</p>
<p><pre class="brush: xml;">
      &lt;a href=&quot;#addurl&quot; data-icon=&quot;plus&quot;&gt;Add URL&lt;/a&gt;
</pre></p>
<p>We will also have to capture the form submit event and save a newly entered url in the local storage.</p>
<p><pre class="brush: jscript;">
// When a new url is added, save it in the local storage and display the home page.
$(&quot;#addurl&quot;).live(&quot;submit&quot; , function(e, data) {
	var url = $(&quot;#url&quot;).val();
	addUrl(url);
	$.mobile.changePage(&quot;#home&quot;);
	return false;
});

// Add a URL to the list.
function addUrl(url) {
	var myUrls = getMyUrls();
	// Check for duplicates
	if (findUrl(url) === -1) {
		myUrls = myUrls.concat(encodeURIComponent(url));
		localStorage.setItem(&quot;myUrls&quot;, JSON.stringify(myUrls));
	}
}

// Find URL in the url list.
// Return index or -1 if not found.
function findUrl(url) {
	var index = -1;
	var myUrls = getMyUrls();
	for (var i=0; i &lt; myUrls.length; i++) {
		if (myUrls[i] === encodeURIComponent(url)) {
			return i;
		}
	}
	return index;
}
</pre></p>
<h3 style="padding-top:20px;">3.3 Deleting sites</h3>
<p>List management would not be complete without an ability to delete items from the list. We will start by adding Delete buttons to the list items on the Home page. Let&#8217;s modify the showUrlList function.</p>
<p><pre class="brush: jscript;">
	// Build the list of urls.
	var markup = &quot;&lt;ul data-role='listview' data-split-icon='delete'&gt;&quot;;
  for (var i=0; i&lt;myUrls.length; i++) {
		markup = markup + &quot;&lt;li&gt;&lt;a href='#qrcode?url=&quot; + myUrls[i] + &quot;'&gt;&quot; + getHostname(myUrls[i]) + &quot;&lt;/a&gt;&quot; + &quot;&lt;a href='#delurl?url=&quot; + myUrls[i] + &quot;' data-rel='dialog'&gt;Delete&lt;/a&gt;&lt;/li&gt;&quot;;
  }
	markup = markup + &quot;&lt;/ul&gt;&quot;;
</pre></p>
<p>We are using a split button list. You can find out more about jQuery Mobile list capabilities <a href="http://jquerymobile.com/demos/1.0/docs/lists/docs-lists.html">here</a>.</p>
<p>Clicking on a Delete button will open up a Delete URL <a href="http://jquerymobile.com/demos/1.0/docs/pages/page-dialogs.html">dialog box</a>. We need to add the dialog box to the html file.</p>
<p><pre class="brush: xml;">
  &lt;div data-role=&quot;page&quot; id=&quot;delurl&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;h1&gt;Delete URL?&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;p class=&quot;center&quot; id=&quot;url_prompt&quot;&gt;url&lt;/p&gt;
      &lt;form action=&quot;#home&quot; method=&quot;POST&quot; name=&quot;delurl&quot; id=&quot;delurl&quot;&gt;
        &lt;div data-role=&quot;fieldcontain&quot;&gt;
          &lt;input type=&quot;hidden&quot; name=&quot;url_value&quot; id=&quot;url_value&quot; value=&quot;url&quot; /&gt;
          &lt;div class=&quot;ui-grid-a&quot;&gt;
            &lt;div class=&quot;ui-block-a&quot;&gt;
              &lt;a href=&quot;#home&quot; data-role=&quot;button&quot; data-rel=&quot;back&quot; data-direction=&quot;reverse&quot;&gt;Cancel&lt;/a&gt;
            &lt;/div&gt;
            &lt;div class=&quot;ui-block-b&quot;&gt;
              &lt;input type=&quot;submit&quot; value=&quot;Delete&quot; /&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/form&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
    &lt;/div&gt;
  &lt;/div&gt;
</pre></p>
<p>Dialog box buttons are positioned using a <a href="http://jquerymobile.com/demos/1.0/docs/content/content-grids.html">layout grid</a>.</p>
<p>The dialog box has to be dynamically populated with a site url. We need to modify pagebeforechange event handler to capture requests to display the dialog box.  We also need to write a function to update content of the dialog box.</p>
<p><pre class="brush: jscript;">
// Listen for any attempts to call changePage().
$(document).bind( &quot;pagebeforechange&quot;, function(e, data) {
	// We only want to handle changePage() calls where the caller is
	// asking us to load a page by URL.
	if (typeof data.toPage === &quot;string&quot;) {
		// We only want to handle a subset of URLs.
		var u = $.mobile.path.parseUrl(data.toPage);
		var home = /^#home/;
		var qrcode = /^#qrcode/;
		var delurl = /^#delurl/;
		if (u.hash.search(home) !== -1) {
			// Display a list of URLs.
			showUrlList(u, data.options);
			e.preventDefault();
		}
		else if (u.hash.search(qrcode) !== -1) {
			// Display QR code for the selected URL.
			showQRCode(u, data.options);
			e.preventDefault();
		}
		else if (u.hash.search(delurl) !== -1) {
			// Display URL delete confirmation dialog box.
			showDelUrl(u, data.options);
			e.preventDefault();
		}
	}
});

// Display Delete URL confirmation dialog for a specific url passed in as a parameter.
function showDelUrl(urlObj, options) {
	// Get the url parameter
	var url = decodeURIComponent(urlObj.hash.replace(/.*url=/, &quot;&quot;));

	// The pages we use to display our content are already in
	// the DOM. The id of the page we are going to write our
	// content into is specified in the hash before the '?'.
	var	pageSelector = urlObj.hash.replace(/\?.*$/, &quot;&quot;);

	// Get the page we are going to write our content into.
	var $page = $(pageSelector);

	// Get the content area element for the page.
	var $content = $page.children(&quot;:jqmData(role=content)&quot;);

	// Set url elements of the page.
	$content.find(&quot;#url_value&quot;).val(url);
	$content.find(&quot;#url_prompt&quot;).html(getHostname(url));

	// Pages are lazily enhanced. We call page() on the page
	// element to make sure it is always enhanced.
	$page.page();

	// Now call changePage() and tell it to switch to the page we just modified.
	$.mobile.changePage($page, options);
}
</pre></p>
<p>Finally we need to capture the dialog box submit requests and remove a site from the local storage.</p>
<p><pre class="brush: jscript;">
// When a url is deleted, remove it from the local storage and display the home page.
$(&quot;#delurl&quot;).live(&quot;submit&quot; , function(e, data) {
	var url = $(&quot;#url_value&quot;).val();
	delUrl(url);
	$.mobile.changePage(&quot;#home&quot;);
	return false;
});

// Delete URL from the list.
function delUrl(url) {
	var myUrls = getMyUrls();
	var index = findUrl(url);
	if (index !== -1) {
		myUrls.splice(index, 1);
		localStorage.setItem(&quot;myUrls&quot;, JSON.stringify(myUrls));
	}
}
</pre></p>
<p>Complete source code is shown below:</p>
<p><pre class="brush: xml;">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Share QR&lt;/title&gt;
  &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css&quot; /&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;shareqr3.3.css&quot; /&gt;
  &lt;script src=&quot;http://code.jquery.com/jquery-1.6.4.min.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js&quot;&gt;&lt;/script&gt;
  &lt;script src=&quot;shareqr3.3.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;

  &lt;div data-role=&quot;page&quot; id=&quot;home&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;home&quot; data-iconpos=&quot;notext&quot;&gt;Home&lt;/a&gt;
      &lt;h1&gt;Share QR&lt;/h1&gt;
      &lt;a href=&quot;#addurl&quot; data-icon=&quot;plus&quot;&gt;Add URL&lt;/a&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
      &lt;a href=&quot;#about&quot; data-icon=&quot;info&quot;&gt;About&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;div data-role=&quot;page&quot; id=&quot;qrcode&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;home&quot; data-iconpos=&quot;notext&quot;&gt;Home&lt;/a&gt;
      &lt;h1&gt;QR Code&lt;/h1&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;arrow-l&quot; data-rel=&quot;back&quot;&gt;Back&lt;/a&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
    &lt;a href=&quot;#about&quot; data-icon=&quot;info&quot;&gt;About&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;div data-role=&quot;page&quot; id=&quot;addurl&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;home&quot; data-iconpos=&quot;notext&quot;&gt;Home&lt;/a&gt;
      &lt;h1&gt;Add URL&lt;/h1&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;arrow-l&quot; data-rel=&quot;back&quot;&gt;Back&lt;/a&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;form action=&quot;#home&quot; method=&quot;POST&quot; name=&quot;addurl&quot; id=&quot;addurl&quot;&gt;
        &lt;div data-role=&quot;fieldcontain&quot;&gt;
          &lt;label for=&quot;url&quot;&gt;URL:&lt;/label&gt;
          &lt;input type=&quot;url&quot; name=&quot;url&quot; id=&quot;url&quot; value=&quot;http://&quot; /&gt;
          &lt;button&gt;Add&lt;/button&gt;
        &lt;/div&gt;
      &lt;/form&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
      &lt;a href=&quot;#about&quot; data-icon=&quot;info&quot;&gt;About&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;div data-role=&quot;page&quot; id=&quot;delurl&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;h1&gt;Delete URL?&lt;/h1&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;p class=&quot;center&quot; id=&quot;url_prompt&quot;&gt;url&lt;/p&gt;
      &lt;form action=&quot;#home&quot; method=&quot;POST&quot; name=&quot;delurl&quot; id=&quot;delurl&quot;&gt;
        &lt;div data-role=&quot;fieldcontain&quot;&gt;
          &lt;input type=&quot;hidden&quot; name=&quot;url_value&quot; id=&quot;url_value&quot; value=&quot;url&quot; /&gt;
          &lt;div class=&quot;ui-grid-a&quot;&gt;
            &lt;div class=&quot;ui-block-a&quot;&gt;
              &lt;a href=&quot;#home&quot; data-role=&quot;button&quot; data-rel=&quot;back&quot; data-direction=&quot;reverse&quot;&gt;Cancel&lt;/a&gt;
            &lt;/div&gt;
            &lt;div class=&quot;ui-block-b&quot;&gt;
              &lt;input type=&quot;submit&quot; value=&quot;Delete&quot; /&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/form&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
    &lt;/div&gt;
  &lt;/div&gt;

  &lt;div data-role=&quot;page&quot; id=&quot;about&quot;&gt;
    &lt;div data-role=&quot;header&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot;&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;home&quot; data-iconpos=&quot;notext&quot;&gt;Home&lt;/a&gt;
      &lt;h1&gt;About&lt;/h1&gt;
      &lt;a href=&quot;#home&quot; data-icon=&quot;arrow-l&quot; data-rel=&quot;back&quot;&gt;Back&lt;/a&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;content&quot;&gt;
      &lt;p&gt;Share your favorite URLs with other mobile phone users through QR codes.&lt;/p&gt;
    &lt;/div&gt;
    &lt;div data-role=&quot;footer&quot; class=&quot;ui-bar&quot; data-theme=&quot;b&quot; data-position=&quot;fixed&quot; data-id=&quot;footer&quot;&gt;
      &lt;a href=&quot;#about&quot; data-icon=&quot;info&quot;&gt;About&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre></p>
<p>&nbsp;</p>
<p><pre class="brush: jscript;">
// Refresh home page using dynamic url list.
$(document).ready(function() {
	$.mobile.changePage(&quot;#home&quot;);
});

// Listen for any attempts to call changePage().
$(document).bind( &quot;pagebeforechange&quot;, function(e, data) {
	// We only want to handle changePage() calls where the caller is
	// asking us to load a page by URL.
	if (typeof data.toPage === &quot;string&quot;) {
		// We only want to handle a subset of URLs.
		var u = $.mobile.path.parseUrl(data.toPage);
		var home = /^#home/;
		var qrcode = /^#qrcode/;
		var delurl = /^#delurl/;
		if (u.hash.search(home) !== -1) {
			// Display a list of URLs.
			showUrlList(u, data.options);
			e.preventDefault();
		}
		else if (u.hash.search(qrcode) !== -1) {
			// Display QR code for the selected URL.
			showQRCode(u, data.options);
			e.preventDefault();
		}
		else if (u.hash.search(delurl) !== -1) {
			// Display URL delete confirmation dialog box.
			showDelUrl(u, data.options);
			e.preventDefault();
		}
	}
});

// When a new url is added, save it in the local storage and display the home page.
$(&quot;#addurl&quot;).live(&quot;submit&quot; , function(e, data) {
	var url = $(&quot;#url&quot;).val();
	addUrl(url);
	$.mobile.changePage(&quot;#home&quot;);
	return false;
});

// When a url is deleted, remove it from the local storage and display the home page.
$(&quot;#delurl&quot;).live(&quot;submit&quot; , function(e, data) {
	var url = $(&quot;#url_value&quot;).val();
	delUrl(url);
	$.mobile.changePage(&quot;#home&quot;);
	return false;
});

// Display a list of urls you want to share.
function showUrlList(urlObj, options) {
	// Get list of urls
	var myUrls = getMyUrls();

	// Get the page we are going to write our content into.
	var $page = $(&quot;#home&quot;);
	// Get the content area element for the page.
	var $content = $page.children(&quot;:jqmData(role=content)&quot;);

	// Build the list of urls.
	var markup = &quot;&lt;ul data-role='listview' data-split-icon='delete'&gt;&quot;;
  for (var i=0; i&lt;myUrls.length; i++) {
		markup = markup + &quot;&lt;li&gt;&lt;a href='#qrcode?url=&quot; + myUrls[i] + &quot;'&gt;&quot; + getHostname(myUrls[i]) + &quot;&lt;/a&gt;&quot; + &quot;&lt;a href='#delurl?url=&quot; + myUrls[i] + &quot;' data-rel='dialog'&gt;Delete&lt;/a&gt;&lt;/li&gt;&quot;;
  }
	markup = markup + &quot;&lt;/ul&gt;&quot;;
	// Inject the list markup into the content element.
	$content.html(markup);

	// Pages are lazily enhanced. We call page() on the page
	// element to make sure it is always enhanced before we
	// attempt to enhance the listview markup we just injected.
	$page.page();

	// Enhance the listview we just injected.
	$content.find( &quot;:jqmData(role=listview)&quot; ).listview();

	// Now call changePage() and tell it to switch to the page we just modified.
	$.mobile.changePage($page, options);
}

// Load the QR Code for a specific url passed in as a parameter.
// Generate markup for the page, and then make that page the current active page.
function showQRCode(urlObj, options) {
	// Get the url parameter
	var qrUrl = decodeURIComponent(urlObj.hash.replace(/.*url=/, &quot;&quot;));

	// The page we use to display QR code is already in the DOM.
	// The id of the page we are going to write the content into is specified in the hash before the '?'.
	var	pageSelector = urlObj.hash.replace(/\?.*$/, &quot;&quot;);

	if (qrUrl) {
		// Get the page we are going to write content into.
		var $page = $(pageSelector);

		// Get the header for the page.
		var $header = $page.children(&quot;:jqmData(role=header)&quot;);

		// Find the h1 element in the header and inject the hostname from the url.
		$header.find(&quot;h1&quot;).html(getHostname(qrUrl));

		// Get the content area element for the page.
		var $content = $page.children(&quot;:jqmData(role=content)&quot;);

		// The markup we are going to inject into the content area of the page.
		var markup = &quot;&lt;img class='center' src=https://chart.googleapis.com/chart?chs=200x200&amp;cht=qr&amp;chl=&quot; + qrUrl + &quot; alt=&quot; + qrUrl + &quot; /&gt;&quot;;

		// Inject the QR code markup into the content element.
		$content.html(markup);

		// Make sure the url displayed in the the browser's location field includes parameters
		options.dataUrl = urlObj.href;

		// Now call changePage() and tell it to switch to the page we just modified.
		$.mobile.changePage($page, options);
	}
}

// Display Delete URL confirmation dialog for a specific url passed in as a parameter.
function showDelUrl(urlObj, options) {
	// Get the url parameter
	var url = decodeURIComponent(urlObj.hash.replace(/.*url=/, &quot;&quot;));

	// The pages we use to display our content are already in
	// the DOM. The id of the page we are going to write our
	// content into is specified in the hash before the '?'.
	var	pageSelector = urlObj.hash.replace(/\?.*$/, &quot;&quot;);

	// Get the page we are going to write our content into.
	var $page = $(pageSelector);

	// Get the content area element for the page.
	var $content = $page.children(&quot;:jqmData(role=content)&quot;);

	// Set url elements of the page.
	$content.find(&quot;#url_value&quot;).val(url);
	$content.find(&quot;#url_prompt&quot;).html(getHostname(url));

	// Pages are lazily enhanced. We call page() on the page
	// element to make sure it is always enhanced.
	$page.page();

	// Now call changePage() and tell it to switch to the page we just modified.
	$.mobile.changePage($page, options);
}

// Extract hostname from a url.
function getHostname(url) {
	return decodeURIComponent(url).replace(/.*\/\//, &quot;&quot;).replace(/\/.*$/, &quot;&quot;);
}

// Retrieve a list of URLs from the local storage.
// Use defaults if storage has not been initialized yet.
// URLs are serialized using JSON for storage.
function getMyUrls() {
	var myUrls;
	var storedUrls = localStorage.getItem(&quot;myUrls&quot;);
	if (storedUrls) {
		// Deserialize URLs
		myUrls = JSON.parse(storedUrls);
	}
	else {
		// Initialize defaults
		myUrls = [encodeURIComponent(&quot;http://ctoinsights.wordpress.com&quot;), encodeURIComponent(&quot;http://www.book-current.com&quot;)];
		localStorage.setItem(&quot;myUrls&quot;, JSON.stringify(myUrls));
	}
	return myUrls;
}

// Find URL in the url list.
// Return index or -1 if not found.
function findUrl(url) {
	var index = -1;
	var myUrls = getMyUrls();
	for (var i=0; i &lt; myUrls.length; i++) {
		if (myUrls[i] === encodeURIComponent(url)) {
			return i;
		}
	}
	return index;
}

// Add a URL to the list.
function addUrl(url) {
	var myUrls = getMyUrls();
	// Check for duplicates
	if (findUrl(url) === -1) {
		myUrls = myUrls.concat(encodeURIComponent(url));
		localStorage.setItem(&quot;myUrls&quot;, JSON.stringify(myUrls));
	}
}

// Delete URL from the list.
function delUrl(url) {
	var myUrls = getMyUrls();
	var index = findUrl(url);
	if (index !== -1) {
		myUrls.splice(index, 1);
		localStorage.setItem(&quot;myUrls&quot;, JSON.stringify(myUrls));
	}
}
</pre></p>
<p>We also made a small addition to the css file to center display of a url in the Delete URL dialog box.</p>
<p><pre class="brush: css;">
p.center {
	text-align: center;
}
img.center {
	display: block;
	margin-left: auto;
	margin-right: auto;
}
</pre></p>
<p>This completes the Tutorial. We built a simple but fully functional web application utilizing many features of jQuery Mobile framework. You can access the application on your mobile phone at <a href="http://rtekie.heroku.com/shareqr3.3.html" target="_blank">http://rtekie.heroku.com/shareqr3.3.html</a>. Sample screen shots are shown below:</p>
<p><a href="http://ctoinsights.files.wordpress.com/2012/01/shareqr3-3-1.png"><img class="aligncenter size-full wp-image-502" title="shareqr3.3-1" src="http://ctoinsights.files.wordpress.com/2012/01/shareqr3-3-1.png?w=575&#038;h=379" alt="" width="575" height="379" /></a></p>
<p><a href="http://ctoinsights.files.wordpress.com/2012/01/shareqr3-3-2.png"><img class="aligncenter size-full wp-image-503" title="shareqr3.3-2" src="http://ctoinsights.files.wordpress.com/2012/01/shareqr3-3-2.png?w=575&#038;h=379" alt="" width="575" height="379" /></a></p>
<p>You can find more tutorials and other resources at <a href="http://jquerymobile.com/resources/">http://jquerymobile.com/resources/</a>.</p>
<br /> Tagged: <a href='http://ctoinsights.wordpress.com/tag/html5/'>HTML5</a>, <a href='http://ctoinsights.wordpress.com/tag/javascript/'>JavaScript</a>, <a href='http://ctoinsights.wordpress.com/tag/jquery/'>jquery</a>, <a href='http://ctoinsights.wordpress.com/tag/jquery-mobile/'>jquery mobile</a>, <a href='http://ctoinsights.wordpress.com/tag/mobile/'>mobile</a>, <a href='http://ctoinsights.wordpress.com/tag/programming/'>programming</a>, <a href='http://ctoinsights.wordpress.com/tag/software-development/'>software development</a>, <a href='http://ctoinsights.wordpress.com/tag/tutorial/'>tutorial</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctoinsights.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctoinsights.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctoinsights.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctoinsights.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctoinsights.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctoinsights.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctoinsights.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctoinsights.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctoinsights.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctoinsights.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctoinsights.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctoinsights.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctoinsights.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctoinsights.wordpress.com/457/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=457&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctoinsights.wordpress.com/2012/01/03/jquery-mobile-tutorial-part-iii-managing-data/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f52276f8d9db1d7c6577deb16eef9e0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ctoinsights</media:title>
		</media:content>

		<media:content url="http://ctoinsights.files.wordpress.com/2012/01/shareqr3-3-1.png" medium="image">
			<media:title type="html">shareqr3.3-1</media:title>
		</media:content>

		<media:content url="http://ctoinsights.files.wordpress.com/2012/01/shareqr3-3-2.png" medium="image">
			<media:title type="html">shareqr3.3-2</media:title>
		</media:content>
	</item>
		<item>
		<title>Do you need a Software QA team was the most popular post in 2011</title>
		<link>http://ctoinsights.wordpress.com/2012/01/02/do-you-need-a-software-qa-team-was-the-most-popular-post-in-2011/</link>
		<comments>http://ctoinsights.wordpress.com/2012/01/02/do-you-need-a-software-qa-team-was-the-most-popular-post-in-2011/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 14:03:29 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[qa]]></category>
		<category><![CDATA[software qa]]></category>
		<category><![CDATA[software skills]]></category>
		<category><![CDATA[technology skills]]></category>

		<guid isPermaLink="false">http://ctoinsights.wordpress.com/?p=472</guid>
		<description><![CDATA[Do you need a Software QA Team? was by far my most popular post in 2011. The topic obviously resonated with many readers. Technical Skills in Demand was number two. I will be publishing a 2012 iteration of the post this quarter. Tagged: qa, software qa, software skills, technology skills<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=472&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a title="Do you need a Software QA Team?" href="http://ctoinsights.wordpress.com/2011/05/14/do-you-need-a-software-qa-team/">Do you need a Software QA Team?</a> was by far my most popular post in 2011. The topic obviously resonated with many readers.</p>
<p><a title="Technical Skills In Demand" href="http://ctoinsights.wordpress.com/2011/03/19/technical-skills-in-demand/">Technical Skills in Demand</a> was number two. I will be publishing a 2012 iteration of the post this quarter.</p>
<br /> Tagged: <a href='http://ctoinsights.wordpress.com/tag/qa/'>qa</a>, <a href='http://ctoinsights.wordpress.com/tag/software-qa/'>software qa</a>, <a href='http://ctoinsights.wordpress.com/tag/software-skills/'>software skills</a>, <a href='http://ctoinsights.wordpress.com/tag/technology-skills/'>technology skills</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctoinsights.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctoinsights.wordpress.com/472/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctoinsights.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctoinsights.wordpress.com/472/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctoinsights.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctoinsights.wordpress.com/472/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctoinsights.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctoinsights.wordpress.com/472/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctoinsights.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctoinsights.wordpress.com/472/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctoinsights.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctoinsights.wordpress.com/472/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctoinsights.wordpress.com/472/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctoinsights.wordpress.com/472/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=472&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctoinsights.wordpress.com/2012/01/02/do-you-need-a-software-qa-team-was-the-most-popular-post-in-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f52276f8d9db1d7c6577deb16eef9e0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ctoinsights</media:title>
		</media:content>
	</item>
		<item>
		<title>Migrating Trac to Lighthouse</title>
		<link>http://ctoinsights.wordpress.com/2011/12/27/migrating-trac-to-lighthouse/</link>
		<comments>http://ctoinsights.wordpress.com/2011/12/27/migrating-trac-to-lighthouse/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 15:28:10 +0000</pubDate>
		<dc:creator>bob</dc:creator>
				<category><![CDATA[software development]]></category>
		<category><![CDATA[lighthouseapp]]></category>
		<category><![CDATA[product development]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[trac]]></category>

		<guid isPermaLink="false">http://ctoinsights.wordpress.com/?p=334</guid>
		<description><![CDATA[We migrated our ticketing system from Trac to Lighthouse recently. Trac uses SQLite database and exporting data was not an issue. Lighthouse does not have a bulk import capability but it does have a comprehensive API. To migrate data all we had to do is write a simple script. The source code is also available [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=334&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We migrated our ticketing system from <a href="http://trac.edgewall.org/">Trac</a> to <a href="http://lighthouseapp.com/">Lighthouse</a> recently.</p>
<p>Trac uses SQLite database and exporting data was not an issue. Lighthouse does not have a bulk import capability but it does have a comprehensive API. To migrate data all we had to do is write a simple script.</p>
<p><pre class="brush: ruby;">
# Migrate records from a Trac database to LighthouseApp
require 'rubygems'
require 'sqlite3'
require 'lib/lighthouse.rb' # download from https://github.com/Caged/lighthouse-api

# Connect to Lighthouse API
Lighthouse.account = 'YOUR LIGHTHOUSE ACCOUNT'
Lighthouse.token = 'YOUR LIGHTHOUSE API TOKEN'
project = Lighthouse::Project.find(:all).first
puts &quot;MIGRATING TICKETS TO PROJECT: #{project.name}&quot;

# Connect to database
db = SQLite3::Database.new(&quot;trac.db&quot;)

# Retrieve open trac ticket records
columns, *rows = db.execute2(&quot;select * from ticket t where t.status in ('new', 'assigned') order by t.id&quot;)

puts &quot;TICKET TABLE COLUMNS&quot;
  (0..columns.length-1).each do |i|
  puts &quot;#{i}:#{columns[i]}&quot;
end

# Process ticket records
rows.each do |row|
  puts row[0] # trac ticket ID
  # Create a new Lighthouse ticket
  ticket = Lighthouse::Ticket.new(:project_id =&gt; project.id)
  ticket.title = row[14] # summary column
  ticket.body = row[15] # description column
  # Additional data mapings go here

  # Get trac ticket changes and append to the Lighthouse ticket
  col, *updates = db.execute2(&quot;select newvalue from ticket_change where ticket=? and field = 'comment'&quot;, row[0])
  updates.each do |update|
    upd = update[0]
    ticket.body &lt;&lt; &quot;\n&quot; + upd if !upd.empty?
  end

  # Display progress
  puts ticket.title
  puts ticket.body
  ticket.save
end
</pre><br />
The source code is also available at <a href="https://gist.github.com/1523987">https://gist.github.com/1523987</a>.</pre>
<br /> Tagged: <a href='http://ctoinsights.wordpress.com/tag/lighthouseapp/'>lighthouseapp</a>, <a href='http://ctoinsights.wordpress.com/tag/product-development/'>product development</a>, <a href='http://ctoinsights.wordpress.com/tag/programming/'>programming</a>, <a href='http://ctoinsights.wordpress.com/tag/ruby-on-rails/'>ruby on rails</a>, <a href='http://ctoinsights.wordpress.com/tag/software-development/'>software development</a>, <a href='http://ctoinsights.wordpress.com/tag/trac/'>trac</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ctoinsights.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ctoinsights.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ctoinsights.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ctoinsights.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ctoinsights.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ctoinsights.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ctoinsights.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ctoinsights.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ctoinsights.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ctoinsights.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ctoinsights.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ctoinsights.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ctoinsights.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ctoinsights.wordpress.com/334/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ctoinsights.wordpress.com&amp;blog=16446976&amp;post=334&amp;subd=ctoinsights&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ctoinsights.wordpress.com/2011/12/27/migrating-trac-to-lighthouse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f52276f8d9db1d7c6577deb16eef9e0c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ctoinsights</media:title>
		</media:content>
	</item>
	</channel>
</rss>
