<?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>Ben McRedmond</title>
	<atom:link href="http://benmcredmond.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://benmcredmond.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 26 Oct 2009 14:04:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>OhEmbedr: Embedding videos and images with oEmbed in Ruby</title>
		<link>http://benmcredmond.com/blog/2009/10/25/ohembedr-embedding-videos-and-images-with-oembed-in-ruby/</link>
		<comments>http://benmcredmond.com/blog/2009/10/25/ohembedr-embedding-videos-and-images-with-oembed-in-ruby/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 23:21:48 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/?p=107</guid>
		<description><![CDATA[

While working on the rewrite of my simple bookmarking service, Picomarks, I needed the capability to easily embed content from video sites like YouTube and Vimeo and image sharing sites like Flickr.

Originally I hacked together some code that would generate a YouTube embed from a YouTube video url before realising that I didn&#8217;t want to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://xkcd.com/619/"><img src="http://imgs.xkcd.com/comics/supported_features.png" title="I hear many of you finally have smooth Flash support, but me and my Intel card are still waiting on a kernel patch somewhere in the pipeline before we can watch Jon Stewart smoothly." alt="Supported Features" style="display: block; width:324px; margin-left: auto; margin-right: auto;"></a></p>

<p>While working on the rewrite of my simple bookmarking service, <a href="http://picomarks.com">Picomarks</a>, I needed the capability to easily embed content from video sites like YouTube and Vimeo and image sharing sites like Flickr.</p>

<p>Originally I hacked together some code that would generate a YouTube embed from a YouTube video url before realising that I didn&#8217;t want to do this for five or six sites. So I searched around and came across the <a href="http://oembed.com">oEmbed</a> standard, created by Leah Culver and others while they were developing Pownce.
<span id="more-107"></span>
oEmbed is a super simple way to get the embed code for all sorts of content including videos and images. For example if I found a <a href="http://www.flickr.com/photos/xdjio/226228060/">cool image</a> on flickr. To get the embed code (which is a  ridiculous process on flickr without oEmbed) I make a simple HTTP GET request to Flickr&#8217;s oEmbed API.</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">http://www.flickr.com/services/oembed?url=http://www.flickr.com/photos/xdjio/226228060/&amp;format=json</pre></div></div>


<p>Flickr responds with an oEmbed response which we requested to be in json.</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span>
    <span style="color: #3366CC;">&quot;version&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;1.0&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;type&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;photo&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;title&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Wasteland&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;author_name&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;xdjio&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;author_url&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;http://www.flickr.com/photos/xdjio/&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;cache_age&quot;</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">3600</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;provider_name&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Flickr&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;provider_url&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;http://www.flickr.com/&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;width&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;500&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;height&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;336&quot;</span><span style="color: #339933;">,</span>
    <span style="color: #3366CC;">&quot;url&quot;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;http://farm1.static.flickr.com/64/226228060_c88ba6cf6b.jpg&quot;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<p>Super simple, right? So I started looking for a way to do this in ruby and I found the <a href="http://github.com/judofyr/ruby-oembed">ruby-oembed</a> library on GitHub, there was no documentation; so I made my own library, <a href="http://github.com/benofsky/ohembedr/">OhEmbedr</a>.</p>

<p>To install just install the gem:</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># If you don't have gemcutters in your gem sources already
gem sources -a http://gemcutter.org
&nbsp;
# Then just gem install
gem install ohembedr</pre></div></div>


<p>Then to use OhEmbedr is just as easy:</p>


<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'ohembedr'</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">begin</span>
    o = <span style="color:#6666ff; font-weight:bold;">OhEmbedr::OhEmbedr</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:url</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;http://vimeo.com/6382511&quot;</span>, 
        <span style="color:#ff3333; font-weight:bold;">:maxwidth</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">600</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    embed_data = o.<span style="color:#CC0066; font-weight:bold;">gets</span>
<span style="color:#9966CC; font-weight:bold;">rescue</span> <span style="color:#6666ff; font-weight:bold;">OhEmbedr::UnsupportedError</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> error
    <span style="color:#008000; font-style:italic;"># URL not supported</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>


<p>We wrap it in a <em>begin rescue</em> block because OhEmbedr will raise an OhEmbedr::UnsupportedError if it encounters a URL which isn&#8217;t in its providers list, meaning we can pass any url to OhEmbedr and if this exception is raised we know that this url can&#8217;t be embedded by oEmbed. Currently the following providers are supported:</p>

<ul>
<li>YouTube</li>
<li>Vimeo</li>
<li>Flickr</li>
<li>Qik</li>
<li>Revision 3</li>
<li>Viddler</li>
<li>Hulu</li>
</ul>

<p>I do wish more people would adopt oEmbed, the idea of having a standard API for embedding data is really nice. Of course there are a few problems with oEmbed for example having to dig around on the provider site to find the oEmbed API URL but I don&#8217;t see anyone suggesting anything better.</p>

<p>So check out the OhEmbedr source on <a href="http://github.com/benofsky/ohembedr/">GitHub</a> or its <a href="http://gemcutter.org/gems/ohembedr">gemcutter</a> page.</p>

<p>Wonderful image from the brilliant <a href="http://xkcd.com/619/">xkcd</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=107</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New Blog&#8230; Yet Again&#8230;</title>
		<link>http://benmcredmond.com/blog/2009/09/22/new-blog-yet-again/</link>
		<comments>http://benmcredmond.com/blog/2009/09/22/new-blog-yet-again/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 20:01:02 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/?p=98</guid>
		<description><![CDATA[

If you&#8217;re reading this, you have quite obviously found my new blog, with a new design and the same rarely updated content!  So what I thought I&#8217;d do this time is put the focus on something else, make benmcredmond.com about me not my blog (keep the blog here for when I do have something [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://benmcredmond.com/wp-content/uploads/2009/09/341866875_a0e8c69f1e.jpg" alt="fireworks" title="fireworks" width="500" height="375" class="alignnone size-full wp-image-99" /></p>

<p>If you&#8217;re reading this, you have quite obviously found my new blog, with a new design and the same rarely updated content! <span id="more-98"></span> So what I thought I&#8217;d do this time is put the focus on something else, make benmcredmond.com about me not my blog (keep the blog here for when I do have something to say though). Enjoy!</p>

<p>P.S. Been working on something pretty cool the last few months so watch here for updates.</p>

<p>Picture &copy; <a href="http://www.flickr.com/photos/bestrated1/341866875/">Timothy K Hamilton</a></p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=98</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Being an Expert</title>
		<link>http://benmcredmond.com/blog/2009/09/18/being-an-exper/</link>
		<comments>http://benmcredmond.com/blog/2009/09/18/being-an-exper/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 17:11:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/?p=18</guid>
		<description><![CDATA[One of my favourite quotes from Jeff Atwood.

It troubles me greatly to hear that people see me as an expert or an authority, and not a fellow amateur.

If I&#8217;ve learned anything in my career, it is that approaching software development as an expert, as someone who has already discovered everything there is to know about [...]]]></description>
			<content:encoded><![CDATA[<p>One of my favourite quotes from Jeff Atwood.</p>

<blockquote>It troubles me greatly to hear that people see me as an expert or an authority, and not a fellow amateur.

If I&#8217;ve learned anything in my career, it is that approaching software development as an expert, as someone who has already discovered everything there is to know about a given topic, is the one surest way to fail.

Experts are, if anything, more suspect than the amateurs, because they&#8217;re less honest. You should question everything I write here, in the same way you question everything you&#8217;ve ever read online &#8212; or anywhere else for that matter. Your own research and data should trump any claims you read from anyone, no matter how much of an authority or expert you, I, Google, or the general community at large may believe them to be.

<cite><a href="http://www.codinghorror.com/blog/archives/001226.html">Jeff Atwood</a></cite>
</blockquote>

<p>If you don&#8217;t already read <a href="http://www.codinghorror.com">Coding Horror</a>, check it out, by far one of the best code-orientated blogs out there.
<span id="more-18"></span></p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=18</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Album Art with Amazon&#8217;s Product Advertising API</title>
		<link>http://benmcredmond.com/blog/2009/07/22/album-art-with-amazons-product-advertising-api/</link>
		<comments>http://benmcredmond.com/blog/2009/07/22/album-art-with-amazons-product-advertising-api/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 13:23:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/?p=10</guid>
		<description><![CDATA[For my upcoming project, I need to download album art programatically for songs. Everywhere recommends using Amazon to do so, yet there are no working examples of how.  So here&#8217;s how:



To use this script you must get an api key for Amazon Web Services and Amazon&#8217;s Product Advertising API.

To start with we do a [...]]]></description>
			<content:encoded><![CDATA[<p>For my upcoming project, I need to download album art programatically for songs. Everywhere recommends using Amazon to do so, yet there are no working examples of how. <span id="more-10"></span> So here&#8217;s how:</p>

<script src="http://gist.github.com/151989.js"></script>

<p>To use this script you must get an api key for <a href="http://aws.amazon.com">Amazon Web Services</a> and Amazon&#8217;s Product Advertising API.</p>

<p>To start with we do a search for &#8220;Album, Artist&#8221; (this I have found works better than searching for &#8220;song, artist&#8221; after all we are looking for &#8220;album&#8221; art), we take the ASIN for the top result. The ASIN is a unique identifier Amazon gives to every item in its catalog.</p>

<p>We then lookup the particular item that this ASIN refers to and ask for Amazon to give us the images for this product (lines 15-21).</p>

<p>Hope this explanation helps someone looking to do something similar.</p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=10</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DHValidation, a Cocoa Form Validation Library</title>
		<link>http://benmcredmond.com/blog/2009/07/18/dhvalidation-a-cocoa-form-validation-library/</link>
		<comments>http://benmcredmond.com/blog/2009/07/18/dhvalidation-a-cocoa-form-validation-library/#comments</comments>
		<pubDate>Sat, 18 Jul 2009 13:17:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/?p=14</guid>
		<description><![CDATA[Working on my latest project, I needed a way to validate forms in Cocoa. Couldn&#8217;t find anything pre-existing; so, I wrote DHValidation a Cocoa form validation library. Click the link to read about it on GitHub. Would love to hear what people think of it.
]]></description>
			<content:encoded><![CDATA[<p>Working on my latest project, I needed a way to validate forms in Cocoa. Couldn&#8217;t find anything pre-existing; so, I wrote <a href="http://wiki.github.com/benofsky/DHValidation">DHValidation</a> a Cocoa form validation library. Click the link to read about it on GitHub. Would love to hear what people think of it.</p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=14</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transition Year</title>
		<link>http://benmcredmond.com/blog/2009/05/15/transition-year/</link>
		<comments>http://benmcredmond.com/blog/2009/05/15/transition-year/#comments</comments>
		<pubDate>Fri, 15 May 2009 20:27:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/?p=16</guid>
		<description><![CDATA[I don&#8217;t usually do the whole personal blogging thing however Transition Year has been one of the most amazing experiences of my, so far, short life and I think I need to share that.



From what I can tell many parents dread the idea of Transition Year, their kids will be doing &#8220;nothing&#8221; for a whole [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t usually do the whole <em>personal blogging</em> thing however Transition Year has been one of the most amazing experiences of my, so far, short life and I think I need to share that.</p>

<p><span id="more-16"></span></p>

<p>From what I can tell many parents dread the idea of Transition Year, their kids will be doing &#8220;nothing&#8221; for a whole year. Of course, you have to put effort in to get something out of Transition Year but if you do what you get out of it its unbelievable.</p>

<p>For those who don&#8217;t know, Transition Year is the fourth year in Irish secondary school, where you <em>transition</em> between the Junior Certificate course and the Leaving Certificate course. In this year you do random things as will come to light in the rest of this blog post.</p>

<p>In transition year I have had some of the most amazing experiences which I certainly would not have experienced had I gone straight in to the Leaving Certificate course.</p>

<p>For a start I had my work experience in The Independent, a totally new environment. I didn&#8217;t think that I would like working in an office at all, however since I was doing what I love, it was brilliant. Now I knew I could work in an office and not be bored out of my mind.</p>

<p>Then I wrote a programming language. If I had been doing the Leaving Cert course there is no way that I would have been able to do this. Writing an extremely simple programming language, which I never finished, was still probably one of the most difficult things I&#8217;ve ever done but the amount I learnt was amazing.</p>

<p>I learnt about data structures such as Binary Search Trees, Linked Lists and Hash Tables. Things I would never have come across till college through my dabbling in web development. I learnt about the underlying structure of compilers and interpreters, all of which made me a fundamentally better programmer.</p>

<p>Furthermore If I hadn&#8217;t written this language, I would not have entered the Young Scientist, here I met some of the people who I would now consider some of my best friends.</p>

<p>Up to this point I thought I was having a pretty good year. However it was just about to get better. Next I had my week of work experience in Contrast where I learnt a huge amount about how much work 4 guys can get done by themselves, how less is more and how unbelievably awesome it would be if I could work somewhere like that when I left college.</p>

<p>The week after Contrast, I experienced my first &#8220;product launch&#8221;. It was nothing big but it got a great response (launching what I had built at Contrast). Followed immediately by attending Future of Web Apps conference in Dublin.</p>

<p>Had I been doing my Leaving Cert I might have still attended FOWA but I certainly wouldn&#8217;t have spent a week in Contrast and if I did not spend a week in Contrast, I would not have met Paul Campbell and therefore I wouldn&#8217;t have had lunch with Blaine Cook and I would not have shook DHH&#8217;s hand (hey it&#8217;s a big thing for me!).</p>

<p>However at this point. I thought it was over. The good part of Transition Year was over. It was the day before I went away to France for four weeks to stay in a French boarding school to learn French, I was dreading even the thought of it.</p>

<p>I have never been so wrong in my life. What was to follow was the best four weeks of my life, it was so good I stayed two extra weeks and if I could, I would go back immediately. In France I met just the most amazing people and had the time of my life.</p>

<p>When I came back, to put it lightly, I was a tad depressed. However I came back to some amazing friends who without the Young Scientist 5 months ago, I would never had been friends with.</p>

<p>Then today, today was my last day of &#8220;supposed to be in school&#8221; Transition Year and I was in <a href="http://camara.ie">Camara</a> developing software to be sent to developing countries in Africa to help easily deploy Moodle, school management software.</p>

<p>So to all those people who skip transition year, to all those people who say it should be abolished or those who just complain about it. It was an unbelievably amazing experience, one which I think everyone should take part in. Just my two cents.</p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=16</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why Stikked has been down recently.</title>
		<link>http://benmcredmond.com/blog/2009/01/18/why-stikked-has-been-down-recently/</link>
		<comments>http://benmcredmond.com/blog/2009/01/18/why-stikked-has-been-down-recently/#comments</comments>
		<pubDate>Sun, 18 Jan 2009 15:57:06 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[stikked]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/blog/?p=49</guid>
		<description><![CDATA[It&#8217;s been a while since I wrote a blog post and as Stikked has been down twice in the the last week I thought I&#8217;d write a post on that&#8230;

Last saturday Stikked was down. What happened? Well something started paging out loads probably mysql. Then mysql crashed and finally the whole server crashed. I still [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since I wrote a blog post and as Stikked has been down twice in the the last week I thought I&#8217;d write a post on that&#8230;
<span id="more-59"></span>
Last saturday Stikked was down. <strong>What happened?</strong> Well something started paging out <em>loads</em> probably mysql. Then mysql crashed and finally the whole server crashed. I still have no idea <em>why</em> this happened.</p>

<p>Stikked has been very slow since the latest update, there are some code fixes I&#8217;ve made which will be pushed shortly I also made some server side improvements which caused Stikked to be down yesterday:</p>

<ol>
<li>I replaced Ubuntu Server with Debian on the Stikked VPS. (This shaved off quite a lot of RAM)</li>
<li>I installed and configured mod_deflate to gzip all html, css and javascript. This halved the size of the page download.</li>
<li>I also setup monitoring tools so <em>next</em> time Stikked goes down, I will know straight away and have more information to determine what happened.</li>
</ol>

<p>Have a nice day,
Ben</p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=59</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Barack Obama&#039;s New 30 Minute &quot;special&quot;</title>
		<link>http://benmcredmond.com/blog/2008/10/31/barack-obamas-new-30-minute-special/</link>
		<comments>http://benmcredmond.com/blog/2008/10/31/barack-obamas-new-30-minute-special/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 01:38:32 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[barack obama]]></category>
		<category><![CDATA[biden]]></category>
		<category><![CDATA[obama]]></category>
		<category><![CDATA[us elections]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/blog/?p=46</guid>
		<description><![CDATA[I just had to share this inspiring video.



Enjoy
]]></description>
			<content:encoded><![CDATA[<p>I just had to share this inspiring video.
<span id="more-46"></span>
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/GtREqAmLsoA&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/GtREqAmLsoA&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>

<p>Enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=46</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting started with the Google Maps API and CodeIgniter</title>
		<link>http://benmcredmond.com/blog/2008/10/24/getting-started-with-the-google-maps-api-and-codeigniter/</link>
		<comments>http://benmcredmond.com/blog/2008/10/24/getting-started-with-the-google-maps-api-and-codeigniter/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 22:28:35 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[ci]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[google maps api]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/blog/?p=41</guid>
		<description><![CDATA[

This week during my week of work experience I was given the task of creating an application for mapping crimes in Dublin. So here I am sharing with you what I learnt. We&#8217;ll create a simple application that loads points from a database and shows them on a map. Using Javascript, PHP, MySQL and CodeIgniter, [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://benmcredmond.com/wp-content/uploads/2008/10/gmaps.png'><img src="http://benmcredmond.com/wp-content/uploads/2008/10/gmaps.png" alt="" title="gmaps" width="530" height="272" /></a></p>

<p>This week during my week of work experience I was given the task of creating an application for mapping crimes in Dublin. So here I am sharing with you what I learnt. We&#8217;ll create a simple application that loads points from a database and shows them on a map. Using Javascript, PHP, MySQL and CodeIgniter, I&#8217;ll assume you have a webserver running and understand PHP and MySQL.
<span id="more-41"></span>
<strong>Note: I think I may have mixed up longitude and latitude throughout the tutorial. It&#8217;ll still work, they&#8217;re just labeled incorrectly</strong>
<!--more-->
<h4>Lets get setup</h4>
So we&#8217;ll start by downloading CodeIgniter (CI) from <a href="http://codeigniter.com">codeigniter.com</a>. Done? ok. Copy it to a directory on your web server and visit your new CI install in your browser. Incase you don&#8217;t know CodeIgniter is an open-source PHP MVC framework which gives us a nice application structure to work with.</p>

<p><a href='http://benmcredmond.com/wp-content/uploads/2008/10/welcome_ci-1.png'><img src="http://benmcredmond.com/wp-content/uploads/2008/10/welcome_ci-1.png" alt="" title="welcome_ci" width="530" height="248" /></a></p>

<p>Fantastic! We also need to get a Google Maps API key from <a href="http://code.google.com/apis/maps/signup.html">Google Code</a>. We&#8217;ll need this later on, so keep it safe.</p>

<h4>Time to start real work</h4>

<p>Open up the application directory (in the system directory) and lets get started. We&#8217;ll mostly be working in the application directory, all of <strong>our</strong> code, goes in here. We&#8217;ll start by renaming controllers/welcome.php to main.php and opening up the routes.php (in the config directory) file.</p>

<p>Routes.php defines the urls for our application. Find the following line</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$route</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default_controller'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;welcome&quot;</span><span style="color: #339933;">;</span></pre></div></div>


<p>And change it to:</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$route</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default_controller'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;main&quot;</span><span style="color: #339933;">;</span></pre></div></div>


<p>We need to do this since we renamed welcome.php to main.php. This process isn&#8217;t entirely necessary but I like to do it.</p>

<p>You also need to open up config.php (in config) and change the base_url setting to match the base url of your site.</p>

<p>Now lets open up main.php.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Welcome <span style="color: #000000; font-weight: bold;">extends</span> Controller <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> Welcome<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		parent<span style="color: #339933;">::</span><span style="color: #004000;">Controller</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'welcome_message'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/* End of file welcome.php */</span>
<span style="color: #666666; font-style: italic;">/* Location: ./system/application/controllers/welcome.php */</span></pre></td></tr></table></div>


<p>Note: We need to replace the instances of <strong>Welcome</strong> on the lines 3 and 5 with <strong>Main</strong> because we renamed our controller.</p>

<p>Controllers are the link between the view, where we show the user the data and the model where we get the data from (a rough explanation of MVC, I know.). So lets start by doing a nice little hello world. Change the <strong>$this->load->view</strong> line, to load &#8216;main_view&#8217; instead of &#8216;welcome&#95;message&#8217;.</p>

<p>Open up the view directory and delete welcome<em>message, we won&#8217;t be needing it anymore. And create &#8216;main</em>view.php&#8217;, note how we didn&#8217;t have to specify the .php suffix while loading the view, put the following into your view.</p>


<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Hello world?<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span></pre></div></div>


<p>If you refresh in your browser right now you should see your lovely hello world message, cool huh? Well maybe you&#8217;re thinking that was a lot of effort for just that. It&#8217;ll help in the long run, I promise!</p>

<h4>Setup the Database</h4>

<p>Woops! I almost forget, we need to setup the database. Open up phpMyAdmin (or some mysql interface) and create a database called &#8216;parties&#8217; and run the following query:</p>


<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #993333; font-weight: bold;">IF</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">EXISTS</span> <span style="color: #ff0000;">`locations`</span> <span style="color: #66cc66;">&#40;</span>
  <span style="color: #ff0000;">`ID`</span> int<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`title`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">64</span><span style="color: #66cc66;">&#41;</span> character <span style="color: #993333; font-weight: bold;">SET</span> utf8 collate utf8_unicode_ci <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`summary`</span> text <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`longitude`</span> double <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #ff0000;">`latitude`</span> double <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span><span style="color: #66cc66;">,</span>
  <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>  <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`ID`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET<span style="color: #66cc66;">=</span>latin1;</pre></div></div>


<p>That should create all the fields we&#8217;ll need for our application. All you need to do now is fill out the relevant info in config/database.php.</p>

<h4>Work with a beautiful model</h4>

<p>Time to create a model. A model is how we interact with the database in CodeIgniter or any MVC application. Create a new file in the models directory called &#8216;locations.php&#8217;. I find it best to name models after the tables which they represent. Copy the following code into your model:</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Locations <span style="color: #000000; font-weight: bold;">extends</span> Model <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">/*
	*	Get the locations we want to put on our map
	*/</span>
	<span style="color: #000000; font-weight: bold;">function</span> get_locations<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Load the database class</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">database</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Get all the entries in the parties table.</span>
		<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'locations'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Are there any results from our query?</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">num_rows</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">// Set a counter to 0</span>
			<span style="color: #000088;">$n</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Create our array</span>
			<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Loop through the results filling our array with the locations</span>
			<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">result_array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$n</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$n</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'summary'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'summary'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$n</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'longitude'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'longitude'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$n</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'latitude'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$row</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'latitude'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
				<span style="color: #000088;">$n</span><span style="color: #339933;">++;</span>
			<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Return the array</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$data</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Returns false if we didn't get any results from our query</span>
		<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">/*
	*	Create a location for our map
	*/</span>
	<span style="color: #000000; font-weight: bold;">function</span> create_location<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Load the database class</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">database</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Insert the data into the table</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'locations'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span></pre></div></div>


<p>Lets walk through how each method works. <strong>get_locations</strong> will provide our map with all the data we need to generate a map. We load the database library, get all the entries from our locations table. We then check if we got any results, to avoid errors and fill an array with our data. Simple enough.</p>

<p><strong>create_location</strong> couldn&#8217;t be simpler, it just inserts an array which is passed to it into the database. Which of course in real life would be validated and cleaned before being inserted into the database, but this is just a tutorial, ok?</p>

<h4>Back to the controller!</h4>

<p>That&#8217;s our model done. Now we need to flesh out our poor controller.</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Main <span style="color: #000000; font-weight: bold;">extends</span> Controller <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> Main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		parent<span style="color: #339933;">::</span><span style="color: #004000;">Controller</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> index<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Load the locations model</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">model</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'locations'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Populate an array with all the locations we want to put on our map.</span>
		<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'locations'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">locations</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_locations</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Load our view</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'main_view'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">function</span> create<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">// Load the url helper, for the view and the redirect below</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">helper</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'submit'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">view</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'create_view'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Load the locations model</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">model</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'locations'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Fill the array with what we want to put in the database</span>
		<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
				<span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'summary'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">input</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'summary'</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">/* Get the longitude and latitude out of the stupid (x, y) string. */</span>
		<span style="color: #666666; font-style: italic;">// Strip the brackets</span>
		<span style="color: #000088;">$location</span> <span style="color: #339933;">=</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'location'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Split it up into two numbers</span>
		<span style="color: #000088;">$location</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">', '</span><span style="color: #339933;">,</span> <span style="color: #000088;">$location</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Add our longitude and latitude to our array</span>
		<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'longitude'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$location</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'latitude'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$location</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// And put it in the database</span>
		<span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">locations</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">create_location</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Redirect the user to the homepage</span>
		redirect<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<p>This is also pretty simple. The index method is the first method called when this controller is called. So we want this to load our &#8216;main_view&#8217;. We fill an array with the data from our database and pass this array to the view through the second parameter.</p>

<p>Our create method will let us create a location to put on the map. It first checks if the form has been submitted and if not loads a view with the form on it (we&#8217;ll make that in a second). If the form has been submitted we fill an array with the form data, do some funky stuff to get the longitude and latitude. Finally we put it in the database and redirect the user to the homepage.</p>

<h4>Create won&#8217;t work yet!</h4>

<p>Well none of it works yet, but for create to work we need to tweak our routes.php just add the following line:</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000088;">$route</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'create'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'main/create'</span><span style="color: #339933;">;</span></pre></div></div>


<p>This tells CodeIgniter that when someone visits <strong>/create</strong> they want to load <strong>main/create</strong>. Also we need to create the view so go ahead and create <strong>create_view.php</strong>.</p>

<p>Time to make our create_view.</p>


<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=YOURAPIKEY&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
			function initialize()
			{
				/*** Create our Map ***/
				var map = new GMap2(document.getElementById(&quot;map_canvas&quot;));
				var mapControl = new GMapTypeControl();
				var center = new GLatLng(53.332923,-6.239548); // Center the map on dublin.
&nbsp;
				map.setCenter(center, 11);
				map.addControl(mapControl);
				map.addControl(new GLargeMapControl());
				map.enableScrollWheelZoom();
&nbsp;
				main(map, center);
			}
&nbsp;
			function main(map, center)
			{
				// Create our Marker
				var marker = new GMarker(center, {draggable: true});
&nbsp;
				// Set the lattiude longitude hidden field to the center of the map, incase they don't move it.
				document.getElementById('latlng').value = center;
/*
				/*** Detect when the marker is moved and update the hidden field ***/
				GEvent.addListener(marker, &quot;dragstart&quot;, function()
				{
				  map.closeInfoWindow();
				});
&nbsp;
				GEvent.addListener(marker, &quot;dragend&quot;, function()
				{
					document.getElementById('latlng').value = marker.getLatLng(); // Update the hidden form field.
				});
&nbsp;
				map.addOverlay(marker);
			}
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span> <span style="color: #000066;">onload</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;initialize()&quot;</span> <span style="color: #000066;">onunload</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;GUnload()&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>Tell us about a party!<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php echo site_url('create');?&gt;</span></span>&quot;&gt;
&nbsp;
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>Title: <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;title&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>Summary: <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;summary&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span><span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span><span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;map_canvas&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;width: 500px; height: 300px;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;location&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;latlng&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span><span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span><span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
			<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Submit&quot;</span><span style="color: #66cc66;">/</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>


<p><strong>Note: in this example and the next you need to fill in YOURAPIKEY with the api key you got earlier from google.</strong></p>

<p>Looks confusing? It&#8217;s really not. When the page is loaded the <strong>onload=&#8221;initialize()&#8221;</strong> causes the initialize function to be called (which is javscript), which creates a new map on the #map_canvas div and then sets the center, etc.</p>

<p>The initialize function then calls the main function which puts a marker in the center of our map and adds listeners which detect when it&#8217;s been moved and if it has updates the hidden field with the new latitude and longitude.</p>

<p>If you know browse to <strong>example.com/index.php/create</strong> you will see the beautiful (well it&#8217;s rather ugly&#8230; but&#8230; yeah <img src='http://benmcredmond.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ) form we just created. If you fill in the details and click create it will insert it into the database and redirect you to our front page.</p>

<h4>Hello World</h4>

<p>Hi! But that&#8217;s not what we want, we want our map! Finally we just need to update our main_view.</p>


<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=YOURAPIKEY&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
&nbsp;
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span>
			function initialize()
			{
				/*** Create our Map ***/
				var map = new GMap2(document.getElementById(&quot;map_canvas&quot;));
				var mapControl = new GMapTypeControl();
				var center = new GLatLng(53.332923,-6.239548); // Center the map on dublin.
&nbsp;
				map.setCenter(center, 11);
				map.addControl(mapControl);
				map.addControl(new GLargeMapControl());
				map.enableScrollWheelZoom();
&nbsp;
				main(map, center);
			}
&nbsp;
			function showPoint(location, i)
			{
				var summary = '<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;margin-bottom:0&quot;</span>&gt;</span>'+location['title']+'<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>' + '<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;width: 300px;&quot;</span>&gt;</span>'+location['summary']+'<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>';
&nbsp;
&nbsp;
		  		marker = new GMarker(location['location']);
				this.map.addOverlay(marker);
				marker.bindInfoWindowHtml(summary);
			}
&nbsp;
			function main(map, center)
			{
				this.map = map;
				this.center = center;
&nbsp;
				this.locations = [];
&nbsp;
				<span style="color: #009900;">&lt;?php</span>
<span style="color: #009900;">				if<span style="color: #66cc66;">&#40;</span>!empty<span style="color: #66cc66;">&#40;</span>$locations<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></span>
<span style="color: #009900;">				<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">					$n <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span>;</span>
<span style="color: #009900;">					foreach<span style="color: #66cc66;">&#40;</span>$locations as $location<span style="color: #66cc66;">&#41;</span></span>
<span style="color: #009900;">					<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">						echo <span style="color: #ff0000;">&quot;this.locations[$n] = [];\n&quot;</span>;</span>
<span style="color: #009900;">						echo <span style="color: #ff0000;">&quot;this.locations[$n]['title'] = '&quot;</span>.$location<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'title'</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&quot;';\n&quot;</span>;</span>
&nbsp;
<span style="color: #009900;">						echo <span style="color: #ff0000;">&quot;this.locations[$n]['location'] = new GLatLng(&quot;</span>.$location<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'longitude'</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&quot;, &quot;</span>.$location<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'latitude'</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&quot;);\n&quot;</span>;</span>
&nbsp;
<span style="color: #009900;">						echo <span style="color: #ff0000;">&quot;this.locations[$n]['summary'] = '&quot;</span>.$location<span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'summary'</span><span style="color: #66cc66;">&#93;</span>.<span style="color: #ff0000;">&quot;';\n&quot;</span>;</span>
<span style="color: #009900;">						$n++;</span>
<span style="color: #009900;">					<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #009900;">				<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #009900;">				?&gt;</span>
&nbsp;
				for (var i = 0; i <span style="color: #009900;">&lt; locations.length; ++i<span style="color: #66cc66;">&#41;</span></span>
<span style="color: #009900;">				<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #009900;">					showPoint<span style="color: #66cc66;">&#40;</span>locations<span style="color: #66cc66;">&#91;</span>i<span style="color: #66cc66;">&#93;</span>, i<span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #009900;">				<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #009900;">			<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #009900;">		&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
&nbsp;
	<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span> <span style="color: #000066;">onload</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;initialize()&quot;</span> <span style="color: #000066;">onunload</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;GUnload()&quot;</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>Parties!<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
		<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;map_canvas&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;width: 500px; height: 300px;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
	<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>


<p>Reload, et voila.</p>

<p>The initialize function is the same here as before. However this time in the main function we populate a javascript array from our php array, which we then loop through and pass to our showPoint function which shows the point on the map along with our title and description, which will show up when the marker is clicked.</p>

<h4>Wrap Up!</h4>

<p>Well that turned out a lot longer than I expected but hopefully it covers all you need to know about getting started with codeigniter + google maps api. Of course if I were creating a real site there&#8217;re several things I&#8217;d do differently, which for length reasons weren&#8217;t discussed here. I&#8217;ve listed some here:</p>

<ul>
<li><strike>I would make it less ugly</strike></li>
<li>I would split up the top and the bottom of both the views into a header and footer view, and then load them so they surround our main content on every page. This means if you want to change the layout of your site you don&#8217;t have to update every view</li>
<li>I would put some of the javascript into it&#8217;s own file, for the same reasons.</li>
<li>I would put the api key into a config file and load it into our view, again if we need to change our api key, we don&#8217;t have to change every file</li>
<li>I would autoload commonly used models, libraries and helpers</li>
</ul>

<p>You can download the code <a href="http://users.benmcredmond.com/ben/parties.zip">here</a>.</p>

<p>Enjoy,
Ben.</p>

<p><em>P.S. If you liked this tutorial please leave a comment!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=41</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>The new &#8220;stealing is ok&#8221; culture</title>
		<link>http://benmcredmond.com/blog/2008/10/19/the-new-stealing-is-ok-culture/</link>
		<comments>http://benmcredmond.com/blog/2008/10/19/the-new-stealing-is-ok-culture/#comments</comments>
		<pubDate>Sat, 18 Oct 2008 23:09:09 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[drm]]></category>
		<category><![CDATA[piracy]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[riaa]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/blog/?p=40</guid>
		<description><![CDATA[I&#8217;m not one to support American border guards checking laptops at the borders for stolen material. Or the hundreds of thousands of dollar fines that the RIAA dishes out. Or software and music companies slapping DRM on everything. I also believe in fair use. However I find it puzzling how people can just steal software, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m not one to support American border guards checking laptops at the borders for stolen material. Or the hundreds of thousands of dollar fines that the RIAA dishes out. Or software and music companies slapping DRM on everything.<span id="more-40"></span> I also believe in fair use. However I find it puzzling how people can just steal software, movies, books and music and think that to be ok.</p>

<p>As a software developer if I had spent hours and hours (and hours) developing an application to support myself (or a family) and I put it up for sale, how is it ok for someone to go onto bittorrent or limewire and get it for free. I can imagine that film makers, authors and artists feel the same.</p>

<p>Would you ever hire a builder to build a house then not pay him? No. So why is it different with software, music and movies? Would you steal a book from a shop? No.</p>

<p>Right now I sound like the anti-piracy ads:
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/MTbX1aMajow&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.youtube.com/v/MTbX1aMajow&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="344"></embed></object></p>

<p>However I do think it&#8217;s becoming a growing problem and that people do it just because it&#8217;s easy and that <strong>the internet generation</strong> are going to cause a revolution in how a product is financed since we/they are starting to expect to get everything for free.</p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=40</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How I integrate subversion into my workflow</title>
		<link>http://benmcredmond.com/blog/2008/10/18/how-i-integrate-subversion-into-my-workflow/</link>
		<comments>http://benmcredmond.com/blog/2008/10/18/how-i-integrate-subversion-into-my-workflow/#comments</comments>
		<pubDate>Sat, 18 Oct 2008 22:21:53 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Project Management]]></category>
		<category><![CDATA[beanstalk]]></category>
		<category><![CDATA[coda]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[versions]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/blog/?p=38</guid>
		<description><![CDATA[Subversion can often be a pain to get started with, it will take a while to integrate into your workflow but once you get it, it&#8217;s a lifesaver. If you don&#8217;t know about subversion see my previous article on getting started.

I haven&#8217;t gone into detail on how to do things because this article is about [...]]]></description>
			<content:encoded><![CDATA[<p>Subversion can often be a pain to get started with, it will take a while to integrate into your workflow but once you get it, <strong>it&#8217;s a lifesaver.</strong> If you don&#8217;t know about subversion see <a href="http://benmcredmond.com/blog/2008/07/12/installing-and-configuring-subversion-on-ubuntu/">my previous article</a> on getting started.
<span id="more-38"></span>
I haven&#8217;t gone into detail on how to do things because this article is about my workflow with subversion not how to use subversion.</p>

<h4>When to make commits</h4>

<p>There&#8217;re several cases when I make a commit, the more often the better in my opinion.</p>

<ul>
<li>When I&#8217;m finished implementing a certain feature.</li>
<li>When I have achieved a particular milestone in implementing a feature</li>
<li>Before I fix a bug</li>
<li>When I have fixed a bug</li>
<li>Before I make major changes to whatever I&#8217;m working on</li>
<li>Before starting work on a new feature</li>
<li>And <strong>always</strong> at the end of the day</li>
</ul>

<p>So basically, whenever I can.</p>

<h4>Commit Messages, Commit Messages, Commit Messages</h4>

<p>This is all however completely useless (in my opinion) unless you provide commit messages with every commit stating what you have changed. Even if it&#8217;s a one man team, this is essential for when you need to go back later and find out what you broke, or why something is done how it is.</p>

<blockquote>
<p>Registration now working, I think. The row is inserted into the user table and the number of remaneing uses on the invite code is being reduced.</p>

<p>Unideally the invite model is being loaded in the construct of the User model. This is the only way it would work, and is loading unnesecary stuff. So that needs attention.</p>

<p>Also still to do in registration.php is the setting of flashdata and redirection to the login page. the flashdata tells the login controller that this is the first login. An email also needs to be sent confirming the email address.</p>
<cite>Example commit from hippstr</cite>
</blockquote>

<p>(I thought it would be more truthful to leave the spelling mistakes in, so don&#8217;t correct me on them). As you can see this commit message outlines everything that is changed in that commit and even outlines what is still to be done (which I don&#8217;t believe is 100% necessary). <em>I do this because all Hippstr commits go into the basecamp project management system (see <a href="http://http://benmcredmond.com/blog/2008/06/29/how-i-manage-projects/">How I Manage Projects</a>) so it lets the team know what&#8217;s happening.</em>
<!--more-->
<h4>Working with teams</h4>
<a href='http://beanstalkapp.com'><img src="http://benmcredmond.com/wp-content/uploads/2008/10/beanstalk_logo.png" alt="" title="beanstalk_logo" class="alignnone size-full wp-image-39" /></a></p>

<p>When working in a team, subversion is key as it handles conflicts when two people edit the same file at the same time. I&#8217;m not going to go into details here but you can refer to the <a href="http://svnbook.red-bean.com/nightly/en/svn.tour.cycle.html">subversion book</a>.</p>

<p>I also use <a href="http://beanstalkapp.com">Beanstalk</a> for my subversion hosting. Sure you can setup a subversion server on any beige box or even some shared hosts. However I use Beanstalk as it provides fantastic integration with other services, such as Basecamp and Twitter.</p>

<p>I highly recommend it, it&#8217;s reasonably priced as well.</p>

<h4>Software</h4>

<p>I&#8217;ve played with versions, coda and other subversion guis but I always come back to the command line interface to subversion. I find it lets me get things done quicker and easier than anything else. There are only a few essential commands you need to learn.</p>

<ul>
<li>commit</li>
<li>add</li>
<li>delete</li>
<li>copy</li>
<li>move</li>
<li>merge</li>
</ul>

<p>Learn the above svn commands and you&#8217;ll soon be flying with subversion. However if this is too daunting I highly recommend <a href="http://versionsapp.com">Versions</a>.</p>

<h4>In conclusion</h4>

<p>Working subversion into your workflow can often be difficult, however once you get into a habit of committing when ever you change anything even slightly significant, you will never go back. Plus don&#8217;t forget to add in those commit messages!</p>

<p>I hope this was at least some help to those struggling to get started with subversion.</p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=38</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stikked.com</title>
		<link>http://benmcredmond.com/blog/2008/09/16/stikkedcom/</link>
		<comments>http://benmcredmond.com/blog/2008/09/16/stikkedcom/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 11:01:32 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Project Management]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[codeigniter]]></category>
		<category><![CDATA[google code]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[pastebin]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[stikked]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/blog/?p=33</guid>
		<description><![CDATA[

Stikked is my &#8216;other&#8217; website and this weekend under went some big updates. Stikked is a pastebin, a place for developers to collaboratively solve coding problems. Most often used to paste code in a chat environment where it is considered bad etiquette to paste code directly into the chat, instead you paste it onto a [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://benmcredmond.com/blog/wp-content/uploads/2008/09/stikked.png'><img src="http://benmcredmond.com/wp-content/uploads/2008/09/stikked.png" alt="" title="stikked" width="540" height="215" class="alignnone size-full wp-image-34" /></a></p>

<p>Stikked is my &#8216;other&#8217; website and this weekend under went some big updates. Stikked is a pastebin, a place for developers to collaboratively solve coding problems. Most often used to paste code in a chat environment where it is considered bad etiquette to paste code directly into the chat, instead you paste it onto a pastebin site, then paste the link into the chat.
<span id="more-33"></span>
This weekend paste replies was added, a long time missing feature. Allowing you to reply to another paste for example to correct a problem in the original paste. Paste downloading was also added, still a little buggy though.</p>

<p>Now, if you know what a pastebin is&#8230; You&#8217;re saying <em>why yet another pastebin?</em> Well firstly pastebins are in general u-g-l-y with exceptions (http://pastie.org/). So I think I fixed that. Pastebins are also kinda feature lacking, sure it&#8217;s a pastebin, but I felt you could do a lot more. So Stikked has a few nice features like snip-url creation, auto-copying the link to your clipboard, remembering settings, etc. The <em>really cool</em> stuff is yet to come.</p>

<p>The final reason I made Stikked is: all open-source pastebins were <strong>awful</strong> and there was no decent open-source <a href="http://codeigniter.com">CodeIgniter</a> (CodeIgniter being the framework which powers stikked) application from which others could learn. So Stikked is 100% open-source available from <a href="http://code.google.com/p/stikked">Google Code</a> included with developer documentation to help you understand how everything works and get you started with CodeIgniter. On <a href="http://blog.stikked.com">The Stikked Blog</a> we will also be doing a series of tutorials on how we built stikked.</p>

<p>So check it out at <a href="http://www.stikked.com">www.stikked.com</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=33</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My top five favourite mac apps</title>
		<link>http://benmcredmond.com/blog/2008/08/30/my-top-five-mac-apps/</link>
		<comments>http://benmcredmond.com/blog/2008/08/30/my-top-five-mac-apps/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 14:18:34 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[barebones]]></category>
		<category><![CDATA[coda]]></category>
		<category><![CDATA[cultured code]]></category>
		<category><![CDATA[favourite mac apps]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[macromates]]></category>
		<category><![CDATA[panic]]></category>
		<category><![CDATA[textmate]]></category>
		<category><![CDATA[things]]></category>
		<category><![CDATA[top five]]></category>
		<category><![CDATA[versions]]></category>
		<category><![CDATA[yojimbo]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/blog/?p=25</guid>
		<description><![CDATA[Eventually every mac blogger has to list his favourite apps, it&#8217;s what we do. (I didn&#8217;t include the usual, Adium, Colloquy, etc. but felt they needed a mention). So here I go.


TextMate



Any of you who know me, know I never shut up about TextMate. Why? There&#8217;s nothing like it. No other editor is able to [...]]]></description>
			<content:encoded><![CDATA[<p>Eventually every mac blogger has to list his favourite apps, it&#8217;s what we do. <em>(I didn&#8217;t include the usual, Adium, Colloquy, etc. but felt they needed a mention).</em> So here I go.
<span id="more-25"></span></p>

<h4>TextMate</h4>

<p><a href='http://benmcredmond.com/wp-content/uploads/2008/08/textmate.png'><img src="http://benmcredmond.com/wp-content/uploads/2008/08/textmate.png" alt="" title="textmate" width="540" height="137" class="alignnone size-full wp-image-26" /></a></p>

<p>Any of you who know me, know I never shut up about TextMate. Why? There&#8217;s nothing like it. No other editor is able to offer so many features yet stay so easy-to-use and lightweight. The power of TextMate is in the bundles. TextMate ships with bundles and language definitions for every language you could think of.</p>

<!--more-->

<p>These bundles provide methods for inserting snippets of codes, tidying your code, posting it to pastebins and lots more. This is made better by the fact that it&#8217;s so easy to write a bundle, you can write a bundle in pretty much any scripting language provided with os x.</p>

<p>The TextMate sidebar is also one of my favourite features, making it so easy to work with projects. Especially web frameworks like CodeIgniter, rails or django. I reccomend you try TextMate today, it is availible from <a href="http://macromates.com">Macromates</a> for <strong>48 Euro</strong>.</p>

<h4>Coda</h4>

<p><a href='http://benmcredmond.com/wp-content/uploads/2008/08/coda.png'><img src="http://benmcredmond.com/wp-content/uploads/2008/08/coda.png" alt="" title="coda" width="540" height="354" class="alignnone size-full wp-image-27" /></a></p>

<blockquote>text editor + file transfer + svn + css + terminal + books + more = whoah.<br/><cite>Panic</cite></blockquote>

<p>Coda is Panic Software&#8217;s beautifully-simple-feature-packed-all-in-one-web-development-tool. <strong>And I love it</strong>. Editor wise nothing beats TextMate, however I often find myself using coda for web development as the all in one nature makes it so easy, with a built in text editor, ftp client, subversion, css editor, terminal, books and so on.</p>

<p>Panic just last week released Coda 1.5, this is what got me to start using coda again. The subversion integration alone is outstanding. It has completely changed the way I work, being able to commit changes in a mouse click.</p>

<blockquote>It has completely changed the way I work</blockquote>

<p>In Coda 1.5 they also added custom books, allowing you to have access to any manual from your text editor. If I was to list every feature of Coda this post would never end, so check it out for yourself at <a href="http://panic.com/coda">panic.com</a>, you can get the free trial or buy it for <strong>$99</strong> (It&#8217;s worth it).</p>

<h4>Yojimbo</h4>

<p><a href='http://benmcredmond.com/wp-content/uploads/2008/08/yojimbo.png'><img src="http://benmcredmond.com/wp-content/uploads/2008/08/yojimbo.png" alt="" title="yojimbo" width="540" height="424" class="alignnone size-full wp-image-28" /></a></p>

<blockquote>Your effortless, reliable information organizer for OS X<br/><cite>Bare Bones Software</cite></blockquote>

<p>Those who know me also know I never shutup about Yojimbo. Yojimbo is an application for storing stuff. That&#8217;s right storing <strong>stuff</strong>. Things you don&#8217;t know where to put. I use it to store passwords, serial numbers, articles, ideas, photos, etc.</p>

<p>You can add an item to yojimbo from anywhere in the os using the quick input dialog. You can assign tags, give it a title and you&#8217;re done. You know it&#8217;s safe in the Yojimbo database. If you have some confidential information you want to store you can use Yojimbo&#8217;s built in encryption to encrypt it.</p>

<p>The usefulness of this application is endless, especially if you have lots of info you don&#8217;t know where to put. The one thing missing is syncing with iphone/touch, I wouldn&#8217;t be surprised if this was added in future versions though. Get it today from <a href="http://www.barebones.com/products/yojimbo/">Bare Bones software</a> for <strong>$39</strong>.</p>

<h4>Things</h4>

<p><a href='http://benmcredmond.com/wp-content/uploads/2008/08/things.png'><img src="http://benmcredmond.com/wp-content/uploads/2008/08/things.png" alt="" title="things" width="540" height="189" class="alignnone size-full wp-image-29" /></a></p>

<p>I was first introduced to Things through their iPhone/iPod Touch application under the same name. Thing is an outstanding to-do list application. With a syncing mobile iPhone/iPod Touch application. Since the GTD craze first started in the Mac Community, I&#8217;ve tried countless solutions.</p>

<p>Things was the first to work for me. It&#8217;s not overly strict about putting this here and that there. You can input from anywhere in the os using the quick input dialog (pictured above). The interface both on the mobile version and the desktop version are beautiful.</p>

<p>I&#8217;ve found this application endlessly helpful in helping me get organised. It&#8217;s currently still in public beta so download it for free from <a href="http://www.culturedcode.com/things/">Cultured Code</a>, it will cost 50$ at launch.</p>

<h4>Versions</h4>

<p><a href='http://benmcredmond.com/wp-content/uploads/2008/08/versionsapp.png'><img src="http://benmcredmond.com/wp-content/uploads/2008/08/versionsapp.png" alt="" title="versions" width="540" height="140" class="alignnone size-full wp-image-30" /></a></p>

<p>Last but certainly not least is Versions. Versions is a stand-alone gui subversion client. It has in my opinion revitalised subversion, well on os x anyway. It&#8217;s beautiful easy-to-use interface combined with it&#8217;s extensive feature set is what makes this application great.</p>

<p>There&#8217;s not much more to say about it, but if you&#8217;re a developer and you use subversion you need to check this app out. It&#8217;s currently free as it&#8217;s still in beta. Get it today from <a href="http://versionsapp.com/">Versions App.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=25</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Installing and Configuring Subversion on Ubuntu</title>
		<link>http://benmcredmond.com/blog/2008/07/12/installing-and-configuring-subversion-on-ubuntu/</link>
		<comments>http://benmcredmond.com/blog/2008/07/12/installing-and-configuring-subversion-on-ubuntu/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 21:15:11 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Project Management]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[subversion clients]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[ubuntu 8]]></category>
		<category><![CDATA[versions]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/blog/?p=21</guid>
		<description><![CDATA[For a long time I&#8217;ve hosted my sites on a MediaTemple VPS or Virtual Private Server. For a pricey $50 a month you get a pretty nice package and 24/7 support but recently I was turned onto Slicehost. They offer great plans for very reasonable prices and great support too (always important).

They also offer a [...]]]></description>
			<content:encoded><![CDATA[<p>For a long time I&#8217;ve hosted my sites on a <a href="http://mediatemple.net">MediaTemple</a> VPS or Virtual Private Server. For a pricey $50 a month you get a pretty nice package and 24/7 support but recently I was turned onto <a href="http://slicehost.com">Slicehost</a>. They offer great plans for very reasonable prices and great support too (always important).
<span id="more-58"></span>
They also offer a choice of operating systems, not forcing me to use my now least favourite operating system: centOS. I chose ubuntu and following on from last weeks post about project management, I will talk about <strong>how to install and configure a subversion server</strong> running on Ubuntu 8.0.4.</p>

<!--more-->

<p>I&#8217;m assuming you have basic developer tools installed and have a good enough concept of the command line + *nix. Start by installing subversion.</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># apt-get install subversion</pre></div></div>


<p>This gives us all the subversion admin and client tools. We&#8217;ll start by creating a central location for our repositories under <strong>/home/svn</strong>.</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># mkdir /home/svn
# cd /home/svn</pre></div></div>


<p>Now lets create a repository, replace <em>myrepo</em> with the name of your repository.</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># svnadmin create myrepo</pre></div></div>


<p>If you do an <em>ls</em> in this directory you&#8217;ll see subversion created a new directory called &#8220;myrepo&#8221;. We&#8217;re going to setup http access to our repository, so we need to ensure apache can read and write the files.</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># cd /home
# chown -R www-data:www-data svn
# chmod -R 770 svn</pre></div></div>


<p>We need to create some users to login to our subversion server, after running each htpasswd command it will prompt for a password which will be the login password for the user.</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># cd /home/svn
# htpasswd -c .htpasswd firstuser
# htpasswd .htpasswd seconduser
# htpasswd .htpasswd thirduser</pre></div></div>


<p>Now we have our repository setup we need to connect apache to it. I&#8217;m assuming you have apache setup and installed. Next we need to install apache subversion bindings and enable webdav.</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># apt-get install libapache2-svn
# cd /etc/apache2
# a2enmod dav</pre></div></div>


<p>Finally we need to configure apache.</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># cd /etc/apache2/sites-available
# nano svn.mydomain.com</pre></div></div>


<p>This will create a new file called svn.mydomain.com and open a blank file in a text editor. Copy the below into it and replace <strong>yourdomain</strong> with the correct value wherever mentioned.</p>


<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">virtualHost</span> *:<span style="color: #ff0000;">80</span>&gt;
&nbsp;
  	<span style="color: #adadad; font-style: italic;"># Admin email, Server Name (domain name) and any aliases</span>
  	<span style="color: #00007f;">ServerAdmin</span> admin@yourdomain.com
  	<span style="color: #00007f;">ServerName</span>  svn.yourdomain.com
&nbsp;
	&lt;<span style="color: #000000; font-weight:bold;">location</span> /&gt;
		<span style="color: #00007f;">AuthType</span> Basic
		<span style="color: #00007f;">AuthUserFile</span> /home/svn/.htpasswd
		<span style="color: #00007f;">AuthName</span> <span style="color: #7f007f;">&quot;Dev Team Only&quot;</span>
		<span style="color: #00007f;">require</span> valid-<span style="color: #00007f;">user</span>
		DAV svn
		SVNPath /home/svn/hippstr/
	&lt;/<span style="color: #000000; font-weight:bold;">location</span>&gt;
&nbsp;
&lt;/<span style="color: #000000; font-weight:bold;">virtualHost</span>&gt;</pre></div></div>


<p>Now we need to enable and restart apache.</p>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># cd /home/apache2
# a2ensite svn.yourdomain.com
# apache2ctl graceful</pre></div></div>


<p>If everything went well we should now be able to access are subversion server at <strong>svn.yourdomain.com</strong>. But we need a subversion client on our desktop machine to access the repository.</p>

<h3>Subversion clients</h3>

<p>My favourite gui subversion client is currently an os x app called <a href="http://versionsapp.com">Versions</a>. Which I&#8217;ll talk a little about below but if you&#8217;re not on os x I would recommend either <a href="http://tortoisesvn.tigris.org/">Tortoise SVN</a> on windows or the standard subversion command line client on any os. Available <a href="http://subversion.tigris.org/">here</a>.</p>

<p>You also need to learn how to use subversion by reading <a href="http://svnbook.red-bean.com/">the free subversion book</a>, there&#8217;s a small learning curve to understanding subversion and integrating it into your workflow but you&#8217;ll get used to it eventually!</p>

<p><a href='http://benmcredmond.com/wp-content/uploads/2008/07/versions.png'><img src="http://benmcredmond.com/wp-content/uploads/2008/07/versions.png" alt="" title="Versions" class="alignnone size-medium wp-image-22" width="500"/></a></p>

<p>To setup subversion in versions click &#8220;add new repository bookmark&#8221; and enter the following information. The user and password are what you set above when running the htpasswd commands.</p>

<p><a href='http://benmcredmond.com/wp-content/uploads/2008/07/versions-1.png'><img src="http://benmcredmond.com/wp-content/uploads/2008/07/versions-1.png" alt="" title="versions-1" class="alignnone size-full wp-image-23" width="500"/></a></p>

<p>There&#8217;s a small learning curve now to understanding subversion, as mentioned above and it&#8217;s all explained better than I could ever explain it in the subversion book mentioned above. Good luck! Ask any questions you still have in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=58</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How I Manage Projects</title>
		<link>http://benmcredmond.com/blog/2008/06/29/how-i-manage-projects/</link>
		<comments>http://benmcredmond.com/blog/2008/06/29/how-i-manage-projects/#comments</comments>
		<pubDate>Sun, 29 Jun 2008 22:47:04 +0000</pubDate>
		<dc:creator>Ben</dc:creator>
				<category><![CDATA[HiPPstr]]></category>
		<category><![CDATA[Project Management]]></category>
		<category><![CDATA[37signals]]></category>
		<category><![CDATA[basecamp]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://benmcredmond.com/blog/?p=19</guid>
		<description><![CDATA[Managing projects is hard. I&#8217;ve come to learn this over the last year. [poor] Project management is also without a doubt one of the factors why Hippstr has been delayed for almost a year now. So I&#8217;m going to share with you a few of the tools, services and practices that have helped improve my [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Managing projects is hard.</strong> I&#8217;ve come to learn this over the last year. [poor] Project management is also without a doubt one of the factors why Hippstr has been delayed for almost a year now. So I&#8217;m going to share with you a few of the tools, services and practices that have helped improve my productivity and my team&#8217;s.
<span id="more-57"></span>
Those who are around me often will know I never shut up about how great <strong>basecamp</strong> is. And it really is.</p>

<blockquote>&#8220;Basecamp is the smarter, easier, more elegant way to collaborate on your internal and client projects.&#8221;<br/><cite>37signals</cite></blockquote>

<p>Basecamp is a really simple and easy-to-use project management system. With great to-do management, a forum like &#8220;messages&#8221; section and milestones (There&#8217;s more but this is the important sutff).
<!--more-->
To-dos are with out a doubt the most useful aspect of Basecamp. They allow me to assign a task to any individual. When this task is complete it can be checked off. This will show up in the project summary page also (pictured below).</p>

<p><a href='http://benmcredmond.com/wp-content/uploads/2008/06/basecamp-dashboard.png'><img src="http://benmcredmond.com/wp-content/uploads/2008/06/basecamp-dashboard.png" alt="basecamp dashboard" title="The basecamp dashboard." width="580" height="349" class="aligncenter size-full wp-image-20" /></a></p>

<p>I use messages mostly for brainstorming. Where I post an idea which is blasted out to all my team via email (They can reply to the message by replying to the email). <strong>Why is this useful?</strong> When you&#8217;re working with a global team or even a local one, that are not all around at the same time, this is an indisposable tool. Reducing the amount of required meetings (which are a pain to schedule across timezones) and including all the team without the use of a messy mailing list solution.</p>

<blockquote>&#8220;Basecamp is the iPod of project collaboration.&#8221; <br/><cite>Joshua Peterson, CEO, 43things</cite></blockquote>

<p>Both messages and to-dos can all be associated with a particular milestone. For example at the moment all hippstr to-do&#8217;s are associated with the <em>private beta 1</em> milestone. Meaning we&#8217;re all working towards <strong>a set target, which is important.</strong></p>

<p>In summary basecamp allows all the team to stay in touch, keep up to date with everything that&#8217;s happening and track progress (which is key and a moral booster on those bad days). I&#8217;ve used it with just myself to teams of 20 and it has always been a success. <strong>Basecamp can be described in one word, &#8220;phenomenal&#8221;</strong>. Sign up for free today at <a href="http://basecamphq.com">http://basecamphq.com</a>.</p>

<p><strong>Subversion</strong>. Subversion (aka. svn) is a version control system. <em>In english</em>, subversion keeps track of all the changes made to a code base (It can be used with anything though, word files, pictures, text files, etc. I just happen to use it for code). Allowing us to revert to a previous version when we break something, instead of wasting hours trying to find <strong>that</strong> thing we changed which broke everything.</p>

<p>Subversion also doubles up as a backup solution as it&#8217;s hosted on a remote server. Meaning if my house burns down all my work isn&#8217;t lost (although I think I have bigger problems if my house burns down). Subversion&#8217;s usefulness is greatly increased when working in teams as it manages conflicts. If two people change the same file, instead of one set of changes being lost, subversion presents you with a choice to merge the changes or choose which you would like to keep.</p>

<p>Previously I would&#8217;ve recommended trac in conjunction with subversion, but really it&#8217;s <strong>completely useless and difficult to use.</strong> I&#8217;m yet to find a bug tracking + svn interface system I like. Nevertheless subversion is an indispensable tool, get started today at <a href="http://subversion.tigris.org/">http://subversion.tigris.org/</a>. <em>Soon there will be an article on how to configure subversion.</em></p>

<p><del datetime="2008-09-04T18:19:00+00:00">Coming up in part 2. I will talk about campfire, getting real, practices and what I don&#8217;t use.</del></p>
]]></content:encoded>
			<wfw:commentRss>http://js-kit.com/rss/benmcredmond.com/p=57</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
