<?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>ten.ynottony.net &#187; Programming</title>
	<atom:link href="http://ten.ynottony.net/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://ten.ynottony.net</link>
	<description>He's at it again...</description>
	<lastBuildDate>Sat, 05 Feb 2011 11:21:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Testing with Python 2.4 on Ubuntu 10.10</title>
		<link>http://ten.ynottony.net/2011/02/testing-with-python24-on-ubuntu-1010/</link>
		<comments>http://ten.ynottony.net/2011/02/testing-with-python24-on-ubuntu-1010/#comments</comments>
		<pubDate>Thu, 03 Feb 2011 18:30:49 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[virtualenv]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/?p=178</guid>
		<description><![CDATA[Recently I needed to test a Django app under Python 2.4. I&#8217;m using Ubuntu 10.10 and the lowest packaged version of Python in the repositories is 2.6. I decided to compile Python 2.4 myself and use it in a virtualenv &#8230; <a href="http://ten.ynottony.net/2011/02/testing-with-python24-on-ubuntu-1010/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently I needed to test a <a href="http://www.djangoproject.com/">Django</a> app under <a href="http://www.python.org/">Python</a> 2.4.  I&#8217;m using <a href="http://www.ubuntu.com/">Ubuntu</a> 10.10 and the lowest packaged version of Python in the repositories is 2.6.  I decided to compile Python 2.4 myself and use it in a <a href="http://pypi.python.org/pypi/virtualenv">virtualenv</a> environment to test the app.  There were a couple of little gotchas that caught me when I was doing this, so I thought I&#8217;d write-up the process.</p>
<h3>Step 1: Install the Build Dependencies </h3>
<p>Python 2.6 is close enough to 2.4 that the dependencies haven&#8217;t changed much (if at all).<br />
	<code>sudo apt-get build-dep python2.6</code></p>
<h3>Step 2: Download Python 2.4 Final</h3>
<p>	<code>wget http://www.python.org/ftp/python/2.4/Python-2.4.tgz<br />
	tar -zxvf Python-2.4.tgz</code></p>
<h3>Step 3: Configure and Install Python 2.4</h3>
<p>My first attempt at building Python 2.4 failed with a buffer overflow.  I found a <a href="https://forums.ubuntulinux.jp/viewtopic.php?id=8265">Japanese forum post</a> that had solved the issue by setting <code>BASECFLAGS=-U_FORTIFY_SOURCE</code> during the configure stage.<br />
	<code>./configure BASECFLAGS=-U_FORTIFY_SOURCE<br />
	make<br />
	sudo make install</code></p>
<h3>Step 4: Fix the Default Python Version</h3>
<p>The make install step sets Python 2.4 as the default version of Python.  I wanted to keep that at 2.6. So&#8230;<br />
	<code>sudo rm /usr/local/bin/python<br />
	sudo ln -s /usr/bin/python2.6 /usr/local/bin/python</code></p>
<h3>Step 5: Install into Virtualenv</h3>
<p>I wanted to set up a virtualenv environment to test the app.  Here I specify which version of python I want to use for the interpreter and activate it.<br />
	<code>virtualenv env -p python2.4 --no-site-packages<br />
	source env/bin/activate</code></p>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2011/02/testing-with-python24-on-ubuntu-1010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Django FormWizard in a view</title>
		<link>http://ten.ynottony.net/2011/01/using-django-formwizard-in-a-view/</link>
		<comments>http://ten.ynottony.net/2011/01/using-django-formwizard-in-a-view/#comments</comments>
		<pubDate>Sun, 02 Jan 2011 09:45:53 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[FormWizard]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/?p=170</guid>
		<description><![CDATA[I recently needed to use a Django form wizard from a view. I needed it in a view as I had some permissions that I needed to check and also wanted to supply some initial data as the form would &#8230; <a href="http://ten.ynottony.net/2011/01/using-django-formwizard-in-a-view/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently needed to use a Django <a href="http://docs.djangoproject.com/en/dev/ref/contrib/formtools/form-wizard/">form wizard</a> from a view.   I needed it in a view as I had some permissions that I needed to check and also wanted to supply some initial data as the form would now be editing information that was previously supplied.</p>
<p>I had found some code on <a href="http://djangosnippets.org/snippets/1833/">Django Snippets</a> but it was also messing around with the way that form wizards were defined.  I didn&#8217;t want to change the way that form wizards behaved so I stripped out the changes and was left with a minimal way to use a form wizard in a view. </p>
<p>The main thing to notice is that first you have to create an instance of the FormWizard.  Then as the object to return from the view you must call the instance passing through the context and the request.</p>
<p><strong>Example</strong>:</p>
<pre><code>
@login_required
def edit_form_wizard(request, slug):
    # Do some permission checking
    ..... snip .....

    # Set up the dictionary of initial data for the form
    # In this case, we are pre-filling some data from the first form only
    initial = {0: {'first_name': request.user.first_name,
                   'last_name': request.user.last_name,
                   'email': request.user.email,
                  },
              }

    # Create the form wizard
    form = EditFormWizard([ContactForm, SecondForm, ThirdForm], initial=initial)

    # Call the form wizard passing through the context and the request
    return form(context=RequestContext(request), request=request)
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2011/01/using-django-formwizard-in-a-view/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>git-svn new branches don&#8217;t show up&#8230;</title>
		<link>http://ten.ynottony.net/2009/02/git-svn-new-branches-dont-show-up/</link>
		<comments>http://ten.ynottony.net/2009/02/git-svn-new-branches-dont-show-up/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 17:22:11 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/?p=35</guid>
		<description><![CDATA[Working with git-svn I noticed that new branched didn&#8217;t show up when I did the usual git svn rebase to get the remote changes. After a bit of searching and not coming up with much, I worked out that git &#8230; <a href="http://ten.ynottony.net/2009/02/git-svn-new-branches-dont-show-up/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Working with git-svn I noticed that new branched didn&#8217;t show up when I did the usual <code>git svn rebase</code> to get the remote changes.  After a bit of searching and not coming up with much, I worked out that <code>git svn fetch</code> pulls in the changes for the whole module, not just the current branch.  After running that command, the new branches, tags etc. show up.</p>
<p>Hope this helps someone&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2009/02/git-svn-new-branches-dont-show-up/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Enabling bash/git auto-completion in Ubuntu</title>
		<link>http://ten.ynottony.net/2009/02/enabling-bashgit-auto-completion-in-ubuntu/</link>
		<comments>http://ten.ynottony.net/2009/02/enabling-bashgit-auto-completion-in-ubuntu/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 16:15:44 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[How-to]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/?p=32</guid>
		<description><![CDATA[I now use git quite a lot for various projects.Â  I noticed that on one computer I had very handy tab completion, and the other one did not.Â  They are both running Ubuntu 8.10, so there shouldn&#8217;t be a difference. &#8230; <a href="http://ten.ynottony.net/2009/02/enabling-bashgit-auto-completion-in-ubuntu/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I now use git quite a lot for various projects.Â  I noticed that on one computer I had very handy tab completion, and the other one did not.Â  They are both running Ubuntu 8.10, so there shouldn&#8217;t be a difference.</p>
<p>It turns out that I had enabled bash completion on one machine but not on the other.</p>
<p>To enable it for all users on your system you need to editÂ  /etc/bash.bashrc and uncomment lines 32 &#8211; 34 (in the default file) so it looks like:</p>
<pre># enable bash completion in interactive shells
if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
fi</pre>
<p>Open a new terminal and auto-completion should now work.</p>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2009/02/enabling-bashgit-auto-completion-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>git vs bzr (vs svn)</title>
		<link>http://ten.ynottony.net/2009/01/git-vs-bzr-vs-svn/</link>
		<comments>http://ten.ynottony.net/2009/01/git-vs-bzr-vs-svn/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 19:51:05 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[bzr]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/?p=15</guid>
		<description><![CDATA[I thought I should write up my experiences of trying out git.Â  It&#8217;s only been a week, but I&#8217;m settling in well.Â  This has probably been posted by many other people all over the internet but if everyone else is &#8230; <a href="http://ten.ynottony.net/2009/01/git-vs-bzr-vs-svn/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I thought I should write up my experiences of trying out <a title="Git" href="http://git-scm.com/" target="_blank">git</a>.Â  It&#8217;s only been a week, but I&#8217;m settling in well.Â  This has probably been posted by many other people all over the internet but if everyone else is doing it so why shouldn&#8217;t I?</p>
<p><span id="more-15"></span></p>
<p>I&#8217;ve been using <a title="Subversion" href="http://subversion.tigris.org/" target="_blank">SVN</a> for years at work, and used it a little bit for personal projects.Â  It&#8217;s good enough but as I travel a lot and don&#8217;t always have a connection to my repository, it can be a bit of a pain.</p>
<p>Most of my personal projects are worked on by 1 or 2 people, so collaboration isn&#8217;t my main concern (although, maybe it should be).</p>
<p>About a year ago I started using <a title="Bazaar" href="http://bazaar-vcs.org/" target="_blank">bzr</a> for my personal projects.Â  This was a great improvement for me as I could commit to my local branches when on a bus, or without internet for whatever reason, and push to my web server whenever the chance arose. I was happy enough with bzr and stayed out of the whole bzr vs <a title="Git" href="http://git-scm.com/" target="_blank">git</a> thing as it didn&#8217;t really concern me.</p>
<p>Then the whole Gnome <a title="Gnomes Distributed Version Control System fiasco" href="http://thread.gmane.org/gmane.comp.gnome.desktop/38525" target="_blank">DVCS</a> thing kicked off which piqued my interest in trying out git. This coincided with me bumping into my old friend <a title="Rick's home page" href="http://sourcesmouth.co.uk/" target="_blank">Rick</a> on a drunken night out.Â  As usual, we bored our friends a little and talked about coding and this time git.Â  He was pretty enthusiastic about it so I thought I&#8217;d give it a shot.Â  Why not, my projects are fairly small so I don&#8217;t have a team to migrate over, just me.</p>
<p>I found <a title="Tailor" href="http://wiki.darcs.net/DarcsWiki/Tailor" target="_blank">Tailor</a> and used that to convert a couple of my smaller projects to git.Â  I read some <a title="git documentation" href="http://git-scm.com/documentation" target="_blank">documentation</a> and found a <a title="Git Cheat Sheet" href="http://ktown.kde.org/~zrusin/git/git-cheat-sheet-medium.png" target="_blank">cheat sheet</a> and then started playing.</p>
<p>So far, it&#8217;s been all good.Â  I&#8217;ve not had a hard time learning the UI, no harder than learning bzr&#8217;s anyway.Â  It seems quicker, but the one thing that makes me want to stay with git over bzr (or anything else) is the really quick and easy branching.Â  I found myself creating new branches to try out new ideas and features.Â  Even for really little silly things.Â  It was quick and painless to branch and merge.Â  Where as with svn and bzr I would have one or two branches for various bits of development + 1 per release, I quickly had 5 branches in git for different ideas and features I wanted to work on.Â  Merging the changes across different branches was painless, and deleting those &#8216;what if&#8217; branches that really were going nowhere was easy too.Â  Although I still have to try pushing to a remote host, it <a title="Setting up a public repository" href="http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#setting-up-a-public-repository" target="_blank">doesn&#8217;t seem hard</a>.</p>
<p>I think I&#8217;m going to stick with git for a long time.Â  I can&#8217;t see any reason not to use it.Â  It is as easy to use as bzr (for my use case), it&#8217;s fast and above all, its branching and merging are fantastic.Â  If you are a bzr user, and have been putting off trying git, now is a good time to do it.Â  I&#8217;m glad I did, it wasn&#8217;t as hard as I thought it would be.</p>
<p>What are your experiences with git, bzr or any other version control software?</p>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2009/01/git-vs-bzr-vs-svn/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ruby Gems on Ubuntu 8.10</title>
		<link>http://ten.ynottony.net/2008/11/ruby-gems-on-ubuntu-810/</link>
		<comments>http://ten.ynottony.net/2008/11/ruby-gems-on-ubuntu-810/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 15:06:21 +0000</pubDate>
		<dc:creator>Anthony Batchelor</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://ten.ynottony.net/2008/11/20/ruby-gems-on-ubuntu-810/</guid>
		<description><![CDATA[Today I was setting up ruby, rails and capistrano on Ubuntu 8.10.Â  It turns out that the gems binary path was not in my path. To fix it, edit your ~/.bashrc file. gedit ~/.bashrc Add these lines to the bottom &#8230; <a href="http://ten.ynottony.net/2008/11/ruby-gems-on-ubuntu-810/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today I was setting up ruby, rails and capistrano on Ubuntu 8.10.Â  It turns out that the gems binary path was not in my path.</p>
<p>To fix it, edit your ~/.bashrc file.<br />
<code>gedit ~/.bashrc</code></p>
<p>Add these lines to the bottom of the file.<br />
<code>#Export the path for Ruby Gems<br />
export PATH=$PATH:/var/lib/gems/1.8/bin</code></p>
<p>Save it and then source the file (to save you from logging-out and back in again).<br />
<code>source ~/.bashrc</code></p>
<p>Then you should be able to run capistrano as you would expect.</p>
<p><strong>Please note: There are potential problems with this as Ruby Gems can install system libraries in this path that end up being used instead of the correct system ones.Â  This can potentially cause problems.Â  See <a title="Launhpad bug" href="https://bugs.launchpad.net/ubuntu/+bug/262063" target="_blank">Launchpad bug #262063</a> for a discussion of the issue.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://ten.ynottony.net/2008/11/ruby-gems-on-ubuntu-810/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

