<?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>Bradley Holt &#187; HTML5</title>
	<atom:link href="http://bradley-holt.com/tag/html5/feed/" rel="self" type="application/rss+xml" />
	<link>http://bradley-holt.com</link>
	<description></description>
	<lastBuildDate>Fri, 06 Jan 2012 18:57:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Top Five Posts of 2011</title>
		<link>http://bradley-holt.com/2011/12/top-five-posts-of-2011/</link>
		<comments>http://bradley-holt.com/2011/12/top-five-posts-of-2011/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 17:15:32 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[AMQP]]></category>
		<category><![CDATA[CouchApp]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[Domain-Driven Design]]></category>
		<category><![CDATA[FOSS]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[Open Standards]]></category>
		<category><![CDATA[OSCON]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP-QAT]]></category>
		<category><![CDATA[Quality Assurance]]></category>
		<category><![CDATA[RabbitMQ]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Scaling]]></category>
		<category><![CDATA[Software Design]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=1480</guid>
		<description><![CDATA[Continuing a trend started by Cal Evans and then followed by Chris Cornutt, Matthew Turland, and Joe Devon; here are the top five most viewed posts from my blog in 2011. 5. CouchDB and Domain-Driven Design This post covered two topics that are of great interest to me. Document databases like CouchDB have much potential [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing a trend started by <a href="http://blog.calevans.com/2011/12/29/top-three-posts-of-2011/">Cal Evans</a> and then followed by <a href="http://blog.phpdeveloper.org/?p=425">Chris Cornutt</a>, <a href="http://matthewturland.com/2011/12/29/top-10-posts-of-2011/">Matthew Turland</a>, and <a href="http://mysqltalk.wordpress.com/2011/12/30/top-posts-of-2011/">Joe Devon</a>; here are the top five most viewed posts from my blog in 2011.</p>
<h3>5. <a href="http://bradley-holt.com/2011/08/couchdb-and-domain-driven-design/">CouchDB and Domain-Driven Design</a></h3>
<p>This post covered two topics that are of great interest to me. Document databases like CouchDB have much potential when it comes to domain-driven design. The post outlined some techniques for serializing domain objects into CouchDB documents.</p>
<h3>4. <a href="http://bradley-holt.com/2011/07/addressing-the-nosql-criticism/">Addressing the NoSQL Criticism</a></h3>
<p>I heard a lot of NoSQL bashing this year at OSCON. As a result, I decided to write a rebuttal to many of the criticisms that I heard. This post inspired a lively <a href="http://bradley-holt.com/2011/07/addressing-the-nosql-criticism/#comments">comment thread</a>.</p>
<h3>3. <a href="http://bradley-holt.com/2011/07/testing-php-5-4/">Testing PHP 5.4</a></h3>
<p>This was a short post on how to help the <a href="http://qa.php.net/">PHP Quality Assurance Team</a> by running the tests for the latest development version of PHP 5.4. It covered downloading, compiling, and running the tests. Most importantly, it also covered reporting your test results.</p>
<h3>2. <a href="http://bradley-holt.com/2011/07/exploring-rabbitmq-and-php/">Exploring RabbitMQ and PHP</a></h3>
<p>I was exploring the possibility of using RabbitMQ for an upcoming project. I decided to post some notes on my experience getting started with RabbitMQ and integrating it with PHP. I haven&#8217;t ended up using RabbitMQ in production yet, but I&#8217;m confident that I&#8217;ll end up using it at some point.</p>
<h3>1. <a href="http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/">CouchDB jQuery Plugin Reference</a></h3>
<p>I had been frustrated by the lack of documentation for the CouchDB jQuery plugin—so decided to write my own. After I wrote the blog post, <a href="http://www.maxogden.com/">Max Ogden</a> pointed me to <a href="http://arandomurl.com/">Dale Harvey</a>‘s <a href="https://github.com/daleharvey/jquery.couch.js-docs">documentation generator for jquery.couch.js</a> and a copy of the generated <a href="http://daleharvey.github.com/jquery.couch.js-docs/symbols/index.html">jQuery CouchDB documentation</a>. Max and Dale are also working on a more flexible jquery.couch2.js.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2011/12/top-five-posts-of-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CouchApps at CouchConf NYC</title>
		<link>http://bradley-holt.com/2011/10/couchapps-at-couchconf-nyc/</link>
		<comments>http://bradley-holt.com/2011/10/couchapps-at-couchconf-nyc/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 20:05:52 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CouchApp]]></category>
		<category><![CDATA[Couchbase]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[NoSQL]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=1413</guid>
		<description><![CDATA[Here are the slides from Monday&#8217;s CouchConf NYC session on CouchApps with CouchDB, JavaScript and HTML5: CouchConf NYC CouchApps View more presentations from Bradley Holt]]></description>
			<content:encoded><![CDATA[<p>Here are the slides from Monday&#8217;s CouchConf NYC session on CouchApps with CouchDB, JavaScript and HTML5:</p>
<div style="width:425px" id="__ss_9862348"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/bradley.holt/couchconf-nyc-couchapps-9862348" title="CouchConf NYC CouchApps" target="_blank">CouchConf NYC CouchApps</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/9862348" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/bradley.holt" target="_blank">Bradley Holt</a> </div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2011/10/couchapps-at-couchconf-nyc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CouchApps at jQuery Conference Boston 2011</title>
		<link>http://bradley-holt.com/2011/10/couchapps-at-jquery-conference-boston-2011/</link>
		<comments>http://bradley-holt.com/2011/10/couchapps-at-jquery-conference-boston-2011/#comments</comments>
		<pubDate>Sun, 02 Oct 2011 17:15:51 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CouchApp]]></category>
		<category><![CDATA[Couchbase]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQCon]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[NoSQL]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=1359</guid>
		<description><![CDATA[Here are the slides from today’s jQuery Conference presentation on CouchApps with CouchDB &#38; jQuery: jQuery Conference Boston 2011 CouchApps View more presentations from Bradley Holt If you were in this talk, please give me feedback on SpeakerRate. Related links: Offline Apps HTML5 Web Storage Local Storage &#8220;Native&#8221; Mobile Web Apps jQuery Mobile PhoneGap Building [...]]]></description>
			<content:encoded><![CDATA[<p>Here are the slides from today’s jQuery Conference presentation on CouchApps with CouchDB &amp; jQuery:</p>
<div style="width:425px" id="__ss_9504563"> <strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/bradley.holt/jquery-conference-boston-2011-couchapps" title="jQuery Conference Boston 2011 CouchApps" target="_blank">jQuery Conference Boston 2011 CouchApps</a></strong> <iframe src="http://www.slideshare.net/slideshow/embed_code/9504563" width="425" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>
<div style="padding:5px 0 12px"> View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/bradley.holt" target="_blank">Bradley Holt</a> </div>
</p></div>
<p>If you were in this talk, please give me <a href="http://speakerrate.com/talks/8512-couchapps-with-couchdb-jquery">feedback on SpeakerRate</a>.</p>
<p>Related links:</p>
<ul>
<li> Offline Apps
<ul>
<li> <a href="http://diveintohtml5.org/offline.html">HTML5 Web Storage</a></li>
<li> <a href="http://diveintohtml5.org/storage.html">Local Storage</a></li>
</ul>
</li>
<li> &#8220;Native&#8221; Mobile Web Apps
<ul>
<li> <a href="http://jquerymobile.com/">jQuery Mobile</a></li>
<li> <a href="http://www.phonegap.com/">PhoneGap</a></li>
<li> <a href="http://shop.oreilly.com/product/9780596805791.do">Building iPhone Apps with HTML, CSS, and JavaScript</a></li>
<li> <a href="http://shop.oreilly.com/product/0636920010067.do">Building Android Apps with HTML, CSS, and JavaScript</a></li>
</ul>
</li>
<li> CouchDB and Couchbase
<ul>
<li> <a href="http://couchdb.apache.org/">CouchDB</a></li>
<li> <a href="http://www.couchbase.com/products-and-services/overview">Couchbase</a></li>
<li> <a href="http://googlecode.blogspot.com/2009/09/chris-anderson-couchdb-relaxing-offline.html">&#8220;Ground Computing&#8221;</a></li>
</ul>
</li>
<li> CouchApp Examples
<ul>
<li> Grocery Sync
<ul>
<li> <a href="https://github.com/couchbaselabs/GrocerySync-CouchApp">Couchapp code</a></li>
<li> <a href="https://github.com/couchbaselabs/iOS-Couchbase-Demo">iOS code</a></li>
<li> <a href="https://github.com/couchbaselabs/AndroidGrocerySync">Android code</a></li>
<li> <a href="http://blog.couchbase.com/couchbase-mobile-see-the-video">Presentation about Couchbase Mobile</a></li>
</ul>
</li>
<li> Monocles
<ul>
<li> <a href="http://monocl.es/">Demo</a></li>
<li> <a href="https://github.com/maxogden/monocles">Code</a></li>
<li> ReadWriteHack Interview with Max Ogden: <a href="http://www.readwriteweb.com/hack/2011/02/hacker-chat-max-ogden.php">Part 1</a>, <a href="http://www.readwriteweb.com/hack/2011/02/max-pt-2.php">Part 2</a></li>
</ul>
</li>
<li> CatMapper
<ul>
<li> <a href="http://catmapper.com/">Demo</a></li>
<li> <a href="https://github.com/maxogden/catmapper">Code</a></li>
</ul>
</li>
</ul>
</li>
<li> CouchDB jQuery Plugin
<ul>
<li> <a href="http://www.w3.org/Security/wiki/Same_Origin_Policy">Same-Origin Policy</a></li>
<li> <a href="http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/">CouchDB jQuery Plugin Reference</a></li>
<li> <a href="http://daleharvey.github.com/jquery.couch.js-docs/symbols/index.html">jQuery CouchDB jsDoc Reference</a></li>
</ul>
</li>
<li> <a href="http://couchapp.org/page/couchapp-python">couchapp command line tool</a></li>
<li> CouchApp Building Blocks
<ul>
<li> <a href="http://couchapp.org/page/evently">Evently</a></li>
<li> <a href="http://mustache.github.com/">Mustache</a></li>
<li> <a href="http://couchapp.couchone.com/docs/_design/docs/index.html#/topic/pathbinder">Pathbinder</a></li>
</ul>
</li>
<li> Alternative CouchApp Tools
<ul>
<li> <a href="https://github.com/mikeal/node.couchapp.js">node.couchapp.js</a></li>
<li> <a href="http://kansojs.org/">Kanso Framework</a></li>
<li> <a href="https://github.com/quirkey/soca">soca</a></li>
<li> <a href="http://reupholster.iriscouch.com/reupholster/_design/app/index.html">Reupholster</a></li>
</ul>
</li>
<li> Hosting
<ul>
<li> <a href="http://www.iriscouch.com/">Iris Couch</a></li>
<li> <a href="https://cloudant.com/">Cloudant</a></li>
</ul>
</li>
<li> CouchDB &amp; CouchApp Resources
<ul>
<li> <a href="http://couchapp.org/">CouchApp Wiki</a></li>
<li> <a href="http://wiki.apache.org/couchdb/">CouchDB Wiki</a></li>
<li> <a href="http://oreilly.com/catalog/9780596155896/">CouchDB: The Definitive Guide</a></li>
<li> <a href="http://oreilly.com/catalog/9781449303129/">Writing and Querying MapReduce Views in CouchDB</a></li>
<li> <a href="http://oreilly.com/catalog/9781449303433/">Scaling CouchDB</a></li>
<li> <a href="http://www.apress.com/9781430272373">Beginning CouchDB</a></li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2011/10/couchapps-at-jquery-conference-boston-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Speaking at CouchConf NYC</title>
		<link>http://bradley-holt.com/2011/09/speaking-at-couchconf-nyc/</link>
		<comments>http://bradley-holt.com/2011/09/speaking-at-couchconf-nyc/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 16:33:58 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CouchApp]]></category>
		<category><![CDATA[Couchbase]]></category>
		<category><![CDATA[CouchConf]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[NYC]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=1352</guid>
		<description><![CDATA[I&#8217;m pleased to announce that I&#8217;ll be speaking at CouchConf New York City on October 24, 2011. This event is part of the CouchConf World Tour presented by Couchbase. My talk will be on CouchApps with CouchDB, JavaScript and HTML5. From the talk description: In this talk we&#8217;ll see how to build CouchApps using CouchDB, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pleased to announce that I&#8217;ll be speaking at <a href="http://www.couchbase.com/couchconf-nyc">CouchConf New York City</a> on October 24, 2011. This event is part of the <a href="http://www.couchbase.com/couchconf-world-tour">CouchConf World Tour</a> presented by Couchbase. My talk will be on CouchApps with CouchDB, JavaScript and HTML5. From the talk description:</p>
<blockquote><p>In this talk we&#8217;ll see how to build CouchApps using CouchDB, Javascript, and HTML5. We&#8217;ll look at related tools such as the couchapp command ine tool, the Evently jQuery plugin, the CouchDB API jQuery plugin, the CouchApp Loader, Pathbinder, and the Mustache templating framework.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2011/09/speaking-at-couchconf-nyc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CouchApps at OSCON 2011</title>
		<link>http://bradley-holt.com/2011/07/couchapps-at-oscon-2011/</link>
		<comments>http://bradley-holt.com/2011/07/couchapps-at-oscon-2011/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 23:30:23 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CouchApp]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[OSCON]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=1202</guid>
		<description><![CDATA[Here are the slides from today&#8217;s OSCON presentation on CouchApps with CouchDB, JavaScript &#38; HTML5: OSCON 2011 CouchApps View more presentations from Bradley Holt Related links: CouchDB jQuery Plugin Reference Same-Origin Policy &#8220;Ground Computing&#8221; HTML5 Web Storage Mustache Evently Evented Programming With jQuery couchapp command line tool (Python) Pathbinder node.couchapp.js Quick Intro to node.couchapp.js Interactive [...]]]></description>
			<content:encoded><![CDATA[<p>Here are the slides from today&#8217;s OSCON presentation on <a href="http://www.oscon.com/oscon2011/public/schedule/detail/18958">CouchApps with CouchDB, JavaScript &amp; HTML5</a>:</p>
<div id="__ss_8668164" style="width: 510px;"><strong style="display: block; margin: 12px 0 4px;"><a title="OSCON 2011 CouchApps" href="http://www.slideshare.net/bradley.holt/oscon-2011-couchapps" target="_blank">OSCON 2011 CouchApps</a></strong> <object id="__sse8668164" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="510" height="426" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=oscon-2011-couchapps-110722224335-phpapp01&amp;stripped_title=oscon-2011-couchapps&amp;userName=bradley.holt" /><param name="name" value="__sse8668164" /><param name="allowfullscreen" value="true" /><embed id="__sse8668164" type="application/x-shockwave-flash" width="510" height="426" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=oscon-2011-couchapps-110722224335-phpapp01&amp;stripped_title=oscon-2011-couchapps&amp;userName=bradley.holt" name="__sse8668164" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<div style="padding: 5px 0 12px;">View more <a href="http://www.slideshare.net/" target="_blank">presentations</a> from <a href="http://www.slideshare.net/bradley.holt" target="_blank">Bradley Holt</a></div>
</div>
<p>Related links:</p>
<ul>
<li><a href="../2011/07/couchdb-jquery-plugin-reference/">CouchDB jQuery Plugin Reference</a></li>
<li><a href="http://www.w3.org/Security/wiki/Same_Origin_Policy">Same-Origin Policy</a></li>
<li><a href="http://googlecode.blogspot.com/2009/09/chris-anderson-couchdb-relaxing-offline.html">&#8220;Ground Computing&#8221;</a></li>
<li><a href="http://dev.w3.org/html5/webstorage/">HTML5 Web Storage</a></li>
<li><a href="http://mustache.github.com/">Mustache</a></li>
<li><a href="http://couchapp.org/page/evently">Evently</a></li>
<li><a href="http://yehudakatz.com/2009/04/20/evented-programming-with-jquery/">Evented Programming With jQuery</a></li>
<li><a href="http://couchapp.org/page/couchapp-python">couchapp command line tool (Python)</a></li>
<li><a href="http://couchapp.couchone.com/docs/_design/docs/index.html#/topic/pathbinder">Pathbinder</a></li>
<li><a href="https://github.com/mikeal/node.couchapp.js">node.couchapp.js</a>
<ul>
<li><a href="http://japhr.blogspot.com/2010/04/quick-intro-to-nodecouchappjs.html">Quick Intro to node.couchapp.js </a></li>
<li><a href="http://vimeo.com/26147136">Interactive HTML5 CouchApps using node.couchapp.js</a></li>
</ul>
</li>
<li><a href="http://kansojs.org/">Kanso Framework</a></li>
<li><a href="https://github.com/quirkey/soca">Sammy On Couch App</a></li>
<li><a href="http://reupholster.iriscouch.com/reupholster/_design/app/index.html">Reupholster</a></li>
<li><a href="http://couchapp.org/page/list-of-couchapps">List of CouchApps</a></li>
<li><a href="http://www.iriscouch.com/">Iris Couch</a> (hosting)</li>
<li><a href="https://cloudant.com/">Cloudant</a> (hosting)</li>
<li>CouchDB &amp; CouchApp Resources
<ul>
<li><a href="http://couchapp.org/">CouchApp Wiki</a></li>
</ul>
<ul>
<li><a href="http://wiki.apache.org/couchdb/">CouchDB Wiki</a></li>
<li><a href="http://oreilly.com/catalog/9780596155896/">CouchDB: The Definitive Guide</a></li>
<li><a href="http://oreilly.com/catalog/9781449303129/">Writing and Querying MapReduce Views in CouchDB</a></li>
<li><a href="http://oreilly.com/catalog/9781449303433/">Scaling CouchDB</a></li>
<li><a href="http://www.apress.com/9781430272373">Beginning CouchDB</a></li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2011/07/couchapps-at-oscon-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CouchDB jQuery Plugin Reference</title>
		<link>http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/</link>
		<comments>http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/#comments</comments>
		<pubDate>Thu, 14 Jul 2011 22:18:46 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CouchApp]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=1143</guid>
		<description><![CDATA[I&#8217;ve had a difficult time finding documentation on the CouchDB jQuery plugin that ships with CouchDB. So, I&#8217;ve decided to create my own reference and share it with you. This should cover almost the entire CouchDB API that is available through the version of the plugin that ships with CouchDB 1.1.0. Setup The same-origin policy [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a difficult time finding documentation on the <a href="https://github.com/apache/couchdb/blob/trunk/share/www/script/jquery.couch.js">CouchDB jQuery plugin</a> that ships with CouchDB. So, I&#8217;ve decided to create my own reference and share it with you. This should cover almost the entire CouchDB API that is available through the version of the plugin that ships with CouchDB 1.1.0.</p>
<h3>Setup</h3>
<p>The <a href="http://www.w3.org/Security/wiki/Same_Origin_Policy">same-origin policy</a> effectively requires that the HTML from which the JavaScript is loaded must be served up from CouchDB (you could instead use a reverse proxy server). This can be done by attaching an HTML document to a CouchDB document. You can do this manually, or through the use of <a href="http://couchapp.org/">CouchApps</a>.</p>
<p>CouchDB ships with several useful JavaScript libraries, including jQuery. Here is an example of an HTML document that takes advantage of CouchDB&#8217;s included JavaScript libraries:</p>
<pre><code class="html">&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
    &lt;title&gt;CouchDB jQuery Examples&lt;/title&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
    &lt;script src="/_utils/script/json2.js"&gt;&lt;/script&gt;
    &lt;script src="/_utils/script/sha1.js"&gt;&lt;/script&gt;
    &lt;script src="/_utils/script/jquery.js?1.4.2"&gt;&lt;/script&gt;
    &lt;script src="/_utils/script/jquery.couch.js?0.11.0"&gt;&lt;/script&gt;
    &lt;script src="/_utils/script/jquery.dialog.js?0.11.0"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>By default, CouchDB will use an empty string as its URL prefix. However, you can configure this before your first API call. For example:</p>
<pre><code class="javascript">$.couch.urlPrefix = "http://localhost:5984";</code></pre>
<p>You will typically not want to change this value since the same-origin policy prevents you from accessing CouchDB databases hosted at a different origin.</p>
<h3>Server API</h3>
<h4>Server Information</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.info({
    success: function(data) {
        console.log(data);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>GET</strong> http://localhost:5984/ <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "couchdb"="Welcome",
    "version"="1.1.0"
}</code></pre>
<h4>All DBs</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.allDbs({
    success: function(data) {
        console.log(data);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>GET</strong> http://localhost:5984/_all_dbs <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">[
    "_replicator",
    "_users"
]</code></pre>
<h4>User Signup</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">var userDoc = {
    _id: "org.couchdb.user:bob",
    name: "bob"
};
$.couch.signup(userDoc, "supersecurepassword", {
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>PUT</strong> http://localhost:5984/_users/org.couchdb.user%3Abob <strong>201 Created</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "ok"=true,
    "id"="org.couchdb.user:bob",
    "rev"="1-230dc0625bd3c4aac735846cc152c296"
}</code></pre>
<h4>Login</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.login({
    name: "bob",
    password: "supersecurepassword",
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>POST</strong> http://localhost:5984/_session <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "ok":true,
    "name":"bob",
    "roles":[]
}</code></pre>
<p>This will result in an <code>AuthSession</code> cookie being set and then sent back to the server on subsequent requests, authenticating the user on each request. The session length is 10 minutes by default, but can be set in CouchDB&#8217;s <code>couch_httpd_auth.timeout</code> configuration option.</p>
<h4>Session</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.session({
    success: function(data) {
        console.log(data);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>GET</strong> http://localhost:5984/_session <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "ok":true,
    "userCtx":{
        "name":"bob",
         "roles":[]
    },
    "info":{
        "authentication_db":"_users",
        "authentication_handlers":[
            "oauth",
            "cookie",
            "default"
        ],
        "authenticated":"cookie"
    }
}</code></pre>
<h4>Logout</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.logout({
    success: function(data) {
        console.log(data);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>DELETE</strong> http://_:_@localhost:5984/_session <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "ok":true
}</code></pre>
<p>This will set the <code>AuthSession</code> cookie to an empty string, effectively logging the client out.</p>
<h4>Active Tasks</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.activeTasks({
    success: function(data) {
        console.log(data);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>GET</strong> http://localhost:5984/_active_tasks <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">[]</code></pre>
<h4>Server Configuration</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.config({
    success: function(data) {
        console.log(data);
    }
}, "uuids", "algorithm");</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>GET</strong> http://localhost:5984/_config/uuids/algorithm <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">"sequential"</code></pre>
<p>The second and third parameters are the <code>section</code> and <code>option</code> parameters, respectively. Omit the <code>option</code> parameter if you&#8217;d like to retrieve the entire section. Omit both the <code>section</code> and <code>option</code> parameters if you&#8217;d like to see the entire server configuration. Add an optional fourth parameter to set the configuration option&#8217;s value, which will result in a <code>PUT</code> request with the value.</p>
<h4>User DB</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.userDb(function(data) {
    console.log(data);
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>GET</strong> http://localhost:5984/_session <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "name"="_users",
    "uri"="../_users/"
}</code></pre>
<p>The URI will be relative to the HTML executing the script.</p>
<h4>New UUID</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">var uuid = $.couch.newUUID();
console.log(uuid);</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>GET</strong> http://localhost:5984/_uuids?count=1 <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">d12ee5ea1df6baa2b06451f44a0156fa</code></pre>
<p>This function takes a <code>count</code> parameter as an optional first parameter. If the <code>count</code> parameter is greater than one, then it will keep a cache of UUIDs that will be returned on subsequent calls, rather than making another request to the server.</p>
<h4>Replicate</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.replicate("mydb", "otherdb", {
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    }
}, {
    create_target: true
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>POST</strong> http://localhost:5984/_replicate <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "ok":true,
    "session_id":"705797bae87456c52f5b76f44fe5f245",
    "source_last_seq":27,
    "replication_id_version":2,
    "history":[
        {
            "session_id":"705797bae87456c52f5b76f44fe5f245",
            "start_time":"Wed, 13 Jul 2011 22:40:09 GMT",
            "end_time":"Wed, 13 Jul 2011 22:40:09 GMT",
            "start_last_seq":0,
            "end_last_seq":27,
            "recorded_seq":27,
            "missing_checked":0,
            "missing_found":14,
            "docs_read":14,
            "docs_written":14,
            "doc_write_failures":0
        }
    ]
}</code></pre>
<h3>Database API</h3>
<h4>Create Database</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").create({
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>PUT</strong> http://localhost:5984/mydb/ <strong>201 Created</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "ok":true
}</code></pre>
<h4>Database Info</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").info({
    success: function(data) {
        console.log(data);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>GET</strong> http://localhost:5984/mydb/ <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "db_name":"mydb",
    "doc_count":0,
    "doc_del_count":0,
    "update_seq":0,
    "purge_seq":0,
    "compact_running":false,
    "disk_size":79,
    "instance_start_time":"1310597000825187",
    "disk_format_version":5,
    "committed_update_seq":0
}</code></pre>
<h4>Save New Document</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">var doc = {};
$.couch.db("mydb").saveDoc(doc, {
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>POST</strong> http://localhost:5984/mydb/ <strong>201 Created</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "ok":true,
    "id":"d12ee5ea1df6baa2b06451f44a019ab9",
    "rev":"1-967a00dff5e02add41819138abb3284d"
}</code></pre>
<h4>Open Document</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").openDoc("d12ee5ea1df6baa2b06451f44a019ab9", {
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>GET</strong> http://localhost:5984/mydb/d12ee5ea1df6baa2b06451f44a019ab9 <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "_id":"d12ee5ea1df6baa2b06451f44a019ab9",
    "_rev":"1-967a00dff5e02add41819138abb3284d"
}</code></pre>
<p>Note that the HTTP response includes an <code>Etag</code> HTTP header. If you do a subsequent request for the same document, and your client supports caching and conditional HTTP requests, then an <code>If-None-Match</code> header should be sent using the value from the previous response&#8217;s <code>Etag</code> header. If the document has not been modified, then CouchDB will send a <code>304 Not Modified</code> response and no response body, saving bandwidth and speeding up the response.</p>
<h4>Save Updated Document</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">var doc = {
    _id: "d12ee5ea1df6baa2b06451f44a019ab9",
    _rev: "1-967a00dff5e02add41819138abb3284d",
    foo: "bar"
};
$.couch.db("mydb").saveDoc(doc, {
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>PUT </strong>http://localhost:5984/mydb/d12ee5ea1df6baa2b06451f44a019ab9 <strong>201 Created</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "ok":true,
    "id":"d12ee5ea1df6baa2b06451f44a019ab9",
    "rev":"2-13839535feb250d3d8290998b8af17c3"
}</code></pre>
<h4>Remove Document</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">var doc = {
    _id: "d12ee5ea1df6baa2b06451f44a019ab9",
    _rev: "2-13839535feb250d3d8290998b8af17c3"
};
$.couch.db("mydb").removeDoc(doc, {
     success: function(data) {
         console.log(data);
    },
    error: function(status) {
        console.log(status);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>DELETE </strong>http://localhost:5984/mydb/d12ee5ea1df6baa2b06451f44a019ab9?rev=2-13839535… <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "id":d12ee5ea1df6baa2b06451f44a019ab9
    "ok":true,
    "rev":"3-1f04f977685e1108b4664f70b09c6f65"
}</code></pre>
<h4>Bulk Save</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").bulkSave({"docs": [{}, {}]}, {
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>POST </strong>http://localhost:5984/mydb/_bulk_docs?successStatus=201 <strong>201 Created</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">[
    {
        "id":"d12ee5ea1df6baa2b06451f44a01a0d8",
        "rev":"1-967a00dff5e02add41819138abb3284d"
    },
    {
        "id":"d12ee5ea1df6baa2b06451f44a01a75a",
        "rev":"1-967a00dff5e02add41819138abb3284d"
    }
]</code></pre>
<h4>Bulk Remove</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">var docs = [
    {
        _id: "d12ee5ea1df6baa2b06451f44a01a0d8",
        _rev: "1-967a00dff5e02add41819138abb3284d"
    },
    {
        _id: "d12ee5ea1df6baa2b06451f44a01a75a",
        _rev: "1-967a00dff5e02add41819138abb3284d"
    }
];
$.couch.db("mydb").bulkRemove({"docs": docs}, {
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>POST </strong>http://localhost:5984/mydb/_bulk_docs?successStatus=201 <strong>201 Created</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">[
    {
        "id":"d12ee5ea1df6baa2b06451f44a01a0d8",
        "rev":"2-eec205a9d413992850a6e32678485900"
    },
    {
        "id":"d12ee5ea1df6baa2b06451f44a01a75a",
        "rev":"2-eec205a9d413992850a6e32678485900"
    }
]</code></pre>
<p>This operates almost exactly like the bulk save, but instead sets the <code>deleted</code> flag to <code>true</code> on the documents.</p>
<h4>All Documents</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").allDocs({
    success: function(data) {
        console.log(data);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>GET </strong>http://localhost:5984/mydb/_all_docs <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "total_rows":11,
    "offset":0,
    "rows":[
        {
            "id":"_design/default",
            "key":"_design/default",
            "value":{
                "rev":"9-5212dde9da06f1933dbe29811fc380d4"
            }
        },
        {
            "id":"d12ee5ea1df6baa2b06451f44a002cef",
            "key":"d12ee5ea1df6baa2b06451f44a002cef",
            "value":{
                "rev":"1-967a00dff5e02add41819138abb3284d"
            }
        },
        …
    ]
}</code></pre>
<h4>All Design Documents</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").allDesignDocs({
    success: function(data) {
        console.log(data);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>GET </strong>
http://localhost:5984/mydb/_all_docs?startkey=%22_design%22&amp;endkey=%22_design0%22 <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "total_rows":11,
    "offset":0,
    "rows":[
        {
            "id":"_design/default",
            "key":"_design/default",
            "value":{
                "rev":"9-5212dde9da06f1933dbe29811fc380d4"
            }
        }
    ]
}</code></pre>
<h4>All Apps</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("tutorial").allApps({
    success: function(data) {
        console.log(data);
    },
    eachApp: function(appName, appPath, ddoc) {
        console.log(appName);
        console.log(appPath);
        console.log(ddoc);
    }
});</code></pre>
<p>Resulting HTTP requests:</p>
<pre><code class="no-highlight"><strong>GET </strong>http://localhost:5984/tutorial/_all_docs?startkey=%22_design%22&amp;endkey=%22_design0%22 <strong>200 OK</strong></code></pre>
<pre><code class="no-highlight"><strong>GET </strong>http://localhost:5984/tutorial/_design/tutorial <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">tutorial</code></pre>
<pre><code class="javascript">/tutorial/_design/tutorial/index.html</code></pre>
<pre><code class="javascript">{
    "_id":"_design/tutorial",
    "_rev":"5-276897ecff6dc272c0b9143aa23e8a2e",
    …
}</code></pre>
<p>This is intended as a convenience to find metadata about CouchApps.</p>
<h4>Query</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">var mapFunction = function(doc) {
    emit();
};
$.couch.db("mydb").query(mapFunction, "_count", "javascript", {
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    },
    reduce: false
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>POST </strong>http://localhost:5984/mydb/_temp_view?reduce=false <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "total_rows":10,
    "offset":0,
    "rows":[
        {
            "id":"d12ee5ea1df6baa2b06451f44a002cef",
            "key":null,
            "value":null
        },
        {
            "id":"d12ee5ea1df6baa2b06451f44a0037b5",
            "key":null,
            "value":null
        },
        {
            "id":"d12ee5ea1df6baa2b06451f44a003b06",
            "key":null,
            "value":null
        },
        …
    ]
}</code></pre>
<p>This creates a temporary view as defined by your map and reduce functions. Temporary views are useful in development, but should be replaced with views permanently saved to design documents for production. Temporary views are slow, especially with a large number of documents.</p>
<h4>View</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").view("default/all", {
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    },
    reduce: false
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>GET </strong>http://localhost:5984/mydb/_design/default/_view/all?reduce=false <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "total_rows":10,
    "offset":0,
    "rows":[
        {
            "id":"d12ee5ea1df6baa2b06451f44a002cef",
            "key":null,
            "value":null
        },
        {
            "id":"d12ee5ea1df6baa2b06451f44a0037b5",
            "key":null,
            "value":null
        },
        {
            "id":"d12ee5ea1df6baa2b06451f44a003b06",
            "key":null,
            "value":null
        },
        …
    ]
}</code></pre>
<h4>List</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").list("default/all", "all", {
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    },
    reduce: false
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>GET </strong>http://localhost:5984/mydb/_design/default/_list/all/all?reduce=false <strong>200 OK</strong></code></pre>
<p>The console output will depend on your list&#8217;s behavior.</p>
<h4>Compact</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").compact({
    success: function(data) {
        console.log(data);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>POST </strong>http://localhost:5984/mydb/_compact <strong>202 Accepted</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "ok":true
}</code></pre>
<h4>View Cleanup</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").viewCleanup({
    success: function(data) {
        console.log(data);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>POST </strong>http://localhost:5984/mydb/_view_cleanup <strong>202 Accepted</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "ok":true
}</code></pre>
<h4>Compact View</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").compactView("default", {
    success: function(data) {
        console.log(data);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>POST </strong>http://localhost:5984/mydb/_compact/default <strong>202 Accepted</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "ok":true
}</code></pre>
<h4>Changes</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").changes().onChange(function(data) {
    console.log(data);
});</code></pre>
<p>Resulting HTTP requests:</p>
<pre><code class="no-highlight"><strong>GET </strong>http://localhost:5984/mydb/ <strong>200 OK</strong></code></pre>
<pre><code class="no-highlight"><strong>GET </strong>http://localhost:5984/mydb/_changes?heartbeat=10000&amp;feed=longpoll&amp;since=34 <strong>200 OK</strong></code></pre>
<p>This will keep a connection open until changes are detected, and then open up another connection to listen for subsequent changes starting from the next sequence.</p>
<p>Console output when a new document is created:</p>
<pre><code class="javascript">{
    "results":[
        {
            "seq":35,
            "id":"d12ee5ea1df6baa2b06451f44a01b7b5",
            "changes":[
                {
                    "rev":"1-967a00dff5e02add41819138abb3284d"
                }
            ]
        }
    ],
    "last_seq":35
}</code></pre>
<p>This is very powerful feature. It allows you to listen for any changes to documents in the database and immediately respond to those changes.</p>
<h4>Copy Document</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").copyDoc("d12ee5ea1df6baa2b06451f44a01b7b5", {
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    }
}, {
    beforeSend: function(xhr) {
        xhr.setRequestHeader("Destination", "aNewDocId");
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>COPY </strong>http://localhost:5984/mydb/d12ee5ea1df6baa2b06451f44a01b7b5 <strong>201 Created</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "id":"aNewDocId",
    "rev":"1-967a00dff5e02add41819138abb3284d"
}</code></pre>
<h4>Drop Database</h4>
<p>JavaScript example:</p>
<pre><code class="javascript">$.couch.db("mydb").drop({
    success: function(data) {
        console.log(data);
    },
    error: function(status) {
        console.log(status);
    }
});</code></pre>
<p>Resulting HTTP request:</p>
<pre><code class="no-highlight"><strong>DELETE </strong>http://localhost:5984/mydb/ <strong>200 OK</strong></code></pre>
<p>Console output:</p>
<pre><code class="javascript">{
    "ok":true
}</code></pre>
<p><a href="https://en.oreilly.com/oscon2011/public/regwith/os11rad"><img class="alignleft" style="border: 0pt none;" title="O'Reilly OSCON" src="http://radar.oreilly.com/oscon-code-os11rad.png" border="0" alt="O'Reilly OSCON" width="148" height="160" /></a>I&#8217;ll be <a href="http://www.oscon.com/oscon2011/public/schedule/detail/18958">giving a presentation on CouchApps at OSCON</a> if you want to learn more about building CouchApps. This presentation will be a part of the <a href="http://www.oscon.com/oscon2011/public/schedule/topic/Javascript+&amp;+HTML5">JavaScript and HTML5 track</a>. You can <a href="https://en.oreilly.com/oscon2011/public/regwith/os11rad">save 20% on registration with the code OS11RAD</a>. I&#8217;ll also be presenting a <a href="http://www.oscon.com/oscon2011/public/schedule/detail/18964">tutorial on Learning CouchDB at OSCON Data</a>.</p>
<p>You can also check out my books <a href="http://oreilly.com/catalog/9781449303129/">Writing and Querying MapReduce Views in CouchDB</a> and <a href="http://oreilly.com/catalog/9781449303433/">Scaling CouchDB</a> if you&#8217;re interested in learning more about CouchDB in general.</p>
<p><em>Update (7/15/2011)</em>: <a href="http://www.maxogden.com/">Max Ogden</a> has pointed me to <a href="http://arandomurl.com/">Dale Harvey</a>&#8216;s <a href="https://github.com/daleharvey/jquery.couch.js-docs">documentation generator for jquery.couch.js</a> and a copy of the generated <a href="http://daleharvey.github.com/jquery.couch.js-docs/symbols/index.html">jQuery CouchDB documentation</a>. Max and Dale are also working on a more flexible <a href="https://github.com/maxogden/removalist/blob/master/attachments/script/jquery.couch2.js">jquery.couch2.js</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2011/07/couchdb-jquery-plugin-reference/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>O&#8217;Reilly Radar on CouchDB and HTML5</title>
		<link>http://bradley-holt.com/2011/06/oreilly-radar-on-couchdb-and-html5/</link>
		<comments>http://bradley-holt.com/2011/06/oreilly-radar-on-couchdb-and-html5/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 15:59:10 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[CouchApp]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[Ground Computing]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[IndexedDB]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Mobile Computing]]></category>
		<category><![CDATA[OSCON]]></category>
		<category><![CDATA[Web Storage]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=1118</guid>
		<description><![CDATA[I was recently interviewed by Audrey Watters of O&#8217;Reilly Radar on what CouchDB can do for HTML5, web apps and mobile. We discussed CouchDB, CouchApps, JavaScript, HTML5, web applications, mobile application development (Android/iOS), Web Storage, IndexedDB, replication, and &#8220;ground computing&#8221;. Read the full interview for the details of what we talked about. I&#8217;ll be giving [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently interviewed by <a href="http://radar.oreilly.com/audreyw/index.html">Audrey Watters</a> of O&#8217;Reilly Radar on <a href="http://radar.oreilly.com/2011/06/couchdb-couchapps-html5-mobile.html">what CouchDB can do for HTML5, web apps and mobile</a>. We discussed <a href="http://couchdb.apache.org/">CouchDB</a>, <a href="http://couchapp.org/page/index">CouchApps</a>, JavaScript, HTML5, web applications, mobile application development (<a href="http://gigaom.com/2010/08/10/couchdb-says-hello-to-google-android/">Android</a>/<a href="http://www.readwriteweb.com/hack/2011/03/couchbase-ios-developer-preview.php">iOS</a>), <a href="http://dev.w3.org/html5/webstorage/">Web Storage</a>, <a href="http://www.w3.org/TR/IndexedDB/">IndexedDB</a>, <a href="http://wiki.apache.org/couchdb/Replication">replication</a>, and &#8220;ground computing&#8221;. <a href="http://radar.oreilly.com/2011/06/couchdb-couchapps-html5-mobile.html">Read the full interview</a> for the details of what we talked about.</p>
<p><a href="https://en.oreilly.com/oscon2011/public/regwith/os11rad"><img class="alignleft" title="O'Reilly OSCON" src="http://radar.oreilly.com/oscon-code-os11rad.png" border="0" alt="O'Reilly OSCON" width="148" height="160" /></a>I&#8217;ll be <a href="http://www.oscon.com/oscon2011/public/schedule/detail/18958">giving a presentation on CouchApps at OSCON</a> if you want to learn more about CouchApps, JavaScript, and HTML5. This presentation will be a part of the <a href="http://www.oscon.com/oscon2011/public/schedule/topic/Javascript+&amp;+HTML5">JavaScript and HTML5 track</a>. You can <a href="https://en.oreilly.com/oscon2011/public/regwith/os11rad">save 20% on registration with the code OS11RAD</a>. I&#8217;ll also be presenting a <a href="http://www.oscon.com/oscon2011/public/schedule/detail/18964">tutorial on Learning CouchDB at OSCON Data</a>.</p>
<p>You can also check out my books <a href="http://oreilly.com/catalog/9781449303129/">Writing and Querying MapReduce Views in CouchDB</a> and <a href="http://oreilly.com/catalog/9781449303433/">Scaling CouchDB</a> if you&#8217;re interested in learning more about CouchDB in general.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2011/06/oreilly-radar-on-couchdb-and-html5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML 5, HTTP Methods &amp; REST</title>
		<link>http://bradley-holt.com/2009/07/html-5-http-methods-rest/</link>
		<comments>http://bradley-holt.com/2009/07/html-5-http-methods-rest/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 23:07:00 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/2009/07/html-5-http-methods-rest/</guid>
		<description><![CDATA[Lots of very exciting things are happening right now for us web standards aficionados. The big news is the buzz around HTML 5 and its growing support in modern web browsers (modern meaning not Internet Explorer). The current state of web standards makes it difficult, but certainly not impossible, to use the web as a [...]]]></description>
			<content:encoded><![CDATA[<p>Lots of very exciting things are happening right now for us web standards aficionados. The big news is the buzz around <a href="http://en.wikipedia.org/wiki/HTML_5">HTML 5</a> and its growing support in modern web browsers (modern meaning not Internet Explorer). The current state of web standards makes it difficult, but certainly not impossible, to use the web as a true application platform. HTML 5 promises to change this (maybe not <a href="http://www.webmonkey.com/blog/HTML_5_Won_t_Be_Ready_Until_2022DOT_Yes__2022DOT">fully until 2022</a> — but we&#8217;re patient). <a href="http://www.alistapart.com/articles/previewofhtml5/">Many</a> <a href="http://www.infoworld.com/d/developer-world/html-5-could-it-kill-flash-and-silverlight-291">articles</a> <a href="http://www.zeldman.com/2009/07/02/xhtml-wtf/">have</a> <a href="https://developer.mozilla.org/en/Canvas_tutorial">been</a> <a href="http://ajaxian.com/archives/html5-canvas-cheat-sheet">written</a> <a href="http://a.deveria.com/caniuse/">about</a> HTML 5 but there&#8217;s one tiny, but very important, feature I&#8217;d like to focus on here: support for the HTTP PUT and DELETE <a href="http://www.w3.org/TR/html5/forms.html#form-submission-0">methods in forms</a>. First, a little bit about REST…</p>
<p>I&#8217;ve <a href="http://bradley-holt.com/2008/04/its-a-restful-world/">talked about REST</a> here before but REST is useful for more than just building web services. REST is an abbreviation for <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer">representational state transfer</a> and is an architectural style for building software. The web itself is built using REST so it is a proven and scalable architecture. Unfortunately many web developers ignore REST to their detriment. Conforming to REST principles can help with search engine optimization (SEO) as well as make your web applications more usable (through predictability of actions) and scalable (the web itself has scaled to massive proportions).</p>
<p>Using a RESTful approach, every URL is a <em>representation</em> of a resource (a noun). These resources can then be retrieved and manipulated (have their <em>state</em> changed) using a standard set of verbs. These verbs are actually <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html">HTTP methods</a>. There are a whole bunch of verbs/HTTP methods but only worry about four of them (at least for now): GET, POST, PUT, and DELETE. Here is an example of how some nouns and verbs can be used to together, borrowing from the <a href="http://www.atomenabled.org/developers/protocol/">Atom Publishing Protocol</a> (APP):</p>
<table style="border-collapse: collapse;">
<tbody>
<tr>
<th style="text-align: left;">HTTP method</th>
<th style="text-align: left;">URI</th>
<th style="text-align: left;">result</th>
</tr>
<tr>
<td>GET</td>
<td>/people</td>
<td>GETs a collection of people</td>
</tr>
<tr>
<td>POST</td>
<td>/people</td>
<td>POSTs a new person to the collection (using data in the POST request)</td>
</tr>
<tr>
<td>GET</td>
<td>/people/bradley-holt</td>
<td>GETs bradley-holt</td>
</tr>
<tr>
<td>PUT</td>
<td>/people/bradley-holt</td>
<td>PUTs an updated version of bradley-holt (using data in the PUT request)</td>
</tr>
<tr>
<td>DELETE</td>
<td>/people/bradley-holt</td>
<td>DELETEs bradley-holt</td>
</tr>
</tbody>
</table>
<p>The problem was that up until now there was no way to specify a form method other than GET or POST. This meant that everything had to be tunneled through POST (or had to be done using JavaScript) which, while not technically incorrect, was incovenient and did not allow web developers to fully express the intent of user actions. HTML 5 specifies that forms can now have the methods of PUT and DELETE as well. This simple addition is one small way in which HTML 5 will allow the web to become more of a fully-feature application platform.</p>
<p>For you Zend Framework developers: I just <a href="http://twitter.com/weierophinney/status/2556823195">learned</a> today that Zend Framework 1.9 will include a new <a href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Controller_Router_Route_Rest+-+Luke+Crouch">REST router</a> which will help web developers adhere to RESTful principles. Please use it and also use the new PUT and DELETE methods in HTML 5 forms as browser support catches on.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2009/07/html-5-http-methods-rest/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

