<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Tom Dunham blog</title><link href="http://tomdunham.org/blog/atom.xml" rel="self"/><link href="http://tomdunham.org"/><updated>2011-01-02T19:55:16Z</updated><id>http://tomdunham.org</id><entry><title>A Python course for Biologists</title><author><name>Tom Dunham</name></author><link href="http://tomdunham.org/blog/2009/python_course_bio.html"/><updated>2009-07-05T00:00:00Z</updated><published>2009-07-05T00:00:00Z</published><id>http://tomdunham.org/blog/2009/python_course_bio.html</id><content type="html">
       
	

	

&lt;p&gt;These are the slides for a five-day course I gave at
the &lt;a href=&quot;http://www.ocgf.ox.ac.uk/&quot;&gt;Oxford Center for Gene
function&lt;/a&gt; in April (on behalf
of &lt;a href=&quot;http://www.nobleprog.co.uk/&quot;&gt;Nobleprog&lt;/a&gt;). It was the
first teaching I&amp;#8217;ve done, and it&amp;nbsp;shows.&lt;/p&gt;


&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;/courses/ocgf/00_Front_Matter.html&quot;&gt;Front&amp;nbsp;Matter&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/courses/ocgf/01_Fundamentals.html&quot;&gt;Fundamentals&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/courses/ocgf/02_Strings_Types.html&quot;&gt;Strings&amp;nbsp;Types&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/courses/ocgf/03_Containers_Lists.html&quot;&gt;Containers &amp;ndash;&amp;nbsp;Lists&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/courses/ocgf/04_Containers_Dictionaries.html&quot;&gt;Containers &amp;ndash;&amp;nbsp;Dictionaries&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/courses/ocgf/05_Tuples_Comprehensions.html&quot;&gt;Tuples&amp;nbsp;Comprehensions&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/courses/ocgf/06_files_exceptions.html&quot;&gt;Files&amp;nbsp;Exceptions&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/courses/ocgf/06_regexs_files_exceptions.html&quot;&gt;Regexs Files&amp;nbsp;Exceptions&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/courses/ocgf/07_Regular_Expressions.html&quot;&gt;Regular&amp;nbsp;Expressions&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/courses/ocgf/08_Iterators.html&quot;&gt;Iterators&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/courses/ocgf/09_Database_Access.html&quot;&gt;Database&amp;nbsp;Access&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/courses/ocgf/10_Biopython.html&quot;&gt;Biopython&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;/courses/ocgf/11_Numpy.html&quot;&gt;Numpy&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I should warn you that my Biology education ended at 16, and most
of the examples in the slides came from what I could fathom from
Wikipedia &amp;ndash; needless to say I made plenty of mistakes. It&amp;#8217;s
all &lt;a href=&quot;http://creativecommons.org/&quot;&gt;Creative
Commons&lt;/a&gt; &lt;a href=&quot;http://creativecommons.org/licenses/by/2.0/uk/&quot;&gt;Attribution
2.0&lt;/a&gt;, so you have a lot of freedom to reuse the material if you
want to. The slides where created
using &lt;a href=&quot;http://meyerweb.com/eric/tools/s5/&quot;&gt;S5&lt;/a&gt;
and &lt;a href=&quot;http://docutils.sourceforge.net/docs/user/slide-shows.html&quot;&gt;ReST&lt;/a&gt;,
and the source is in the &lt;tt&gt;zip&lt;/tt&gt;.&lt;/p&gt;



	
        
   </content></entry><entry><title>Building a Django App server on Vagrant</title><author><name>Tom Dunham</name></author><link href="http://tomdunham.org/blog/2010/building_django_appserver_vagrant.html"/><updated>2010-12-29T00:00:00Z</updated><published>2010-12-29T00:00:00Z</published><id>http://tomdunham.org/blog/2010/building_django_appserver_vagrant.html</id><content type="html">
       
	

	

&lt;p&gt;Eric Holscher has recently written &lt;a
href=&quot;http://ericholscher.com/blog/2010/nov/8/building-django-app-server-chef/&quot;&gt;an
excellent series of articles about provisioning an app server with
chef&lt;/a&gt;.  Around the same time, &lt;a
href=&quot;http://morethanseven.net/2010/11/04/Why-you-should-be-using-virtualisation.html&quot;&gt;Gareth
Rushgrove mentioned Vagrant&lt;/a&gt; - a tool that takes a lot of the pain
out of managing development environments on virtual&amp;nbsp;machines.&lt;/p&gt;

&lt;p&gt;Stealing with both hands, I present the fewest commands necessary
to get a Django app server running in a virtual&amp;nbsp;machine.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download &lt;span class=&quot;amp&quot;&gt;&amp;amp;&lt;/span&gt; install &lt;a href=&quot;http://www.virtualbox.org/wiki/Downloads&quot;&gt;virtualbox&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Install vagrant (should just be &amp;#8220;&lt;code&gt;gem install vagrant&lt;/code&gt;&amp;#8220;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vagrant box add lucid32 http://files.vagrantup.com/lucid32.box&lt;/code&gt;&lt;/li&gt;

&lt;li&gt;&lt;code&gt;git clone https://github.com/ericholscher/chef-django-example.git&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cd chef-django-example&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;vagrant init&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;edit &lt;code&gt;Vagrantfile&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Add (or uncomment) these lines:

   &lt;pre&gt;&lt;code&gt;
   config.vm.provisioner = :chef_solo
   config.chef.add_recipe &quot;main&quot;
   config.chef.json.merge!({
                            &quot;run_list&quot;=&gt; [ &quot;main::default&quot;, &quot;main::python&quot;, &quot;main::readthedocs&quot; ],
                            &quot;base_packages&quot;=&gt; [&quot;git-core&quot;, &quot;bash-completion&quot;],
                            &quot;users&quot;=&gt; {
                              &quot;docs&quot;=&gt; {
                                &quot;id&quot;=&gt; 1001,
                                &quot;full_name&quot;=&gt; &quot;Docs User&quot;,
                                &quot;key&quot;=&gt; &quot;ssh-rsa key-goes-here eric@Bahamut&quot;
                              }
                            },
                            &quot;groups&quot;=&gt; {
                              &quot;docs&quot;=&gt; {
                                &quot;gid&quot;=&gt; 201,
                                &quot;members&quot;=&gt; [&quot;docs&quot;]
                              }
                            },
                            &quot;ubuntu_python_packages&quot; =&gt; [&quot;python-setuptools&quot;, &quot;python-pip&quot;, &quot;python-dev&quot;, &quot;libpq-dev&quot;],
                            &quot;pip_python_packages&quot; =&gt; {
                              &quot;virtualenv&quot; =&gt; &quot;1.5.1&quot;,
                              &quot;mercurial&quot; =&gt; &quot;1.7&quot;
                            },
                          }
                          )
   &lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;


&lt;li&gt;edit &lt;code&gt;cookbooks/main/recipies/default.rb&lt;/code&gt;

&lt;pre&gt;&lt;code&gt;
execute &quot;apt-get update&quot; do
  action :run
end
&lt;/code&gt;&lt;/pre&gt;

&lt;li&gt;&lt;code&gt;vagrant up&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You now have an app server running the code for &lt;a
  href=&quot;http://readthedocs.org/&quot;&gt;Readthedocs&lt;/a&gt;. You can&amp;#8217;t do a lot
 with it as this server would need a database and a &lt;a
  href=&quot;http://ask.github.com/celery/&quot;&gt;Celery&lt;/a&gt; server to talk to,
 but you can login and poke at the&amp;nbsp;services:&lt;/p&gt;

&lt;code&gt;&lt;pre&gt;
$ vagrant ssh
vagrant@vagrantup:~$ pgrep gunicorn
vagrant@vagrantup:~$ sudo initctl list
vagrant@vagrantup:~$ sudo tail -f  /home/docs/sites/readthedocs.org/run/celery.log
&lt;/pre&gt;&lt;/code&gt;

&lt;p&gt;You can&amp;#8217;t resolve the names of Holscher&amp;#8217;s other servers so you&amp;#8217;ll see
celery moaning in the&amp;nbsp;logs.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s a shame that we don&amp;#8217;t end up with a fully-working server to play
with, but this still illustrates how easy vagrant and chef make it to
build a server. It&amp;#8217;s also not difficult to see how this config could
be moved into another file in the repository and used to provision
staging and production servers as&amp;nbsp;well.&lt;/p&gt;


&lt;h3&gt;A brief explanation of what&amp;#8217;s going on&amp;nbsp;here:&lt;/h3&gt;

&lt;p&gt;When you run &lt;code&gt;vagrant up&lt;/code&gt; Vagrant reads Vagrantfile,
boots the &lt;span class=&quot;caps&quot;&gt;VM&lt;/span&gt; then runs chef-solo to provision it (because you set
&lt;code&gt;config.vm.provisioner = :chef_solo&lt;/code&gt;). Chef follows the
directions in &lt;code&gt;cookbooks/main/recipies/default.rb&lt;/code&gt; to
install the server (because we put the line
&lt;code&gt;config.chef.add_recipe &quot;main&quot;&lt;/code&gt; in
&lt;code&gt;Vagrantfile&lt;/code&gt;). When it&amp;#8217;s executing, the data from
&lt;code&gt;config.chef.json&lt;/code&gt; is available in &lt;code&gt;node&lt;/code&gt; - in
Holscher&amp;#8217;s examples this data is stored in the &lt;code&gt;node.json&lt;/code&gt;
file, though it&amp;#8217;s called &lt;code&gt;dna.js&lt;/code&gt; by vagrant (which seems
to be a Chef&amp;nbsp;convention).&lt;/p&gt;



	
        
   </content></entry><entry><title>Homebrewing PIL on Mac OSX</title><author><name>Tom Dunham</name></author><link href="http://tomdunham.org/blog/2010/homebrew_pil.html"/><updated>2010-02-14T00:00:00Z</updated><published>2010-02-14T00:00:00Z</published><id>http://tomdunham.org/blog/2010/homebrew_pil.html</id><content type="html">
       
	

	

&lt;p&gt;Wrote my first &lt;a
 href=&quot;http://github.com/mxcl/homebrew&quot;&gt;homebrew&lt;/a&gt; formula. It
builds &lt;a href=&quot;http://www.pythonware.com/products/pil/&quot;&gt;&lt;span class=&quot;caps&quot;&gt;PIL&lt;/span&gt;&lt;/a&gt; (with
the optional jpeg, opentype, littleCMS dependencies). It&amp;#8217;s a dupe (as
it can be built from &lt;a
 href=&quot;http://pypi.python.org/pypi/pip&quot;&gt;pip&lt;/a&gt;), and homebrew
(reasonably enough) don&amp;#8217;t want dups so I don&amp;#8217;t expect anyone other
than me will ever use it, &lt;a
 href=&quot;http://github.com/TomDunham/homebrew&quot;&gt;but I should be able to
find it again&amp;nbsp;now.&lt;/a&gt;&lt;/p&gt;



	
        
   </content></entry></feed>
