<?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>recurser</title>
	
	<link>http://recurser.com</link>
	<description />
	<lastBuildDate>Sun, 07 Mar 2010 06:41:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Recurser" /><feedburner:info uri="recurser" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>How to find out if Ubuntu is 32 bit or 64 bit</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/Aw0amoYyobQ/</link>
		<comments>http://recurser.com/articles/2010/03/06/how-to-find-out-if-ubuntu-is-32-bit-or-64-bit/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 06:41:31 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=480</guid>
		<description><![CDATA[Title says it all really :)]]></description>
			<content:encoded><![CDATA[	<p>To find out if Ubuntu is 32 bit or 64 bit, run <em>uname</em> :<br />
<pre class="bash">uname -m</pre><br />
x86_64 = 64 bit<br />
i686 = 32 bit</p><img src="http://feeds.feedburner.com/~r/Recurser/~4/Aw0amoYyobQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2010/03/06/how-to-find-out-if-ubuntu-is-32-bit-or-64-bit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2010/03/06/how-to-find-out-if-ubuntu-is-32-bit-or-64-bit/</feedburner:origLink></item>
		<item>
		<title>sources.list For Ubuntu Hardy Heron (8.04)</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/c8y1IQD3gTY/</link>
		<comments>http://recurser.com/articles/2010/03/06/sources-list-for-ubuntu-hardy-heron-8-04/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 06:33:21 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=477</guid>
		<description><![CDATA[sources.list For Ubuntu Hardy Heron (8.04)]]></description>
			<content:encoded><![CDATA[	<p>I keep having to look this up to add multiverse repositories (courtesy of <a href="http://tuxicity.wordpress.com/sourceslist-for-ubuntu-hardy-heron-810/">tuxicity</a> ).</p>

	<p><pre class="php"><span style="color: #808080; font-style: italic;">## a “general” sources.list for Hardy Heron; all sources are uncommented.</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to</span>
<span style="color: #808080; font-style: italic;"># newer versions of the distribution.</span>
&nbsp;
deb http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy main restricted</span>
deb-src http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy main restricted</span>
&nbsp;
<span style="color: #808080; font-style: italic;">## Major bug fix updates produced after the final release of the</span>
<span style="color: #808080; font-style: italic;">## distribution.</span>
&nbsp;
deb http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy-updates main restricted</span>
deb-src http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy-updates main restricted</span>
&nbsp;
<span style="color: #808080; font-style: italic;">## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu</span>
<span style="color: #808080; font-style: italic;">## team, and may not be under a free licence. Please satisfy yourself as to</span>
<span style="color: #808080; font-style: italic;">## your rights to use the software. Also, please note that software in</span>
&nbsp;
<span style="color: #808080; font-style: italic;">## universe WILL NOT receive any review or updates from the Ubuntu security</span>
<span style="color: #808080; font-style: italic;">## team.</span>
&nbsp;
deb http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy universe</span>
deb-src http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy universe</span>
&nbsp;
deb http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy-updates universe</span>
deb-src http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy-updates universe</span>
&nbsp;
<span style="color: #808080; font-style: italic;">## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu</span>
<span style="color: #808080; font-style: italic;">## team, and may not be under a free licence. Please satisfy yourself as to</span>
<span style="color: #808080; font-style: italic;">## your rights to use the software. Also, please note that software in</span>
<span style="color: #808080; font-style: italic;">## multiverse WILL NOT receive any review or updates from the Ubuntu</span>
<span style="color: #808080; font-style: italic;">## security team.</span>
&nbsp;
deb http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy multiverse</span>
deb-src http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy multiverse</span>
&nbsp;
deb http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy-updates multiverse</span>
deb-src http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy-updates multiverse</span>
&nbsp;
<span style="color: #808080; font-style: italic;">## Uncomment the following two lines to add software from the ‘backports’</span>
<span style="color: #808080; font-style: italic;">## repository.</span>
&nbsp;
<span style="color: #808080; font-style: italic;">## N.B. software from this repository may not have been tested as</span>
<span style="color: #808080; font-style: italic;">## extensively as that contained in the main release, although it includes</span>
<span style="color: #808080; font-style: italic;">## newer versions of some applications which may provide useful features.</span>
<span style="color: #808080; font-style: italic;">## Also, please note that software in backports WILL NOT receive any review</span>
<span style="color: #808080; font-style: italic;">## or updates from the Ubuntu security team.</span>
&nbsp;
deb http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse</span>
deb-src http:<span style="color: #808080; font-style: italic;">//archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse</span>
&nbsp;
<span style="color: #808080; font-style: italic;">## Uncomment the following two lines to add software from Canonical’s</span>
<span style="color: #808080; font-style: italic;">## ‘partner’ repository. This software is not part of Ubuntu, but is</span>
<span style="color: #808080; font-style: italic;">## offered by Canonical and the respective vendors as a service to Ubuntu</span>
<span style="color: #808080; font-style: italic;">## users.</span>
&nbsp;
deb http:<span style="color: #808080; font-style: italic;">//archive.canonical.com/ubuntu hardy partner</span>
deb-src http:<span style="color: #808080; font-style: italic;">//archive.canonical.com/ubuntu hardy partner</span>
&nbsp;
deb http:<span style="color: #808080; font-style: italic;">//security.ubuntu.com/ubuntu hardy-security main restricted</span>
deb-src http:<span style="color: #808080; font-style: italic;">//security.ubuntu.com/ubuntu hardy-security main restricted </span></pre></p><img src="http://feeds.feedburner.com/~r/Recurser/~4/c8y1IQD3gTY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2010/03/06/sources-list-for-ubuntu-hardy-heron-8-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2010/03/06/sources-list-for-ubuntu-hardy-heron-8-04/</feedburner:origLink></item>
		<item>
		<title>Installing git-up on Ubuntu 8.10</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/p_CWwrnvfVY/</link>
		<comments>http://recurser.com/articles/2010/02/14/installing-git-up-on-ubuntu-8-10/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 02:17:53 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Version Control]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=469</guid>
		<description><![CDATA[How to get "git-up":http://github.com/aanand/git-up running properly on Ubuntu 8.10]]></description>
			<content:encoded><![CDATA[	<p>Recently I had a bit of trouble getting <a href="http://github.com/aanand/git-up">git-up</a> to work on Ubuntu (or <a href="http://recurser.com/articles/2010/02/14/updating-rubygems-on-mac-os-x-10-5-leopard/">anywhere else</a> for that matter), so here&#8217;s some of the steps I had to go through.</p>

	<p>Initially ubuntu seems to have <a href="http://rubyforge.org/projects/rubygems/">RubyGems</a> 1.01 and 1.2.0 installed :<br />
<pre class="bash">&gt; gem --version
<span style="color: #cc66cc;">1.2</span><span style="color: #cc66cc;">.0</span>
&gt;/usr/bin/gem1<span style="color: #cc66cc;">.8</span> --version
<span style="color: #cc66cc;">1.2</span><span style="color: #cc66cc;">.0</span>
&gt;/usr/bin/gem1<span style="color: #cc66cc;">.9</span> --version
<span style="color: #cc66cc;">1.0</span><span style="color: #cc66cc;">.1</span></pre></p>

	<p>Unlike <a href="http://recurser.com/articles/2010/02/14/updating-rubygems-on-mac-os-x-10-5-leopard/">installation on OS X</a> , the initial gem install worked fine :</p>

	<p><pre class="bash">&gt; sudo gem install git-up
Successfully installed git-up<span style="color: #cc66cc;">-0.1</span><span style="color: #cc66cc;">.0</span>
<span style="color: #cc66cc;">1</span> gem installed
Installing ri documentation <span style="color: #b1b100;">for</span> git-up<span style="color: #cc66cc;">-0.1</span><span style="color: #cc66cc;">.0</span>...
Installing RDoc documentation <span style="color: #b1b100;">for</span> git-up<span style="color: #cc66cc;">-0.1</span><span style="color: #cc66cc;">.0</span>...</pre></p>

	<p>Trying to actually use it, however, caused a few errors :</p>

	<p><pre class="bash">&gt;  git up
/usr/<span style="color: #000066;">local</span>/lib/site_ruby/<span style="color: #cc66cc;">1.8</span>/rubygems.rb:<span style="color: #cc66cc;">578</span>:<span style="color: #b1b100;">in</span> `report_activate_error<span style="color: #ff0000;">': Could not find RubyGem thoughtbot-shoulda (&gt;= 0) (Gem::LoadError)
        from /usr/local/lib/site_ruby/1.8/rubygems.rb:134:in `activate'</span>
        from /usr/<span style="color: #000066;">local</span>/lib/site_ruby/<span style="color: #cc66cc;">1.8</span>/rubygems.rb:<span style="color: #cc66cc;">158</span>:<span style="color: #b1b100;">in</span> `activate<span style="color: #ff0000;">'
        from /usr/local/lib/site_ruby/1.8/rubygems.rb:157:in `each'</span>
        from /usr/<span style="color: #000066;">local</span>/lib/site_ruby/<span style="color: #cc66cc;">1.8</span>/rubygems.rb:<span style="color: #cc66cc;">157</span>:<span style="color: #b1b100;">in</span> `activate<span style="color: #ff0000;">'
        from /usr/local/lib/site_ruby/1.8/rubygems.rb:49:in `gem'</span>
        from /usr/bin/git-up:<span style="color: #cc66cc;">18</span></pre></p>

	<p>This error persists even after installing shoulda :</p>

	<p><pre class="bash">&gt;  sudo gem install shoulda
Successfully installed shoulda<span style="color: #cc66cc;">-2.10</span><span style="color: #cc66cc;">.3</span>
<span style="color: #cc66cc;">1</span> gem installed
Installing ri documentation <span style="color: #b1b100;">for</span> shoulda<span style="color: #cc66cc;">-2.10</span><span style="color: #cc66cc;">.3</span>...
Installing RDoc documentation <span style="color: #b1b100;">for</span> shoulda<span style="color: #cc66cc;">-2.10</span><span style="color: #cc66cc;">.3</span>...</pre></p>

	<p>After my experience installing it on OS X, i decided the easiest way to move forward was probably to install RubyGems 1.3.1 :</p>

	<p><pre class="bash">&gt; wget http://rubyforge.org/frs/download.php/<span style="color: #cc66cc;">45905</span>/rubygems<span style="color: #cc66cc;">-1.3</span><span style="color: #cc66cc;">.1</span>.tgz
&gt; tar xzf rubygems<span style="color: #cc66cc;">-1.3</span><span style="color: #cc66cc;">.1</span>.tgz
&gt; <span style="color: #000066;">cd</span> rubygems<span style="color: #cc66cc;">-1.3</span><span style="color: #cc66cc;">.1</span>
&gt; sudo ruby setup.rb
.....
RubyGems installed the following executables:
        /usr/bin/gem1<span style="color: #cc66cc;">.8</span>
&nbsp;
If `gem` was installed by a previous RubyGems installation, you may need
to remove it by hand.
&nbsp;
&gt; gem -v
<span style="color: #cc66cc;">1.3</span><span style="color: #cc66cc;">.1</span>
&gt; sudo gem install git-up
Successfully installed git-up<span style="color: #cc66cc;">-0.1</span><span style="color: #cc66cc;">.0</span>
<span style="color: #cc66cc;">1</span> gem installed
Installing ri documentation <span style="color: #b1b100;">for</span> git-up<span style="color: #cc66cc;">-0.1</span><span style="color: #cc66cc;">.0</span>...
Installing RDoc documentation <span style="color: #b1b100;">for</span> git-up<span style="color: #cc66cc;">-0.1</span><span style="color: #cc66cc;">.0</span>...</pre></p>

	<p>After this, trying to run <em>git up</em> caused a bunch of missing dependency errors, and I had to install gems for <em>archive-tar-minitar</em>, <em>nokogiri</em> (which also required installing <em>libxslt-ruby</em>), and <em>rcov</em>. Finally, I got stuck trying to install <em>hoe</em> :</p>

	<p><pre class="bash">&gt; sudo gem install hoe                                                                                                                         <span style="color: #cc66cc;">1</span> ?
ERROR:  Error installing hoe:
        gemcutter requires RubyGems version &gt;= <span style="color: #cc66cc;">1.3</span><span style="color: #cc66cc;">.5</span></pre></p>

	<p>Let&#8217;s try all this again with RubyGems 1.3.5 :</p>

	<p><pre class="bash">&gt; wget http://rubyforge.org/frs/download.php/<span style="color: #cc66cc;">60718</span>/rubygems<span style="color: #cc66cc;">-1.3</span><span style="color: #cc66cc;">.5</span>.tgz
&gt; tar xvzf rubygems<span style="color: #cc66cc;">-1.3</span><span style="color: #cc66cc;">.5</span>.tgz 
&gt; <span style="color: #000066;">cd</span> rubygems<span style="color: #cc66cc;">-1.3</span><span style="color: #cc66cc;">.5</span> 
&gt; sudo ruby setup.rb
RubyGems installed the following executables:
        /usr/bin/gem1<span style="color: #cc66cc;">.8</span>
&gt; gem -v
<span style="color: #cc66cc;">1.3</span><span style="color: #cc66cc;">.5</span>
&gt; sudo gem -v
<span style="color: #cc66cc;">1.3</span><span style="color: #cc66cc;">.5</span>
&gt; sudo gem install git-up
Successfully installed git-up<span style="color: #cc66cc;">-0.1</span><span style="color: #cc66cc;">.0</span>
<span style="color: #cc66cc;">1</span> gem installed
Installing ri documentation <span style="color: #b1b100;">for</span> git-up<span style="color: #cc66cc;">-0.1</span><span style="color: #cc66cc;">.0</span>...
Installing RDoc documentation <span style="color: #b1b100;">for</span> git-up<span style="color: #cc66cc;">-0.1</span><span style="color: #cc66cc;">.0</span>...
&gt; git up
master              up to date</pre></p>

	<p>Finally with RubyGems 1.3.5, git-up works fine, with no dependency issues or missing gems.</p><img src="http://feeds.feedburner.com/~r/Recurser/~4/p_CWwrnvfVY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2010/02/14/installing-git-up-on-ubuntu-8-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2010/02/14/installing-git-up-on-ubuntu-8-10/</feedburner:origLink></item>
		<item>
		<title>Updating RubyGems on Mac OS X 10.5 Leopard</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/NLW933_j5bY/</link>
		<comments>http://recurser.com/articles/2010/02/14/updating-rubygems-on-mac-os-x-10-5-leopard/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 01:34:47 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Version Control]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=465</guid>
		<description><![CDATA[How to update "RubyGems":http://rubyforge.org/projects/rubygems/ from v1.0.1 to v1.3.5 on OS X]]></description>
			<content:encoded><![CDATA[	<p>I haven&#8217;t used ruby for a while, but recently wanted to try out <a href="http://github.com/aanand/git-up">git-up</a> on <span class="caps">OSX</span>. According to the <a href="http://github.com/aanand/git-up/blob/master/README.md">instructions</a> , a simple <em>gem install git-up</em> should work :</p>

	<p><pre class="bash">&gt; sudo gem install git-up
Updating metadata <span style="color: #b1b100;">for</span> <span style="color: #cc66cc;">1</span> gems from http://gems.rubyforge.org
.
<span style="color: #000066;">complete</span>
ERROR:  could not find git-up locally or <span style="color: #b1b100;">in</span> a repository</pre></p>

	<p>I assume this is something to do with gem hosting moving to github or something&#8230; I haven&#8217;t really been following ruby for a year or so so I&#8217;m not sure exactly what&#8217;s going on. It seems i&#8217;m running a pretty old version of <a href="http://rubyforge.org/projects/rubygems/">RubyGems</a> , so I tried to update :</p>

	<p><pre class="bash">&gt; gem --version
<span style="color: #cc66cc;">1.0</span><span style="color: #cc66cc;">.1</span>
&gt; sudo gem update
Updating installed gems...
Updating metadata <span style="color: #b1b100;">for</span> <span style="color: #cc66cc;">1</span> gems from http://gems.rubyforge.org
.
<span style="color: #000066;">complete</span>
Nothing to update</pre></p>

	<p>After a little googling, the correct command turned out to be the following :<br />
<pre class="bash">&gt; sudo gem update --system
Updating RubyGems...
Updating metadata <span style="color: #b1b100;">for</span> <span style="color: #cc66cc;">1</span> gems from http://gems.rubyforge.org
.
<span style="color: #000066;">complete</span>
Attempting remote update of rubygems-update
Successfully installed rubygems-update<span style="color: #cc66cc;">-1.3</span><span style="color: #cc66cc;">.5</span>
<span style="color: #cc66cc;">1</span> gem installed
Installing ri documentation <span style="color: #b1b100;">for</span> rubygems-update<span style="color: #cc66cc;">-1.3</span><span style="color: #cc66cc;">.5</span>...
Installing RDoc documentation <span style="color: #b1b100;">for</span> rubygems-update<span style="color: #cc66cc;">-1.3</span><span style="color: #cc66cc;">.5</span>...
Could not find main page README
Could not find main page README
Could not find main page README
Could not find main page README
Updating version of RubyGems to <span style="color: #cc66cc;">1.3</span><span style="color: #cc66cc;">.5</span>
Installing RubyGems <span style="color: #cc66cc;">1.3</span><span style="color: #cc66cc;">.5</span>
RubyGems <span style="color: #cc66cc;">1.3</span><span style="color: #cc66cc;">.5</span> installed
&nbsp;
=== <span style="color: #cc66cc;">1.3</span><span style="color: #cc66cc;">.5</span> / <span style="color: #cc66cc;">2009</span><span style="color: #cc66cc;">-07</span><span style="color: #cc66cc;">-21</span>
&nbsp;
Bug fixes:
&nbsp;
* Fix use of prerelease gems.
* Gem.bin_path no longer escapes path with spaces. Bug <span style="color: #808080; font-style: italic;">#25935 and #26458.</span>
&nbsp;
Deprecation Notices:
&nbsp;
* Bulk index update is no longer supported <span style="color: #66cc66;">&#40;</span>the code currently remains, but not
  the tests<span style="color: #66cc66;">&#41;</span>
* Gem::manage_gems was removed <span style="color: #b1b100;">in</span> <span style="color: #cc66cc;">1.3</span><span style="color: #cc66cc;">.3</span>.
* Time::today was removed <span style="color: #b1b100;">in</span> <span style="color: #cc66cc;">1.3</span><span style="color: #cc66cc;">.3</span>.
&nbsp;
&nbsp;
------------------------------------------------------------------------------
&nbsp;
RubyGems installed the following executables:
        /System/Library/Frameworks/Ruby.framework/Versions/<span style="color: #cc66cc;">1.8</span>/usr/bin/gem
&nbsp;
RubyGems system software updated</pre></p>

	<p>Now with the more recent version, <a href="http://github.com/aanand/git-up">git-up</a> installs fine :</p>

	<p><pre class="bash">&gt; gem --version
<span style="color: #cc66cc;">1.3</span><span style="color: #cc66cc;">.5</span>
&gt; sudo gem install git-up
Successfully installed colored<span style="color: #cc66cc;">-1.2</span>
Successfully installed diff-lcs<span style="color: #cc66cc;">-1.1</span><span style="color: #cc66cc;">.2</span>
Successfully installed grit<span style="color: #cc66cc;">-2.0</span><span style="color: #cc66cc;">.0</span>
Successfully installed git-up<span style="color: #cc66cc;">-0.1</span><span style="color: #cc66cc;">.0</span>
<span style="color: #cc66cc;">4</span> gems installed
Installing ri documentation <span style="color: #b1b100;">for</span> colored<span style="color: #cc66cc;">-1.2</span>...
Installing ri documentation <span style="color: #b1b100;">for</span> diff-lcs<span style="color: #cc66cc;">-1.1</span><span style="color: #cc66cc;">.2</span>...
Installing ri documentation <span style="color: #b1b100;">for</span> grit<span style="color: #cc66cc;">-2.0</span><span style="color: #cc66cc;">.0</span>...
Installing ri documentation <span style="color: #b1b100;">for</span> git-up<span style="color: #cc66cc;">-0.1</span><span style="color: #cc66cc;">.0</span>...
Installing RDoc documentation <span style="color: #b1b100;">for</span> colored<span style="color: #cc66cc;">-1.2</span>...
Installing RDoc documentation <span style="color: #b1b100;">for</span> diff-lcs<span style="color: #cc66cc;">-1.1</span><span style="color: #cc66cc;">.2</span>...
Installing RDoc documentation <span style="color: #b1b100;">for</span> grit<span style="color: #cc66cc;">-2.0</span><span style="color: #cc66cc;">.0</span>...
Installing RDoc documentation <span style="color: #b1b100;">for</span> git-up<span style="color: #cc66cc;">-0.1</span><span style="color: #cc66cc;">.0</span>...</pre></p><img src="http://feeds.feedburner.com/~r/Recurser/~4/NLW933_j5bY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2010/02/14/updating-rubygems-on-mac-os-x-10-5-leopard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2010/02/14/updating-rubygems-on-mac-os-x-10-5-leopard/</feedburner:origLink></item>
		<item>
		<title>nginx error – 413 Request Entity Too Large</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/xeMQlm3KHHk/</link>
		<comments>http://recurser.com/articles/2009/11/18/nginx-error-413-request-entity-too-large/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 00:12:06 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=449</guid>
		<description><![CDATA[How to increase the allowed file upload size in "Nginx":http://nginx.net/, and stop _413 Request Entity Too Large_ errors.]]></description>
			<content:encoded><![CDATA[	<p>If you&#8217;re getting <em>413 Request Entity Too Large</em> errors trying to upload with <a href="http://nginx.net/">Nginx</a> , you need to increase the size limit in <em>nginx.conf</em> . Add &#8216;client_max_body_size xxM&#8217; inside the <em>server</em> section, where <em>xx</em> is the size (in megabytes) that you want to allow.<br />
<pre class="c">http <span style="color: #66cc66;">&#123;</span>
    include       mime.<span style="color: #202020;">types</span>;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  <span style="color: #cc66cc;">65</span>;
&nbsp;
    server <span style="color: #66cc66;">&#123;</span>
        client_max_body_size 20M;
        listen       <span style="color: #cc66cc;">80</span>;
        server_name  localhost;
&nbsp;
        <span style="color: #339933;"># Main location</span>
        location / <span style="color: #66cc66;">&#123;</span>
            proxy_pass         http:<span style="color: #808080; font-style: italic;">//127.0.0.1:8000/;</span>
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></p><img src="http://feeds.feedburner.com/~r/Recurser/~4/xeMQlm3KHHk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2009/11/18/nginx-error-413-request-entity-too-large/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2009/11/18/nginx-error-413-request-entity-too-large/</feedburner:origLink></item>
		<item>
		<title>Makefile – missing separator. Stop.</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/-iDVlxGv1oo/</link>
		<comments>http://recurser.com/articles/2009/11/12/makefile-missing-separator-stop/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 01:11:54 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=446</guid>
		<description><![CDATA[How to fix _missing separator_ errors in Makefiles]]></description>
			<content:encoded><![CDATA[	<p>If you&#8217;re getting <em>missing separator</em> errors in your makefile, similar to the following :</p>

	<p><pre class="bash">Makefile:<span style="color: #cc66cc;">22</span>: *** missing separator.  Stop.</pre></p>

	<p>&#8230; make sure you are using real tabs instead of spaces. A global search and replace for four-spaces should fix things up.</p><img src="http://feeds.feedburner.com/~r/Recurser/~4/-iDVlxGv1oo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2009/11/12/makefile-missing-separator-stop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2009/11/12/makefile-missing-separator-stop/</feedburner:origLink></item>
		<item>
		<title>NoReverseMatch : custom registration templates break django unit tests</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/YAG47J-cBT0/</link>
		<comments>http://recurser.com/articles/2009/11/10/noreversematch-custom-registration-templates-break-django-unit-tests/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 09:11:31 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=439</guid>
		<description><![CDATA[How to fix _NoReverseMatch_ errors in the "django":http://www.djangoproject.com/ auth and "django-registration":http://bitbucket.org/ubernostrum/django-registration/ test suites when you are using customized login and registration templates.]]></description>
			<content:encoded><![CDATA[	<p>I&#8217;ve over-ridden several of the built-in <a href="http://www.djangoproject.com/">django</a> auth and <a href="http://bitbucket.org/ubernostrum/django-registration/">django-registration</a> templates so I can have my own custom-styled login and registration pages. This all worked fine until i tried to run the built-in django and django_registration test suites, when everything fell apart :</p>

	<p><pre class="python">======================================================================
ERROR: test_confirm_different_passwords <span style="color: black;">&#40;</span>django.<span style="color: black;">contrib</span>.<span style="color: black;">auth</span>.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">PasswordResetTest</span><span style="color: black;">&#41;</span>
----------------------------------------------------------------------
<span style="color: #dc143c;">Traceback</span> <span style="color: black;">&#40;</span>most recent call last<span style="color: black;">&#41;</span>:
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/contrib/auth/tests/views.py&quot;</span>, line <span style="color: #ff4500;">124</span>, <span style="color: #ff7700;font-weight:bold;">in</span> test_confirm_different_passwords
    <span style="color: #483d8b;">'new_password2'</span>:<span style="color: #483d8b;">' x'</span><span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/test/client.py&quot;</span>, line <span style="color: #ff4500;">313</span>, <span style="color: #ff7700;font-weight:bold;">in</span> post
    response = <span style="color: #008000;">self</span>.<span style="color: black;">request</span><span style="color: black;">&#40;</span>**r<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/core/handlers/base.py&quot;</span>, line <span style="color: #ff4500;">92</span>, <span style="color: #ff7700;font-weight:bold;">in</span> get_response
    response = callback<span style="color: black;">&#40;</span>request, *callback_args, **callback_kwargs<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/contrib/auth/views.py&quot;</span>, line <span style="color: #ff4500;">141</span>, <span style="color: #ff7700;font-weight:bold;">in</span> password_reset_confirm
    <span style="color: #ff7700;font-weight:bold;">return</span> render_to_response<span style="color: black;">&#40;</span>template_name, context_instance=context_instance<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/shortcuts/__init__.py&quot;</span>, line <span style="color: #ff4500;">20</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render_to_response
    <span style="color: #ff7700;font-weight:bold;">return</span> HttpResponse<span style="color: black;">&#40;</span>loader.<span style="color: black;">render_to_string</span><span style="color: black;">&#40;</span>*args, **kwargs<span style="color: black;">&#41;</span>, **httpresponse_kwargs<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/loader.py&quot;</span>, line <span style="color: #ff4500;">108</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render_to_string
    <span style="color: #ff7700;font-weight:bold;">return</span> t.<span style="color: black;">render</span><span style="color: black;">&#40;</span>context_instance<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/test/utils.py&quot;</span>, line <span style="color: #ff4500;">29</span>, <span style="color: #ff7700;font-weight:bold;">in</span> instrumented_test_render
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">nodelist</span>.<span style="color: black;">render</span><span style="color: black;">&#40;</span>context<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/__init__.py&quot;</span>, line <span style="color: #ff4500;">779</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render
    bits.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">render_node</span><span style="color: black;">&#40;</span>node, context<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/__init__.py&quot;</span>, line <span style="color: #ff4500;">792</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render_node
    <span style="color: #ff7700;font-weight:bold;">return</span> node.<span style="color: black;">render</span><span style="color: black;">&#40;</span>context<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/loader_tags.py&quot;</span>, line <span style="color: #ff4500;">97</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render
    <span style="color: #ff7700;font-weight:bold;">return</span> compiled_parent.<span style="color: black;">render</span><span style="color: black;">&#40;</span>context<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/test/utils.py&quot;</span>, line <span style="color: #ff4500;">29</span>, <span style="color: #ff7700;font-weight:bold;">in</span> instrumented_test_render
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">nodelist</span>.<span style="color: black;">render</span><span style="color: black;">&#40;</span>context<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/__init__.py&quot;</span>, line <span style="color: #ff4500;">779</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render
    bits.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">render_node</span><span style="color: black;">&#40;</span>node, context<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/__init__.py&quot;</span>, line <span style="color: #ff4500;">792</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render_node
    <span style="color: #ff7700;font-weight:bold;">return</span> node.<span style="color: black;">render</span><span style="color: black;">&#40;</span>context<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/__init__.py&quot;</span>, line <span style="color: #ff4500;">946</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render
    autoescape=context.<span style="color: black;">autoescape</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/__init__.py&quot;</span>, line <span style="color: #ff4500;">779</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render
    bits.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">render_node</span><span style="color: black;">&#40;</span>node, context<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/__init__.py&quot;</span>, line <span style="color: #ff4500;">792</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render_node
    <span style="color: #ff7700;font-weight:bold;">return</span> node.<span style="color: black;">render</span><span style="color: black;">&#40;</span>context<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/loader_tags.py&quot;</span>, line <span style="color: #ff4500;">24</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render
    result = <span style="color: #008000;">self</span>.<span style="color: black;">nodelist</span>.<span style="color: black;">render</span><span style="color: black;">&#40;</span>context<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/__init__.py&quot;</span>, line <span style="color: #ff4500;">779</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render
    bits.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">render_node</span><span style="color: black;">&#40;</span>node, context<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/__init__.py&quot;</span>, line <span style="color: #ff4500;">792</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render_node
    <span style="color: #ff7700;font-weight:bold;">return</span> node.<span style="color: black;">render</span><span style="color: black;">&#40;</span>context<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/defaulttags.py&quot;</span>, line <span style="color: #ff4500;">244</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">nodelist_false</span>.<span style="color: black;">render</span><span style="color: black;">&#40;</span>context<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/__init__.py&quot;</span>, line <span style="color: #ff4500;">779</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render
    bits.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">render_node</span><span style="color: black;">&#40;</span>node, context<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/__init__.py&quot;</span>, line <span style="color: #ff4500;">792</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render_node
    <span style="color: #ff7700;font-weight:bold;">return</span> node.<span style="color: black;">render</span><span style="color: black;">&#40;</span>context<span style="color: black;">&#41;</span>
  <span style="color: #008000;">File</span> <span style="color: #483d8b;">&quot;/Users/dave/Documents/Code/python/loudgallery/django/template/defaulttags.py&quot;</span>, line <span style="color: #ff4500;">382</span>, <span style="color: #ff7700;font-weight:bold;">in</span> render
    <span style="color: #ff7700;font-weight:bold;">raise</span> e
NoReverseMatch: Reverse <span style="color: #ff7700;font-weight:bold;">for</span> <span style="color: #483d8b;">'&lt;function index at 0x1ca9c30&gt;'</span> with arguments <span style="color: #483d8b;">'()'</span> <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #dc143c;">keyword</span> arguments <span style="color: #483d8b;">'{}'</span> <span style="color: #ff7700;font-weight:bold;">not</span> found.</pre></p>

	<p>There were quite a few more of these, including :</p>

	<p><pre class="python">test_activation_success_url <span style="color: black;">&#40;</span>registration.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">RegistrationViewTests</span><span style="color: black;">&#41;</span> ... <span style="color: black;">ERROR</span>
test_activation_template_name <span style="color: black;">&#40;</span>registration.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">RegistrationViewTests</span><span style="color: black;">&#41;</span> ... <span style="color: black;">ERROR</span>
test_registration_disallowed_url <span style="color: black;">&#40;</span>registration.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">RegistrationViewTests</span><span style="color: black;">&#41;</span> ... <span style="color: black;">ERROR</span>
test_registration_extra_context <span style="color: black;">&#40;</span>registration.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">RegistrationViewTests</span><span style="color: black;">&#41;</span> ... <span style="color: black;">ERROR</span>
test_registration_success_url <span style="color: black;">&#40;</span>registration.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">RegistrationViewTests</span><span style="color: black;">&#41;</span> ... <span style="color: black;">ERROR</span>
test_registration_template_name <span style="color: black;">&#40;</span>registration.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">RegistrationViewTests</span><span style="color: black;">&#41;</span> ... <span style="color: black;">FAIL</span>
test_registration_view_closed <span style="color: black;">&#40;</span>registration.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">RegistrationViewTests</span><span style="color: black;">&#41;</span> ... <span style="color: black;">ERROR</span>
test_registration_view_failure <span style="color: black;">&#40;</span>registration.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">RegistrationViewTests</span><span style="color: black;">&#41;</span> ... <span style="color: black;">FAIL</span>
test_registration_view_initial <span style="color: black;">&#40;</span>registration.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">RegistrationViewTests</span><span style="color: black;">&#41;</span> ... <span style="color: black;">FAIL</span>
test_registration_view_success <span style="color: black;">&#40;</span>registration.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">RegistrationViewTests</span><span style="color: black;">&#41;</span> ... <span style="color: black;">ERROR</span>
test_valid_activation <span style="color: black;">&#40;</span>registration.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">RegistrationViewTests</span><span style="color: black;">&#41;</span> ... <span style="color: black;">ERROR</span>
...
<span style="color: black;">test_confirm_complete</span> <span style="color: black;">&#40;</span>django.<span style="color: black;">contrib</span>.<span style="color: black;">auth</span>.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">PasswordResetTest</span><span style="color: black;">&#41;</span> ... <span style="color: black;">FAIL</span>
test_confirm_invalid <span style="color: black;">&#40;</span>django.<span style="color: black;">contrib</span>.<span style="color: black;">auth</span>.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">PasswordResetTest</span><span style="color: black;">&#41;</span> ... <span style="color: black;">FAIL</span>
test_confirm_valid <span style="color: black;">&#40;</span>django.<span style="color: black;">contrib</span>.<span style="color: black;">auth</span>.<span style="color: black;">tests</span>.<span style="color: black;">views</span>.<span style="color: black;">PasswordResetTest</span><span style="color: black;">&#41;</span> ... <span style="color: black;">FAIL</span>
...</pre><br />
&#8230; and so on. After some investigation, it seems these errors occur because I have links to my own views in these custom templates, for example :</p>

	<p><pre class="python">&lt;a href=<span style="color: #483d8b;">&quot;{% url home.views.index}&quot;</span>&gt;Cancel&lt;/a&gt;</pre></p>

	<p>For whatever reason, django doesn&#8217;t include my project&#8217;s various <em>urls.py</em> files when it runs its tests, so it doesn&#8217;t know anything about my URLs. After a few hours I found <a href="http://www.mail-archive.com/django-users@googlegroups.com/msg78790.html">this solution</a> , which is a little hack-y, but seems to work. Simply add <em>as xxxx</em> at the end of your url call, and output the url as a variable using (for example) {{ index }} . This seems to suppress the errors :</p>

	<p><pre class="python">&lt;a href=<span style="color: #483d8b;">&quot;{% url home.views.index as index %}{{ index }}&quot;</span>&gt;Cancel&lt;/a&gt;</pre></p><img src="http://feeds.feedburner.com/~r/Recurser/~4/YAG47J-cBT0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2009/11/10/noreversematch-custom-registration-templates-break-django-unit-tests/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2009/11/10/noreversematch-custom-registration-templates-break-django-unit-tests/</feedburner:origLink></item>
		<item>
		<title>Sending Django email with Gmail</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/nIPI8hP2riU/</link>
		<comments>http://recurser.com/articles/2009/10/16/sending-django-email-with-gmail/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 06:02:27 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=437</guid>
		<description><![CDATA[How to set up your "django":http://www.djangoproject.com/ application so email is sent through "Gmail":http://mail.google.com/.]]></description>
			<content:encoded><![CDATA[	<p>After spending a few hours struggling to get <a href="http://www.postfix.org/">postfix</a> to work with <a href="http://www.djangoproject.com/">django</a> on my local dev machine, I gave up and decided to use <a href="http://mail.google.com/">Gmail</a> . To do it, add the following to your <em>settings.py</em> :</p>

	<p><pre class="python">EMAIL_USE_TLS = <span style="color: #008000;">True</span>
EMAIL_HOST = <span style="color: #483d8b;">'smtp.gmail.com'</span>
EMAIL_HOST_USER = username@gmail.<span style="color: black;">com</span><span style="color: #483d8b;">'
EMAIL_HOST_PASSWORD = '</span>password<span style="color: #483d8b;">'
EMAIL_PORT = 587 </span></pre></p>

	<p>(Obviously, substituting your own email and password)</p>

	<p>You can also use an address at your own domain if you set the <span class="caps">DNS</span> records to use google apps.</p>

	<p>To test if it&#8217;s working :</p>

	<p><pre class="python">&gt; python manage.<span style="color: black;">py</span> shell
&gt;&gt;&gt; <span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">core</span>.<span style="color: black;">mail</span> <span style="color: #ff7700;font-weight:bold;">import</span> EmailMessage
&gt;&gt;&gt; <span style="color: #dc143c;">email</span> = EmailMessage<span style="color: black;">&#40;</span><span style="color: #483d8b;">'Mail Test'</span>, <span style="color: #483d8b;">'This is a test'</span>, to=<span style="color: black;">&#91;</span><span style="color: #483d8b;">'test@your-address.com'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
&gt;&gt;&gt; <span style="color: #dc143c;">email</span>.<span style="color: black;">send</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></p><img src="http://feeds.feedburner.com/~r/Recurser/~4/nIPI8hP2riU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2009/10/16/sending-django-email-with-gmail/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2009/10/16/sending-django-email-with-gmail/</feedburner:origLink></item>
		<item>
		<title>Compiling mysql-python on OS X leopard</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/0X0dOy0yuRI/</link>
		<comments>http://recurser.com/articles/2009/08/18/compiling-mysql-python-on-os-x-leopard/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 11:04:32 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=416</guid>
		<description><![CDATA[How to get around a few of the problems you may encounter trying to install  install "mysql-python":http://sourceforge.net/projects/mysql-python/ bindings on OS X Leopard.]]></description>
			<content:encoded><![CDATA[	<p>I&#8217;ve just finished trying to install <a href="http://sourceforge.net/projects/mysql-python/">mysql-python</a> on <span class="caps">OSX</span> Leopard, and had quite a few problems. This is the procedure that finally ended up working for me.</p>

	<p>First, download mysql-python from <a href="http://downloads.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3c1.tar.gz">here</a> .<br />
Unzip and try to build it :<br />
<pre class="bash">&gt; tar xvzf MySQL-python<span style="color: #cc66cc;">-1.2</span>.3c1.tar.gz
&gt; <span style="color: #000066;">cd</span> MySQL-python<span style="color: #cc66cc;">-1.2</span>.3c1
&gt; sudo python setup.py build</pre></p>

	<p>If the build works, you&#8217;re in luck&#8230; you simply need to install it :<br />
<pre class="bash">&gt; sudo python setup.py install</pre></p>

	<p>More than likely though, it isn&#8217;t going to work :) At first, i got an error about _LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)_ :<br />
<pre class="bash">running buildrunning build_py
copying MySQLdb/release.py -&gt; build/lib.macosx<span style="color: #cc66cc;">-10.5</span>-i386<span style="color: #cc66cc;">-2.5</span>/MySQLdb
running build_ext
building <span style="color: #ff0000;">'_mysql'</span> extension
/usr/bin/gcc<span style="color: #cc66cc;">-4.0</span> -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -<span style="color: #0000ff;">Dversion_info=</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>,<span style="color: #cc66cc;">2</span>,<span style="color: #cc66cc;">3</span>,<span style="color: #ff0000;">'gamma'</span>,<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> -<span style="color: #0000ff;">D__version__=</span><span style="color: #cc66cc;">1.2</span>.3c1 -I/usr/<span style="color: #000066;">local</span>/mysql<span style="color: #cc66cc;">-5.1</span><span style="color: #cc66cc;">.30</span>-osx10<span style="color: #cc66cc;">.5</span>-x86_64/include -I/opt/<span style="color: #000066;">local</span>/Library/Frameworks/Python.framework/Versions/<span style="color: #cc66cc;">2.5</span>/include/python2<span style="color: #cc66cc;">.5</span> -c _mysql.c -o build/temp.macosx<span style="color: #cc66cc;">-10.5</span>-i386<span style="color: #cc66cc;">-2.5</span>/_mysql.o -g -Os -arch x86_64 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL
In file included from /opt/<span style="color: #000066;">local</span>/Library/Frameworks/Python.framework/Versions/<span style="color: #cc66cc;">2.5</span>/include/python2<span style="color: #cc66cc;">.5</span>/Python.h:<span style="color: #cc66cc;">57</span>,
                 from pymemcompat.h:<span style="color: #cc66cc;">10</span>,
                 from _mysql.c:<span style="color: #cc66cc;">29</span>:
/opt/<span style="color: #000066;">local</span>/Library/Frameworks/Python.framework/Versions/<span style="color: #cc66cc;">2.5</span>/include/python2<span style="color: #cc66cc;">.5</span>/pyport.h:<span style="color: #cc66cc;">761</span>:<span style="color: #cc66cc;">2</span>: error: <span style="color: #808080; font-style: italic;">#error &quot;LONG_BIT definition appears wrong for platform (bad gcc/glibc config?).&quot;</span>
In file included from _mysql.c:<span style="color: #cc66cc;">36</span>:
/usr/<span style="color: #000066;">local</span>/mysql<span style="color: #cc66cc;">-5.1</span><span style="color: #cc66cc;">.30</span>-osx10<span style="color: #cc66cc;">.5</span>-x86_64/include/my_config.h:<span style="color: #cc66cc;">1104</span>:<span style="color: #cc66cc;">1</span>: warning: <span style="color: #ff0000;">&quot;SIZEOF_LONG&quot;</span> redefined
In file included from /opt/<span style="color: #000066;">local</span>/Library/Frameworks/Python.framework/Versions/<span style="color: #cc66cc;">2.5</span>/include/python2<span style="color: #cc66cc;">.5</span>/Python.h:<span style="color: #cc66cc;">8</span>,
                 from pymemcompat.h:<span style="color: #cc66cc;">10</span>,
                 from _mysql.c:<span style="color: #cc66cc;">29</span>:
/opt/<span style="color: #000066;">local</span>/Library/Frameworks/Python.framework/Versions/<span style="color: #cc66cc;">2.5</span>/include/python2<span style="color: #cc66cc;">.5</span>/pyconfig.h:<span style="color: #cc66cc;">814</span>:<span style="color: #cc66cc;">1</span>: warning: this is the location of the previous definition
error: <span style="color: #000066;">command</span> <span style="color: #ff0000;">'/usr/bin/gcc-4.0'</span> failed with <span style="color: #000066;">exit</span> status <span style="color: #cc66cc;">1</span></pre></p>

	<p>To get around this, edit the file mentioned in the error ( /opt/local/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5/pyport.h ) and comment out the line mentioned in the error (line 761 in the current version) :</p>

	<p><pre class="c"><span style="color: #808080; font-style: italic;">/* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent
 * 32-bit platforms using gcc.  We try to catch that here at compile-time
 * rather than waiting for integer multiplication to trigger bogus
 * overflows.
 */</span>
<span style="color: #808080; font-style: italic;">/*#error &quot;LONG_BIT definition appears wrong for platform (bad gcc/glibc config?).&quot;*/</span></pre></p>

	<p>At this point, hopefully you can build and install without problems :<br />
<pre class="bash">&gt; sudo python setup.py build
&gt; sudo python setup.py install</pre></p>

	<p>Even after i managed to install it, i continued to get the following error :<br />
<pre class="bash">django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: dynamic module does not define init <span style="color: #b1b100;">function</span> <span style="color: #66cc66;">&#40;</span>init_mysql<span style="color: #66cc66;">&#41;</span></pre><br />
After a bit of digging around, it turns out that this is caused by running a 32-bit version of python alongside a 64-bit version of MySQL. </p>

	<p>We need to uninstall the 64-bit version first. I found some great instructions on <a href="http://akrabat.com/2008/09/11/uninstalling-mysql-on-mac-os-x-leopard/">akrabat.com</a> :</p>

	<p><pre class="php">To uninstall <a href="http://www.php.net/mysql"><span style="color: #000066;">MySQL</span></a> and completely remove it from you Mac <span style="color: #b1b100;">do</span> the following:
&nbsp;
    * sudo rm /usr/local/<a href="http://www.php.net/mysql"><span style="color: #000066;">mysql</span></a>
    * sudo rm -rf /usr/local/<a href="http://www.php.net/mysql"><span style="color: #000066;">mysql</span></a>*
    * sudo rm -rf /Library/StartupItems/MySQLCOM
    * sudo rm -rf /Library/PreferencePanes/My*
    * edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
    * sudo rm -rf /Library/Receipts/<a href="http://www.php.net/mysql"><span style="color: #000066;">mysql</span></a>*
    * sudo rm -rf /Library/Receipts/<a href="http://www.php.net/mysql"><span style="color: #000066;">MySQL</span></a>*
&nbsp;
The last two lines are particularly important <span style="color: #b1b100;">as</span> otherwise, you can<span style="color: #ff0000;">'t install an older version of MySQL even though you think that you'</span>ve completely deleted the newer version!</pre></p>

	<p>Once this is done, download and install the <em>Mac OS X 10.5 (x86)</em> version from the mysql site (make sure you don&#8217;t get the x86_64 version again!), and with a bit of luck everything should be working.</p><img src="http://feeds.feedburner.com/~r/Recurser/~4/0X0dOy0yuRI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2009/08/18/compiling-mysql-python-on-os-x-leopard/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2009/08/18/compiling-mysql-python-on-os-x-leopard/</feedburner:origLink></item>
		<item>
		<title>‘Hello World’ with Scala and Lift on OSX</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/3sGYjwTHjBc/</link>
		<comments>http://recurser.com/articles/2009/08/17/hello-world-with-scala-and-lift-on-osx/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 18:14:48 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Scala]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=404</guid>
		<description><![CDATA[How to install "Scala":http://www.scala-lang.org/ and "Lift":http://liftweb.net/ on OS X, and create a simple sample project.]]></description>
			<content:encoded><![CDATA[	<p>Obviously we&#8217;re going to need scala before we can do anything useful; the easiest way to install it is via <a href="http://www.macports.org/">macports</a> . We&#8217;re also going to need maven.<br />
<pre class="bash">&gt; sudo port install scala  
&gt; sudo port install maven2</pre><br />
Scala seems to have moved their repository to <a href="http://github.com/dpp/liftweb/tree/master">github</a> , and the old <a href="http://code.google.com/p/liftweb/">google code repository</a> no longer works. Assuming you have <a href="http://git-scm.com/">git</a> installed (if not, there&#8217;s an <a href="http://code.google.com/p/git-osx-installer/downloads/list?can=3">OS X installer here</a> ) :<br />
<pre class="bash">&gt; mkdir -p Documents/code/scala
&gt; <span style="color: #000066;">cd</span> Documents/code/scala
&gt; git clone git://github.com/dpp/liftweb.git
&gt; <span style="color: #000066;">cd</span> liftweb
&gt;  mvn clean:clean install</pre><br />
The <em>mvn install</em> may take quite a while.</p>

	<p>At this point i got an error :<br />
<pre class="java">Required goal not found: org.<span style="color: #006600;">apache</span>.<span style="color: #006600;">maven</span>.<span style="color: #006600;">plugins</span>:maven-archetype-plugin:jar in org.<span style="color: #006600;">apache</span>.<span style="color: #006600;">maven</span>.<span style="color: #006600;">plugins</span>:maven-archetype-plugin:<span style="color: #cc66cc;">1.0</span>-alpha<span style="color: #cc66cc;">-7</span></pre><br />
&#8230; which i think might have been because <a href="http://www.obdev.at/products/littlesnitch/index.html">Little Snitch</a> blocked a request or something&#8230; I ran <em>mvn clean:clean install</em> again and after a few complaints from Little Snitch, success :<br />
<pre class="java"><span style="color: #66cc66;">&#91;</span>INFO<span style="color: #66cc66;">&#93;</span> ------------------------------------------------------------------------
<span style="color: #66cc66;">&#91;</span>INFO<span style="color: #66cc66;">&#93;</span> BUILD SUCCESSFUL
<span style="color: #66cc66;">&#91;</span>INFO<span style="color: #66cc66;">&#93;</span> ------------------------------------------------------------------------
<span style="color: #66cc66;">&#91;</span>INFO<span style="color: #66cc66;">&#93;</span> Total time: <span style="color: #cc66cc;">7</span> minutes <span style="color: #cc66cc;">50</span> seconds
<span style="color: #66cc66;">&#91;</span>INFO<span style="color: #66cc66;">&#93;</span> Finished at: Tue Aug <span style="color: #cc66cc;">18</span> <span style="color: #cc66cc;">03</span>:<span style="color: #cc66cc;">47</span>:<span style="color: #cc66cc;">19</span> JST <span style="color: #cc66cc;">2009</span>
<span style="color: #66cc66;">&#91;</span>INFO<span style="color: #66cc66;">&#93;</span> <span style="color: #000000; font-weight: bold;">Final</span> Memory: 50M/63M
<span style="color: #66cc66;">&#91;</span>INFO<span style="color: #66cc66;">&#93;</span> ------------------------------------------------------------------------
mvn clean:clean install  <span style="color: #cc66cc;">360</span>.40s user <span style="color: #cc66cc;">51</span>.08s system <span style="color: #cc66cc;">87</span>% cpu <span style="color: #cc66cc;">7</span>:<span style="color: #cc66cc;">50.98</span> total</pre></p>

	<p>Next, it&#8217;s time to create our new project :<br />
<pre class="bash">&gt; <span style="color: #000066;">cd</span> ..
&gt; mvn archetype:create -U  \
 -<span style="color: #0000ff;">DarchetypeGroupId=</span>net.liftweb                             \
 -<span style="color: #0000ff;">DarchetypeArtifactId=</span>lift-archetype-basic                 \
 -<span style="color: #0000ff;">DarchetypeVersion=</span><span style="color: #cc66cc;">1.0</span>                            \
 -<span style="color: #0000ff;">DremoteRepositories=</span>http://scala-tools.org/repo-releases  \
 -<span style="color: #0000ff;">DgroupId=</span>net.liftweb.hello -<span style="color: #0000ff;">DartifactId=</span>hello-lift</pre><br />
This should create a <em>hello-lift</em> folder with your new application in it. There are <a href="http://wiki.liftweb.net/index.php/Archetypes">several archetypes available</a> &#8211; this example uses <em>lift-archetype-basic</em>, which provides basic database support and a basic stylesheet. To run it :<br />
<pre class="bash">&gt; <span style="color: #000066;">cd</span> hello-lift/
&gt; mvn install jetty:run</pre><br />
&#8230; and point your browser at <a href="http://localhost:8080/">http://localhost:8080/</a> , and you should be in business!</p>

	<p><a href="/wp-content/uploads/2009/08/lift-basic.png" target="_blank"><img src="http://recurser.com/wp-content/uploads/2009/08/lift-basic-300x131.png" alt="lift-basic" title="lift-basic" width="300" height="131" class="aligncenter size-medium wp-image-412" /></a></p><img src="http://feeds.feedburner.com/~r/Recurser/~4/3sGYjwTHjBc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2009/08/17/hello-world-with-scala-and-lift-on-osx/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2009/08/17/hello-world-with-scala-and-lift-on-osx/</feedburner:origLink></item>
		<item>
		<title>mysql select random row with join</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/Lvtd6WPAU80/</link>
		<comments>http://recurser.com/articles/2009/08/11/mysql-select-random-row-with-join/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 17:27:14 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=330</guid>
		<description><![CDATA[A couple of attempts to select random rows via a join in MySQL.]]></description>
			<content:encoded><![CDATA[	<p>I have a <em>users</em> table and an <em>assets</em> (basically just images) table, and I want to select and display a random <em>asset</em> for each <em>user</em>. I want to show a list of users, with a random thumbnail for each user from their assets.</p>

	<p>I could do this easily enough in code with multiple queries, but it seemed like a nice challenge to try and find a pure-sql alternative.</p>

	<h2>First attempt </h2>

	<p>This was based on an idea from <a href="http://forums.mysql.com/read.php?20,35526,35560#msg-35560">the mysql forums</a> :</p>

	<p><pre class="sql"><span style="color: #993333; font-weight: bold;">SELECT</span> u.login, a.filename <span style="color: #993333; font-weight: bold;">FROM</span> users u 
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> filename, user_id, id <span style="color: #993333; font-weight: bold;">AS</span> rand_id <span style="color: #993333; font-weight: bold;">FROM</span> assets <span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> user_id <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> RAND<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> a 
<span style="color: #993333; font-weight: bold;">ON</span> u.id = a.user_id 
<span style="color: #993333; font-weight: bold;">WHERE</span> a.filename <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span>
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> u.login;</pre></p>

	<p>Since the &#8216;order by rand()&#8217; happens after the &#8216;group by&#8217;, it doesn&#8217;t return random results &#8211; it always returns the same results, but in random order.</p>

	<h2>Second attempt</h2>

	<p>Apparently this is known as the <a href="http://markmail.org/message/xwj3gpzoshpyxi2h"><span class="caps">MAX-CONCAT</span> trick</a> :</p>

	<p><pre class="sql"><span style="color: #993333; font-weight: bold;">SELECT</span> u.login, user_id, SUBSTRING<span style="color: #66cc66;">&#40;</span>MAX<span style="color: #66cc66;">&#40;</span>CONCAT<span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">TRUNCATE</span><span style="color: #66cc66;">&#40;</span>RAND<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span>,a.id<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>,<span style="color: #cc66cc;">7</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> asset_id 
<span style="color: #993333; font-weight: bold;">FROM</span> assets a 
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> users u <span style="color: #993333; font-weight: bold;">ON</span> a.user_id = u.id 
<span style="color: #993333; font-weight: bold;">WHERE</span> user_id <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span>
<span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> user_id 
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> user_id;</pre></p>

	<p>This works, however it&#8217;s pretty hacky and <strong>very</strong> MySQL-specific, and I doubt it will work on any other databases. Depending on the number of rows you want to return, it could well end up being faster just doing the heavy lifting in code rather than trying to bend <span class="caps">SQL</span> to your will.</p>

	<h2>Update &#8211; Solution (2009/12/04)</h2>

	<p><a href="http://egeriis.me/">Ronnii</a> commented and pointed out this approach which (as far as i can tell) seems to do exactly what i wanted.</p>

	<p><pre class="sql"><span style="color: #993333; font-weight: bold;">SELECT</span> u.login, a.filename <span style="color: #993333; font-weight: bold;">FROM</span> users u 
<span style="color: #993333; font-weight: bold;">JOIN</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> filename, user_id, id <span style="color: #993333; font-weight: bold;">AS</span> rand_id <span style="color: #993333; font-weight: bold;">FROM</span> assets <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> RAND<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> a
<span style="color: #993333; font-weight: bold;">ON</span> u.id = a.user_id 
<span style="color: #993333; font-weight: bold;">WHERE</span> a.filename <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span>
<span style="color: #993333; font-weight: bold;">GROUP</span> <span style="color: #993333; font-weight: bold;">BY</span> user_id
<span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> u.login;</pre></p>

	<p>Thanks Ronni!</p><img src="http://feeds.feedburner.com/~r/Recurser/~4/Lvtd6WPAU80" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2009/08/11/mysql-select-random-row-with-join/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2009/08/11/mysql-select-random-row-with-join/</feedburner:origLink></item>
		<item>
		<title>Passing IPs to apache with nginx proxy</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/Z1QBDhMEtFA/</link>
		<comments>http://recurser.com/articles/2009/08/10/passing-ips-to-apache-with-nginx-proxy/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 04:59:56 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=395</guid>
		<description><![CDATA[How to configure "apache":http://httpd.apache.org/ to pick up the correct IP address for logs etc, when requests are proxied from  "nginx":http://nginx.net .]]></description>
			<content:encoded><![CDATA[	<p>When you use <a href="http://nginx.net">nginx</a> to proxy to <a href="http://httpd.apache.org/">apache</a> , apache picks up the IP address of your nginx proxy as the client. A consequence of this is that apache log files, and any application running on the apache backend, will all receive the same IP address (for example 127.0.0.1 if apache and nginx are running the same server).</p>

	<p>Luckily, nginx provides a <span class="caps">HTTP</span> <em>X-Forwarded-For</em> header containing the clients real IP address, although apache doesn&#8217;t pick it up by default. To allow apache to recognize the original client IP, we need to install the mod_rpaf module. On ubuntu, this is as simple as installing a package :</p>

	<p><pre class="bash">&gt; sudo apt-get install  libapache2-mod-rpaf</pre></p>

	<p>Once you have installed mod_rpaf, you need to configure apache. Add something similar to the following to you apache config (alter the RPAFproxy_ips setting as appropriate to match the IP address(es) of your nginx server(s) :</p>

	<p><pre class="bash">&lt;IfModule mod_rpaf.c&gt;
RPAFenable On
RPAFsethostname On
RPAFproxy_ips <span style="color: #cc66cc;">127.0</span><span style="color: #cc66cc;">.0</span><span style="color: #cc66cc;">.1</span>
&lt;/IfModule&gt;</pre></p>

	<p>If you installed the ubuntu package, this should be set up for you automatically in <em>/etc/apache2/mods-available/rpaf.conf</em> . </p>

	<p>Once apache is restarted, you should be able to see the correct IP addresses in the apache access logs.</p>

	<p>If nginx has trouble passing the <em>X-Forwarded-For</em> header for some reason, you can try to force it to set headers by hand :</p>

	<p><pre class="php">...
proxy_set_header Host <span style="color: #0000ff;">$host</span>;
proxy_set_header X-Real-IP <span style="color: #0000ff;">$remote_addr</span>;
proxy_set_header X-Forwarded-<span style="color: #b1b100;">For</span> <span style="color: #0000ff;">$proxy_add_x_forwarded_for</span>;
...</pre></p><img src="http://feeds.feedburner.com/~r/Recurser/~4/Z1QBDhMEtFA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2009/08/10/passing-ips-to-apache-with-nginx-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2009/08/10/passing-ips-to-apache-with-nginx-proxy/</feedburner:origLink></item>
		<item>
		<title>Customize the Nginx server header</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/evldvZdVYE4/</link>
		<comments>http://recurser.com/articles/2009/08/10/customize-the-nginx-server-header/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 23:48:40 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=373</guid>
		<description><![CDATA[How to alter the 'server' header in "nginx":http://nginx.net/ .]]></description>
			<content:encoded><![CDATA[	<p>Unfortunately the only way to change the server header in <a href="http://nginx.net/">nginx</a> is to actually recompile it from source. Luckily this is quite easy.</p>

	<p>First, download the latest version of nginx (0.7.61 at the time of writing) :<br />
<pre class="bash">&gt; wget http://sysoev.ru/nginx/nginx<span style="color: #cc66cc;">-0.7</span><span style="color: #cc66cc;">.61</span>.tar.gz 
&gt; tar xvzf nginx<span style="color: #cc66cc;">-0.7</span><span style="color: #cc66cc;">.61</span>.tar.gz
&gt; <span style="color: #000066;">cd</span> nginx<span style="color: #cc66cc;">-0.7</span><span style="color: #cc66cc;">.61</span></pre></p>

	<h2>Changing the server string</h2>

	<p>The server header is in a file called ngx_http_header_filter_module.c :<br />
<pre class="bash">&gt; vi src/http/ngx_http_header_filter_module.c</pre></p>

	<p>Edit the following line (currently line 48 in version 0.7.61) :<br />
<pre class="c"><span style="color: #993333;">static</span> <span style="color: #993333;">char</span> ngx_http_server_string<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">&quot;Server: nginx&quot;</span> CRLF;</pre></p>

	<p>&#8230; and change the <em>nginx</em> in <em>&#8216;Server: nginx&#8217;</em> to whatever you want:<br />
<pre class="c"><span style="color: #993333;">static</span> <span style="color: #993333;">char</span> ngx_http_server_string<span style="color: #66cc66;">&#91;</span><span style="color: #66cc66;">&#93;</span> = <span style="color: #ff0000;">&quot;Server: recurser&quot;</span> CRLF;</pre></p>

	<p>Next, edit <em>src/core/nginx.h</em> :<br />
<pre class="bash">&gt; vi src/core/nginx.h</pre></p>

	<p>Edit the following line (currently line 13 in version 0.7.61) :<br />
<pre class="c"><span style="color: #339933;">#define NGINX_VER          &quot;nginx/&quot; NGINX_VERSION </span></pre></p>

	<p>&#8230; and change the server string to whatever you want:<br />
<pre class="c"><span style="color: #339933;">#define NGINX_VER          &quot;recurser/&quot; NGINX_VERSION </span></pre></p>

	<h2>Changing the version number</h2>

	<p>You might also want to change the version number to confuse attackers, or just for fun :) Edit <em>src/core/nginx.h</em> :<br />
<pre class="bash">&gt; vi src/core/nginx.h</pre></p>

	<p>Edit the following line (currently line 12 in version 0.7.61) :<br />
<pre class="c"><span style="color: #339933;">#define NGINX_VERSION      &quot;0.7.61&quot; </span></pre></p>

	<p>&#8230; and change the version to whatever you want:<br />
<pre class="c"><span style="color: #339933;">#define NGINX_VERSION      &quot;1.0&quot; </span></pre></p>

	<p>You can stop nginx from displaying the version entirely if you want, by including the server_tokens directive in your <em>nginx.conf</em> :<br />
<pre class="php">server_tokens off;</pre></p>

	<h2>Compiling</h2>

	<p>You can set the prefix as appropriate &#8211; I keep it in <em>/opt/</em> on Ubuntu.<br />
<pre class="bash">&gt; ./configure --<span style="color: #0000ff;">prefix=</span>/opt/nginx<span style="color: #cc66cc;">-0.7</span><span style="color: #cc66cc;">.61</span> --with-http_ssl_module
&gt; make
&gt; sudo make install</pre></p>

	<p>After this, use <em>.bashrc</em> or similar to add /opt/nginx-0.7.61/sbin to your path, then you can start your new nginx install using :<br />
<pre class="bash">&gt; sudo ngingx</pre></p>

	<p>To stop it, use &#8216;-s&#8217; to send the stop signal :<br />
<pre class="bash">&gt; sudo nginx -s stop</pre></p>

	<h2>Results</h2>

	<p>If you check the reponse headers, you should see your custom server string :<br />
<pre class="php">Server: recurser/<span style="color: #cc66cc;">1.0</span>, recurser
<a href="http://www.php.net/date"><span style="color: #000066;">Date</span></a>: Tue, <span style="color: #cc66cc;">11</span> Aug <span style="color: #cc66cc;">2009</span> <span style="color: #cc66cc;">02</span>:<span style="color: #cc66cc;">47</span>:<span style="color: #cc66cc;">31</span> GMT
Content-Type: text/html; charset=UTF<span style="color: #cc66cc;">-8</span>
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/<span style="color: #cc66cc;">5.2</span><span style="color: #cc66cc;">.4</span>-2ubuntu5<span style="color: #cc66cc;">.6</span>
X-Pingback: http:<span style="color: #808080; font-style: italic;">//recurser.com/xmlrpc.php</span>
Expires: Tue, <span style="color: #cc66cc;">18</span> Aug <span style="color: #cc66cc;">2009</span> <span style="color: #cc66cc;">02</span>:<span style="color: #cc66cc;">47</span>:<span style="color: #cc66cc;">31</span> GMT
Last-Modified: Tue, <span style="color: #cc66cc;">11</span> Aug <span style="color: #cc66cc;">2009</span> <span style="color: #cc66cc;">02</span>:<span style="color: #cc66cc;">47</span>:<span style="color: #cc66cc;">31</span> GMT
Cache-Control: max-age=<span style="color: #cc66cc;">604800</span>
Pragma: no-cache
Content-Encoding: gzip</pre></p><img src="http://feeds.feedburner.com/~r/Recurser/~4/evldvZdVYE4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2009/08/10/customize-the-nginx-server-header/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2009/08/10/customize-the-nginx-server-header/</feedburner:origLink></item>
		<item>
		<title>InnoDB as default MySQL table type</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/_XHA4bV-3Ew/</link>
		<comments>http://recurser.com/articles/2009/08/09/innodb-as-default-mysql-table-type/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 02:17:21 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=380</guid>
		<description><![CDATA[How to change the default MySQL table type.]]></description>
			<content:encoded><![CDATA[	<p>To change the default MySQL table type, edit your <em>my.cnf</em> file (usually <em>/etc/mysql/my.cnf</em> on ubuntu), and add the following line to the <em>[mysqld]</em> section :</p>

	<p><pre class="bash">default-table-<span style="color: #0000ff;">type=</span>innodb</pre></p>

	<p>The resulting config will look something like this :</p>

	<p><pre class="bash">.....
<span style="color: #66cc66;">&#91;</span>mysqld<span style="color: #66cc66;">&#93;</span>
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;"># * Basic Settings</span>
<span style="color: #808080; font-style: italic;">#</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;"># * IMPORTANT</span>
<span style="color: #808080; font-style: italic;">#   If you make changes to these settings and your system uses apparmor, you may</span>
<span style="color: #808080; font-style: italic;">#   also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.</span>
<span style="color: #808080; font-style: italic;">#</span>
&nbsp;
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = <span style="color: #cc66cc;">3306</span>
basedir     = /usr
datadir     = /var/lib/mysql
tmpdir      = /tmp
language    = /usr/share/mysql/english
skip-external-locking
default-character-<span style="color: #0000ff;">set=</span>utf8
skip-character-set-client-handshake
default-table-<span style="color: #0000ff;">type=</span>innodb
.....</pre></p>

	<p>You can also add the <em>&#8212;default-table-type=innodb</em> argument to <em>mysqld</em> on startup to achieve the same result.</p><img src="http://feeds.feedburner.com/~r/Recurser/~4/_XHA4bV-3Ew" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2009/08/09/innodb-as-default-mysql-table-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2009/08/09/innodb-as-default-mysql-table-type/</feedburner:origLink></item>
		<item>
		<title>Flushing the DNS cache on OS X</title>
		<link>http://feedproxy.google.com/~r/Recurser/~3/Id_OXOMOJMU/</link>
		<comments>http://recurser.com/articles/2009/08/05/flushing-the-dns-cache-on-os-x/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 02:10:50 +0000</pubDate>
		<dc:creator>dave</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://recurser.com/?p=375</guid>
		<description><![CDATA[How to manually flush the DNS cache on OS X to force _/etc/hosts_ changes to take effect.]]></description>
			<content:encoded><![CDATA[	<p>I often find that OS X refuses to obey my <em>/etc/hosts</em> file for some time after I change it. It seems that often you have to manually flush the <span class="caps">DNS</span> cache by hand to force host file changes to take effect.</p>

	<p>Under pre-leopard systems, use <em>lookupd</em> :</p>

	<p><pre class="bash">&gt; sudo lookupd -flushcache</pre></p>

	<p>Starting with Leopard, <em>lookupd</em> has been replaced with <em>dscacheutil</em> :</p>

	<p><pre class="bash">&gt; sudo dscacheutil -flushcache</pre></p><img src="http://feeds.feedburner.com/~r/Recurser/~4/Id_OXOMOJMU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://recurser.com/articles/2009/08/05/flushing-the-dns-cache-on-os-x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://recurser.com/articles/2009/08/05/flushing-the-dns-cache-on-os-x/</feedburner:origLink></item>
	</channel>
</rss>
