<?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>Epidiascope</title>
	<atom:link href="http://thefire.us/feed" rel="self" type="application/rss+xml" />
	<link>http://thefire.us</link>
	<description>Projecting Opacity</description>
	<lastBuildDate>Fri, 02 Jul 2010 00:46:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>update script for unittest2 integration</title>
		<link>http://thefire.us/archives/458</link>
		<comments>http://thefire.us/archives/458#comments</comments>
		<pubDate>Fri, 02 Jul 2010 00:46:16 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[unittest2]]></category>

		<guid isPermaLink="false">http://thefire.us/?p=458</guid>
		<description><![CDATA[Django is moving to use unittest2 as part of the default test suite. Unfortunately, it needs to be bundled, which means that it will live in django.utils.unittest rather than in the pythonpath where it expects to be. This means that we need to patch the import statements. I&#8217;ve written a little script to download the [...]]]></description>
			<content:encoded><![CDATA[<p>Django is moving to use unittest2 as part of the default test suite. Unfortunately, it needs to be bundled, which means that it will live in django.utils.unittest rather than in the pythonpath where it expects to be. This means that we need to patch the import statements. I&#8217;ve written a little script to download the latest version, untar it into the appropriate directory, and make the changes.</p>
<pre><code>
#!/bin/sh
rm -v django/utils/unittest/*.py*
wget http://hg.python.org/unittest2/archive/tip.tar.gz -O unittest2.tar.gz
tar --wildcards --no-wildcards-match-slash --strip-components=2 --directory=django/utils/unittest -xf unittest2.tar.gz unittest2-*/unittest2/*.py
rm -v unittest2.tar.gz
sed -i 's/^from unittest2/from django\.utils\.unittest/' django/utils/unittest/*.py
echo "unittest2 updated"
</code></pre>
<p>Run it from the root of the svn checkout.</p>
]]></content:encoded>
			<wfw:commentRss>http://thefire.us/archives/458/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django model definitions can&#8217;t be reloaded</title>
		<link>http://thefire.us/archives/452</link>
		<comments>http://thefire.us/archives/452#comments</comments>
		<pubDate>Wed, 23 Jun 2010 11:09:51 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://thefire.us/?p=452</guid>
		<description><![CDATA[I spent way too much time this evening figuring this out. If you have a models file like this (artificial, but play along): from django.db import models from random import random rand_val = random() class MyModel(models.Model): r = rand_val After you import MyModel in some other module, you can&#8217;t re-load the class definition of MyModel. [...]]]></description>
			<content:encoded><![CDATA[<p>I spent way too much time this evening figuring this out.</p>
<p>If you have a models file like this (artificial, but play along):</p>
<pre><code>
from django.db import models
from random import random
rand_val = random()

class MyModel(models.Model):
    r = rand_val
</code></pre>
<p>After you import <code>MyModel</code> in some other module, you can&#8217;t re-load the class definition of <code>MyModel</code>.</p>
<p>You might think that calling <code>reload()</code> on models would do the trick. What actually happens is:</p>
<ul>
<li> <code>models.py</code> is reloaded (the file is executed again)</li>
<li>so <code>models.rand_value</code> changes&#8230;</li>
<li>but <code>models.MyModel.r</code> does not!</li>
</ul>
<p>Classes that inherit from <code>models.Model</code> seem to be immortal singletons. I tried <a href="http://github.com/arthurk/django/commit/9bf0c1f3239a902bfd4f3fbb71b36cdab960cfb3#L0R22">removing them  from <code>sys.modules</code></a> as arthurk is doing. I tried deleting all references to the variables in my code. The first instance came back every time, even though python was shown to be reloading the module and re-executing the code within.</p>
<p>In most use cases, this is exactly what you want. It usually would be inefficient to have multiple copies of <code>MyModel</code> available in different parts of your code.</p>
<p>Unfortunately, I needed multiple instances for testing purposes. I ended up settling for a less comprehensive testing solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://thefire.us/archives/452/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GSOC Status Update</title>
		<link>http://thefire.us/archives/450</link>
		<comments>http://thefire.us/archives/450#comments</comments>
		<pubDate>Tue, 22 Jun 2010 04:21:57 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[gsoc2010]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://thefire.us/?p=450</guid>
		<description><![CDATA[This past week I worked up updating the model tests, and committed 7 changes. I did an analysis of the rate at which I need to finish the project, and I&#8217;m going to aim for converting 25 tests a week. I&#8217;ve gotten better at formulating unittests and have learned a bunch of useful emacs features. [...]]]></description>
			<content:encoded><![CDATA[<p>This past week I worked up updating the model tests, and committed 7 changes. I did an analysis of the rate at which I need to finish the project, and I&#8217;m going to aim for converting 25 tests a week. I&#8217;ve gotten better at formulating unittests and have learned a bunch of useful emacs features. My progress this week was slowed down by the fact that my development machine died a nasty death. I think the hard drive is mostly ok, but I haven&#8217;t recovered anything yet. Of the 132 tests that needed conversion at the start of coding, 25 are done. I need to have at least 93 finished and at most 39 remaining by the midterm evaluation on July 12, in order to have a week&#8217;s buffer at the end to wrap things up.</p>
]]></content:encoded>
			<wfw:commentRss>http://thefire.us/archives/450/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t use Ontrac for shipping</title>
		<link>http://thefire.us/archives/445</link>
		<comments>http://thefire.us/archives/445#comments</comments>
		<pubDate>Thu, 17 Jun 2010 22:49:18 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://thefire.us/?p=445</guid>
		<description><![CDATA[I recently had a package sent overnight to me via Ontrac. The first day they attempted to deliver the package, they couldn&#8217;t find my address (a clearly marked commercial mail receiving service). The second day they attempted to deliver, they decided to deliver to a college dorm down the street. It was only by chance [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had a package sent overnight to me via Ontrac. The first day they attempted to deliver the package, they couldn&#8217;t find my address (a clearly marked commercial mail receiving service). The second day they attempted to deliver, they decided to deliver to a college dorm down the street. It was only by chance that the dorm mail room found my contact info and called me to pick up the package.</p>
<p>I&#8217;ve never had any trouble like this with my mail service before. Don&#8217;t use Ontrac.</p>
]]></content:encoded>
			<wfw:commentRss>http://thefire.us/archives/445/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>GSOC status report</title>
		<link>http://thefire.us/archives/442</link>
		<comments>http://thefire.us/archives/442#comments</comments>
		<pubDate>Fri, 11 Jun 2010 19:50:12 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[gsoc2010]]></category>

		<guid isPermaLink="false">http://thefire.us/?p=442</guid>
		<description><![CDATA[I&#8217;ve been behind on the Summer of Code work. This week I started working on converting model tests, and converted 3 changes. I also submitted a patch clarifying the documentation (and help text) of the dumpdata command. I&#8217;ve been going more slowly than I should because I&#8217;ve had to read a lot of documentation about [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been behind on the Summer of Code work. This week I started working on converting model tests, and converted 3 changes. I also submitted a patch clarifying the documentation (and help text) of the dumpdata command. I&#8217;ve been going more slowly than I should because I&#8217;ve had to read a lot of documentation about unittesting and had to ask many questions.Things should pick up next week, and I am going to spend significantly more time working on it to make up for lost time so far.</p>
]]></content:encoded>
			<wfw:commentRss>http://thefire.us/archives/442/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GSOC Status Report</title>
		<link>http://thefire.us/archives/440</link>
		<comments>http://thefire.us/archives/440#comments</comments>
		<pubDate>Sat, 05 Jun 2010 04:09:27 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[gsoc]]></category>
		<category><![CDATA[gsoc2010]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://thefire.us/?p=440</guid>
		<description><![CDATA[So&#8230; I&#8217;ve been working on the summer of code project now for a bit. Hopefully I&#8217;ll be more productive next week, as this week was frustrating with non-SOC things. The main SOC things I did this week involved getting stuff set up to do more work next week. I spent a bunch of time setting [...]]]></description>
			<content:encoded><![CDATA[<p>So&#8230; I&#8217;ve been working on the summer of code project now for a bit. Hopefully I&#8217;ll be more productive next week, as this week was frustrating with non-SOC things. The main SOC things I did this week involved getting stuff set up to do more work next week.</p>
<p>I spent a bunch of time setting up and configuring VMs with test environments. I can now test in Ubuntu, OS X, Windows, and have a couple of configurations for each of those. I don&#8217;t have every possible supported combo, but it&#8217;s a good start. I spent more time than I should have messing with virtualenv. I still don&#8217;t have automated scripts to do everything I need, but I&#8217;m not going to invest more time in that right now.</p>
<p>I also spent a while becoming acquainted with the details of how tests are actually run. I&#8217;ve done some modification of the test runner to fix some of the hard-coded paths, but it&#8217;s still not working the way I want it to. I think that in the end, the right thing to do is probably to leave the existing test infrastructure as-is, and then move everything to the new consolidated single test directory at the end of the project, after the tests are cleaned up and moved to unittests. The alternative is to move them one at a time as I get them cleaned up, but then we&#8217;ll have to have some interm test running code that checks both options. I think it&#8217;s probably best to leave my branch as close to trunk as possible so that patches can go back and forth as improvements are made.</p>
<p>I need to update the documentation on contributing to include a note that new patches should use unittests not doctests.</p>
<p>So in summary &#8211; not a lot of committed code, but a bunch of work that should make things more productive for next week.</p>
]]></content:encoded>
			<wfw:commentRss>http://thefire.us/archives/440/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GSOC 2010 &#8211; I&#8217;m updating the Django Test Suite</title>
		<link>http://thefire.us/archives/435</link>
		<comments>http://thefire.us/archives/435#comments</comments>
		<pubDate>Wed, 28 Apr 2010 00:59:21 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[doctest]]></category>
		<category><![CDATA[gsoc2010]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[unittest]]></category>

		<guid isPermaLink="false">http://thefire.us/?p=435</guid>
		<description><![CDATA[I&#8217;ve been accepted to work on Django&#8217;s Test Suite during the Google Summer of Code this year. I&#8217;ll be working to improve the runtime and uniformity of the test suite, mainly by converting existing doc tests to unit tests. This isn&#8217;t particularly glamorous, but it should be a chance to get intimately familiar with the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been accepted to work on Django&#8217;s Test Suite during the <a href="http://code.google.com/soc/">Google Summer of Code</a> this year. I&#8217;ll be working to improve the runtime and uniformity of the test suite, mainly by converting existing doc tests to unit tests. This isn&#8217;t particularly glamorous, but it should be a chance to get intimately familiar with the Django code base, and it is something that really should be done. </p>
<p>Unit tests will make it quicker to pinpoint exactly what is causing a test to fail. Moving each test case into its own function may reveal bugs that were concealed or glossed over as a side effect of the existing test case environment in the doctest. As I&#8217;m working through the code, I&#8217;ll be looking out for tests which are doing inefficient things. Developers run the tests regularly, and runtimes can vary from 10 minutes to over an hour depending on hardware and database configuration. By speeding them up, I&#8217;ll be saving countless future developer-hours.</p>
]]></content:encoded>
			<wfw:commentRss>http://thefire.us/archives/435/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Copying large drives with DD</title>
		<link>http://thefire.us/archives/433</link>
		<comments>http://thefire.us/archives/433#comments</comments>
		<pubDate>Mon, 29 Mar 2010 22:47:06 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[7200.11]]></category>
		<category><![CDATA[barracuda]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[dd]]></category>
		<category><![CDATA[drive]]></category>
		<category><![CDATA[seagate]]></category>
		<category><![CDATA[ST31500341AS]]></category>
		<category><![CDATA[TB]]></category>

		<guid isPermaLink="false">http://thefire.us/?p=433</guid>
		<description><![CDATA[I needed to do an exact copy of the byte-level contents of one Seagate Barracuda 7200.11 1.5 TB (ST31500341AS) to another identical drive. dd is the obvious tool for the job, but the default settings copy very slowly. This is because the default block copy size is only 512 bytes. After a bit of experimentation, [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to do an exact copy of the byte-level contents of one Seagate Barracuda 7200.11 1.5 TB (ST31500341AS) to another identical drive. <code>dd</code> is the obvious tool for the job, but the default settings copy very slowly. This is because the default block copy size is only 512 bytes. After a bit of experimentation, I settled on a block size of 64k as providing the best performance.</p>
<p><code>dd if=/dev/disk1 of=/dev/disk2 conv=noerror,sync bs=64k</code></p>
<p>(obviously you will need to specify the correct disk devices for your setup)</p>
<p>Using the larger block size resulted in a speed increase from 7MB/s to an average transfer speed of 37MB/s. It makes a big difference when you&#8217;re copying a full 1.5 TB!</p>
]]></content:encoded>
			<wfw:commentRss>http://thefire.us/archives/433/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading from Ubuntu 9.04 to 9.10 &#8211; memcached problems, postgresql upgrades, and svn</title>
		<link>http://thefire.us/archives/418</link>
		<comments>http://thefire.us/archives/418#comments</comments>
		<pubDate>Thu, 25 Feb 2010 00:13:34 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[8.3]]></category>
		<category><![CDATA[8.4]]></category>
		<category><![CDATA[9.04]]></category>
		<category><![CDATA[9.10]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[slicehost]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://thefire.us/?p=418</guid>
		<description><![CDATA[I recently upgraded a couple of servers over at slicehost from Ubuntu 9.04 to 9.10 via the command line upgrade. There were only a couple problems. During the install, I kept my php and svn config files, since the diff showed no major changes to the ones in the package (other than my configurations, of [...]]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded a couple of servers over at slicehost from Ubuntu 9.04 to 9.10 via the command line upgrade. There were only a couple problems.</p>
<p>During the install, I kept my php and svn config files, since the diff showed no major changes to the ones in the package (other than my configurations, of course).</p>
<p>The first problem was that the Postgresql 8.3 databases needed to be updated to 8.4, and the installer doesn&#8217;t do that. I made sure to run these <em>before</em> the installer removed the 8.3 package (it asks before doing so at the end of the install script), though I don&#8217;t know if that is strictly necessary. The upgrade was relatively simple:<br />
<code><br />
#see what clusters you currently have<br />
pg_lscluster </p>
<p>#drop the empty new 8.4 cluster the installer created<br />
sudo pg_dropcluster 8.4 main </p>
<p>#upgrade your existing cluster<br />
sudo pg_upgradecluster 8.3 main /var/lib/postgresql/8.4/main<br />
</code></p>
<p>The upgrade command SHOULD take care of copying the data, upgrading it to the new format, stopping the old cluster, and starting the new cluster on the same port. On one of my machines the process of stopping the old cluster failed, but doing it manually with <code>pg_ctlcluster</code> worked.</p>
<p>Once I upgraded the Postgres databases, I allowed the script to remove the old packages and reboot the machine. Then I selected the kernel upgrade in the slicehost control panel (which rebooted the machine again) and let it come up. Almost everything worked perfectly.</p>
<p>The other issue I encountered was that after the upgrade, memcached no longer started on reboot. After a bit of poking around, I discovered that the upgraded package that comes with 9.10 comes with a new file in <code>/etc/default/memcached</code> which defaults to having memcached disabled. To enable it, set <code>ENABLE_MEMCACHED=yes</code> and memcached starts when your server boots. This does have a <a href="https://bugs.launchpad.net/ubuntu/+source/memcached/+bug/411856">launchpad bug</a>, but nobody seems to be taking responsibility for fixing it.</p>
<p>Another gotcha turned out to be the fact that memcached <em>must already be running</em> when Django starts. I only resolved the issues with memcached after my Django processes had started on the other server, and it took me a few minutes to remember that I needed to restart them to fix caching.</p>
<p>The only other minor issue was that (as expected) the upgrade overwrote my script that gets invoked whenever svnserve is called. I have this in place so that I can <code>svn+ssh</code> into the server and check files out without specifying their absolute path in the file system. My script looks like this:<br />
<code><br />
#!/bin/sh<br />
umask 002<br />
exec /usr/bin/svnserve.bin -t -r [path to svn repo] "$@"<br />
</code></p>
<p>I keep the actual <code>svnserve</code> binary (default installed to <code>/usr/bin/svnserve</code>) in <code>svnserve.bin</code> and the script in <code>svnserve.ssh</code>. I then link <code>/usr/bin/svnserve</code> to <code>svnserve.ssh</code>, so when svn gets upgraded, I just recopy the binary and re-link.</p>
]]></content:encoded>
			<wfw:commentRss>http://thefire.us/archives/418/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dreamhost facebook app dev note</title>
		<link>http://thefire.us/archives/414</link>
		<comments>http://thefire.us/archives/414#comments</comments>
		<pubDate>Tue, 16 Feb 2010 02:00:53 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php4]]></category>
		<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://thefire.us/?p=414</guid>
		<description><![CDATA[Dreamhost has deprecated php4 and doesn&#8217;t serve it using apache anymore. Nonetheless, the php command is still hardlinked to the php4 binary. This means that when you try to execute your php code to see what&#8217;s going wrong, facebook&#8217;s code (which only works with php5) throws a lovely error: Parse error: syntax error, unexpected T_STRING, [...]]]></description>
			<content:encoded><![CDATA[<p>Dreamhost has deprecated php4 and doesn&#8217;t serve it using apache anymore. Nonetheless, the <code>php</code> command is still hardlinked to the php4 binary. This means that when you try to execute your php code to see what&#8217;s going wrong, facebook&#8217;s code (which only works with php5) throws a lovely error:<br />
<code><br />
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/<your_folder>/facebook.php on line 38<br />
</your_folder></code></p>
<p>To fix this, add <code>alias php='/usr/local/php5/bin/php'</code> to your <code>~/.bash_profile</code> and re-login. Now when you run php from the command line, it will use version 5, which you can verify by running <code>php -v</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://thefire.us/archives/414/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
