<?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"
	>

<channel>
	<title>gods wear hats &#187; code</title>
	<atom:link href="http://godswearhats.com/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://godswearhats.com</link>
	<description>mortals wear shoes</description>
	<pubDate>Fri, 25 Jul 2008 17:32:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Twitter P2P</title>
		<link>http://godswearhats.com/2008/04/24/twitter-p2p/</link>
		<comments>http://godswearhats.com/2008/04/24/twitter-p2p/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 14:26:28 +0000</pubDate>
		<dc:creator>aidan</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://godswearhats.com/2008/04/24/twitter-p2p/</guid>
		<description><![CDATA[From mj:
They break out the infrastructure and make it P2P. This could shift the responsibility for uptime to others and allow them to host their own options for advertising or value-added services. Maybe even license the software out so there are a bazillion twitter servers out there. This would be the method by which Twitter [...]]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://cimota.com/blog/2008/04/24/twitter-so-how-does-it-make-money/">mj</a>:</p>
<blockquote><p><em>They break out the infrastructure and make it P2P. This could shift the responsibility for uptime to others and allow them to host their own options for advertising or value-added services. Maybe even license the software out so there are a bazillion twitter servers out there. This would be the method by which Twitter could sneak up and murder Instant Messaging in it’s sleep. I tweeted recently that Twitter was not Broadcast IM. But, of course, it is.</em></p></blockquote>
<p>Reminds me a bit of <a href="http://savingtheinternetwithhate.com/">Zed&#8217;s UTU project</a>.</p>
<p>To speak to some of the other points that mj makes (and bear in mind I&#8217;m only a recent Twitter user), I think that Twitter could monetise easily enough.  There is definitely a stigma against running adverts on your website - I know I don&#8217;t do it on any of the sites that I run, even though I know I would make some money.  But consider the sorts of users who use Twitter a lot - they are the same sorts of people who are happy to pay $10-$25 for an app to allow them to use Twitter more easily.</p>
<p>Twitter haven&#8217;t charged anything for their API or the right to use their service as a platform for making money, which no doubt has earned them a lot of kudos and is probably another reason for the large uptake.  I&#8217;m certain that a portion of those people who use their service every day, <em>n</em> times a day, would be willing to pay that $10-$25 for improved services.  I think mj is right with things like being able to add pictures, having URLs automatically &#8220;tinied&#8221;, being able to make their own look and feel to posts and so forth.  Would it make enough?</p>
<p>I don&#8217;t know how many users Twitter has, but I&#8217;m willing to be that all of the active ones fall squarely in &#8220;Early Adopter&#8221; (if you subscribe to the Crossing the Chasm metaphor).  In using the Twitter site, I&#8217;ve been a bit underwhelmed by it&#8217;s functionality.  Keep the free service, improve it gradually, but innovate like crazy in a pay-for service.</p>
<p>One possible ego-stroking mechanism.  Make it such that you <strong>must</strong> be on the pay-for service if you have more than 100 people following you.</p>
]]></content:encoded>
			<wfw:commentRss>http://godswearhats.com/2008/04/24/twitter-p2p/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Some sites I&#8217;ve worked on recently</title>
		<link>http://godswearhats.com/2008/04/16/some-sites-ive-worked-on-recently/</link>
		<comments>http://godswearhats.com/2008/04/16/some-sites-ive-worked-on-recently/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 10:58:04 +0000</pubDate>
		<dc:creator>aidan</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://godswearhats.com/2008/04/16/some-sites-ive-worked-on-recently/</guid>
		<description><![CDATA[
Blueshell - UK E-commerce partnership company
Vivanco Direct - UK Electronic Accessories Store
Scartplug.com - UK audio and video cable store
White Wave - Cyprus web development company

None of them are particularly spectacular, but I felt I should let people know a bit about what I&#8217;ve been working on.  I&#8217;m also working on a website for a [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li>Blueshell - <a href="http://www.blueshell.co.uk">UK E-commerce partnership company</a></li>
<li>Vivanco Direct - <a href="http://www.vivanco-direct.com">UK Electronic Accessories Store</a></li>
<li>Scartplug.com - <a href="http://www.scartplug.com">UK audio and video cable store</a></li>
<li>White Wave - <a href="http://www.whitewaveweb.com">Cyprus web development company</a></li>
</ul>
<p>None of them are particularly spectacular, but I felt I should let people know a bit about what I&#8217;ve been working on.  I&#8217;m also working on a website for a Cyprus property investment company, which should be done in the next couple of weeks.</p>
]]></content:encoded>
			<wfw:commentRss>http://godswearhats.com/2008/04/16/some-sites-ive-worked-on-recently/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Command Line History Meme</title>
		<link>http://godswearhats.com/2008/04/16/command-line-history-meme/</link>
		<comments>http://godswearhats.com/2008/04/16/command-line-history-meme/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 10:51:36 +0000</pubDate>
		<dc:creator>aidan</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[command line history meme]]></category>

		<guid isPermaLink="false">http://godswearhats.com/2008/04/16/command-line-history-meme/</guid>
		<description><![CDATA[From Cimota.

cat ~/.zshist &#124; awk '{a[$1]++} END {for(i in a)print a[i] &#8221; &#8221; i}&#8217; &#124; sort -rn &#124; head -10
2870 ls
2444 cd
659 vi
348 rm
254 svn
232 ssh
206 telnet
182 whois
180 egrep
179 sudo

]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://cimota.com/blog/2008/04/16/command-line-history-meme/">Cimota</a>.</p>
<p><code><br />
cat ~/.zshist | awk '{a[$1]++} END {for(i in a)print a[i] &#8221; &#8221; i}&#8217; | sort -rn | head -10</p>
<p>2870 ls<br />
2444 cd<br />
659 vi<br />
348 rm<br />
254 svn<br />
232 ssh<br />
206 telnet<br />
182 whois<br />
180 egrep<br />
179 sudo<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://godswearhats.com/2008/04/16/command-line-history-meme/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Green fields and how to sow them</title>
		<link>http://godswearhats.com/2008/01/03/green-fields-and-how-to-sow-them/</link>
		<comments>http://godswearhats.com/2008/01/03/green-fields-and-how-to-sow-them/#comments</comments>
		<pubDate>Thu, 03 Jan 2008 13:30:51 +0000</pubDate>
		<dc:creator>aidan</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[news]]></category>

		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://godswearhats.com/2008/01/03/green-fields-and-how-to-sow-them/</guid>
		<description><![CDATA[Here&#8217;s the scenario:  you&#8217;re writing a green field web application.  This application will be used to power more than one e-commerce site, which means that it must be easily tailored.  You can use any toolset you like, and the requirements are fairly standard (e.g. exporting data to CSV, modern UI, payment gateway, [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the scenario:  you&#8217;re writing a green field web application.  This application will be used to power more than one e-commerce site, which means that it must be easily tailored.  You can use any toolset you like, and the requirements are fairly standard (e.g. exporting data to CSV, modern UI, payment gateway, etc.).  What do you choose?</p>
<ol>
<li>Off-the-shelf e-commerce engine</li>
<li>Open-source e-commerce engine</li>
<li>Build your own</li>
</ol>
<p>So, it seems you&#8217;ve got three options (anyone think of a 4th?).  Of course within each of these options there are any number of competing solutions, especially in &#8220;build your own&#8221;, where you could potentially use any language, web server, etc.</p>
<p>I think with any software developer, the preference is to build one&#8217;s own.  That way you get ultimate flexibility and intimate understanding of the code, which makes it easier to expand and customise.  The downside is that you have more work up-front in order to get running.</p>
<p>Off-the-shelf (i.e. commercial) software tends to have a lot of features that your accountant and fulfillment department would like, and often gives you the ability to customise using one of a few popular languages or their own pseudo-language.  The real advantage is that you can have a store quickly, or so you might think.  Often, shoe-horning your data into their proprietary and closed-source format makes this option longer and more expensive than building it yourself.</p>
<p>All of which leaves open-source engines.  You can be up and running quickly (like with commercial apps) but you have access to the source code if you decide you need to change things the way you want them.  Potential downsides are lack of support and lack of particular features you might need (e.g. a particular payment gateway).</p>
<p>So, which would you choose?</p>
]]></content:encoded>
			<wfw:commentRss>http://godswearhats.com/2008/01/03/green-fields-and-how-to-sow-them/feed/</wfw:commentRss>
		</item>
		<item>
		<title>From nothing to something: iterative app development</title>
		<link>http://godswearhats.com/2007/12/04/from-nothing-to-something-iterative-app-development/</link>
		<comments>http://godswearhats.com/2007/12/04/from-nothing-to-something-iterative-app-development/#comments</comments>
		<pubDate>Tue, 04 Dec 2007 15:42:48 +0000</pubDate>
		<dc:creator>aidan</dc:creator>
		
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://godswearhats.com/2007/12/04/from-nothing-to-something-iterative-app-development/</guid>
		<description><![CDATA[1. Prove it works
write the simplest code possible to show one thing working end-to-end
This can be as horrible and hackish as needed.  I regularly hardcode things like URLs, integers, strings, file names/paths: whatever is needed just to show that the idea works.  E.g. for Rickshaw, I started off by always sending a file [...]]]></description>
			<content:encoded><![CDATA[<h3>1. Prove it works</h3>
<h4>write the simplest code possible to show one thing working end-to-end</h4>
<p>This can be as horrible and hackish as needed.  I regularly hardcode things like URLs, integers, strings, file names/paths: whatever is needed just to show that the idea works.  E.g. for Rickshaw, I started off by always sending a file called rickshaw.png, which just got removed and replaced by a URL - the URL in the e-mail was hardcoded to be a reference to <code>http://localhost/~aidan/rickshaw.png</code>, and I happened to have the file in that directory.  The whole workflow appeared to work, even though none of the upload magic was there.  I proved out two concepts though:</p>
<ul>
<li>that attachments could be manipulated after sending</li>
<li>that the resulting e-mail still made sense</li>
</ul>
<h3>2. Add to it</h3>
<h4>write the next most important bit simply, then test it all</h4>
<p>This can be harder than you think.  Not the writing, but choosing what bit is the next most important.  For me, I wanted to have that file be written dynamically.  The important thing is to keep it small - do it, test it and be happy with it.  Some things lend themselves to automated testing: some don&#8217;t.  I&#8217;m a fan of test-driven development, but I don&#8217;t get hung up on ensuring coverage - look at Microsoft Windows Vista: excellent automated test coverage, crappy user experience.  Test manually where it makes sense, and automatically where needed.</p>
<h3>3. Repeat step 2</h3>
<p>You go from your tasks being &#8220;remove hardcoded URL and replace with URL generation code&#8221; to &#8220;Add application icon&#8221; and &#8220;Build website to sell app&#8221;.  One step at a time, doing the most important thing at any given time.</p>
<p>Rickshaw had no user interface for quite some time - it was just a plug-in that was copied from the command line.  Eventually that was good enough that a UI for configuring it was the most important thing.  Then a button that tested the configuration before using it.  Then some code to install the plug-in.  License keys.  Usability enhancements.  And so on.</p>
<p>None of this is new or original - it&#8217;s all common sense, especially if you&#8217;ve worked in an agile development team before.  The great thing about working this way is you see results early on.  I had a working prototype of Rickshaw which did &#8220;uploads&#8221; to localhost (using <code>NSData writeToFile:atomically</code>) within a week, and real uploads within three weeks.  The downside is that you feel very close to finishing at an early stage.</p>
<p>If you consider the entirety of what&#8217;s needed to build an app as being 100% of the effort, I&#8217;d lay out the effort required for different parts as something like this:</p>
<ul>
<li>Hack to prove concept: 5%</li>
<li>Prototype to prove hack: 15%</li>
<li>Making prototype robust: 30%</li>
<li>Getting it ready for users: 50%</li>
</ul>
<p>Open source projects are one of the first three stages (corresponding roughly to &#8216;alpha&#8217;, &#8216;beta&#8217; and &#8217;stable&#8217; projects).  The last stage takes just as long as the first three, and it&#8217;s the reason why commercial Mac apps (in particular) are better than open source apps for Linux - as much time has been spent getting the application to work well for users as has been spent getting the application to work for the developers.</p>
<p>If you&#8217;re developing an app for any platform, ensuring you spend the time in that last stage is what will make your work stand out.</p>
]]></content:encoded>
			<wfw:commentRss>http://godswearhats.com/2007/12/04/from-nothing-to-something-iterative-app-development/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ironcoder 7 date set</title>
		<link>http://godswearhats.com/2007/10/25/ironcoder-7-date-set/</link>
		<comments>http://godswearhats.com/2007/10/25/ironcoder-7-date-set/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 09:09:31 +0000</pubDate>
		<dc:creator>aidan</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[news]]></category>

		<category><![CDATA[cocoa]]></category>

		<category><![CDATA[ironcoder]]></category>

		<category><![CDATA[mac os x]]></category>

		<guid isPermaLink="false">http://godswearhats.com/2007/10/25/ironcoder-7-date-set/</guid>
		<description><![CDATA[The 7th Ironcoder contest was announced today (for some definition of today - damn those pesky time zones).  I think this year I actually feel confident enough to take part, even if I accomplish not very much   For those who have no idea what it is, each contest selects a theme and [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://ironcoder.org/blog/2007/10/24/ironcoder-7/trackback/">7th Ironcoder contest</a> was announced today (for some definition of today - damn those pesky time zones).  I think this year I actually feel confident enough to take part, even if I accomplish not very much <img src='http://godswearhats.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  For those who have no idea what it is, each contest selects a theme and Mac OS X API, then gives you 48 hours (real time) to write an app that has both theme and API centrally featured.  Check out the <a href="http://irconcoder.org">Ironcoder</a> site for more info, or take a look at the entries for <a href="http://ironcoder.googlecode.com/svn/trunk/entries/ironcoder_5/individual/">Ironcoder 5</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://godswearhats.com/2007/10/25/ironcoder-7-date-set/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rickshaw preview - Attachments without the attachment.</title>
		<link>http://godswearhats.com/2007/10/24/rickshaw-preview-attachments-without-the-attachment/</link>
		<comments>http://godswearhats.com/2007/10/24/rickshaw-preview-attachments-without-the-attachment/#comments</comments>
		<pubDate>Wed, 24 Oct 2007 23:21:11 +0000</pubDate>
		<dc:creator>aidan</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[attachments]]></category>

		<category><![CDATA[mac os x]]></category>

		<category><![CDATA[mail]]></category>

		<category><![CDATA[rickshaw]]></category>

		<guid isPermaLink="false">http://godswearhats.com/2007/10/24/rickshaw-preview-attachments-without-the-attachment/</guid>
		<description><![CDATA[Here&#8217;s a quick preview of the product I&#8217;m currently working on.  It&#8217;s called Rickshaw and it&#8217;s designed for people who like the convenience of sending (large) attachments via e-mail.  Using Rickshaw your attachments are stripped from the mail as it is sent and uploaded to your designated server.  The attachment is replaced [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick preview of the product I&#8217;m currently working on.  It&#8217;s called Rickshaw and it&#8217;s designed for people who like the convenience of sending (large) attachments via e-mail.  Using Rickshaw your attachments are stripped from the mail as it is sent and uploaded to your designated server.  The attachment is replaced with a URL that allows the recipient to just download what you sent at their leisure.</p>
<p>This product is primarily aimed at people who have to work with large files and need to send them to multiple recipients - avoiding issues with mailbox quotas, mail server file size limits or file type restrictions and so on.  More details about how to use the product will follow, but here&#8217;s a quick video showing it in action.</p>
<p>Enjoy!  (<a href="http://infurious.com/rickshaw.mov">also available as a QuickTime movie</a>)</p>
<p><object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/cKIZq8BaiGQ"></param><embed src="http://www.youtube.com/v/cKIZq8BaiGQ" type="application/x-shockwave-flash" width="425" height="350"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://godswearhats.com/2007/10/24/rickshaw-preview-attachments-without-the-attachment/feed/</wfw:commentRss>
<enclosure url="http://infurious.com/rickshaw.mov" length="508694" type="video/quicktime" />
		</item>
		<item>
		<title>syntax error before ‘AT_NAME’ token</title>
		<link>http://godswearhats.com/2007/10/22/syntax-error-before-%e2%80%98at_name%e2%80%99-token/</link>
		<comments>http://godswearhats.com/2007/10/22/syntax-error-before-%e2%80%98at_name%e2%80%99-token/#comments</comments>
		<pubDate>Mon, 22 Oct 2007 08:56:08 +0000</pubDate>
		<dc:creator>aidan</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[news]]></category>

		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://godswearhats.com/2007/10/22/syntax-error-before-%e2%80%98at_name%e2%80%99-token/</guid>
		<description><![CDATA[If you happen to be using Xcode and get this somewhat baffling error message when building:
syntax error before ‘AT_NAME’ token
The problem is that you are missing an @end in some file that you&#8217;ve #imported, probably a header file.  This error also shows up as &#8220;parse error ...&#8221; in some versions of Xcode (took me [...]]]></description>
			<content:encoded><![CDATA[<p>If you happen to be using Xcode and get this somewhat baffling error message when building:</p>
<p><code>syntax error before ‘AT_NAME’ token</code></p>
<p>The problem is that you are missing an <code>@end</code> in some file that you&#8217;ve <code>#import</code>ed, probably a header file.  This error also shows up as &#8220;<code>parse error ...</code>&#8221; in some versions of Xcode (took me a while to track down with Google as a result).</p>
]]></content:encoded>
			<wfw:commentRss>http://godswearhats.com/2007/10/22/syntax-error-before-%e2%80%98at_name%e2%80%99-token/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to use subversion: an absolute beginner&#8217;s guide</title>
		<link>http://godswearhats.com/2007/10/18/how-to-use-subversion-an-absolute-beginners-guide/</link>
		<comments>http://godswearhats.com/2007/10/18/how-to-use-subversion-an-absolute-beginners-guide/#comments</comments>
		<pubDate>Thu, 18 Oct 2007 12:51:22 +0000</pubDate>
		<dc:creator>aidan</dc:creator>
		
		<category><![CDATA[code]]></category>

		<category><![CDATA[news]]></category>

		<category><![CDATA[beginner's guide]]></category>

		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://godswearhats.com/2007/10/18/how-to-use-subversion-an-absolute-beginners-guide/</guid>
		<description><![CDATA[I&#8217;ve started working on some projects with a bunch of guys who are not used to using version control systems.  This post is as much for them as it is for anyone else.  I won&#8217;t go into how to install subversion, because that is covered by many other people elsewhere.  I also [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started working on some projects with a <a href="http://infurious.com">bunch of guys</a> who are not used to using version control systems.  This post is as much for them as it is for anyone else.  I won&#8217;t go into how to install subversion, because that is covered by many other people elsewhere.  I also don&#8217;t touch on how to administer subversion for the same reason.  This simple guide is purely for how to be a subversion user.  It assumes that you know how to access and use a Unix command line.  There are GUIs out there for handling these activities, but I&#8217;m working from the perspective that (a) &#8220;In the beginning was the command line&#8230;&#8221; and (b) the principle is the same regardless of the interface.</p>
<h4>Getting started</h4>
<p>If you are about to use subversion, your administrator has probably given you a URL for your repository.  This could have a number of forms, but for our purposes they can all be treated identically - I&#8217;m going to use the fictitious URL http://example.com/svn/repo/trunk/project.  The repository (as you probably know) is just a central store for all the files for a given project, along with version information.  The first thing you&#8217;ll do is create a <strong>working copy</strong> of the repository on your computer.</p>
<blockquote><p><code><br />
svn co http://example.com/svn/repo/trunk/next_big_thing<br />
</code></p></blockquote>
<p>Subversion will spit out some information about what it&#8217;s doing - ignore that for now.  What&#8217;s happening here?  It&#8217;s very simple.<code>svn</code> is the subversion command line application.  The <code>co</code> command is short for <code>checkout</code>, which tells subversion to go the URL supplied and bring back a copy of the latest version of what&#8217;s there.  This will create a directory (or folder if you prefer that term) with the same name as the bit after the last / of the URL - in this example: <code>next_big_thing</code>.  That <code>next_big_thing</code> directory is your working copy of the repository.</p>
<p>Everyone who works on the Next Big Thing project will need to perform this same sort of checkout to their local computer.  What lives in a working copy?  Any sorts of files that you like: documents, source code, images, etc.</p>
<h4>Editing and changing your working copy</h4>
<p>Go ahead and fiddle with stuff in your working copy - you can do anything you like because none of it will affect anyone else until you <strong>commit your changes back to the repository</strong>. Put some files into the directory, edit what&#8217;s already there, delete some as well - you can get it all back the way it was very easily.  But first, let&#8217;s take a look at what&#8217;s changed (yes, that means you actually do have to go and change some things in your working copy:  go on, I&#8217;ll go get a cup of coffee while you&#8217;re doing that &#8230; ready?  OK, good).  Run this command (from within your working copy - anywhere will do, but the top-level folder is best):</p>
<blockquote><p><code>svn status</code></p></blockquote>
<p>You should see a list of the changes you&#8217;ve made, with one of three characters beside them.  Don&#8217;t worry about anything else that is spat out at this point (if anything).</p>
<blockquote><p><code>? foo.txt</code> - <em>a file you&#8217;ve added that subversion doesn&#8217;t know about (yet)</em><br />
<code>M bar.txt</code> - <em>a file you&#8217;ve changed (M stands for merge, which is what happens to this file if you commit your changes)</em><br />
<code>! baz.txt</code> -<em> a file you&#8217;ve deleted</em></p></blockquote>
<h4>Adding files to a repository</h4>
<p>You&#8217;ve put some files into your working copy, but there&#8217;s another step that needs to happen before they can be committed to the central repository.</p>
<blockquote><p><code>svn add mynewfile.txt</code></p></blockquote>
<p>Naturally, you substitute &#8220;mynewfile.txt&#8221; for the name of your actual file.  This tells subversion that you want to add the file to the repository the next time that you perform a commit (which we&#8217;ll get to in a moment).  Why is this step necessary?  There are any number of reasons why you wouldn&#8217;t want to automatically commit any file in your repository. The most common is probably that many programs create backup or temporary copies of files in a directory while you&#8217;re working on them - it wouldn&#8217;t be good to clutter up the repository with cruft.  Subversion itself creates temporary files when there&#8217;s a conflict (yes, even in version control there is conflict - I may do another guide on how to deal with that).</p>
<p>Likewise, to delete a file you need to use:</p>
<blockquote><p><code>svn delete myoldfile.txt</code></p></blockquote>
<p>otherwise subversion gets confused.  When you use <code>add</code> and <code>delete</code>, you&#8217;ll get a different <code>status</code> beside your file when you run that command - it&#8217;ll be <code>A</code> and <code>D</code> respectively (instead of the <code>?</code> and <code>!</code> that we saw above).</p>
<h4>Holy crap!  I didn&#8217;t want to do that!</h4>
<p>As I mentioned above, it&#8217;s easy to get things back the way they were.  If you want to back out any changes you&#8217;ve made to the whole project, do this in the top-level directory:</p>
<blockquote><p><code>svn revert</code></p></blockquote>
<p>You can also use <code>svn revert myfile.txt</code> to revert individual files (or directories).</p>
<h4>Committing to the repository, and getting updates</h4>
<p>So, now you&#8217;ve made all the changes you want to make, it&#8217;s time to commit them back to the central repository.  This is where all the actual version control magic actually happens.  Run this command from the top-level directory of your working copy:</p>
<blockquote><p><code>svn commit</code></p></blockquote>
<p>The first thing that will happen here is that a text editor will start up (usually <code>vi</code>).  Enter a comment describing your change and then save and exit (in <code>vi</code> that means typing <code>ZZ</code> in command mode).</p>
<p>This will take all the changes you&#8217;ve made and upload them into the repository, commented with what you wrote.  Now the next time someone runs <code>svn co ...</code> all your changes will be visible to them.  If someone else has also committed some changes, you can get the latest version with (from the top-level directory):</p>
<blockquote><p><code>svn update</code></p></blockquote>
<p>You will probably need to run the <code>update</code> command before you do a commit so that you have the latest version of the repository before trying to change it.  Any time you (or anyone else) runs <code>svn commit</code>, the <strong>version number</strong> of the repository goes up by one.  In this way, it&#8217;s easy to tell the state of every file in the repository at any particular point in the repository&#8217;s history, and it&#8217;s how you avoid having one person overwrite all (or worse: some) of the work done by someone else.</p>
<h4>What&#8217;s changed?</h4>
<p>You can see the changes that people have made by using</p>
<blockquote><p><code>svn log</code></p></blockquote>
<p>Be careful with running this in the top-level directory of your working copy - you&#8217;ll get every commit message for the project since the first revision.  Usually this is run on an individual file to see the history of that file.</p>
<h4>And I&#8217;m spent &#8230;</h4>
<p>That&#8217;s it - you now know the absolute basics of subversion.  For more detail, I suggest reading the <a href="http://svnbook.red-bean.com/">online Subversion Book</a>.  Any questions, comments or inaccuracies can be <a href="mailto:five@godswearhats.com">sent my way</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://godswearhats.com/2007/10/18/how-to-use-subversion-an-absolute-beginners-guide/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
