<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>occasionally useful &#187; web 2.0</title>
	<atom:link href="http://blog.maxaller.name/category/web-20/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.maxaller.name</link>
	<description>ruby, ubuntu, etc</description>
	<lastBuildDate>Thu, 02 Sep 2010 07:00:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How we got here: Web App Stores</title>
		<link>http://blog.maxaller.name/2010/08/how-we-got-here-web-app-stores/</link>
		<comments>http://blog.maxaller.name/2010/08/how-we-got-here-web-app-stores/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 07:00:20 +0000</pubDate>
		<dc:creator>Max</dc:creator>
				<category><![CDATA[musing]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://blog.maxaller.name/?p=297</guid>
		<description><![CDATA[The recent sudden popularity in web "app stores" is taking off with a rate normally associated with fads, but in some respects is actually to be expected. Still, it bears an interesting similarity with one of the oldest types of websites that the average consumer has seen: directories. Back in ye olden days (1996), lots [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://blog.chromium.org/2010/05/chrome-web-store.html" target="_blank">recent</a> <a href="http://blog.mozilla.com/blog/2010/05/20/an-open-web-app-store/" target="_blank">sudden</a> <a href="http://www.openappmkt.com/" target="_blank">popularity</a> <a href="http://www.apple.com/webapps/" target="_blank">in</a> web "app stores" is taking off with a rate normally associated with fads, but in some respects is actually to be expected.  Still, it bears an interesting similarity with one of the oldest types of websites that the average consumer has seen: directories.<br />
<span id="more-297"></span><br />
Back in ye olden days (1996), lots of tech savvy individuals were creating websites...only one problem.  Discoverability!  Now that they've launched www.awesomesauce.com, how do they tell people about it?  They could either rely on word of mouth, or they could submit it to...Yahoo!, which kept lists of worthy websites in directories.</p>
<p>It wasn't long before websites running these directories realized they could write a program that browsed the websites that were listed on their directory and archive the discovered text into a database, and then expose this database to the public via a convenient form in their handy dandy Internet Browser (alternatively, you could "submit" your website to search engine to tell them to index it...you still can, too).</p>
<p>However, most of the search engines weren't very...good.  If you searched Excite and Lycos didn't find what you were looking for, you'd try another search engine (WebCrawler?).  Still didn't find what you were looking for?  Keep looking!  Maybe Altavista has it!</p>
<p>The tech folks realized this, too, and came up with a somewhat reactionary response: make a search engine <em>that searched other search engines</em>.  Metacrawler?  Hell yeah.  Your one query would show you results from two, three, or more other search engines.  Even now, Metacrawler searches Google, Yahoo!, Bing, and Ask (which, for the record, appears to be the same as WebCrawler now).</p>
<p>Then along came Google.  Google had three main allures: it was simple (no bloated "search portal"), it had great (and fast!) search algorithms, and indexed damn near everything (1998-2000).  Lots of people were contributing content to the web, creating their own sites on Tripod.com, GeoCities, and Angelfire.  The amount of content search engines were indexing continued to increase.  Unique page counts increase from thousands to millions to billions (Google is purportedly around 20 billion pages now, see http://www.worldwidewebsize.com/).</p>
<p>Innovation slows a bit (well, a lot) when the dot com bubble pops, when companies realize that simply having a website doesn't guarantee multi-million dollar successes (shocking!).  While people are still playing with JavaScript and making pretty animated snowflakes tumble down the tops of their GeoCities pages, Google does something unprecedented: it releases Gmail on April 1, 2004, creating one of the first major web applications (what we now call "Rich Internet Applications") the world had ever seen, and launched it into the spotlight by offering an unprecedented amount of space in the inbox: 1 gigabyte!  Other web-based email services existed, like MSN Hotmail (with 2 megabytes for email storage), and Yahoo! Mail (with 25 megabytes of email storage on the premium plan, $30/yr), but these suffered from various issues from security to slowness to being downright ugly.</p>
<p>Gmail, besides revitalizing the webmail industry, showed us all two things: 1) Javascript can be used to be, well, useful, and 2) XmlHTTPRequest is incredibly useful (and iframes, bleh).  This begins the trend of taking web applications seriously as a replacement for certain desktop applications.</p>
<p>Fast forward a few years -- there are now many <em>many</em> Web 2.0 apps and/or RIA apps.  So many, in fact, that there is a veritable glut of apps.  We have a new discoverability problem, but not because we can't find the apps we need, but because we can find <em>too many</em> apps that could fulfill our needs.  How do we deal with hundreds of todo list apps, dozens of task-management apps, scores of invoicing apps, etc etc?</p>
<p>Well, there are a few things.  SEO (and search), word of mouth, getting <a href="http://news.cnet.com/8301-17939_109-9926105-2.html" target="_blank">featured</a> on news sites, and <a href="http://www.webbyawards.com/webbys/current.php?media_id=96&#038;season=14" target="_blank" title="Webby Awards">awards</a>.  But those are all so...qualitative.  None of those things means a product is necessarily even what you're looking for, except for getting covered in a story perhaps, but even that is only the opinion of one person.  What if you want reviews from lots of people, and not just journalists?  Or reviews of <em>all</em> sites, not just sites popular enough to get noticed by the media?  And that's why we'll be seeing an increase in web app stores -- they're low barrier to entry, help people learn about online tools from other people, and are more structured.  People will be able to find what they're looking for without having to figure out the best combination of search keywords.  This is definitely a good thing, provided that superior web products get the attention they deserve and incumbency means nothing.  Looking forward to what the web has to offer, again!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxaller.name/2010/08/how-we-got-here-web-app-stores/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 Web SQL Database &#8211; Intro to Versioning and Migrations</title>
		<link>http://blog.maxaller.name/2010/03/html5-web-sql-database-intro-to-versioning-and-migrations/</link>
		<comments>http://blog.maxaller.name/2010/03/html5-web-sql-database-intro-to-versioning-and-migrations/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 02:47:50 +0000</pubDate>
		<dc:creator>Max</dc:creator>
				<category><![CDATA[html5]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://blog.maxaller.name/?p=263</guid>
		<description><![CDATA[An introduction to HTML5 Web SQL Database version management and schema migrations.]]></description>
			<content:encoded><![CDATA[<p>I've been dabbling a bit with Chrome extensions, which have at their disposal HTML5 <a href="http://dev.w3.org/html5/webstorage/#the-localstorage-attribute" target="_blank">localStorage</a> and <a href="http://dev.w3.org/html5/webdatabase/" target="_blank">Web SQL Database</a>.  And...the web sql database especially is pretty cool.  But one thing was bothering me -- if I have a database on the client, how do I maintain the schema?  The (simplest) answer is in changeVersion.<br />
<span id="more-263"></span><br />
First a little background -- each database has an "version" property stored in the metadata of the database.  This basically safeguards you from the following scenario:</p>
<ol>
<li>Webmaster creates Javascript that requires database with schema A</li>
<li>User goes to website and a local database with schema A is created</li>
<li>Webmaster updates Javascript to use schema B</li>
<li>User goes to another page -- but what now?  User's database is using schema A but the javascript expects schema B</li>
</ol>
<p>How does the webmaster update from A to B?  Or create the initial schema, for that matter?  changeVersion.</p>
<p>Here's how you migrate the original schema, A in our case:<script src="http://gist.github.com/324073.js?file=1-Initial+schema.js"></script></p>
<p>That works...but already there's a problem.  If a user revisits a page, that changeVersion line will attempt to execute again.  Easy enough to fix: <script src="http://gist.github.com/324073.js?file=2-Repeat+visits+possible.js"></script> </p>
<p>(Note: the second argument to openDatabase is the "expected version" of the database.  If you specify it, the openDatabase method will <em>fail</em> unless the database matches the version you provided, without chance to recover.  I haven't found a use for this yet, so you'll always see the expected version as empty string from me.  Also note: this particular problem could be solved by setting the initial schema in the openDatabase callback, but you'd still hit it later when you add your first schema alteration)</p>
<p>Now users can view and refresh a page without the database connection erroring out.  Gooood.  But wait, I need to modify the schema again.  What now? Let's try this: <script src="http://gist.github.com/324073.js?file=3-Migrations+v1.js"></script></p>
<p>This...actually doesn't work at all (except within the scope of web workers, perhaps), because within the "regular" web sql database (window.openDatabase), <em>everything is asynchronous</em>.  Which is awesome for performance, but a pain if you're trying to do what we're trying to do right now.  Also, changeVersion only changes the version after the callback has run, successfully.  In other words, for a user new to the site with no schema, the "if db version == 1" line will get executed before the database has been updated to version 1!  If you refresh the page a few times this might work, but...that's obviously not acceptable.  But we're getting closer: <script src="http://gist.github.com/324073.js?file=4-Migrations+v2-v3.js"></script></p>
<p>Alright, this actually works, but it's cumbersome and still has a fair bit of code duplication (less in the second version...).</p>
<p><strong>And now for the punch line</strong> -- what if we take that "v3" migration, stash all the migrations in an array, and...say, put it in a class, maybe called Migrator?  And that's what I've done: <script src="http://gist.github.com/324073.js?file=Migrator.js"></script> And usage example: <script src="http://gist.github.com/324073.js?file=Migrator-usage.js"></script></p>
<p>Granted, it is small and fairly simple (and uh, disclaimer, not tested super thoroughly), but if nothing else it should be a good starter for your own migration scripts.</p>
<p>Thanks for reading!</p>
<p>UPDATE on June 5, 2010:<br />
I've created a github project with a more recent version (one that works with Safari/Webkit), available <a href="http://github.com/nanodeath/JS-Migrator" target="_blank">here</a>.  It does this by using a schema table to track state instead of relying on changeVersion.  While sort of a hack, the changeVersion design is rather poor anyway (pretty much the only useful openDatabase version string is "", since everything else could throw an exception).  Additionally, I added some logging, an example, and what I discovered to be a much-needed feature: callbacks, which let you execute further SQL with confidence that the migrations have already occurred.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.maxaller.name/2010/03/html5-web-sql-database-intro-to-versioning-and-migrations/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
