<?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>Brit Gardner &#187; code</title>
	<atom:link href="http://britg.com/tags/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://britg.com</link>
	<description>The big yellow one&#039;s the sun.</description>
	<lastBuildDate>Fri, 03 Feb 2012 05:08:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Results are in &#8211; No One Likes Working With Time</title>
		<link>http://britg.com/2009/01/15/results-are-in-no-one-likes-working-with-time/</link>
		<comments>http://britg.com/2009/01/15/results-are-in-no-one-likes-working-with-time/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 13:14:52 +0000</pubDate>
		<dc:creator>britg</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[timeago]]></category>

		<guid isPermaLink="false">http://britg.com/?p=557</guid>
		<description><![CDATA[I recently performed a very Scientific survery asking &#8216;do you like working with time?&#8217;  I don&#8217;t mean &#8216;working with time constraints&#8217;, or &#8216;working with a person whos name is Time but they probably spell it like PThyhm (the P is silent).&#8217;  No, I mean working with time (timestamps, date formating, human-friendly time representation, etc) in [...]]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-560" href="http://britg.com/2009/01/15/results-are-in-no-one-likes-working-with-time/20fswp3/"><img class="alignright size-medium wp-image-560" title="20fswp3" src="http://britg.com/wordpress/wp-content/uploads/2009/01/20fswp3-211x300.jpg" alt="20fswp3" width="211" height="300" /></a>I recently performed a very Scientific survery asking &#8216;do you like working with time?&#8217;  I don&#8217;t mean &#8216;working with time constraints&#8217;, or &#8216;working with a person whos name is Time but they probably spell it like PThyhm (the P is silent).&#8217;  No, I mean working with time (timestamps, date formating, human-friendly time representation, etc) in your code &#8212; do you like it?</p>
<p>The results may or may not surprise you.  With a sample size of 1, most if not all of those surveyed responded that they very strongly dislike working with timestamps!</p>
<p>I strongly agree with the person surveyed, so that&#8217;s why I&#8217;m so elated that I stumbled upon this repo on github the other day &#8212; <a title="jQuery Timeago" href="http://github.com/rmm5t/jquery-timeago/tree/master">jQuery timeago</a>.  Yes!  Finally I can just dump my timestamps straight from the database onto the page, call $.timeago(&#8216;selector&#8217;), and bam &#8212; a perfectly human readable, self updating time representation.</p>
<p>If you&#8217;re one of the many that agree with the extremely scientific survey above, then I highly recommend you give this jQuery plugin a try &#8211; here&#8217;s the plugins <a title="jQuery Timeago" href="http://timeago.yarp.com/">homepage</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://britg.com/2009/01/15/results-are-in-no-one-likes-working-with-time/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using CouchDB For Storing Google Geocoded JSON Data</title>
		<link>http://britg.com/2008/08/15/using-couchdb-for-storing-google-geocoded-json-data/</link>
		<comments>http://britg.com/2008/08/15/using-couchdb-for-storing-google-geocoded-json-data/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 19:11:43 +0000</pubDate>
		<dc:creator>britg</dc:creator>
				<category><![CDATA[news]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[couchdb]]></category>
		<category><![CDATA[google geocoding]]></category>

		<guid isPermaLink="false">http://britg.com/?p=329</guid>
		<description><![CDATA[Recently, I&#8217;ve been working on a project that requires a lot of geocoding.  Google provides a free service that takes any string as an input and returns a bunch of JSON encoded data if that string matches a physical location.  Check it out here. Unfortunately, Google&#8217;s geocoding service is limited to 15k requests per day [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" src="http://britg.com/wp-content/uploads/2008/05/couch.png" alt="" width="397" height="96" />Recently, I&#8217;ve been working on a project that requires a lot of geocoding.  Google provides a free service that takes any string as an input and returns a bunch of JSON encoded data if that string matches a physical location.  <a href="http://code.google.com/apis/maps/documentation/services.html#Geocoding">Check it out here</a>.</p>
<p>Unfortunately, Google&#8217;s geocoding service is limited to 15k requests per day per IP.  Sounds like a lot, but for certain applications this limit can be reached very quickly.</p>
<p>What&#8217;s a good solution in these cases?  Why, how about use my favorite up-and-coming database, <a href="http://incubator.apache.org/couchdb/">CouchDB</a>, to store a repository of geo-data mined from Google?  Why use CouchDB?  As previously mentioned, google natively return JSON data for geocoding requests.  Perfect.  CouchDB just happens to store documents natively in JSON!</p>
<p>The following is a rough and tumble library I put together called <a href="http://geocouch.googlecode.com/files/geocouch.php">GeoCouch</a> that you can use to easily handle geocoded data in CouchDB.  This lib has a narrow scope right now &#8211; the requirements are:</p>
<ol>
<li>PHP 5+</li>
<li>CouchDB</li>
<li>A Google API Key (<a href="http://code.google.com/apis/maps/signup.html">get one here</a>)</li>
</ol>
<h2>Usage</h2>
<p>Using the GeoCouch is dead simple.<br />
<a href="http://geocouch.googlecode.com/files/geocouch.php">Grab the file here.</a></p>
<pre lang="php">
<?php
	require ('geocouch.php');

	/*
	 * Don't forget to edit the $GeoCouch->conf parameters!
	 */
	$GeoCouch = new GeoCouch();

	/*
	 * The all-in-one method.
	 * This geocodes the string and writes it to CouchDB
	 * The second parameter is any other fields other
	 * than the Google data that you want to save along
	 * with this document.
	 *
	 * NOTE: if this address already exists in CouchDB
	 * a new revision is created.
	 *
	 * Returns the CouchDB response, i.e.:
	 * {"ok" : true, "rev":"3825793742", "id" : "dallas-tx" }
	 */
	$GeoCouch->save('Dallas, TX', array('custom_field' => 'value')); 

	/*
	 * Simply geo coding.
	 * Does not write to CouchDB.
	 * Returns an Google Geocoded Object.
	 */
	$geoObj = $GeoCouch->geoCode('Dallas, TX');

	/*
	 * Write some Geo JSON to CouchDB.
	 * First parameter is a unique name for the data
	 * Second parameter is the JSON - in
	 * this case the json_encoded $geoObj from above.
	 */
	$GeoCouch->put('Dallas, TX', json_encode($geoObj));

	/*
	 * Get some existing geo data
	 */
	$geoObj = $GeoCouch->get('Dallas, TX');
?>
</pre>]]></content:encoded>
			<wfw:commentRss>http://britg.com/2008/08/15/using-couchdb-for-storing-google-geocoded-json-data/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

