<?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; JavaScript</title>
	<atom:link href="http://bradley-holt.com/tag/javascript/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>CouchDB 1.1 Released</title>
		<link>http://bradley-holt.com/2011/06/couchdb-1-1-released/</link>
		<comments>http://bradley-holt.com/2011/06/couchdb-1-1-released/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 21:40:11 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[Databases]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=1107</guid>
		<description><![CDATA[CouchDB 1.1 was released this past Friday. CouchBase has a CouchDB Release 1.1 Feature Guide that provides details on the new features available in CouchDB 1.1. Some of the key new features include: A replicator database that stores replications which are automatically restarted when the server restarts Native SSL support—you can now connect to CouchDB [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://couchdb.apache.org/">CouchDB</a> 1.1 was released this past Friday. CouchBase has a <a href="http://docs.couchbase.org/couchdb-release-1.1/">CouchDB Release 1.1 Feature Guide</a> that provides details on the new features available in CouchDB 1.1. Some of the key new features include:</p>
<ul>
<li>A <a href="http://docs.couchbase.org/couchdb-release-1.1/index.html#couchb-release-1.1-replicatordb">replicator database</a> that stores replications which are automatically restarted when the server restarts</li>
<li><a href="http://docs.couchbase.org/couchdb-release-1.1/index.html#couchdb-release-1.1-ssl">Native SSL support</a>—you can now connect to CouchDB securely without maintaining a separate proxy server that handles SSL</li>
<li><a href="http://docs.couchbase.org/couchdb-release-1.1/index.html#couchdb-release-1.1-httprange">HTTP range requests</a>—this allows for resumable downloads and skippable audio and video streams</li>
<li><a href="http://docs.couchbase.org/couchdb-release-1.1/index.html#couchdb-release-1.1-proxying">HTTP proxying</a>—allows external content to be served from your CouchDB URL</li>
<li><a href="http://docs.couchbase.org/couchdb-release-1.1/index.html#couchdb-release-1.1-commonjs">Map functions now support CommonJS</a>—this allows for reuse of JavaScript code</li>
<li><a href="http://docs.couchbase.org/couchdb-release-1.1/index.html#couchdb-release-1.1-etag">More granular ETags on view responses</a>—this increases the probability of a <code>304 Not Modified</code> response when doing conditional requests</li>
</ul>
<p>See the <a href="http://docs.couchbase.org/couchdb-release-1.1/">CouchDB Release 1.1 Feature Guide</a> for the complete list and more detail.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2011/06/couchdb-1-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CouchDB 1.0 Released</title>
		<link>http://bradley-holt.com/2010/07/couchdb-1-0-released/</link>
		<comments>http://bradley-holt.com/2010/07/couchdb-1-0-released/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 16:25:59 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[btvphpug]]></category>
		<category><![CDATA[CouchDB]]></category>
		<category><![CDATA[FOSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=704</guid>
		<description><![CDATA[Apache CouchDB is a free/open source RESTful JSON document (NoSQL) database with map reduce views and peer-based replication. Version 1.0 was just released today and is 300% faster than the previous version and includes Microsoft Windows support, an authentication system, and flexible replicator options. The New York Times, ReadWriteEnterprise and InfoWorld covered the release. Couchio [...]]]></description>
			<content:encoded><![CDATA[<p>Apache CouchDB is a free/open source RESTful JSON  document (NoSQL) database with map reduce views and peer-based  replication. Version 1.0 was just released today and is 300% faster than the previous version and  includes Microsoft Windows support, an authentication system, and  flexible replicator options. The <a href="http://www.nytimes.com/external/idg/2010/07/14/14idg-couchdb-nosql-database-ready-for-production-use-58614.html">New York Times</a>, <a rel="nofollow" href="http://www.readwriteweb.com/enterprise/2010/07/nosql-database-couchdb.php">ReadWriteEnterprise</a> and <a rel="nofollow" href="http://www.infoworld.com/d/data-management/couchdb-releases-nosql-database-runs-windows-229">InfoWorld</a> covered the release. Couchio has a <a rel="nofollow" href="http://www.couch.io/">clever release announcement</a> as well. I&#8217;ve been reading up on CouchDB since <a href="http://weierophinney.net/matthew/">Matthew Weier O’Phinney</a>&#8216;s  presentation on Document Databases at the last <a href="http://groups.google.com/group/burlington-vt-php">Burlington,  VT  PHP Users Group</a> meeting and I may have some projects where CouchDB will be a good fit.</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2010/07/couchdb-1-0-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>TEK·X Arrival and Day Zero</title>
		<link>http://bradley-holt.com/2010/05/tek%c2%b7x-arrival-and-day-zero/</link>
		<comments>http://bradley-holt.com/2010/05/tek%c2%b7x-arrival-and-day-zero/#comments</comments>
		<pubDate>Wed, 19 May 2010 01:20:04 +0000</pubDate>
		<dc:creator>Bradley Holt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[tekX]]></category>
		<category><![CDATA[tekX10]]></category>

		<guid isPermaLink="false">http://bradley-holt.com/?p=673</guid>
		<description><![CDATA[Yesterday I arrived in Chicago for my first TEK·X PHP conference. After getting in, I had an interesting conversation with Bill Karwin over dinner. Bill is the author of  SQL Antipatterns and is presenting on SQL Injection Myths and Fallacies as well as Models for Hierarchical Data with SQL and PHP here at TEK·X. I [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I arrived in Chicago for my first <a href="http://tek.phparch.com/">TEK·X</a> PHP conference. After getting in, I had an interesting conversation with <a href="http://karwin.blogspot.com/">Bill Karwin</a> over dinner. Bill is the author of  <a href="http://www.pragprog.com/titles/bksqla/sql-antipatterns">SQL Antipatterns</a> and is presenting on <a href="http://tek.phparch.com/talks/#TEKXS37">SQL Injection Myths and Fallacies</a> as well as <a href="http://tek.phparch.com/talks/#TEKXS09">Models for Hierarchical Data with SQL and PHP</a> here at TEK·X. I was able to pick his brain on a wide range of topics including his thoughts on <a href="http://en.wikipedia.org/wiki/NoSQL">NoSQL</a> and <a href="http://en.wikipedia.org/wiki/Object-relational_mapping">Object-Relational Mappers</a> (ORMs). I tend to be skeptical of both (although there are certainly uses for both) and I got the sense from our conversation that my skepticism is well founded.</p>
<p>Today was tutorial day, or day zero. This morning I attended Arne Blankerts&#8217; <a href="http://tek.phparch.com/talks/#TEKXT03">Bad Guy For a Day – A Websecurity hands-on tutorial</a>. I liked that he took a step back and looked at the different types of security such as the transport layer, infrastructure layer, data warehouse, user interface design, user level security, and application level security. He talked about the usual suspects such as <a href="http://en.wikipedia.org/wiki/Cross-site_scripting">cross-site scripting</a> (XSS), <a href="http://en.wikipedia.org/wiki/Session_fixation">session fixation</a>, <a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery">cross-site request forgery</a> (XSRF), and <a href="http://en.wikipedia.org/wiki/SQL_injection">SQL injection</a>. <a href="http://shiflett.org/blog/2005/feb/my-top-two-php-security-practices">Filtering input and escaping output</a> was also addressed, of course. He demonstrated attacks on several security holes in an (intentionally) badly written application. Take a look at the <a href="http://www.slideshare.net/TheSeer/bad-guy-for-a-day-a-websecurity-handson-tutorial">slides</a> for more details.</p>
<p>This afternoon I attended Ed Finkler&#8217;s <a href="http://tek.phparch.com/talks/#TEKXT05">JavaScript for PHP Developers</a> talk. Like most PHP developers, I find myself often working with other web technologies such as JavaScript. The object model in JavaScript is very different than in PHP and I found Ed&#8217;s explanations of these differences very helpful. The JavaScript core language is often confused with the <a href="http://en.wikipedia.org/wiki/Document_Object_Model">Document Object Model</a> (DOM) API and a clear explanation of the line between the two was also useful. His slides don&#8217;t appear to be posted yet, but I&#8217;ll link to them once they are.</p>
<p>One last note: if you happen to be here at TEK·X then be sure to rate the sessions on <a href="http://joind.in/">joind.in</a>. The speakers really appreciate the feedback!</p>
]]></content:encoded>
			<wfw:commentRss>http://bradley-holt.com/2010/05/tek%c2%b7x-arrival-and-day-zero/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

