John McFarlane's bloghttp://static-02.rockfloat.com/blog/feed/?type=rssJohn McFarlane's blogENCopyright 2007Fri, 18 May 2012 12:00:00 ESTRockfloat powered by Chula v0.13.3http://blogs.law.harvard.edu/tech/rssPython SimpleHTTPServer is really handy<p> Ever had a situation where you want to send a file to a friend at work or something, and sending it over email makes you feel all dirty? &nbsp;One way to solve the problem is to copy the file into /var/www/foo or something and send a link... we&#39;ve all done it. &nbsp;But there&#39;s a better way :)</p> http://static-02.rockfloat.com/blog/id=44http://static-02.rockfloat.com/blog/id=44Thu, 24 Mar 2011 08:28:59 ESTHow fast is Chula's guid generation compared to uuid and randrange?<p> Chula comes with a guid generator class who&#39;s implementation is a bit naive.&nbsp; Considering Python already has (probably much better) functionality builtin, I figured I&#39;d see how fast they are.</p> http://static-02.rockfloat.com/blog/id=43http://static-02.rockfloat.com/blog/id=43Tue, 16 Nov 2010 07:54:00 ESTPostgreSQL tsearch2 migration from 8.0 to 8.3 - how I did it successfully<p> Recently I was in the process of moving my site to a much better hosting situation (more on that later).&nbsp; During the move I decided to upgrade from PostgreSQL-8.0 to PostgreSQL-8.3 as I&nbsp;was pretty far behind and I&nbsp;prefer to stay current. &nbsp;This sort of upgrade isn&#39;t a big deal, and I&#39;ve done it many times.&nbsp; So I&nbsp;did my usual process:</p> <ol> <li> Install the desired version of PostgreSQL (in this case 8.3)</li> <li> Scp my last backup (taken a few minutes after I&nbsp;lock down the site) to the new host</li> <li> Run a script that essentially creates a new db, and restores the backup to it</li> </ol> <p> That&#39;s when things went horribly wrong.&nbsp; After a few searches I&nbsp;quickly learned that moving from 8.0 to 8.3 is a bit tricky when you have tsearch2 stuff in there.&nbsp; It turned out to be really easy to upgrade, read on if you want to know how I&nbsp;did it.</p> http://static-02.rockfloat.com/blog/id=42http://static-02.rockfloat.com/blog/id=42Fri, 24 Apr 2009 07:53:51 EST2008 Surly Steamroller - my new ride (literally)<p>One of my goals in moving to California was to put more focus on getting healthy.&nbsp; Now I'm lucky enough to be able to ride a really nice bike to work each day and get in a little work out each way.</p>http://static-02.rockfloat.com/blog/id=41http://static-02.rockfloat.com/blog/id=41Mon, 23 Mar 2009 04:21:21 ESTHow do you setup git-daemon on Ubuntu?<p>Git is by far my favorite version control system I've used.&nbsp; I use it all the time, and one of it's benefits is how easy it is to share code.&nbsp; I usually just send someone the link to gitweb and they can look at my code there.&nbsp; Other times people give me their public key, and they can clone my stuff over ssh.&nbsp; But just recently I&nbsp;wanted to have a way to easily allow anonymous readonly access.&nbsp; I&nbsp;was surprised to find that this isn't exactly straightforward on Ubuntu, but here's how I&nbsp;got it working...</p>http://static-02.rockfloat.com/blog/id=40http://static-02.rockfloat.com/blog/id=40Sat, 07 Feb 2009 06:27:35 ESTPerforce sucks<p>Seriously, I've had it.&nbsp; Perforce is the most horrible version control system ever.&nbsp; It's not as bad as Microsoft Source Safe - but no one pays for that anymore so it doesn't count.</p>http://static-02.rockfloat.com/blog/id=39http://static-02.rockfloat.com/blog/id=39Sat, 20 Dec 2008 05:26:01 ESTTips for extremely aggressive content caching<p>When it comes to performance one of the most important considerations is caching of content.&nbsp; There are all sorts of approaches to the caching.&nbsp; Some protect the database from duplicate queries while others protect your application from having to perform an expensive algorithm over and over.&nbsp; Today I am going to talk about the most aggressive form of content caching when it comes to the web - full page caching.</p>http://static-02.rockfloat.com/blog/id=38http://static-02.rockfloat.com/blog/id=38Thu, 23 Oct 2008 04:51:48 ESTWe wants the precious...<p><a href="http://www.techcrunch.com/2008/09/22/t-mobile-g1-specs-leaked-prior-to-announcement/"><img alt="" src="http://www.mobilecrunch.com/wp-content/uploads/picture-4.png" /></a></p> <p>Must have the precious!</p>http://static-02.rockfloat.com/blog/id=37http://static-02.rockfloat.com/blog/id=37Tue, 23 Sep 2008 09:05:51 ESTUnit testing is great - but don't forget about configuration testing<p>Recently a friend of mine pointed out that I had an error on one of my pages.&nbsp; It took me almost 45 minutes to figure out what was happening.&nbsp; I wasn't able to reproduce the defect in my development environment.&nbsp; The version of Python installed was exactly the same.&nbsp; I tried executing the problematic piece of code on the production server and it did not reproduce the problem.&nbsp; All of my unit tests passed... I was at a loss as to the source of the problem.</p> <p>It just so happend that a few months ago I had turned on a particular configuration option in Apache that influenced the way Python works.&nbsp; The reason why I wasn't able to reproduce the problem in dev was because it does not use a production configuration.&nbsp; The reason why I wasn't able to reproduce the problem using a Python interpreter is because it doesn't care about how mod_python works.&nbsp; Once I figured out what was wrong the fix was very simple, in fact all I had to change were two letters.</p> <p><b>The moral of the story is:</b> Testing is good, unit testing is great, but don't forget to test your configuration&nbsp; :)</p>http://static-02.rockfloat.com/blog/id=36http://static-02.rockfloat.com/blog/id=36Fri, 11 Jul 2008 07:56:01 ESTMoving to sunny California<p>So I've landed a job with <a href="http://www.reardencommerce.com">Rearden Commerce</a> in <a href="http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;q=foster+city,+ca&amp;ie=UTF8&amp;ll=37.567168,-122.268562&amp;spn=0.117288,0.247192&amp;z=12&amp;iwloc=addr">Foster City</a>, California.&nbsp; All of our belongings [including our car] are currently in a trailer on it's way to Redwood City.&nbsp; We sold our house, purchased plane tickets, and pretty much finished up all the stuff required for a move across the entire country.</p> <p>Why wouldn't it be perfect timing to get summoned for <a href="http://www.clermontclerk.org/Jury_Notify.htm">jury duty</a> in Cincinnati&nbsp; :/&nbsp;</p>http://static-02.rockfloat.com/blog/id=35http://static-02.rockfloat.com/blog/id=35Tue, 22 Apr 2008 08:34:45 EST