<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bongo&#039;s Codeways</title>
	<atom:link href="http://www.kelvinwong.ca/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kelvinwong.ca</link>
	<description>web programming, life, etc...</description>
	<lastBuildDate>Sun, 15 Aug 2010 03:15:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MV Sun Sea in Esquimalt</title>
		<link>http://www.kelvinwong.ca/2010/08/14/mv-sun-sea-in-esquimalt/</link>
		<comments>http://www.kelvinwong.ca/2010/08/14/mv-sun-sea-in-esquimalt/#comments</comments>
		<pubDate>Sun, 15 Aug 2010 03:08:02 +0000</pubDate>
		<dc:creator>flickr</dc:creator>
				<category><![CDATA[etc]]></category>
		<category><![CDATA[mv sun sea]]></category>
		<category><![CDATA[refugees]]></category>
		<category><![CDATA[ships]]></category>

		<guid isPermaLink="false">http://www.kelvinwong.ca/2010/08/14/mv-sun-sea-in-esquimalt/</guid>
		<description><![CDATA[



MV Sun Sea


The migrant/refugee vessel MV Sun Sea arrived in Esquimalt Harbour on Friday.
]]></description>
			<content:encoded><![CDATA[<div style="margin: 10px;">
<a href="http://www.flickr.com/photos/wongo888/4889581349/" title="MV Sun Sea by wongo888, on Flickr"><img src="http://farm5.static.flickr.com/4134/4889581349_9e904b8285.jpg" width="500" height="342" alt="MV Sun Sea" /></a><br />
<br />
<span style="font-size: 0.9em;margin-top: 0px"><br />
<a href="http://www.flickr.com/photos/wongo888/4889581349/">MV Sun Sea</a><br />
</span>
</div>
<p>The migrant/refugee vessel MV Sun Sea arrived in Esquimalt Harbour on Friday.<br /></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kelvinwong.ca/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kelvinwong.ca/2010/08/14/mv-sun-sea-in-esquimalt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python 2.7 on Dreamhost</title>
		<link>http://www.kelvinwong.ca/2010/08/02/python-2-7-on-dreamhost/</link>
		<comments>http://www.kelvinwong.ca/2010/08/02/python-2-7-on-dreamhost/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 19:49:43 +0000</pubDate>
		<dc:creator>kelvin.wong</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[walkthroughs]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[python 2.7]]></category>

		<guid isPermaLink="false">http://www.kelvinwong.ca/?p=467</guid>
		<description><![CDATA[Python 2.7 was released on 3 July 2010 and I wanted to use it on my Dreamhost account, but the usual installation method yields some warnings:

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             _tkinter    [...]]]></description>
			<content:encoded><![CDATA[<p>Python 2.7 <a href="http://docs.python.org/whatsnew/2.7.html">was released on 3 July 2010</a> and I wanted to use it on my <a href="http://www.dreamhost.com/r.cgi?90503">Dreamhost</a> account, but <a href="http://wiki.dreamhost.com/Python#Building_a_custom_version_of_Python">the usual installation method</a> yields some warnings:</p>
<pre>
Python build finished, but the necessary bits to build these modules were not found:
<span style="font-weight:bold;">_bsddb</span>             <span style="font-weight:bold;">_tkinter</span>           <strike style="color:red;" title="Choose either version 1.8.5 or 4.8.5 not both.">bsddb185</strike>
<span style="font-weight:bold;">bz2</span>                <strike style="color:red;" title="Requires 32-bit operating system. ctypes does similar.">dl</strike>                 <strike style="color:red;" title="Does not work on 64-bit platforms. It is deprecated. Use PIL.">imageop</strike>         <strike style="color:red;" title="Only for SunOS. Does not work on Debian GNU/Linux.">sunaudiodev</strike>
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
</pre>
<p>Three of these modules cannot be installed on Dreamhost&#8217;s 64-bit Debian servers anyway and one of them is an older version of a module I am going to install:</p>
<ul>
<li><b>bsddb185:</b> Older version of Oracle Berkeley DB. <a href="http://docs.python.org/library/undoc.html?highlight=bsddb185">Undocumented.</a> Install version 4.8 instead.</li>
<li><b>dl:</b> For 32-bit machines. <a href="http://docs.python.org/library/dl.html">Deprecated.</a> Use <a href="http://docs.python.org/library/ctypes.html">ctypes</a> instead.</li>
<li><b>imageop:</b> For 32-bit machines. <a href="http://docs.python.org/library/imageop.html">Deprecated.</a> Use <a href="http://www.pythonware.com/products/pil/">PIL</a> instead.</li>
<li><b>sunaudiodev:</b> For Sun hardware. <a href="http://docs.python.org/library/sunaudio.html">Deprecated.</a></li>
</ul>
<p>Now, if you don&#8217;t need any of those remaining modules, then you should be able to just complete the installation and be done with it. If you want all the modules that you can get, you are in for some extra building. <a href="http://andrew.io/weblog/2010/02/installing-python-2-6-virtualenv-and-virtualenvwrapper-on-dreamhost/">This post</a> does a good job of explaining the installation of Python 2.6; mine is based on it. Let&#8217;s put the files in the following directories:</p>
<dl>
<dt>Python 2.7</dt>
<dd>$HOME/local/Python-2.7</dd>
<dt>Berkeley DB 4.8</dt>
<dd>$HOME/local/BerkeleyDB.4.8</dd>
<dt>Other executables</dt>
<dd>$HOME/local/bin</dd>
<dt>Header files</dt>
<dd>$HOME/local/include</dd>
<dt>Libraries</dt>
<dd>$HOME/local/lib</dd>
<dt>Temporary artifacts</dt>
<dd>$HOME/temp</dd>
</dl>
<p>We&#8217;ll need to push these values into the UNIX environment by using the export tool under the default bash shell:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LDFLAGS</span>=<span style="color: #ff0000;">&quot;-L<span style="color: #007800;">$HOME</span>/local/lib -L<span style="color: #007800;">$HOME</span>/local/BerkeleyDB.4.8/lib&quot;</span>
$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CPPFLAGS</span>=<span style="color: #ff0000;">&quot;-I<span style="color: #007800;">$HOME</span>/local/include -I<span style="color: #007800;">$HOME</span>/local/BerkeleyDB.4.8/include&quot;</span>
$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CXXFLAGS</span>=<span style="color: #007800;">$CPPFLAGS</span>
$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">CFLAGS</span>=<span style="color: #007800;">$CPPFLAGS</span>
$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LD_LIBRARY_PATH</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib:<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>BerkeleyDB.4.8<span style="color: #000000; font-weight: bold;">/</span>lib
$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LD_RUN_PATH</span>=<span style="color: #007800;">$LD_LIBRARY_PATH</span></pre></div></div>

<p>Next make the directories:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> ~<span style="color: #000000; font-weight: bold;">/</span>temp ~<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span></pre></div></div>

<p>It&#8217;s also a good idea to check your machine (note the &#8220;<a href="http://en.wikipedia.org/wiki/X86-64">x86_64</a>&#8221; token). It should look similar to this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">uname</span> <span style="color: #660033;">-a</span>
Linux machine 2.6.32.8-grsec-2.1.14-modsign-xeon-<span style="color: #000000;">64</span> <span style="color: #666666; font-style: italic;">#2 SMP Sat Mar 13 00:42:43 PST 2010 x86_64 GNU/Linux</span>
$ <span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #660033;">-v</span>
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ..<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">-v</span> <span style="color: #660033;">--with-pkgversion</span>=<span style="color: #ff0000;">'Debian 4.3.2-1.1'</span> <span style="color: #660033;">--with-bugurl</span>=<span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>gcc-<span style="color: #000000;">4.3</span><span style="color: #000000; font-weight: bold;">/</span>README.Bugs <span style="color: #660033;">--enable-languages</span>=c,<span style="color: #c20cb9; font-weight: bold;">c++</span>,fortran,objc,obj-c++ <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--enable-shared</span> <span style="color: #660033;">--with-system-zlib</span> <span style="color: #660033;">--libexecdir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib <span style="color: #660033;">--without-included-gettext</span> <span style="color: #660033;">--enable-threads</span>=posix <span style="color: #660033;">--enable-nls</span> <span style="color: #660033;">--with-gxx-include-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>include<span style="color: #000000; font-weight: bold;">/</span>c++<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4.3</span> <span style="color: #660033;">--program-suffix</span>=-<span style="color: #000000;">4.3</span> <span style="color: #660033;">--enable-clocale</span>=gnu <span style="color: #660033;">--enable-libstdcxx-debug</span> <span style="color: #660033;">--enable-objc-gc</span> <span style="color: #660033;">--enable-mpfr</span> <span style="color: #660033;">--enable-cld</span> <span style="color: #660033;">--enable-checking</span>=release <span style="color: #660033;">--build</span>=x86_64-linux-gnu <span style="color: #660033;">--host</span>=x86_64-linux-gnu <span style="color: #660033;">--target</span>=x86_64-linux-gnu
Thread model: posix
<span style="color: #c20cb9; font-weight: bold;">gcc</span> version 4.3.2 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Debian 4.3.2-<span style="color: #000000;">1.1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> 
$</pre></div></div>

<p>Berkeley DB will be hooked into the installed TCL, so you should install TCL before you install Berkeley DB. Install Python last. Other than that, I don&#8217;t believe that order of installation should matter. Let&#8217;s do it!</p>
<h2>TCL/TK</h2>
<p>The warning &#8220;_tkinter&#8221; indicates that the  _tkinter module was not built. You will need to build both TCL and TK:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>temp
$ <span style="color: #7a0874; font-weight: bold;">pwd</span>
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>username<span style="color: #000000; font-weight: bold;">/</span>temp
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>prdownloads.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>tcl<span style="color: #000000; font-weight: bold;">/</span>tcl8.5.8-src.tar.gz
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf tcl8.5.8-src.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> tcl8.5.8<span style="color: #000000; font-weight: bold;">/</span>unix
$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>..
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>prdownloads.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>tcl<span style="color: #000000; font-weight: bold;">/</span>tk8.5.8-src.tar.gz
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf tk8.5.8-src.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> tk8.5.8<span style="color: #000000; font-weight: bold;">/</span>unix
$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>..</pre></div></div>

<h2>Berkeley DB 4.8</h2>
<p>The warning &#8220;_bsddb&#8221; will go away when you install version 4.8 of the Oracle Berkeley DB:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>temp
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.oracle.com<span style="color: #000000; font-weight: bold;">/</span>berkeley-db<span style="color: #000000; font-weight: bold;">/</span>db-4.8.30.tar.gz
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf db-4.8.30.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> db-4.8.30<span style="color: #000000; font-weight: bold;">/</span>build_unix
$ ..<span style="color: #000000; font-weight: bold;">/</span>dist<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>BerkeleyDB.4.8 <span style="color: #660033;">--enable-tcl</span> <span style="color: #660033;">--with-tcl</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ..<span style="color: #000000; font-weight: bold;">/</span>..</pre></div></div>

<h2>BZip2</h2>
<p>Dreamhost has an earlier version of BZip2 (version 1.0.4) and no library (at least I couldn&#8217;t find one). To get the latest version:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>temp
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.bzip.org<span style="color: #000000; font-weight: bold;">/</span>1.0.5<span style="color: #000000; font-weight: bold;">/</span>bzip2-1.0.5.tar.gz
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf bzip2-1.0.5.tar.gz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> bzip2-1.0.5
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #660033;">-f</span> Makefile-libbz2_so
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #007800;">PREFIX</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span>
$ <span style="color: #c20cb9; font-weight: bold;">cp</span> .<span style="color: #000000; font-weight: bold;">/</span>libbz2.so.1.0.4 <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib
$ <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libbz2.so.1.0.4 <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libbz2.so.1.0
$ <span style="color: #7a0874; font-weight: bold;">cd</span> ..</pre></div></div>

<h2>Python 2.7</h2>
<p>You should be able to build and install Python 2.7 now, less the modules that either cannot be built on a 64-bit platform or cannot coexist with a contemporary version.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>temp
$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>python.org<span style="color: #000000; font-weight: bold;">/</span>ftp<span style="color: #000000; font-weight: bold;">/</span>python<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2.7</span><span style="color: #000000; font-weight: bold;">/</span>Python-2.7.tgz
$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf Python-2.7.tgz
$ <span style="color: #7a0874; font-weight: bold;">cd</span> Python-<span style="color: #000000;">2.7</span>
$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>Python-<span style="color: #000000;">2.7</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span>
$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>At the end of the make process, you will see this:</p>
<pre>
Python build finished, but the necessary bits to build these modules were not found:
<b>bsddb185</b>           <b>dl</b>                 <b>imageop</b>
<b>sunaudiodev</b>
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
</pre>
<p>As mentioned earlier, these modules are either not buildable on Dreamhost&#8217;s 64-bit machines or not compatible with the newer version of Berkeley DB.</p>
<h2>Hooking up the new Python</h2>
<p>You want to put the new Python 2.7 on your <a href="http://www.cs.purdue.edu/homes/cs348/unix_path.html">PATH</a> so that bash executes it before the systemwide Python 2.5. If you don&#8217;t want to append these export statements, you can also do it via a text editor (vim, emacs, etc).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> ~
$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;export PATH=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">$HOME</span>/local/bin:<span style="color: #000099; font-weight: bold;">\$</span>PATH<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> .bashrc
$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;export PATH=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">$HOME</span>/local/Python-2.7/bin:<span style="color: #000099; font-weight: bold;">\$</span>PATH<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> .bashrc
$ <span style="color: #7a0874; font-weight: bold;">source</span> .bashrc
$ <span style="color: #c20cb9; font-weight: bold;">which</span> python
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>username<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>Python-<span style="color: #000000;">2.7</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>python
$ python <span style="color: #660033;">-V</span>
Python <span style="color: #000000;">2.7</span></pre></div></div>

<h2>Try it out!</h2>
<p>Try out your new modules&#8230;at the shell prompt type &#8220;python&#8221;!</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">bsddb</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> db = <span style="color: #dc143c;">bsddb</span>.<span style="color: black;">btopen</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'/tmp/spam.db'</span>, <span style="color: #483d8b;">'c'</span><span style="color: black;">&#41;</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">10</span><span style="color: black;">&#41;</span>: db<span style="color: black;">&#91;</span><span style="color: #483d8b;">'%d'</span><span style="color: #66cc66;">%</span>i<span style="color: black;">&#93;</span> = <span style="color: #483d8b;">'%d'</span><span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>i<span style="color: #66cc66;">*</span>i<span style="color: black;">&#41;</span>
...
<span style="color: #66cc66;">&gt;&gt;&gt;</span> db<span style="color: black;">&#91;</span><span style="color: #483d8b;">'3'</span><span style="color: black;">&#93;</span>
<span style="color: #483d8b;">'9'</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> db.<span style="color: black;">keys</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: black;">&#91;</span><span style="color: #483d8b;">'0'</span>, <span style="color: #483d8b;">'1'</span>, <span style="color: #483d8b;">'2'</span>, <span style="color: #483d8b;">'3'</span>, <span style="color: #483d8b;">'4'</span>, <span style="color: #483d8b;">'5'</span>, <span style="color: #483d8b;">'6'</span>, <span style="color: #483d8b;">'7'</span>, <span style="color: #483d8b;">'8'</span>, <span style="color: #483d8b;">'9'</span><span style="color: black;">&#93;</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> db.<span style="color: black;">sync</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> db.<span style="color: black;">isOpen</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #008000;">True</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">bz2</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #dc143c;">bz2</span>.__author__
The <span style="color: #dc143c;">bz2</span> python module was written by:
&nbsp;
    Gustavo Niemeyer <span style="color: #66cc66;">&lt;</span>niemeyer@conectiva.<span style="color: black;">com</span><span style="color: #66cc66;">&gt;</span>
&nbsp;
<span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">Tkinter</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #dc143c;">Tkinter</span>.__version__
<span style="color: #483d8b;">'$Revision: 81008 $'</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span></pre></div></div>

<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kelvinwong.ca/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kelvinwong.ca/2010/08/02/python-2-7-on-dreamhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shock the monkey!</title>
		<link>http://www.kelvinwong.ca/2010/07/16/shock-the-monkey/</link>
		<comments>http://www.kelvinwong.ca/2010/07/16/shock-the-monkey/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 05:36:45 +0000</pubDate>
		<dc:creator>kelvin.wong</dc:creator>
				<category><![CDATA[etc]]></category>

		<guid isPermaLink="false">http://www.kelvinwong.ca/?p=457</guid>
		<description><![CDATA[Some important research from the Institute of Biomedical Engineering, National Taiwan University, Taipei, Taiwan. Drs. Tsai, Chang, Liu, Kuo, Chen, Jaw, &#038; Hsieh (whew&#8230;seven researchers) published a study of the electrical properties of the Ding-Dong. No, not that Ding-Dong, the other ding-dong.
Anyway, you can read the shocking news on Disco blog or the abstract on [...]]]></description>
			<content:encoded><![CDATA[<p>Some important research from the <a href="http://bme.ntu.edu.tw">Institute of Biomedical Engineering, National Taiwan University</a>, Taipei, Taiwan. Drs. Tsai, Chang, Liu, Kuo, Chen, Jaw, &#038; Hsieh (whew&#8230;seven researchers) published a study of the electrical properties of the Ding-Dong. No, not that <a href="http://en.wikipedia.org/wiki/Doraemon">Ding-Dong</a>, the other <a href="http://adam.about.com/reports/Male-reproductive-anatomy.htm">ding-dong</a>.</p>
<p>Anyway, you can read <a href="http://blogs.discovermagazine.com/discoblog/2010/07/16/ncbi-rofl-ever-wonder-how-much-electricity-your-penis-can-take/">the shocking news on Disco blog</a> or <a href="http://www.ncbi.nlm.nih.gov/pubmed/20524977">the abstract on PubMed</a>. This is going to win them <a href="http://improbable.com/">seven awards</a>.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kelvinwong.ca/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kelvinwong.ca/2010/07/16/shock-the-monkey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>USCYBERCOM: 9ec4c12949a4f31474f299058ce2b22a in Python</title>
		<link>http://www.kelvinwong.ca/2010/07/08/uscybercom-md5-hash-in-python/</link>
		<comments>http://www.kelvinwong.ca/2010/07/08/uscybercom-md5-hash-in-python/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 04:53:27 +0000</pubDate>
		<dc:creator>kelvin.wong</dc:creator>
				<category><![CDATA[etc]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[9ec4c12949a4f31474f299058ce2b22a]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[hashlib]]></category>
		<category><![CDATA[md5]]></category>
		<category><![CDATA[uscybercom]]></category>
		<category><![CDATA[wired]]></category>

		<guid isPermaLink="false">http://www.kelvinwong.ca/?p=449</guid>
		<description><![CDATA[In Wired, Noah Shachtman pointed out that the US Cyber Command logo has a 32-character code inscribed onto its inner gold ring. It is well-known that MD5 produces 128-bit message digests (often represented as 32-character hexadecimal digests) so it surprised few that the code turned out to be an MD5 hash of the organization&#8217;s mission [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.wired.com/dangerroom/2010/07/solve-the-mystery-code-in-cyber-commands-logo">In Wired</a>, Noah Shachtman pointed out that the US Cyber Command logo has a 32-character code inscribed onto its inner gold ring. It is well-known that <a href="http://tools.ietf.org/html/rfc1321">MD5</a> produces 128-bit message digests (often represented as 32-character hexadecimal digests) so it surprised few that <a href="http://www.theregister.co.uk/2010/07/08/cyber_command_crest_md5/">the code turned out to be an MD5 hash of the organization&#8217;s mission statement</a>.</p>
<p>To recreate this hash in Python, type the following into your Python interpreter:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">Python 2.5.4 <span style="color: black;">&#40;</span>r254:<span style="color: #ff4500;">67917</span>, Dec <span style="color: #ff4500;">23</span> <span style="color: #ff4500;">2008</span>, <span style="color: #ff4500;">14</span>:<span style="color: #ff4500;">57</span>:<span style="color: #ff4500;">27</span><span style="color: black;">&#41;</span> 
<span style="color: black;">&#91;</span>GCC 4.0.1 <span style="color: black;">&#40;</span>Apple Computer, Inc. <span style="color: black;">build</span> <span style="color: #ff4500;">5363</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span> on darwin
Type <span style="color: #483d8b;">&quot;help&quot;</span>, <span style="color: #483d8b;">&quot;copyright&quot;</span>, <span style="color: #483d8b;">&quot;credits&quot;</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: #483d8b;">&quot;license&quot;</span> <span style="color: #ff7700;font-weight:bold;">for</span> more information.
<span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">from</span> hashlib <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">md5</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> ms = <span style="color: #483d8b;">&quot;USCYBERCOM plans, coordinates, integrates, synchronizes and conducts activities to: direct the operations and defense of specified Department of Defense information networks and; prepare to, and when directed, conduct full spectrum military cyberspace operations in order to enable actions in all domains, ensure US/Allied freedom of action in cyberspace and deny the same to our adversaries.&quot;</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> o = <span style="color: #dc143c;">md5</span><span style="color: black;">&#40;</span>ms<span style="color: black;">&#41;</span>.<span style="color: black;">hexdigest</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #ff7700;font-weight:bold;">print</span> o
9ec4c12949a4f31474f299058ce2b22a
<span style="color: #66cc66;">&gt;&gt;&gt;</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>o<span style="color: black;">&#41;</span>
<span style="color: #ff4500;">32</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span></pre></div></div>

<p>Note: <a href="http://docs.python.org/library/hashlib.html">The library &#8216;hashlib&#8217; was added in Python 2.5.</a></p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kelvinwong.ca/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kelvinwong.ca/2010/07/08/uscybercom-md5-hash-in-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Funniest release notes ever? Thank Chaos Tools for Drupal</title>
		<link>http://www.kelvinwong.ca/2010/06/02/funniest-release-notes-ever-chaos-tools-drupal/</link>
		<comments>http://www.kelvinwong.ca/2010/06/02/funniest-release-notes-ever-chaos-tools-drupal/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 03:49:14 +0000</pubDate>
		<dc:creator>kelvin.wong</dc:creator>
				<category><![CDATA[etc]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[botched]]></category>
		<category><![CDATA[chaos tools]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[drupal rocks]]></category>
		<category><![CDATA[fail]]></category>

		<guid isPermaLink="false">http://www.kelvinwong.ca/?p=446</guid>
		<description><![CDATA[From the Chaos Tools release notes for version 1.6 for Drupal 6:

The 1.5 release was botched: only some of the changes listed on the release notes were actually included. This release (1.6) includes all changes that were supposed to be in 1.5.

See for yourself and feel your confidence in the codebase rise with each word.
]]></description>
			<content:encoded><![CDATA[<p>From the Chaos Tools release notes for version 1.6 for Drupal 6:</p>
<blockquote><p>
The 1.5 release was botched: only some of the changes listed on the release notes were actually included. This release (1.6) includes all changes that were supposed to be in 1.5.
</p></blockquote>
<p><a href="http://drupal.org/node/815542">See for yourself</a> and feel your confidence in the codebase rise with each word.</p>
<p><a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save"><img src="http://www.kelvinwong.ca/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a> </p>]]></content:encoded>
			<wfw:commentRss>http://www.kelvinwong.ca/2010/06/02/funniest-release-notes-ever-chaos-tools-drupal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.511 seconds -->
