The migrant/refugee vessel MV Sun Sea arrived in Esquimalt Harbour on Friday.
MV Sun Sea in Esquimalt
Aug 14
Python 2.7 on Dreamhost
Aug 2
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 _tkinterbsddb185bz2dlimageopsunaudiodevTo find the necessary bits, look in setup.py in detect_modules() for the module's name.
Three of these modules cannot be installed on Dreamhost’s 64-bit Debian servers anyway and one of them is an older version of a module I am going to install:
- bsddb185: Older version of Oracle Berkeley DB. Undocumented. Install version 4.8 instead.
- dl: For 32-bit machines. Deprecated. Use ctypes instead.
- imageop: For 32-bit machines. Deprecated. Use PIL instead.
- sunaudiodev: For Sun hardware. Deprecated.
Now, if you don’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. This post does a good job of explaining the installation of Python 2.6; mine is based on it. Let’s put the files in the following directories:
- Python 2.7
- $HOME/local/Python-2.7
- Berkeley DB 4.8
- $HOME/local/BerkeleyDB.4.8
- Other executables
- $HOME/local/bin
- Header files
- $HOME/local/include
- Libraries
- $HOME/local/lib
- Temporary artifacts
- $HOME/temp
We’ll need to push these values into the UNIX environment by using the export tool under the default bash shell:
$ export LDFLAGS="-L$HOME/local/lib -L$HOME/local/BerkeleyDB.4.8/lib" $ export CPPFLAGS="-I$HOME/local/include -I$HOME/local/BerkeleyDB.4.8/include" $ export CXXFLAGS=$CPPFLAGS $ export CFLAGS=$CPPFLAGS $ export LD_LIBRARY_PATH=$HOME/local/lib:$HOME/local/BerkeleyDB.4.8/lib $ export LD_RUN_PATH=$LD_LIBRARY_PATH
Next make the directories:
$ mkdir ~/temp ~/local
It’s also a good idea to check your machine (note the “x86_64” token). It should look similar to this:
$ uname -a Linux machine 2.6.32.8-grsec-2.1.14-modsign-xeon-64 #2 SMP Sat Mar 13 00:42:43 PST 2010 x86_64 GNU/Linux $ gcc -v Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1.1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-cld --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.3.2 (Debian 4.3.2-1.1) $
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’t believe that order of installation should matter. Let’s do it!
TCL/TK
The warning “_tkinter” indicates that the _tkinter module was not built. You will need to build both TCL and TK:
$ cd ~/temp $ pwd /home/username/temp $ wget http://prdownloads.sourceforge.net/tcl/tcl8.5.8-src.tar.gz $ tar zxvf tcl8.5.8-src.tar.gz $ cd tcl8.5.8/unix $ ./configure --prefix=$HOME/local $ make $ make install $ cd ../.. $ wget http://prdownloads.sourceforge.net/tcl/tk8.5.8-src.tar.gz $ tar zxvf tk8.5.8-src.tar.gz $ cd tk8.5.8/unix $ ./configure --prefix=$HOME/local $ make $ make install $ cd ../..
Berkeley DB 4.8
The warning “_bsddb” will go away when you install version 4.8 of the Oracle Berkeley DB:
$ cd ~/temp $ wget http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz $ tar zxvf db-4.8.30.tar.gz $ cd db-4.8.30/build_unix $ ../dist/configure --prefix=$HOME/local/BerkeleyDB.4.8 --enable-tcl --with-tcl=$HOME/local/lib $ make $ make install $ cd ../..
BZip2
Dreamhost has an earlier version of BZip2 (version 1.0.4) and no library (at least I couldn’t find one). To get the latest version:
$ cd ~/temp $ wget http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz $ tar zxvf bzip2-1.0.5.tar.gz $ cd bzip2-1.0.5 $ make -f Makefile-libbz2_so $ make $ make install PREFIX=$HOME/local $ cp ./libbz2.so.1.0.4 $HOME/local/lib $ ln -s $HOME/local/lib/libbz2.so.1.0.4 $HOME/local/lib/libbz2.so.1.0 $ cd ..
Python 2.7
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.
$ cd ~/temp $ wget http://python.org/ftp/python/2.7/Python-2.7.tgz $ tar zxvf Python-2.7.tgz $ cd Python-2.7 $ ./configure --prefix=$HOME/local/Python-2.7 $ make $ make install
At the end of the make process, you will see this:
Python build finished, but the necessary bits to build these modules were not found: bsddb185 dl imageop sunaudiodev To find the necessary bits, look in setup.py in detect_modules() for the module's name.
As mentioned earlier, these modules are either not buildable on Dreamhost’s 64-bit machines or not compatible with the newer version of Berkeley DB.
Hooking up the new Python
You want to put the new Python 2.7 on your PATH so that bash executes it before the systemwide Python 2.5. If you don’t want to append these export statements, you can also do it via a text editor (vim, emacs, etc).
$ cd ~ $ echo "export PATH=\"$HOME/local/bin:\$PATH\"" >> .bashrc $ echo "export PATH=\"$HOME/local/Python-2.7/bin:\$PATH\"" >> .bashrc $ source .bashrc $ which python /home/username/local/Python-2.7/bin/python $ python -V Python 2.7
Try it out!
Try out your new modules…at the shell prompt type “python”!
>>> import bsddb >>> db = bsddb.btopen('/tmp/spam.db', 'c') >>> for i in range(10): db['%d'%i] = '%d'% (i*i) ... >>> db['3'] '9' >>> db.keys() ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] >>> db.sync() >>> db.isOpen() True >>> import bz2 >>> print bz2.__author__ The bz2 python module was written by: Gustavo Niemeyer <niemeyer@conectiva.com> >>> import Tkinter >>> Tkinter.__version__ '$Revision: 81008 $' >>>
Shock the monkey!
Jul 16
Some important research from the Institute of Biomedical Engineering, National Taiwan University, Taipei, Taiwan. Drs. Tsai, Chang, Liu, Kuo, Chen, Jaw, & Hsieh (whew…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 PubMed. This is going to win them seven awards.
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’s mission statement.
To recreate this hash in Python, type the following into your Python interpreter:
Python 2.5.4 (r254:67917, Dec 23 2008, 14:57:27) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from hashlib import md5 >>> ms = "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." >>> o = md5(ms).hexdigest() >>> print o 9ec4c12949a4f31474f299058ce2b22a >>> len(o) 32 >>>
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.
I had some trouble installing Webmin 1.510 on Ubuntu 10.04 LTS Server (aka Lucid). The problem is that Webmin uses a deprecated Perl module (a wrapper around Digest::MD5 for users of an ancient MD5 library) and both Debian and Ubuntu refuse to put it back into their respective repositories. Entirely within their rights, of course, but not so good for us weekend admins who want a painless install process.
Okay, so let’s get to work. I’m installing Webmin 1.510 via the remaining Debian packages.
Install the (easy) dependencies
Run this from a terminal. Expect some trouble from ‘libmd5-perl’.
$ sudo aptitude -y install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl libmd5-perl apt-show-versions libapt-pkg-perl
You should find an error like this:
Couldn't find any package whose name or description matched "libmd5-perl"
The reason for this is that ‘libmd5-perl’ is persona non grata at both Debian and Ubuntu, as mentioned.
Install the deprecated dependencies
Download the libmd5-perl deb file and install it manually:
Open a browser and get the newest libmd5-perl package (from 2004 – lol)
http://ftp.debian.org/pool/main/libm/libmd5-perl/
The likely package is named: libmd5-perl_2.03-1_all.deb
so we download it and install it:
kelvin@example.com:~$ wget http://ftp.debian.org/pool/main/libm/libmd5-perl/libmd5-perl_2.03-1_all.deb --2010-05-22 19:50:45-- http://ftp.debian.org/pool/main/libm/libmd5-perl/libmd5-perl_2.03-1_all.deb Resolving ftp.debian.org... 130.89.149.226, 2001:610:1908:a000::149:226 Connecting to ftp.debian.org|130.89.149.226|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 5700 (5.6K) [application/x-debian-package] Saving to: `libmd5-perl_2.03-1_all.deb' 100%[=======================================================================>] 5,700 30.3K/s in 0.2s 2010-05-22 19:50:46 (30.3 KB/s) - `libmd5-perl_2.03-1_all.deb' saved [5700/5700] kelvin@example.com:~$ sudo dpkg -i libmd5-perl_2.03-1_all.deb Selecting previously deselected package libmd5-perl. (Reading database ... 50494 files and directories currently installed.) Unpacking libmd5-perl (from libmd5-perl_2.03-1_all.deb) ... Setting up libmd5-perl (2.03-1) ... Processing triggers for man-db ... kelvin@example.com:~$
Install Webmin
The dependencies should all be installed now. We can download the Webmin deb package from Sourceforge.
http://sourceforge.net/projects/webadmin/files/
Use the most recent deb package. In my case it was ‘webmin_1.510-2_all.deb‘
Sourceforge will generate a link for you to use from their web site. My link was:
kelvin@example.com:~$ wget http://downloads.sourceforge.net/project/webadmin/webmin/1.510/webmin_1.510-2_all.deb?use_mirror=cdnetworks-us-1 --2010-05-22 19:53:44-- http://downloads.sourceforge.net/project/webadmin/webmin/1.510/webmin_1.510-2_all.deb?use_mirror=cdnetworks-us-1 Resolving downloads.sourceforge.net... 216.34.181.59 Connecting to downloads.sourceforge.net|216.34.181.59|:80... connected. HTTP request sent, awaiting response... 302 Found Location: http://cdnetworks-us-1.dl.sourceforge.net/project/webadmin/webmin/1.510/webmin_1.510-2_all.deb [following] --2010-05-22 19:53:44-- http://cdnetworks-us-1.dl.sourceforge.net/project/webadmin/webmin/1.510/webmin_1.510-2_all.deb Resolving cdnetworks-us-1.dl.sourceforge.net... 174.35.19.11 Connecting to cdnetworks-us-1.dl.sourceforge.net|174.35.19.11|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 14504260 (14M) [application/octet-stream] Saving to: `webmin_1.510-2_all.deb' 100%[===================================================================>] 14,504,260 512K/s in 21s 2010-05-22 19:54:06 (664 KB/s) - `webmin_1.510-2_all.deb' saved [14504260/14504260] kelvin@example.com:~$ sudo dpkg -i webmin_1.510-2_all.deb Selecting previously deselected package webmin. (Reading database ... 50500 files and directories currently installed.) Unpacking webmin (from webmin_1.510-2_all.deb) ... Setting up webmin (1.510-2) ... Webmin install complete. You can now login to https://example.com:10000/ as root with your root password, or as any user who can use sudo to run commands as root. Processing triggers for ureadahead ... ureadahead will be reprofiled on next reboot
You should now be able to visit your webmin login page on port 10000 (use your own IP number):
http://192.168.0.5:10000/
Ideally, the Webmin gurus will refactor the old MD5 code dependencies, but this seems to work fine for now.
So I don’t why I always have trouble setting up web apps to send mail through my hosted GMail accounts (like, um, Redmine?). Really, it seems like I end up pulling my hair out every time I have to do it.
So the problem we want to solve today should be straightforward. I have a Ruby-on-Rails app called Redmine which I want to have send notifications and whatnot via my Google Apps hosted GMail account. So here’s some basic instruction from Redmine. Great. And here is my email.yml file that actually works (passwords and other crap redacted, obviously):
production:
delivery_method: :smtp
smtp_settings:
tls: true
address: "smtp.gmail.com"
port: 587
domain: "example.com"
authentication: :plain
user_name: "robots@example.com"
password: N1ceP@55wurd!
This set-up will allow Redmine to send emails from robots@example.com using hosted GMail
I ran into some trouble installing the Fileinfo extension for PHP on CentOS. I tried installing the extension using yum and all went well until I saw these errors:
PHP Warning: PHP Startup: fileinfo: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match
Like I said, I installed the extension using yum, so I checked out what I had installed:
$ yum list installed | grep "php-pecl-Fileinfo" php-pecl-Fileinfo.x86_64 1.0.4-3.el5.centos installed
Oh crap, I always forget to pull these things from the Atomicorp repository because my php is from there.
$ yum list installed | grep "php.x86_64" php.x86_64 5.2.13-1.el5.art installed
Well, the bad news is that the Fileinfo extension is not available on the Atomicorp repo. Hmm. Ok, so my next step is to remove the thing and install it with PECL.
$ sudo yum erase php-pecl-Fileinfo.x86_64 ... Running Transaction Erasing : php-pecl-Fileinfo 1/1 warning: /etc/php.d/Fileinfo.ini saved as /etc/php.d/Fileinfo.ini.rpmsave Removed: php-pecl-Fileinfo.x86_64 0:1.0.4-3.el5.centos Complete! $ sudo rm /etc/php.d/Fileinfo.ini.rpmsave $
I didn’t need that config file, because I never got it to work!
Install Fileinfo with PECL
Before anything else, here is the system I’m using:
$ cat /etc/redhat-release CentOS release 5.4 (Final) $ php -v PHP 5.2.13 (cli) (built: Mar 2 2010 18:08:48) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies $ pecl -V PEAR Version: 1.9.0 PHP Version: 5.2.13 Zend Engine Version: 2.2.0 Running on: Linux system.local 2.6.18-028stab064.7 #1 SMP Wed Aug 26 13:11:07 MSD 2009 x86_64
If the PHP extension that I’m after is not in the yum repo then I usually just install it with PECL. It is fairly painless.
$ sudo pecl install fileinfo audit_log_user_command(): Connection refused WARNING: "pear/Fileinfo" is deprecated in favor of "channel://php-src/ext/fileinfo/in php sources" downloading Fileinfo-1.0.4.tgz ... Starting to download Fileinfo-1.0.4.tgz (5,835 bytes) .....done: 5,835 bytes 3 source files, building running: phpize ...lotsa crap... build process completed successfully Installing '/usr/lib64/php/modules/fileinfo.so' install ok: channel://pear.php.net/Fileinfo-1.0.4 $
The PECL warning is trying to let you know that Fileinfo is bundled with PHP 5.3 and you don’t need to install if you are running PHP 5.3, but I’m running 5.2 so that warning is not for me. Okay, now we turn on the extension by putting “extension=fileinfo.so” somewhere in the /etc/php.ini file.
$ sudo vim /etc/php.ini $
And make the change…
640 | extension=fileinfo.so |
Now restart apache…
$ sudo /sbin/service httpd restart audit_log_user_command(): Connection refused Stopping httpd: [ OK ] Starting httpd: [ OK ] $
Okay, let’s find out if it is in the phpinfo…
$ php -r "phpinfo();" | grep "fileinfo" fileinfo fileinfo support => enabled
Yay!!!
A fontsize too small?
Feb 25
Goodbye XML
Feb 6
I’m leaving you XML. I’m just not into you anymore. I don’t think I ever was…I just used you. Sorry.
Why? You’re just too damn hard to read and you give me a headache. I always have to check if you’re well-formed and, frankly, most of the time, you’re not.
It’s not because you have only one root. No, it’s not. You’re always so damn verbose…and you use tabs everywhere we go and who picks those up? I do. That’s who.
Well, it stops today.
Yes, there is someone else.


