<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Rory Hart</title>
	
	<link>http://www.roryhart.net</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Sat, 04 Sep 2010 06:33:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/RoryHart" /><feedburner:info uri="roryhart" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:browserFriendly></feedburner:browserFriendly><item>
		<title>My Cooking Secret</title>
		<link>http://www.roryhart.net/food/my-cooking-secret/</link>
		<comments>http://www.roryhart.net/food/my-cooking-secret/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 05:19:59 +0000</pubDate>
		<dc:creator>hartror</dc:creator>
				<category><![CDATA[Food]]></category>

		<guid isPermaLink="false">http://www.roryhart.net/?p=54</guid>
		<description><![CDATA[Yesterday I purchased some Rapini, which I&#8217;ve never eaten before let alone cooked with. I grabbed it as it was there, figuring it would make a good side for the duck legs I had found in my local butcher. When &#8230; <a href="http://www.roryhart.net/food/my-cooking-secret/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yesterday I purchased some <em>Rapini,</em> which I&#8217;ve never eaten before let alone cooked with. I grabbed it as it was there, figuring it would make a good side for the duck legs I had found in my local butcher. When I got to checkout of the grocers the girl asked me what I was going to do with it. I replied that I didn&#8217;t know as I had never eaten it. The checkout girl looked shocked, I didn&#8217;t know what I was going to do with it? I was buying something I had never eaten? What the hell?!</p>
<p>Her reaction got me thinking about my attitude towards cooking and how it differs from others.</p>
<p>I enjoy wowing with food, and that includes wowing myself. There is a thrill and sense of accomplishment when a dish turns out and people enjoy it. To do this I&#8217;ve learnt a trick, not being afraid to fail when cooking a dish. With this I am happy to leap into trying new dishes, new techniques, so I regularly cook with new ingredients or untried recipes.</p>
<p>Too many people are afraid to fail when it comes to cooking, so they don&#8217;t try and the lack of variety leads to boredom and cooking being a chore. I still get annoyed when a dish doesn&#8217;t turn out as I had wished, but that just means I take another crack at it later. Rarely will there be an inedible disaster, so guests are rarely left hungry even if I have to apologise for such and such not quite working.</p>
<p><strong>Cook one thing a week that you have never tried to cook, I dare you.</strong></p>
<p><em>ps. I did sort of know what I was going to do with the Rapini and that was add butter and garlic, if in doubt use butter and garlic, you can&#8217;t go wrong!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.roryhart.net/food/my-cooking-secret/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django and Dreampie</title>
		<link>http://www.roryhart.net/code/django-and-dreampie/</link>
		<comments>http://www.roryhart.net/code/django-and-dreampie/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 10:48:00 +0000</pubDate>
		<dc:creator>hartror</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[dreampie]]></category>
		<category><![CDATA[hacking]]></category>

		<guid isPermaLink="false">http://www.roryhart.net/?p=46</guid>
		<description><![CDATA[As would be obvious by now I am a dedicated djangonaut (cheesy name I know) and I&#8217;ve been using django long enough now that using the ORM (Object Relational Mapping) is becoming second nature. Using SQL for anything but database &#8230; <a href="http://www.roryhart.net/code/django-and-dreampie/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As would be obvious by now I am a dedicated djangonaut (cheesy name I know) and I&#8217;ve been using django long enough now that using the ORM (Object Relational Mapping) is becoming second nature. Using SQL for anything but database gymnastics is somewhat annoying as the data isn&#8217;t as accessible to python as it is with an ORM. So when I need to get a quick insight into some data or prototype some code I want to be able to use the ORM instead of SQL.</p>
<p>I&#8217;ve also fallen in love with <a href="http://dreampie.sourceforge.net/">dreampie</a>, which is an interactive python shell on steroids. It allows you to type and edit multi-line pieces of python code which you can then run in the inbuilt python shell. It has a fast clean interface and autocompletes attributes from the interpreter so you can get some hacking done quick.</p>
<p>Of course I want to be able to do quick django hacking in dreampie and I worked out a simple way of doing this.</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span><br />
<span style="color: #dc143c;">sys</span>.<span style="color: black;">path</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'/path/to/your/project/'</span><span style="color: black;">&#41;</span><br />
<span style="color: #ff7700;font-weight:bold;">import</span> settings<br />
<span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">core</span>.<span style="color: black;">management</span> <span style="color: #ff7700;font-weight:bold;">import</span> setup_environ<br />
setup_environ<span style="color: black;">&#40;</span>settings<span style="color: black;">&#41;</span><br />
<span style="color: #ff7700;font-weight:bold;">from</span> a_django_app.<span style="color: black;">models</span> <span style="color: #ff7700;font-weight:bold;">import</span> AModel</div></div>
<p>Pasting this into dreampie (or loading it from the nice history functionality dreampie provides) sets up the shell with everything it needs to access the ORM (or anything else you use in django for that matter. The first two lines add the project&#8217;s path to the list of paths python uses to search for modules and packages. The next imports the project&#8217;s settings and activates those settings using the django function setup_environ. After that you can import app models and query away.</p>
<p>You can also use the same snippet of code at the top of standalone scripts to allow them to access the project&#8217;s django environment which is useful though it is normally advisable to add a <a href="http://docs.djangoproject.com/en/dev/howto/custom-management-commands/">management command</a> instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.roryhart.net/code/django-and-dreampie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django Site Admin Emails</title>
		<link>http://www.roryhart.net/code/django-site-admin-emails/</link>
		<comments>http://www.roryhart.net/code/django-site-admin-emails/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 11:28:38 +0000</pubDate>
		<dc:creator>hartror</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[alerts]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[pragmatic]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.roryhart.net/?p=37</guid>
		<description><![CDATA[There is a neat feature in default behavior of Django. If while rendering a view it throws an uncaught exception it emails all the sysadmins in it&#8217;s settings file. This simple little feature is great on several levels. Repeatedly getting emails about &#8230; <a href="http://www.roryhart.net/code/django-site-admin-emails/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There is a neat feature in default behavior of Django. If while rendering a view it throws an uncaught exception it emails all the sysadmins in it&#8217;s settings file. This simple little feature is great on several levels.</p>
<ol>
<li>Repeatedly getting emails about an issue with often enough information to diagnose and fix the problem means you&#8217;re less likely to put up with <a href="http://www.artima.com/intv/fixit.html">broken windows</a>.</li>
<li>When something goes wrong you&#8217;re much more likely to find out about it, as monitoring is often one of the last things to be done on a project.</li>
</ol>
<p>So it is a warm and fuzzy safety net that reassures you with an empty inbox, I really like it when I come in on Monday morning and I don&#8217;t get a single email telling me something barfed over the weekend.</p>
<p>And as an added bonus Django has this wonderful philosophy about exposing the pixie dust it uses to do it&#8217;s magic. All it takes is a call to <a href="http://docs.djangoproject.com/en/dev/topics/email/#mail-admins">mail_admins()</a>:</p>
<div class="codecolorer-container python default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mail_admins<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Made a sale&quot;</span>,<span style="color: #483d8b;">&quot;We just sold a pony for $%d&quot;</span> <span style="color: #66cc66;">%</span> pony_price<span style="color: black;">&#41;</span></div></div>
<p>And you&#8217;re alerting everyone when something good happens. This is great with new low volume projects where every sale is a momentous event. Of course you can use this for alerting the team about errors as well. There is also <a href="http://docs.djangoproject.com/en/dev/topics/email/#mail-managers-function">mail_managers()</a> so you can setup the non technicals to receive relevant alerts with the same amount of effort.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.roryhart.net/code/django-site-admin-emails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Composite Primary Keys to Django</title>
		<link>http://www.roryhart.net/code/adding-composite-primary-keys-to-django/</link>
		<comments>http://www.roryhart.net/code/adding-composite-primary-keys-to-django/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 14:03:08 +0000</pubDate>
		<dc:creator>hartror</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[composite keys]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://www.roryhart.net/?p=27</guid>
		<description><![CDATA[Composite primary keys are great and relating two records together is best done using them. Adding another field just to identify the relationship makes the table un-normalized (that isn&#8217;t a word is it?) and we all want our tables normalized &#8230; <a href="http://www.roryhart.net/code/adding-composite-primary-keys-to-django/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Composite primary keys are great and relating two records together is best done using them. Adding another field just to identify the relationship makes the table un-normalized (that isn&#8217;t a word is it?) and we all want our tables normalized don&#8217;t we? So it is common practice for (good) database designs to use them anywhere two records are being related.</p>
<p>Unfortunately Django doesn&#8217;t support them right now, at least not without some nasty hacks. This means every time you get your hands on a legacy database there is a high likelihood that there will be composite primary keys are in use and you will be in for a world of pain if you wish to integrate it with Django. I&#8217;ve been there and the hacks are nasty, and also mean you can&#8217;t use a lot of components such as the admin which makes me sad as the admin is a beautiful thing.</p>
<p>The ticket (<a href="http://code.djangoproject.com/ticket/373">http://code.djangoproject.com/ticket/373</a>) has been around for 5 years with only one person taking a decent crack at it and he seems to have stopped working on it around the same time the core team was working on 1.0. So I have started on the path of getting Django to support them. And this doesn&#8217;t just mean working on the ORM part of Django, it means getting every part of Django to understand that a primary key doesn&#8217;t just mean one column/field. Not a small project by any means but it will show some pay-offs in the short term as it replaces the hacks I currently have in place.</p>
<p>Once I have some code to show it will be up on my github <a href="http://github.com/hartror">http://github.com/hartror</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.roryhart.net/code/adding-composite-primary-keys-to-django/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My 4 favourite development sites</title>
		<link>http://www.roryhart.net/code/my-4-favourite-coding-sites/</link>
		<comments>http://www.roryhart.net/code/my-4-favourite-coding-sites/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 05:01:29 +0000</pubDate>
		<dc:creator>hartror</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.roryhart.net/?p=19</guid>
		<description><![CDATA[1. Hacker News I habitually go to hacker news a few times a day, the people are intelligent and the discussion is the right mixture of coding, entrepreneurial and geek. It is also the first site I&#8217;ve consistently commented on, the karma feedback &#8230; <a href="http://www.roryhart.net/code/my-4-favourite-coding-sites/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<h3><a href="http://news.ycombinator.com/">1. Hacker News</a></h3>
<p>I habitually go to hacker news a few times a day, the people are intelligent and the discussion is the right mixture of coding, entrepreneurial and geek. It is also the first site I&#8217;ve consistently commented on, the karma feedback from writing an insightful comment is quite effective.</p>
<h3><a href="http://www.startuplessonslearned.com/">2. Startup Lessons Learned</a></h3>
<p>I work as the head of development at a startup and I refer to this site regularly. The author, Eric Ries, has an excellent writing style that combines the best of narrative and technical writing to highlight the lessons he draws from his experiences in the trenches.</p>
<h3><a href="http://www.joelonsoftware.com/">3. Joel on Software</a></h3>
<p>I want to work with this guy, but I am afraid that the only way I will ever get job satisfaction again will be to run my own company, which probably isn&#8217;t a bad thing. His articles inform and inspire developers the world over to question how and what they do and generally do an all round better job.</p>
<h3><a href="http://www.scottberkun.com/">4. Scott Berkun</a></h3>
<p>Scott Berkun&#8217;s book <em>Making Things Happen</em> has been my bible in the project managerial baptism of fire I experienced. His website has a varied focus but I always seem to find it applicable to my situation, weather it is dealing with deadlines, people or public speaking.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.roryhart.net/code/my-4-favourite-coding-sites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why do I seek to be a better developer?</title>
		<link>http://www.roryhart.net/code/improving-oneself/</link>
		<comments>http://www.roryhart.net/code/improving-oneself/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 11:54:54 +0000</pubDate>
		<dc:creator>hartror</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[professional development]]></category>

		<guid isPermaLink="false">http://www.roryhart.net/?p=7</guid>
		<description><![CDATA[I am continually reading about programming, software engineering and project management, both on the net and in dead tree form, my latest dead tree being Effective C++ by Scott Meyers. This reading is out of a desire to be a &#8230; <a href="http://www.roryhart.net/code/improving-oneself/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I am continually reading about programming, software engineering and project management, both on the net and in dead tree form, my latest dead tree being <em>Effective C++</em> by Scott Meyers. This reading is out of a desire to be a better developer, and today I though: but why do <strong>I </strong>seek to be a better developer? A little bit of the drive to better myself comes from the usual suspects, monetary gain, respect from my peers and suchlike. But for the most part I want to feel like I am doing a good job at something that I love, that how well I perform is important to me for its own sake rather than from some external pressure.</p>
<p>This means that if I hate what I am working on or am unable to complete it to my own satisfaction I have to take care not to fall into a funk, professional pride has its drawbacks (though feel and hope are overwhelmed by its advantages). So to manage this what do I do? Well I am fortunate to have an innumerable number of hobbies that I can draw professional pride from, programming being a major one, cooking being another. And then I always have learning, the discovery of new techniques and coming to new understandings is often the best way to for me to create that feeling of self worth we all seek.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.roryhart.net/code/improving-oneself/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
