<?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>Reliably Broken &#187; david</title>
	<atom:link href="http://reliablybroken.com/b/author/david/feed/" rel="self" type="application/rss+xml" />
	<link>http://reliablybroken.com/b</link>
	<description>It&#039;s a blog: let&#039;s do funch!</description>
	<lastBuildDate>Sat, 31 Jul 2010 01:07:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Anita said yes!</title>
		<link>http://reliablybroken.com/b/2010/07/anita-said-yes/</link>
		<comments>http://reliablybroken.com/b/2010/07/anita-said-yes/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 23:43:42 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[adobe]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=515</guid>
		<description><![CDATA[I have been poking at Adobe&#8217;s support pages recently. They have RSS feeds to which you can subscribe in order to learn when new support documents have been published. Today I happened to refresh the feed in those moments before someone bothered to proof-read what they were publishing.


  Please do not publish this doc [...]]]></description>
			<content:encoded><![CDATA[<p>I have been poking at <a href="http://www.adobe.com/">Adobe</a>&#8217;s support pages recently. They have RSS feeds to which you can subscribe in order to learn when <a href="http://www.adobe.com/support/rss/">new support documents have been published</a>. Today I happened to refresh the feed in those moments before someone bothered to proof-read what they were publishing.</p>

<blockquote>
  <p>Please do not publish this doc without checking with Anita. I&#8217;m in the process of reviewing and editing it. Thanks. AnitaWhat&#8217;s coveredIntroduction to the GPUGPU features in Photoshop and Adobe Bridge&#8230;</p>
</blockquote>

<p>Here&#8217;s how it looked in <a href="http://netnewswireapp.com/">NetNewsWire</a>:</p>

<p><a href="http://reliablybroken.com/b/wp-content/uploads/2010/07/anita-said-yes.jpg"><img src="http://reliablybroken.com/b/wp-content/uploads/2010/07/anita-said-yes.jpg" alt="Screenshot of NetNewsWire" title="Anita says yes!" width="600" height="416" class="aligncenter size-full wp-image-519" /></a></p>

<p>Those run-together words in the feed are a fair example of the lack of attention to detail in the design of <a href="http://www.adobe.com/support/">the Adobe support site</a>. There&#8217;s good stuff on there, but finding it is frustrating and anyway wouldn&#8217;t you rather download a demo of something with <a href="http://kb2.adobe.com/cps/402/kb402065.html">motherfucking Akamai download manager</a>?</p>

<p>Meanwhile Anita must have said to go ahead because <a href="http://kb2.adobe.com/cps/404/kb404898.html">there&#8217;s no mention of her on that article&#8217;s page now</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/07/anita-said-yes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django-style routing for Bottle</title>
		<link>http://reliablybroken.com/b/2010/07/django-style-routing-for-bottle/</link>
		<comments>http://reliablybroken.com/b/2010/07/django-style-routing-for-bottle/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 21:57:40 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[bottle]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=510</guid>
		<description><![CDATA[Bottle provides the @route decorator to associate URL paths with view functions. This is very convenient, but if you are a Django-reject like me then you may prefer having all your URLs defined in one place, the advantage being it is easy to see at a glance all the different URLs your application will match.

Updated: [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bottle.paws.de/">Bottle</a> provides the <a href="http://bottle.paws.de/docs/0.8/api.html#bottle.route"><code>@route</code> decorator</a> to associate URL paths with view functions. This is very convenient, but if you are a <a href="http://www.djangoproject.com/">Django</a>-reject like me then you may prefer having all your URLs defined in one place, the advantage being it is easy to see at a glance <a href="http://docs.djangoproject.com/en/1.2/topics/http/urls/#example">all the different URLs your application will match</a>.</p>

<p><em>Updated: I have re-written this post and the example to make it simpler following Marcel Hellkamp&#8217;s comments (Marcel is the primary author of Bottle). My original example was needlessly complicated.</em></p>

<p>It is possible to have <a href="http://docs.djangoproject.com/en/dev/topics/http/urls/">a Django-style urlpatterns stanza</a> with a Bottle app. Here&#8217;s how it can work:</p>

<pre><code>from bottle import route

# Assuming your *_page view functions are defined above somewhere
urlpatterns = (
    # (path, func, name)
    ('/', home_page, 'home'),
    ('/about', about_page, 'about'),
    ('/contact', contact_page, 'contact'),
)

for path, func, name in urlpatterns:
    route(path, name=name)(func)
</code></pre>

<p>Here we run through a list where each item is a triple of URL path, view function and a name for the route. For each we simply call the <code>route</code> method and then invoke it with the function object. Not as flexible as using the decorator on a function (because the <code>@route</code> decorator can take additional keyword arguments) but at least you can have all the routes in one place at the end of the module.</p>

<p>Then again if you have so many routes that you need to keep them in a pretty list you probably aren&#8217;t writing the simple application that Bottle was intended for.</p>

<p>(This was tested with Bottle&#8217;s 0.8 and 0.9-dev branches.)</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/07/django-style-routing-for-bottle/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extensions are not enough</title>
		<link>http://reliablybroken.com/b/2010/07/extensions-are-not-enough/</link>
		<comments>http://reliablybroken.com/b/2010/07/extensions-are-not-enough/#comments</comments>
		<pubDate>Thu, 22 Jul 2010 15:59:22 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=499</guid>
		<description><![CDATA[Another thing I like about Mac OS X is the print preview available in any software that chooses to provide printing (unless that software chooses to be awkward).

When this feature first appeared, one could trigger a stupid bug if one happened to have an application other than Preview.app set as the default application for files [...]]]></description>
			<content:encoded><![CDATA[<p>Another thing I like about Mac OS X is <a href="http://support.apple.com/kb/HT3771">the print preview available in any software</a> that chooses to provide printing (unless that software <a href="http://www.adobe.com/products/acrobatpro/">chooses to be awkward</a>).</p>

<div id="attachment_500" class="wp-caption aligncenter" style="width: 510px"><a href="http://reliablybroken.com/b/wp-content/uploads/2010/07/preview-not-supported.jpg"><img src="http://reliablybroken.com/b/wp-content/uploads/2010/07/preview-not-supported.jpg" alt="Acrobat dialog box being unhelpful as ever" title="Acrobat dialog box being unhelpful as ever" width="500" height="233" class="size-full wp-image-500" /></a><p class="wp-caption-text">Best software ever</p></div>

<p>When this feature first appeared, one could trigger a stupid bug if one happened to have an application other than Preview.app set as the default application for files with the <code>.pdf</code> extension. If you had Adobe Acrobat set as your default PDF viewer, then hitting the preview button in print dialog boxes would open that preview in Acrobat.</p>

<p>It was a stupid bug, particularly because it was so obvious what was going wrong. The preview was being written to a temporary file with a <code>.pdf</code> extension and then being opened using whatever handler was defined in launch services. But you don&#8217;t want that, you want it to be handled by the operating system and not be subject to whether or not you have the patience to wait thirty seconds while Acrobat version 6 merrily paints its splash screen for your pleasure.</p>

<p>Later versions of Mac OS X fixed this so that the print preview is <em>always</em> displayed using Preview.app. This happens even if you set Acrobat as the default application for <code>.pdf</code> files, and it is a good thing it behaves like this. (In fairness, launch times for Acrobat since version 8 are no longer painful.)</p>

<p><em>I tested what happens if you delete Preview.app on a clean 10.5.8 install: the system falls back to opening QuickTime Player.app for displaying previews (which works fine). And if you delete QuickTime Player.app it falls back to using Safari.app (also works fine). And if you delete Safari.app it falls back to TextEdit.app (which works fine as long as you can render raw PDF data in your head).</em></p>

<p>It is as if going by the default association between file extension and application was not enough; that the system had a need to use a particular bit of software for these PDF preview files, regardless of what software was chosen as the handler for a different set of PDF files. Who&#8217;d have guessed?</p>

<p>All of this is an argument for providing a <strong>programmatic</strong> way to set the owning application for a file. You might call this a creator code, potentially any file could have one, but no biggie if it was not present because you could fall back to some regular stupid heuristic for determining the owner.</p>

<p>And then in Mac OS X 10.6 you might <a href="http://db.tidbits.com/article/10537">change the behaviour of the system</a> so that <a href="http://arstechnica.com/staff/fatbits/2009/09/metadata-madness.ars">this useful and important information about the file is ignored</a>. Grumble.</p>

<p>Dammit, only just occurred to me to see whether the system would eventually fall back to using Acrobat itself for displaying previews. Grumble.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/07/extensions-are-not-enough/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More mail bombs</title>
		<link>http://reliablybroken.com/b/2010/07/more-mail-bombs/</link>
		<comments>http://reliablybroken.com/b/2010/07/more-mail-bombs/#comments</comments>
		<pubDate>Sun, 11 Jul 2010 09:09:20 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=495</guid>
		<description><![CDATA[Tim Gaden over on Hawk Wings doesn&#8217;t agree that Mail.app&#8217;s behaviour regarding deleting POP accounts is misguided.

His first point is that Mail.app gives you a big warning before doing the dirty. I don&#8217;t think that excuses the bad behaviour. Warning someone that you behave badly does not excuse that bad behaviour (my ex says this [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.hawkwings.net/">Tim Gaden over on Hawk Wings</a> <a href="http://www.hawkwings.net/2010/07/07/mail-apps-disappearing-pop-mail-trick/">doesn&#8217;t agree</a> that <a href="http://reliablybroken.com/b/2010/07/apple-mail-bomb/">Mail.app&#8217;s behaviour regarding deleting POP accounts is misguided</a>.</p>

<p>His first point is that Mail.app gives you a big warning before doing the dirty. I don&#8217;t think that excuses the bad behaviour. Warning someone that you behave badly does not excuse that bad behaviour (my ex says this rule applies in more cases than the implementation of mail clients).</p>

<p>His second point is that the user should have a backup; with a good backup she can recover from her mistake when all those old messages disappear. I agree that people should have backups, but I don&#8217;t think that argument has any weight because you can imagine that the answer for all bad design decisions is &#8220;you should have had a backup&#8221;, in which case there are no bad design decisions.</p>

<p>The problem is that Mail.app&#8217;s insistence on a POP account being a separate set of folders means a message cannot appear in the Inbox unless it belongs to an account. If you delete a POP account then you have to move the messages to the Inbox of another account just to keep them appearing in the Inbox. This does not make sense.</p>

<p>Suppose you have a large history of messages received via a POP account. Then you delete that account and switch to an IMAP service with a meagre storage limit. If you want to keep those old messages appearing in the Inbox you must move your the historic Inbox messages to the IMAP account&#8217;s Inbox even though that will take up space on the server (and there may not be sufficient space on the server for them anyway). The other option is to give up the idea that old messages belong in the Inbox and just move them to local folders &#8220;On My Mac&#8221;.</p>

<p>If Mail.app provided a local Inbox folder that appeared as part of the unified Inbox then my objections would go away. (There should also be a corresponding local Sent folder.)</p>

<p>IMAP and POP are different in that a POP account&#8217;s mailbox is really just a temporary queue for messages that have yet to be retrieved by the client. Mail.app should recognize that difference and stop pretending that the two types of account are equivalent.</p>

<p>Quite pleased that Hawk Wings even knows my blog exists. Hawk Wings is good.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/07/more-mail-bombs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A digression on Entourage</title>
		<link>http://reliablybroken.com/b/2010/07/a-digression-on-entourage/</link>
		<comments>http://reliablybroken.com/b/2010/07/a-digression-on-entourage/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 10:03:31 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=490</guid>
		<description><![CDATA[Microsoft Entourage is such an interesting piece of software. It evolved from (Mac) Outlook Express which was a great mail client for the old Mac OS (despite its grumpy IMAP implementation). Outlook Express itself took many of its design cues from Claris Emailer, to the extent I believe the early versions of Outlook Express were [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.microsoft.com/mac/products/entourage2008/">Microsoft Entourage</a> is such an interesting piece of software. It evolved from (Mac) Outlook Express which was a great mail client for the old Mac OS (despite its grumpy IMAP implementation). Outlook Express itself took many of its design cues from Claris Emailer, to the extent I believe the early versions of Outlook Express were <a href="http://blog.entourage.mvps.org/2007/05/in_the_beginning.html">coded by peeps who had worked on Claris Emailer</a>.</p>

<p>I always liked that Outlook Express and Entourage defaulted to plain text for messages. I particularly liked the fact that OE / Entourage defaulted to bottom-posting when replying to a message &#8211; as any fule kno top-posting is a hideous convention foisted on us by miserable office mail systems back when there was still a chance that your e-mail would not be delivered via SMTP (Exchange version 5 and earlier is the primary culprit here).</p>

<p>I still get annoyed that when using Mail.app hitting the tab key in a plain-text e-mail inserts a tab character instead of expanding it to four spaces like Entourage.</p>

<p>Given enough time this post would devolve into arguments about <a href="http://www.faqs.org/rfcs/rfc1855.html">top-posting versus bottom-posting</a>, the width of <a href="http://www.jwz.org/doc/tabs-vs-spaces.html">the one true tab-stop</a> and how <a href="http://www.birdhouse.org/etc/evilmail.html">HTML e-mail</a> has turned our youths&#8217; minds into mush.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/07/a-digression-on-entourage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apple mail bomb</title>
		<link>http://reliablybroken.com/b/2010/07/apple-mail-bomb/</link>
		<comments>http://reliablybroken.com/b/2010/07/apple-mail-bomb/#comments</comments>
		<pubDate>Sat, 03 Jul 2010 09:22:31 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=481</guid>
		<description><![CDATA[Apple&#8217;s Mail.app has an approach to mailboxes for POP mail accounts that has never made sense to me. At least, I can see that it is a logical approach, but I don&#8217;t think it is a good approach because it can easily lead the user to inadvertently delete messages.

The problem is related to how Mail.app [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.apple.com/support/mail/">Apple&#8217;s Mail.app</a> has an approach to mailboxes for <a href="http://en.wikipedia.org/wiki/Post_Office_Protocol">POP mail accounts</a> that has never made sense to me. At least, I can see that it is a logical approach, but I don&#8217;t think it is a good approach because it can easily lead the user to inadvertently delete messages.</p>

<p>The problem is related to how Mail.app stores messages for an account. For an <a href="http://en.wikipedia.org/wiki/IMAP">IMAP account</a> (or a <a href="http://www.microsoft.com/exchange/">Microsoft Exchange account</a>) Mail.app creates a folder on the local disk and creates mailboxes within that folder corresponding to the mailboxes on the server. The contents of those mailboxes are synchronised with the contents of the mailboxes residing on the server. This makes perfect sense because with IMAP because the messages live on the server &#8211; keeping a local copy of those messages is effectively a performance optimisation.</p>

<p>What is weird is that Mail.app uses the same strategy for POP accounts, even though with POP there is only one mailbox on the server and it is effectively a temporary store for messages, which is to say that with a POP account a message does not live on the server but moves from one mailbox to another until it reaches its final resting place, that place being on the client.</p>

<p>The only copy of a message received via POP is on the client. (Having said that, <a href="http://mail.google.com/support/bin/answer.py?answer=13273">Gmail&#8217;s POP support</a> muddies the waters because <a href="http://tools.ietf.org/html/rfc1939#page-8">issuing a DELE command</a> does not actually delete the message from the server, but the principle is the same.)</p>

<p>Now when you go to remove an IMAP account Mail.app deletes all the local mailboxes for that IMAP account. This is not a problem, after all those local mailboxes are simple caches; the only reason the client keeps a copy is as a performance optimisation (as noted above).</p>

<p>Now when you remove a POP account Mail.app deletes all messages sent or received via that account, even though there will be no copy of those messages on the server (especially true for sent messages). This is not useful or intuitive &#8211; it is a bad design.</p>

<p><a href="http://reliablybroken.com/b/wp-content/uploads/2010/07/mail-delete-account.jpg"><img src="http://reliablybroken.com/b/wp-content/uploads/2010/07/mail-delete-account.jpg" alt="" title="mail-delete-account" width="612" height="625" class="aligncenter size-full wp-image-486" /></a></p>

<p>Why is this a bad design? It is a bad design because with an IMAP account you understand that the messages live on the server whereas with a POP account you understand that the messages live on your local hard drive. With an IMAP account you understand that removing the account removes your access to those mailboxes that exist on the server, whereas with a POP account it makes no sense that the act of stopping the retrieval of messages from the account implies that all the messages received via that account and now stored on your hard disk should be removed as well.</p>

<p>Earlier versions of Mail.app had an even more destructive behaviour when removing a POP mailbox. In the version of Mail.app that shipped as part of Mac OS X 10.4, if you removed a POP account then <em>all messages associated with that account were removed without warning</em>. Now imagine the not uncommon sequence of events for someone changing from POP account A to POP account B using earlier versions of Mail.app:</p>

<ol>
<li>User accumulates years of e-mail using POP account A.</li>
<li>User adds new POP account B.</li>
<li>User removes POP account A.</li>
</ol>

<p>At step 3 the user lost all her historic e-mail! Apple finally realised that this was no way to win friends and so introduced a confirmation specifically warning that messages would be lost before deleting a POP account (this change was introduced with Mac OS X 10.5).</p>

<p>Another unfortunate behaviour is how Mail.app handles a disabled POP account. Disabling an account stops Mail.app from using that account for sending and receiving but also removes all the associated messages from the Inbox.</p>

<p>It is possible to keep an old POP account enabled so that its messages are still displayed but then turn off the preference to &#8220;Include when automatically checking for new messages&#8221;. This leaves the old account available when composing a new message as a choice in the From field so one must also change the preference for &#8220;Send new messages from&#8221; to always use the new POP account in order to avoid inadvertently sending a message using the old From address (or edit the from  address in the old account to match that in the new account).</p>

<p><a href="http://www.microsoft.com/mac/products/entourage2008/default.mspx">Microsoft Entourage</a> has a better approach to this situation: messages for POP accounts are delivered to the Inbox mail folder &#8220;On My Computer&#8221;, and they stay there when the POP account is deleted. The flaw in Entourage&#8217;s approach is that the local folders appear even when all your e-mail accounts are server-based (i.e. all IMAP and / or Exchange accounts). I think it would be better to create those local folders only when a POP account has been defined because if you have only server-based accounts then it is distracting to have a set of folders called &#8220;On My Computer&#8221; which have no purpose.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/07/apple-mail-bomb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Growl for president</title>
		<link>http://reliablybroken.com/b/2010/06/growl-for-president/</link>
		<comments>http://reliablybroken.com/b/2010/06/growl-for-president/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 23:11:42 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[growl]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=471</guid>
		<description><![CDATA[It is fun talking to geeks who have recently converted to Macintosh coming from a career with Windows. They are excited about the possibilities of using all those Unix tools from the command-line (and who wouldn&#8217;t be excited about that?) and are disoriented by the differences.

I tell them that a lot of things are the [...]]]></description>
			<content:encoded><![CDATA[<p>It is fun talking to geeks who have recently converted to Macintosh coming from a career with Windows. They are excited about the possibilities of using all those Unix tools from the command-line (and who wouldn&#8217;t be excited about that?) and are disoriented by the differences.</p>

<p>I tell them that a lot of things are the same, that their new computer will still go wrong in frustrating ways and that the Finder is the way it is for historical reasons. The most productive part of the conversation is suggesting bits of software that make your computing career on Macintosh less painful&#8230;</p>

<p><a href="http://growl.info/">Growl!</a> What a fantastic piece of software. <a href="http://www.apple.com/support/macos9/">Mac OS 9</a> introduced modeless notifications and it was immediately obvious why it was a good thing. Before then you could bring a Mac server to a halt just by holding down the mouse button for too long, and many Mac applications wanted to get your attention by throwing up a global dialog box to let you know when something had happened. Due to the classic Mac relying on co-operative multi-tasking a modal dialog box could not only interrupt the front-most application but also stop all background applications until the dialog box was dismissed. So Mac OS 9&#8217;s mode-less notifications were a great thing.</p>

<p>On <a href="http://www.apple.com/macosx/">Mac OS X</a> there is no built-in API for posting global mode-less notifications. Growl fills that gap. Growl provides <a href="http://growl.info/documentation/developer/">an API for Mac applications to post notifications</a> and it presents those notifications in an unobtrusive manner, floating small windows on the top of your desktop that can be easily dismissed or ignored.</p>

<p>The truly great thing about Growl is how it has been adopted by developers. <a href="http://www.barebones.com/support/bbedit/arch_bbedit92.html">BBEdit</a> uses Growl; <a href="http://trac.cyberduck.ch/wiki/help/en/howto/growl">Cyberduck</a> uses Growl; <a href="http://panic.com/transmit/">pretty</a> <a href="http://www.linotype.com/fontexplorerX">much</a> <a href="http://adiumx.com/">every</a> <a href="http://colloquy.info/">great</a> <a href="http://netnewswireapp.com/">Mac</a> <a href="http://www.transmissionbt.com/">application</a> supports Growl because it is such an excellent way to post notifications.</p>

<div id="attachment_477" class="wp-caption aligncenter" style="width: 337px"><a href="http://reliablybroken.com/b/wp-content/uploads/2010/06/growl-example.jpg"><img src="http://reliablybroken.com/b/wp-content/uploads/2010/06/growl-example.jpg" alt="" title="growl-example" width="327" height="124" class="size-full wp-image-477" /></a><p class="wp-caption-text">An example of Cyberduck's upload complete Growl notification</p></div>

<p>And so it seems to me that Mac OS X itself should support a Growl-like API for notifications. Either the operating system should take advantage of Growl when a user has installed it or Apple should just ship Growl as part of the system to provide its functionality as a standard API for any application to post notifications.</p>

<p>I believe there is a need for such an API. Witness the <a href="http://toolbar.google.com/gmail-helper/notifier_mac.html">Google Notifier</a> application which does <em>not</em> use Growl for notifications but instead chooses to post floating mode-less notification windows that look an awful lot like Growl&#8217;s notifications but which behave in a subtly different manner. Annoying.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/06/growl-for-president/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Station To Station</title>
		<link>http://reliablybroken.com/b/2010/06/station-to-station/</link>
		<comments>http://reliablybroken.com/b/2010/06/station-to-station/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 09:23:59 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[bowie]]></category>
		<category><![CDATA[pixies]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=466</guid>
		<description><![CDATA[I am pretty sure my favourite David Bowie album is Station To Station. I am pretty sure my favourite Bowie track is Station To Station off that same album.

When I am invited to appear on Desert Island Discs I will choose Station To Station as the one song I can take with me &#8211; it [...]]]></description>
			<content:encoded><![CDATA[<p>I am pretty sure my favourite <a href="http://www.davidbowie.com/">David Bowie</a> album is <a href="http://www.teenagewildlife.com/Albums/STS/Title.html">Station To Station</a>. I am pretty sure my favourite Bowie track is <em>Station To Station</em> off that same album.</p>

<p>When I am invited to appear on <a href="http://www.bbc.co.uk/programmes/b006qnmr">Desert Island Discs</a> I will choose <em>Station To Station</em> as the one song I can take with me &#8211; it is flipping ten minutes long, and on a desert island I will want a song that takes a long time to understand and doesn&#8217;t repeat too often on my walkman.</p>

<p><em>Station To Station</em> is great because it is at least two songs in one, if not three. The opening section has the discordant stop / start rhythm of a steam train getting up to speed and Bowie&#8217;s lyrics are intelligible while being sufficiently dense that I can&#8217;t sing along without a dictionary.</p>

<p>And then the song breaks into the second section with a solid disco rhythm interrupted by Bowie expressing the joy and uncertainty of a new love affair before we finally hit the chorus which takes the rest of the song to the end.</p>

<blockquote>
  <p>It&#8217;s not the side-effects of the cocaine, I&#8217;m thinking that it must be love.</p>
</blockquote>

<p>Oh my gosh it is fantastic.</p>

<p>It is likely that if I can&#8217;t take <em>Station To Station</em> to my desert island I will take the prelude from <a href="http://en.wikipedia.org/wiki/Tristan_und_Isolde"><em>Tristan Und Isolde</em></a>, also about 10 minutes. Failing that maybe <em>Something Against You</em> by <a href="http://www.pixiesmusic.com/">Pixies</a>.</p>

<p><a href="http://www.youtube.com/watch?v=jNrtSWup_Tg">I am one happy prick</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/06/station-to-station/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Office 2008 update includes Entourage EWS</title>
		<link>http://reliablybroken.com/b/2010/06/office-2008-update-includes-entourage-ews/</link>
		<comments>http://reliablybroken.com/b/2010/06/office-2008-update-includes-entourage-ews/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 15:49:42 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[installer]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[office]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=461</guid>
		<description><![CDATA[Not that the release notes have any mention of it, but the Microsoft Office 2008 12.2.5 update will also install the latest Entourage EWS 13.0.5 if you had it on your hard disk already (else you get vanilla Entourage updated). You only need to install the stand-alone update if this is the first time you [...]]]></description>
			<content:encoded><![CDATA[<p>Not that the <a href="http://support.microsoft.com/kb/2028864">release notes have any mention of it</a>, but the <a href="http://www.microsoft.com/mac/downloads.mspx?pid=Mactopia_Office2008&amp;fid=D46255BD-6470-4106-9FE2-EA67ACD3F1BD">Microsoft Office 2008 12.2.5</a> update will also install the latest <a href="http://www.microsoft.com/mac/downloads.mspx?pid=Mactopia_Office2008&amp;fid=EC991D3B-6B25-41C3-9119-D0E6985F2FC1">Entourage EWS 13.0.5</a> if you had it on your hard disk already (else you get vanilla Entourage updated). You only need to install the stand-alone update if this is the first time you are installing the Exchange Web Services version of Entourage.</p>

<p>Microsoft&#8217;s Mac installers are good, but unnecessarily complicated. And the design of the <a href="http://www.microsoft.com/mac/">Mactopia website</a> drives me up the wall &#8211; tiny little scrolling <code>&lt;div&gt;</code> blocks and javascript hyperlinks makes it difficult to read the information and difficult to link straight to an update.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/06/office-2008-update-includes-entourage-ews/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xcode and Mercurial .hgignore</title>
		<link>http://reliablybroken.com/b/2010/06/xcode-and-mercurial-hgignore/</link>
		<comments>http://reliablybroken.com/b/2010/06/xcode-and-mercurial-hgignore/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 13:50:44 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[xcode]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=454</guid>
		<description><![CDATA[For future reference, culled from Peter Hosey and Ben Clark-Robinson, a mostly useful .hgignore definition for use with an Xcode project stored in the Mercurial version control system.

syntax: glob
*.pyc
.DS_Store
._*
*.xcodeproj/*.pbxuser
*.xcodeproj/*.perspective*
*.xcodeproj/*.mode*

syntax: regexp
^build/


Ugh to .DS_Store files and gaaaaaah to resource forks wedged into dot-underscore files. Yay! to regular expressions.
]]></description>
			<content:encoded><![CDATA[<p>For future reference, culled from <a href="http://boredzo.org/blog/archives/2008-03-20/hgignore-for-mac-os-x-applications">Peter Hosey</a> and <a href="http://mozketo.com/mercurial-hgignore-for-xcodecocoa/">Ben Clark-Robinson</a>, a mostly useful <code>.hgignore</code> definition for use with an <a href="http://developer.apple.com/technologies/tools/xcode.html">Xcode</a> project stored in the <a href="http://mercurial.selenic.com/">Mercurial version control system</a>.</p>

<pre><code>syntax: glob
*.pyc
.DS_Store
._*
*.xcodeproj/*.pbxuser
*.xcodeproj/*.perspective*
*.xcodeproj/*.mode*

syntax: regexp
^build/
</code></pre>

<p><em>Ugh</em> to <code>.DS_Store</code> files and <em>gaaaaaah</em> to resource forks wedged into dot-underscore files. <em>Yay!</em> to regular expressions.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/06/xcode-and-mercurial-hgignore/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Death or beachball</title>
		<link>http://reliablybroken.com/b/2010/05/death-or-beachball/</link>
		<comments>http://reliablybroken.com/b/2010/05/death-or-beachball/#comments</comments>
		<pubDate>Sat, 29 May 2010 06:23:37 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[adobe]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=450</guid>
		<description><![CDATA[Pierre Igot&#8217;s post about Adobe&#8217;s use of a new cursor in CS5 draws attention to how Adobe is continuing to fail to adhere to Macintosh user interface conventions.

But I disagree that the correct cursor to use for a blocking task that cannot be cancelled is the spinning beachball of death. That cursor after all is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.betalogue.com">Pierre Igot</a>&#8217;s post about <a href="http://www.betalogue.com/2010/05/18/cs5-cursor/">Adobe&#8217;s use of a new cursor in CS5</a> draws attention to how Adobe is continuing to fail to adhere to Macintosh user interface conventions.</p>

<p>But I disagree that the correct cursor to use for a blocking task that cannot be cancelled is the spinning beachball of death. That cursor after all is the cursor automatically provided by the operating system when an application is <em>not responding to input events</em>. As such when I see the beachball I associate it with a stuck application, one that may need to be forcibly quit.</p>

<p>Previous versions of Photoshop showed the watch cursor for actions which took a significant length of time. Showing the watch cursor is friendlier than showing the beachball of death because it indicates that the application is busy, too busy to handle your clicks but everything is hunky dory and the train <em>will</em> arrive at the station.</p>

<p>There is no watch cursor listed in <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSCursor_Class/Reference/Reference.html">Apple&#8217;s documentation on cursors</a>. However the cursor is still present in the system and can be found in the headers for the carbon appearance manager:</p>

<pre><code>kThemeWatchCursor             = 7,    /* Can Animate */
</code></pre>

<p>If you have Xcode 3.2.2 installed you can find this in <code>/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Appearance.h</code>, line 634.</p>

<p>I don&#8217;t know enough about Macintosh programming to say whether it is possible to employ this cursor from a Cocoa-based application.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/05/death-or-beachball/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>More Python features that I really like</title>
		<link>http://reliablybroken.com/b/2010/05/more-python-features-that-i-really-like/</link>
		<comments>http://reliablybroken.com/b/2010/05/more-python-features-that-i-really-like/#comments</comments>
		<pubDate>Fri, 28 May 2010 15:00:00 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Ben Dodd]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=446</guid>
		<description><![CDATA[Another thing that makes using Python pleasing is decorators. A decorator is a wrapper for a function (or method) that takes a function (or method) as an argument and returns a new function (or&#8230;) which is then bound to the name for the original function.

The newly-decorated function can then do things like checking the called [...]]]></description>
			<content:encoded><![CDATA[<p>Another thing that makes using <a href="http://www.python.org">Python</a> pleasing is decorators. <a href="http://docs.python.org/reference/compound_stmts.html#function">A decorator is a wrapper for a function</a> (or method) that takes a function (or method) as an argument and returns a new function (or&#8230;) which is then bound to the name for the original function.</p>

<p>The newly-decorated function can then do things like checking the called arguments before invoking the original un-decorated function.</p>

<p><a href="http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.decorators.user_passes_test">Django provides decorators for authentication</a> so that you can wrap a view function with a check for client credentials before deciding whether to return the original response or a deny access.</p>

<p>In this manner Django&#8217;s authentication decorators encourage orthogonal code: the logic for displaying a view is separated from the logic for deciding whether you should be permitted to see the view&#8217;s output. By keeping them separate, it becomes simpler to re-use the authentication logic and apply it to other views.</p>

<p>Suppose you have a view that accepts <a href="http://docs.djangoproject.com/en/dev/ref/request-response/">a Django request object</a> and checks whether the user is signed in:</p>

<pre><code>def administration_page(request):
    if request.user.is_authenticated():
        return HttpResponse("Welcome, dear user.")
    else:
        return HttpResponseRedirect("/signin/")
</code></pre>

<p>With a decorator you can simplify and clarify things:</p>

<pre><code>@login_required
def administration_page(request):
    return HttpResponse("Welcome, dear user.")
</code></pre>

<p>For older versions of Python (pre 2.4) <a href="http://docs.python.org/whatsnew/2.4.html#pep-318-decorators-for-functions-and-methods">which don&#8217;t understand the <code>@</code> operator</a> one must explicitly decorate the view function like so:</p>

<pre><code>def administration_page(request):
    return HttpResponse("Welcome, dear administrator.")

administration_page = login_required(administration_page)
</code></pre>

<p>Note in the example that the original <code>administration_page</code> function is passed to the decorator. The <code>@</code> syntax in the first example makes that implicit but the two are equivalent.</p>

<p>The implementation of a decorator is interesting. It takes the function itself as an argument and returns a new function which does the actual checking. Here is how the decorator used above might do its stuff:</p>

<pre><code>def login_required(view_function):
    def decorated_function(request):
        if request.user.is_authenticated():
            return view_function(request)
        else:
            return HttpResponseRedirect("/signin/")

    return decorated_function
</code></pre>

<p><em>The actual <a href="http://code.djangoproject.com/browser/django/tags/releases/1.2.1/django/contrib/auth/decorators.py">implementation of Django&#8217;s <code>login_required</code> decorator</a> is considerably less idiotic. Python&#8217;s <a href="http://docs.python.org/library/functools.html">functools module</a> has helpers for writing well-behaved decorators.</em></p>

<p>Because functions in Python are themselves objects the decorator can accept a function reference, construct a new function that checks for authentication and then return a reference to that new function.</p>

<p>Simples!</p>

<p>(Simples gets less simples when you want to write a decorator that accepts configuration arguments because you then need either another layer of nested function definitions or a class whose instances can be called directly, but I&#8217;m going to ignore you for a bit and <em>wow is that Concorde&#8230;?</em>)</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/05/more-python-features-that-i-really-like/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx and Wordpress</title>
		<link>http://reliablybroken.com/b/2010/05/nginx-and-wordpress/</link>
		<comments>http://reliablybroken.com/b/2010/05/nginx-and-wordpress/#comments</comments>
		<pubDate>Sat, 01 May 2010 08:18:08 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=441</guid>
		<description><![CDATA[My Nginx and Wordpress configuration on Debian Linux 5 (Lenny). This has Nginx as the Web server using the fastcgi module to talk to php-cgi processes that run Wordpress with pretty URLs.

The virtual private server I installed this on (from John Companies) has a 256 megabyte slice, so I figured a regular Apache + mod_php [...]]]></description>
			<content:encoded><![CDATA[<p>My <a href="http://nginx.org/">Nginx</a> and <a href="http://wordpress.org/">Wordpress</a> configuration on <a href="http://wiki.debian.org/DebianLenny">Debian Linux 5 (Lenny)</a>. This has Nginx as the Web server using the fastcgi module to talk to php-cgi processes that run Wordpress with pretty URLs.</p>

<p>The virtual private server I installed this on (from <a href="http://www.johncompanies.com/">John Companies</a>) has a 256 megabyte slice, so I figured a regular Apache + mod_php setup might be in trouble seeing as one of the sites I am running gets several thousand visits a day. Up to now I have always used Apache with mod_php to run Wordpress, and anyway it is fun to learn how unfamiliar software works (<a href="http://www.ibm.com/software/lotus/products/notes/">Lotus Notes</a> excepted).</p>

<p>On a side note, <a href="http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/ref-guide/s1-boot-init-shutdown-sysv.html">SysV run-levels</a> and /etc/rcX.d directories are needlessly clever. <a href="http://sysv-rc-conf.sourceforge.net/">sysv-rc-conf</a> makes editing those easy.</p>

<pre><code>server {
    listen   80;
    server_name  example.com;

    root   /home/david/example.com;
    index  index.php index.html index.htm;
    error_page   500 502 503 504  /50x.html;

    location / {

    }

    location = /50x.html {
        root   /var/www/nginx-default;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    location ~ /\.ht {
        deny  all;
    }

    location /b/ {
        if (!-e $request_filename) {
            rewrite ^(.+)$ /b/index.php?q=$1 last;
        }
    }

    location ~ \.php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

# Rewrite www.example.com to example.com
server {
    listen 80;
    server_name www.example.com;
    rewrite ^ http://example.com$request_uri?;
}
</code></pre>

<p>This configuration is for Wordpress installed under http://example.com/b/ on my server.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/05/nginx-and-wordpress/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Split a file on any character in Python</title>
		<link>http://reliablybroken.com/b/2010/04/split-a-file-on-any-character-in-python/</link>
		<comments>http://reliablybroken.com/b/2010/04/split-a-file-on-any-character-in-python/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 10:38:12 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=437</guid>
		<description><![CDATA[I need to split a big text file on a certain character. I expect I am being thick about this, but split doesn&#8217;t quite do what I want because it includes the matching line, whereas I want to split right on the matching character.

My Python answer:

def readlines(filename, endings, chunksize=4096):
    """Returns a generator [...]]]></description>
			<content:encoded><![CDATA[<p>I need to split a big text file on a certain character. I expect I am being thick about this, but <a href="http://developer.apple.com/Mac/library/documentation/Darwin/Reference/ManPages/man1/split.1.html"><code>split</code></a> doesn&#8217;t quite do what I want because it includes the matching line, whereas I want to split right on the matching character.</p>

<p>My Python answer:</p>

<pre><code>def readlines(filename, endings, chunksize=4096):
    """Returns a generator that splits on lines in a file with the given
    line-ending.
    """
    line = ''
    while True:        
        buf = filename.read(chunksize)
        if not buf:
            yield line
            break

        line = line + buf

        while endings in line:
            idx = line.index(endings) + len(endings)
            yield line[:idx]
            line = line[idx:]

if __name__ == "__main__":
    import sys, os

    FORMFEED = chr(12) # ASCII 12
    basename = os.path.basename(sys.argv[1])
    for num, data in enumerate(readlines(open(sys.argv[1]), endings=FORMFEED)):
        filename = basename + '-' + str(num)
        open(filename, 'wb').write(data)
</code></pre>

<p>This is also useful when reading data exported from some old-fashioned Mac application like <a href="http://www.filemaker.com/support/downloads/downloads_prev_versions.html">Filemaker 5</a> where the line-endings are ASCII 13 not ASCII 10.</p>

<p>This post was inspired by <a href="http://www-01.ibm.com/software/lotus/products/notes/">Lotus Notes</a> version 8.5, which is so advanced that to save a message in a file on disk you have to export it as structured text. And if you want to save a whole bunch of messages as individual files you must forget that <a href="http://www.mactech.com/articles/mactech/Vol.10/10.06/DragAndDrop/index.html">drag-and-drop was introduced with System 7</a>, that would be too obvious.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/04/split-a-file-on-any-character-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django AdminForm objects and templates</title>
		<link>http://reliablybroken.com/b/2010/04/django-adminform-objects-and-templates/</link>
		<comments>http://reliablybroken.com/b/2010/04/django-adminform-objects-and-templates/#comments</comments>
		<pubDate>Sun, 04 Apr 2010 21:21:54 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=425</guid>
		<description><![CDATA[I can&#8217;t find documentation for the context of a Django admin template. In particular, where is the form and how does one access the fields? This post describes the template context for a generic admin model for Django 1.1.

Django uses an instance of ModelAdmin (defined in django.contrib.admin.options) to handle the request for a model object [...]]]></description>
			<content:encoded><![CDATA[<p>I can&#8217;t find documentation for the context of a Django admin template. In particular, where is the form and how does one access the fields? This post describes the template context for a generic admin model for <a href="http://code.djangoproject.com/browser/django/tags/releases/1.1">Django 1.1</a>.</p>

<p>Django uses an instance of <code>ModelAdmin</code> (defined in <a href="http://code.djangoproject.com/browser/django/tags/releases/1.1/django/contrib/admin/options.py#L175"><code>django.contrib.admin.options</code></a>) to handle the request for a model object add / change view in the admin site. <code>ModelAdmin.add_view</code> and <code>ModelAdmin.change_view</code> are responsible for populating the template context when rendering the add object and change object pages respectively.</p>

<p>Here are the keys common to add and change views:</p>

<ul>
<li><strong>title</strong>, &#8216;Add &#8216; or &#8216;Change &#8216; + your model class&#8217; <code>_meta.verbose_name</code></li>
<li><strong>adminform</strong> is an instance of <code>AdminForm</code></li>
<li><strong>is_popup</strong>, a boolean which is true when <code>_popup</code> is passed as a request parameter</li>
<li><strong>media</strong> is an instance of <a href="http://docs.djangoproject.com/en/dev/topics/forms/media/"><code>django.forms.Media</code></a></li>
<li><strong>inline_admin_formsets</strong> is a list of <a href="http://code.djangoproject.com/browser/django/tags/releases/1.1/django/contrib/admin/helpers.py#L102"><code>InlineAdminFormSet</code></a> objects</li>
<li><strong>errors</strong> is an instance of <a href="http://code.djangoproject.com/browser/django/tags/releases/1.1/django/contrib/admin/helpers.py#L198"><code>AdminErrorList</code></a></li>
<li><strong>root_path</strong> is the <code>root_path</code> attribute of the <code>AdminSite</code> object</li>
<li><strong>app_label</strong> is your model class&#8217; <code>_meta.app_label</code> attribute</li>
</ul>

<p>The way that Django renders a form in the admin view is to iterate over the <code>adminform</code> instance and then iterate over each <a href="http://code.djangoproject.com/browser/django/tags/releases/1.1/django/contrib/admin/helpers.py#L50"><code>FieldSet</code></a> which in turn yield <a href="http://code.djangoproject.com/browser/django/tags/releases/1.1/django/contrib/admin/helpers.py#L82"><code>AdminField</code></a> instances. All I want to do is layout the form fields, ignoring the fieldset groupings which may or may not be defined in the model&#8217;s <code>ModelAdmin.fieldset</code> attribute.</p>

<p>This turns out to be easy once you know how. The regular form is an attribute of the <code>adminform</code> object. So if your model has a field named &#8220;<code>king_of_pop</code>&#8221; you can refer to the form field in your template like so:</p>

<pre><code>{{ adminform.form.king_of_pop.label_tag }}: {{ adminform.form.king_of_pop }}
</code></pre>

<p>Or if you want to save your finger tips you can use the <a href="http://docs.djangoproject.com/en/dev/ref/templates/builtins/#with"><code>with</code> template tag</a>:</p>

<pre><code>{% with adminform.form as f %}
{{ f.king_of_pop.label_tag }}: {{ f.king_of_pop }}
{% endwith %}
</code></pre>

<p>Delving through the Django source while I tried to understand all of this I was struck by how <a href="http://docs.python.org/reference/datamodel.html#emulating-container-types">Python defines hook functions for iteration and accessing attributes</a>. Half of Python&#8217;s attraction is in how easy it is from the program author&#8217;s point of view to treat objects as built-in types like lists, dicts, etc.; the other half is the responsibility of the author of a Python module to encourage that same ease of use by implementing the related iteration protocols. It is harder to write a good Python module than it is to write a good Python program that uses a good module.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/04/django-adminform-objects-and-templates/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using MacPorts behind a firewall</title>
		<link>http://reliablybroken.com/b/2010/03/using-macports-behind-a-firewall/</link>
		<comments>http://reliablybroken.com/b/2010/03/using-macports-behind-a-firewall/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 11:37:39 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=420</guid>
		<description><![CDATA[I failed to persuade MySQLdb to build on a Mac OS X Server 10.5.8 install using the system Python + MySQL installation. So I turned to MacPorts where I know I can get Django + all the bits working without much hassle (but with much patience).

The next problem was that MacPorts couldn&#8217;t update because rsync [...]]]></description>
			<content:encoded><![CDATA[<p>I failed to persuade <a href="http://mysql-python.sourceforge.net/MySQLdb.html">MySQLdb</a> to build on a <a href="http://www.apple.com/server/macosx/">Mac OS X Server 10.5.8</a> install using the system <a href="http://www.python.org/">Python</a> + <a href="http://www.mysql.com/">MySQL</a> installation. So I turned to <a href="http://www.macports.org/">MacPorts</a> where I know I can get <a href="http://www.djangoproject.com/">Django</a> + all the bits working without much hassle (but with much patience).</p>

<p>The next problem was that MacPorts couldn&#8217;t update because <a href="http://samba.anu.edu.au/rsync/">rsync</a> was blocked by the corporate access policy. Fortunately plain HTTP is permitted outbound. Here&#8217;s how to use a local ports tree.</p>

<p>Install MacPorts using the disk image for 10.5.</p>

<pre><code>curl -O http://distfiles.macports.org/MacPorts/MacPorts-1.8.2-10.5-Leopard.dmg
hdiutil attach MacPorts-1.8.2-10.5-Leopard.dmg
sudo installer -pkg /Volumes/MacPorts-1.8.2/MacPorts-1.8.2.pkg -target /
hdiutil detach /Volumes/MacPorts-1.8.2
</code></pre>

<p>If the MacPorts install directories are not in your $PATH environment, you can add them to your <code>.profile</code>. This change will not take effect until you start a new terminal session.</p>

<pre><code>cat &gt;&gt; ~/.profile &lt;&lt;EOF
PATH=/opt/local/bin:/opt/local/sbin:${PATH}
MANPATH=/opt/local/share/man:${MANPATH}
EOF
</code></pre>

<p>After you have installed MacPorts, create a directory for the ports tree and check it out using <a href="http://subversion.tigris.org/">Subversion</a>.</p>

<pre><code>sudo mkdir -p /opt/local/var/macports/sources/svn.macports.org/trunk/dports
cd /opt/local/var/macports/sources/svn.macports.org/trunk/dports
sudo svn co http://svn.macports.org/repository/macports/trunk/dports/ .
</code></pre>

<p>N.B. In the last line beginning <code>svn co ...</code> the trailing directory separator is significant!</p>

<p>Now tell MacPorts to use the local checkout rather than rsync. Edit <code>/opt/local/etc/macports/sources.conf</code> and add a new line to the end with the path to the ports tree, then comment out the previous line that uses rsync. Here are the last lines from my configuration:</p>

<pre><code>#rsync://rsync.macports.org/release/ports/ [default]
file:///opt/local/var/macports/sources/svn.macports.org/trunk/dports/ [default]
</code></pre>

<p>Finally you must create an index for the tree (otherwise you will see messages saying &#8220;Warning: No index(es) found!&#8221;).</p>

<pre><code>cd /opt/local/var/macports/sources/svn.macports.org/trunk/dports
sudo portindex
</code></pre>

<p>Now go do great things.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/03/using-macports-behind-a-firewall/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Confused of Wapping</title>
		<link>http://reliablybroken.com/b/2010/03/confused-of-wapping/</link>
		<comments>http://reliablybroken.com/b/2010/03/confused-of-wapping/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 00:36:38 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=416</guid>
		<description><![CDATA[Trying to get my head straight about what it means to modify a file and what it means to modify a folder for a desktop operating system. Mac OS X&#8217;s behaviour feels intuitively wrong, but turns out it is much harder than I expected to nail down exactly why it is wrong.

In general the implementation [...]]]></description>
			<content:encoded><![CDATA[<p>Trying to get my head straight about what it means to modify a file and what it means to modify a folder for a desktop operating system. Mac OS X&#8217;s behaviour feels intuitively wrong, but turns out it is much harder than I expected to nail down exactly why it is wrong.</p>

<p>In general the implementation of filesystem metadata on OS X has been two steps back with respect to the old Mac OS ways. (The one step forward has been the rich metadata provided by the Finder in terms of previews, performance on folders with hundreds of files, and the exposing of file content metadata with the interface for finding files.)</p>

<p>I feel that Mac OS X is shifting away from the concept of files existing on a filesystem without providing a suitable alternative.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/03/confused-of-wapping/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>watchedinstall is useful</title>
		<link>http://reliablybroken.com/b/2010/01/watchedinstall-is-useful/</link>
		<comments>http://reliablybroken.com/b/2010/01/watchedinstall-is-useful/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 22:48:40 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[watchedinstall]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=411</guid>
		<description><![CDATA[Very satisfying to use watchedinstall at work the other day to see exactly what a tricksy meta-package was doing during installation. Now that I fixed a stupid bug involving dtrace, watchedinstall works a treat for recording exactly what goes where.

Many thanks to Preston Holmes for releasing watchedinstall in the first place.

My goal is to replace [...]]]></description>
			<content:encoded><![CDATA[<p>Very satisfying to use <a href="http://bitbucket.org/davidbuxton/watchedinstall/">watchedinstall</a> at work the other day to see exactly what a tricksy meta-package was doing during installation. Now that I <a href="http://bitbucket.org/davidbuxton/watchedinstall/changeset/d97aaae628c3/">fixed a stupid bug involving dtrace</a>, watchedinstall works a treat for recording exactly what goes where.</p>

<p>Many thanks to <a href="http://www.ptone.com/">Preston Holmes</a> for releasing watchedinstall in the first place.</p>

<p>My goal is to replace the functionality of the fsevents helper application with a <a href="http://www.sun.com/bigadmin/content/dtrace/">dtrace</a> script that can list filesystem changes. A single python script would be simpler to install and use &#8211; you wouldn&#8217;t need to install it at all, just run it from the directory you downloaded it to. No effing about with setting PATH environment variables, no worry about compiling a C program for whatever architecture.</p>

<p>Hey Esther!</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/01/watchedinstall-is-useful/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>AJAX-ified result paging is not good</title>
		<link>http://reliablybroken.com/b/2010/01/ajaxified-result-paging/</link>
		<comments>http://reliablybroken.com/b/2010/01/ajaxified-result-paging/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 21:27:10 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=405</guid>
		<description><![CDATA[An annoying trend in Web design: using AJAX to load results when there is more than one page.

Apple does this for their search results. Netgear does this when searching their knowledge base. Microsoft does this for their Mactopia discussion forums. All three ostensibly good, clean designs fail to consider what the hell a visitor wants [...]]]></description>
			<content:encoded><![CDATA[<p>An annoying trend in Web design: using <a href="http://en.wikipedia.org/wiki/Ajax_(programming)">AJAX</a> to load results when there is more than one page.</p>

<p>Apple does this for their <a href="http://support.apple.com/downloads/#airport">search results</a>. Netgear does this when <a href="http://kb.netgear.com/app/answers/list/">searching their knowledge base</a>. Microsoft does this for their <a href="http://www.officeformac.com/ProductForums/Entourage/">Mactopia discussion forums</a>. All three ostensibly good, clean designs fail to consider what the hell a visitor wants in the first place, which is to see the next damn page of results.</p>

<p>The first problem with using AJAX to load results is that the browser view does not change when the new results are loaded. Suppose you have read the first ten results, you scroll to the last result on the page and the first result scrolls up and out of view. Then you click the link for the next page of results. The fancy AJAX loader replaces the existing list of results with the next page&#8217;s list of results, but does not move the view, leaving you staring at the last result on the second page when what you want is to see the first result of the second page, so you have to scroll back to the top of the page.</p>

<p>The script to load the results should scroll the view so the first result of the subsequent page is visible &#8211; I have yet to see an example of this behaviour.</p>

<p>The second problem is the URL does not change between one page and the next, which means you cannot bookmark any page other than the first. URLs and hyperlinks are the very stuff of the Web, it is mad not to make use of them.</p>

<p>My guess is that the Web designer in each of these cases was so pleased by the effect of updating the visitor&#8217;s view of a page without changing the browser location that she figured it was an improvement over the established technique of passing query parameters in a URL.</p>

<p>It is not. Please go back to the old-fashioned use of a query parameter to indicate the offset into a list of results.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/01/ajaxified-result-paging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tea Timer widget</title>
		<link>http://reliablybroken.com/b/2010/01/tea-timer-widget/</link>
		<comments>http://reliablybroken.com/b/2010/01/tea-timer-widget/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 19:57:49 +0000</pubDate>
		<dc:creator>david</dc:creator>
				<category><![CDATA[Link]]></category>
		<category><![CDATA[dashboard]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://reliablybroken.com/b/?p=401</guid>
		<description><![CDATA[Finally found a use for Dashboard with Stefan Scherfke&#8217;s Tea Timer.
]]></description>
			<content:encoded><![CDATA[<p>Finally found a use for <a href="http://www.apple.com/downloads/dashboard/">Dashboard</a> with <a href="http://stefan.sofa-rockers.org">Stefan Scherfke</a>&#8217;s <a href="http://stefan.sofa-rockers.org/teatimer/">Tea Timer</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://reliablybroken.com/b/2010/01/tea-timer-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
