CapsLock… who needs it?  If you’ve got a CapsLock problem, there is help.  Otherwise, if you happen to be an vi addict, then swapping CapsLock with ESC is pretty awesome since that Meta key is only rivaled by the space bar in terms of key presses per second.

Nowdays, a default Debian install with Gnome comes with a gnome-control-center capplet for gnome-keyboard-properties. If you go System->Preferences->Keyboard->Layouts->Layout Options->CapsLock Key behavior->”Swap ESC and CapsLock” then your ESC and CapsLock are swapped. More or less. I found a few problems with this on my T61p.

  • The little Thinkpad CapsLock LED does not do the swap.  It will toggle as you hit your new Meta (ESC) key, not your new CapsLock key.
  • Hibernation:  Depending on what combo of ESC and CapsLock are set when you initiate hibernation, when you come out of hibernation they can be in an inconsistent state.  The only GUI solution I’ve found to this is to reset my Keyboard Layout Options to the defaults, and then do the “Swap ESC and CapsLock” GUI chain again.  (No, I haven’t tracked this bug down and filed a report… I suspect it’s somehow unique to Thinkpads.)

Old skool to the rescue… Xmodmap.

Edit (create if non-existent) your ~/.Xmodmap file as follows:

! Swap Caps_Lock and Escape.
! see man xmodmap

remove Lock = Caps_Lock
keycode 0x9 = Caps_Lock
keycode 0x42 = Escape
add Lock = Caps_Lock

And restart your X session. Bam. The above two issues are solved.

Update: I’ve released an updated version of AutoTracOnDreamHost.

I’ve made a few updates to the original AutoTracOnDreamHost.  They are:

  • Bumped up to Trac 0.11.2, just released last weekend.
  • The python version you use is now a config option in configure.inc – though Trac 0.11.2 proper requires python2.4, this is expected to be fixed in Trac 0.11.2.1.
  • If DH has installed setuptools on your machine, now AutoTracOnDreamHost doesn’t use it, as it may be too far out of date to install the latest and greatest mysqldb, genshi, or pygments.
  • Minor edits to the README.

Questions?  Bugs?  Please use the comments. Enjoy!

README:

AutoTracOnDreamHost: README

#################### LICENSE #####################

AutoTracOnDreamHost is free software: you can redistribute
it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, either
version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

http://www.gnu.org/licenses/gpl-3.0.html

#################### HowTo #######################

Preliminaries:

  1. Assuming you're going to use this with SVN, you need to already
     have an SVN repository setup and running.  The webserver needs
     to have at least read permissions to the repository.

  2. You need to have a complete domain/subdomain set up to use
     with trac or a subdirectory of an existing domain.

  3. A MySQL database ready to use with trac.  This doesn't have to
     be it's own database, but AFAIK, there is no good reason not
     to give each trac site it's own database.

  4. Trac 0.11.2.0 requires python 2.4, not 2.3.  Trac 0.11.2.1 (not
     out as of this writing) should fix this
     (http://trac.edgewall.org/ticket/7801).

  5. To avoid permission failings by apache, it's best to install this
     using the same user as you have apache doing it's cgi stuff under (If
     you didn't change anything from the dreamhost default - then you have
     only one user and you can ignore this step.)

Do once:

  1. Edit the configure.inc:

     - you probably want the latest and greatest of Trac, Genshi,
       MySQLDB, and Pygments.  Minor version releases of these
       shouldn't break this script.
     - alter the trac directory structure to your liking, or just
       run with my setup.

  2. Run the backend.sh.  This will set up all the parts of trac that
     are shared between all your trac sites (even if you have only one).

Do once per trac site:

  1. Run the site.sh.  This script will query you for details about
     the configuration of your database, your directory structure,
     svn repository, an admin trac user etc.

  2. Test it! Go to your new trac url and log in, browse the svn
     repository, create a dummy ticket etc.

#################### Help Me! ####################

I'll post about any major updates or known bugs on my blog.
http://blog.fogel.ca  In event of enough interest in these
scripts, I'll set up a public repository for it so we can
all contribute.

If you find any major bugs or want to submit a patch, you can
email me which is my first name (mike) at my domain (fogel.ca).
Requests for personalized help will be answered in the limit
of infinite free time, which I don't have, so no promises.

Elsewise, the best conglomeration of information about Trac
on DreamHost AFAIK is currently at on the DreamHost wiki.
http://wiki.dreamhost.com/Trac

##################################################

configure.inc:

# AutoTracOnDreamHost: configure.inc
# Released under GLPv3. http://www.gnu.org/licenses/gpl-3.0.html
# Copyright 2008 Michael Fogel. http://fogel.ca

# Abort on any errors
set -e

PYTHON_VERS=2.4
TRAC_VERS=0.11.2
GENSHI_VERS=0.5.1
MYSQLDB_VERS=1.2.2
PYGMENTS_VERS=0.11.1

# trac dir structure
TRAC_ROOT="${HOME}/trac"
PKG=${TRAC_ROOT}/packages
EGG=${TRAC_ROOT}/egg_cache
INSTALL=${TRAC_ROOT}/install
SITES=${TRAC_ROOT}/sites
SVN=${HOME}/svn
TRAC_SITE_PACKAGES=${PKG}/lib/python${PYTHON_VERS}/site-packages
TRAC_HTDOCS=${TRAC_SITE_PACKAGES}/Trac-${TRAC_VERS}-py${PYTHON_VERS}.egg/trac/htdocs

EXP_CMD1="export PYTHONPATH=$TRAC_SITE_PACKAGES"
EXP_CMD2="export PYTHON_EGG_CACHE=$EGG"
EXP_CMD3="export LD_LIBRARY_PATH=$PKG/lib"
EXP_CMD4="export PATH=$PKG/bin:\$PATH"

cat <<OutputDreamTracInstallReminder

==== Put the following in your ~/.bash_profile ====
Where trac/packages=PKG
$EXP_CMD1
$EXP_CMD2
$EXP_CMD3
$EXP_CMD4
===================================================

OutputDreamTracInstallReminder

# modify those env vars for the duration of this script too.
$EXP_CMD1
$EXP_CMD2
$EXP_CMD3
if [[ "$PATH" != *"$PKG/bin"* ]]; then export PATH=$PKG/bin:$PATH; fi

# Update version information here and DIRs below.

TRAC=http://ftp.edgewall.com/pub/trac/Trac-${TRAC_VERS}.tar.gz
GENSHI=http://ftp.edgewall.com/pub/genshi/Genshi-${GENSHI_VERS}.tar.gz
SETUPTOOLS=http://peak.telecommunity.com/dist/ez_setup.py
MYSQLDB=http://switch.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-${MYSQLDB_VERS}.tar.gz
PYGMENTS=http://pypi.python.org/packages/source/P/Pygments/Pygments-${PYGMENTS_VERS}.tar.gz

TRACDIR=Trac-${TRAC_VERS}
GENSHIDIR=Genshi-${GENSHI_VERS}
MYSQLDBDIR=MySQL-python-${MYSQLDB_VERS}
PYGMENTSDIR=Pygments-${PYGMENTS_VERS}

#### function getInupt - used primarily in site.sh #####
# arg 1: message
# arg 2: initial value
function getInput {
  MES="$1"
  eval "VAL=\$$2"
  echo ""
  echo "Press enter to accept the current value, or input a new value."
  TMP="$VAL"
  while [[ -n "$TMP" ]]; do
    VAL="$TMP"
    echo "$MES: $VAL"
    read TMP
  done
  echo "Using $MES: $VAL"
  eval "$2=\"$VAL\""
}

backend.sh:

# AutoTracOnDreamHost: backend.sh
# Released under GLPv3. http://www.gnu.org/licenses/gpl-3.0.html
# Copyright 2008 Michael Fogel. http://fogel.ca

source ./configure.inc

echo -e "\n==== Creating need dir structure ===="
[ ! -d ${PKG} ] && mkdir -p ${PKG}
# the egg_cache dir must be writable by your apache cgi/python user
[ ! -d ${EGG} ] && mkdir -p ${EGG} && chmod 770 ${EGG}
[ ! -d ${INSTALL} ] && mkdir -p ${INSTALL}
[ ! -d ${SITES} ] && mkdir -p ${SITES}

echo -e "\n==== Retrieving installation files ===="
cd ${INSTALL}
[ ! -f ${TRACDIR}.tar.gz ] && wget ${TRAC}
[ ! -f ${GENSHIDIR}.tar.gz ] && wget ${GENSHI}
[ ! -f ${MYSQLDBDIR}.tar.gz ] && wget ${MYSQLDB}
[ ! -f ${PYGMENTSDIR}.tar.gz ] && wget ${PYGMENTS}
[ ! -f ez_setup.py ] && wget ${SETUPTOOLS}

echo -e "\n==== Installing Setup Tools ===="
#Create site-packages directory. Script will fail without it.
mkdir -p ${TRAC_SITE_PACKAGES}
cd ${INSTALL} && python ez_setup.py --prefix=${PKG}

echo -e "\n==== Installing Pygments ===="
cd ${INSTALL} && tar xzf ${PYGMENTSDIR}.tar.gz
cd ${PYGMENTSDIR} && python setup.py install --prefix=${PKG}

echo -e "\n==== Installing MYSQLdb ===="
cd ${INSTALL} && tar xzf ${MYSQLDBDIR}.tar.gz
cd ${MYSQLDBDIR} && python setup.py install --prefix=${PKG}

echo -e "\n==== Installing Genshi ===="
cd ${INSTALL} && tar xzf ${GENSHIDIR}.tar.gz
cd ${GENSHIDIR} && python setup.py install --prefix=${PKG}

echo -e "\n==== Installing Trac ===="
cd ${INSTALL} && tar xzf ${TRACDIR}.tar.gz
cd ${TRACDIR} && python setup.py install --prefix=${PKG}
mkdir -p ${PKG}/share/trac
cp -fr ${INSTALL}/${TRACDIR}/cgi-bin ${PKG}/share/trac

echo -e "\n==== Setting permissions for Trac htdocs ===="
DIR=${TRAC_HTDOCS}
while [ "$DIR" != "$HOME" ]; do
  chmod o+x $DIR
  DIR=`dirname $DIR`
done
find ${TRAC_HTDOCS} -type d -exec chmod 751 {} \;
find ${TRAC_HTDOCS} -type f -exec chmod 644 {} \;

echo -e "\n==== Backend install complete ===="

site.sh:

# AutoTracOnDreamHost: site.sh
# Released under GLPv3. http://www.gnu.org/licenses/gpl-3.0.html
# Copyright 2008 Michael Fogel. http://fogel.ca

source ./configure.inc

# Prompt for project parameters, with defaults
PROJECT=somesvnproject;         getInput "Subversion Project ID"  PROJECT
DOMAIN=trac.somedomain.com;     getInput "Domain for Trac"        DOMAIN
DOMAINDIR=${HOME}/http/$DOMAIN; getInput "Path for domain root"   DOMAINDIR
TRACPATH=/trac;                 getInput "Relative Path for Trac" TRACPATH
MYSQLHOST=mysql.$DOMAIN;        getInput "MySQL hostname"         MYSQLHOST
MYSQLUSER=trac_username;        getInput "MySQL username"         MYSQLUSER
MYSQLPASSWD=trac_password;      getInput "MySQL password"         MYSQLPASSWD
MYSQLDBNAME=trac_$PROJECT;      getInput "MySQL DB name"          MYSQLDBNAME
TRAC_USER=admin;                getInput "Trac Admin username"    TRAC_USER
TRAC_PASSWORD=password;         getInput "Trac Admin password"    TRAC_PASSWORD

# confirm those values
echo "Please confirm the values you entered:"
echo "PROJECT:${PROJECT}"
echo "DOMAIN:${DOMAIN}"
echo "DOMAINDIR:${DOMAINDIR}"
echo "TRACPATH:${TRACPATH}"
echo "MYSQLHOST:${MYSQLHOST}"
echo "MYSQLUSER:${MYSQLUSER}"
echo "MYSQLPASSWD:${MYSQLPASSWD}"
echo "MYSQLDBNAME:${MYSQLDBNAME}"
echo "TRAC_USER:${TRAC_USER}"
echo "TRAC_PASSWORD:${TRAC_PASSWORD}"
echo "Look good?"
lookingGood=Yes;
getInput "Looking good? 'Yes' to continue, all else to quit." lookingGood
[ "$lookingGood" != "Yes" ] && exit 1;

# Vars for this site
WEBDIR=${DOMAINDIR}/${TRACPATH}
INDEX_CGI=${WEBDIR}/index.cgi
TRACINI=${SITES}/${PROJECT}/conf/trac.ini
HTACCESS=${WEBDIR}/.htaccess
HTPASSWD=${WEBDIR}/.htpasswd
NAME="Trac: ${DOMAIN}${TRACPATH}/"

echo "Setup site"
if [ ! -d ${SITES}/${PROJECT} ]; then

  #Setup Trac Environment for MySQL
  ${PKG}/bin/trac-admin ${SITES}/${PROJECT} \
    initenv ${PROJECT} \
    "mysql://${MYSQLUSER}:${MYSQLPASSWD}@${MYSQLHOST}/${MYSQLDBNAME}" \
    svn \
    ${SVN}/${PROJECT};

  # set admin user to premissions
  ${PKG}/bin/trac-admin ${SITES}/${PROJECT} \
  permission add $TRAC_USER TRAC_ADMIN
fi

echo "Make Trac Web Accessible"
# Make Trac Web Accessible
mkdir -p ${WEBDIR}
chmod 751 ${WEBDIR}

if [ -f "${INDEX_CGI}" ]; then
  rm ${INDEX_CGI}
fi
echo "#!/bin/bash" >> ${INDEX_CGI}
echo "export HOME=\"/home/${USER}\"" >> ${INDEX_CGI}
echo "export TRAC_ENV=\"$SITES/${PROJECT}\"" >> ${INDEX_CGI}
echo "$EXP_CMD1" >> ${INDEX_CGI}
echo "$EXP_CMD2" >> ${INDEX_CGI}
echo "$EXP_CMD3" >> ${INDEX_CGI}
echo "$EXP_CMD4" >> ${INDEX_CGI}
echo "exec $PKG/share/trac/cgi-bin/trac.cgi" >> ${INDEX_CGI}
chmod 755 ${INDEX_CGI}

# logo in trac.ini
sed -i "s/^alt = .*$/alt = trac_banner.png/" ${TRACINI}
# some fancy sed to escape forward slashes... simplier patches are welcome.
TRACPATH_S=`echo ${TRACPATH} | sed -e "s/\/$//" -e "s/\//\\\\\\ \//g" -e "s/ \//\//g"`
sed -i "s/^src = .*$/src = ${TRACPATH_S}\/chrome\/common\/trac_banner.png/"${TRACINI}

#Pretty URLs
mkdir -p ${WEBDIR}/chrome
chmod 751 ${WEBDIR}/chrome
ln -sf ${TRAC_HTDOCS} ${WEBDIR}/chrome/common

# .htaccess fun
if [ -f ${HTACCESS} ]; then
  rm ${HTACCESS}
fi

touch ${HTACCESS}
chmod 644 ${HTACCESS}

echo "AuthType Basic" >> ${HTACCESS}
echo "AuthUserFile ${HTPASSWD}" >> ${HTACCESS}
echo "AuthName '${NAME}'" >> ${HTACCESS}
echo "require valid-user" >> ${HTACCESS}
echo "" >> ${HTACCESS}
echo "DirectoryIndex index.cgi" >> ${HTACCESS}
echo "Options ExecCGI FollowSymLinks" >> ${HTACCESS}
echo "" >> ${HTACCESS}
echo "" >> ${HTACCESS}
echo "RewriteEngine On" >> ${HTACCESS}
echo "RewriteCond %{REQUEST_FILENAME} !-f" >> ${HTACCESS}
echo "RewriteCond %{REQUEST_FILENAME} !-d" >> ${HTACCESS}
echo "RewriteRule ^(.*)\$ ${TRACPATH}/index.cgi/\$1 [L]" >> ${HTACCESS}
echo "" >> ${HTACCESS}

#Create .htpasswd file for trac admin with password
htpasswd -bc ${HTPASSWD} $TRAC_USER "$TRAC_PASSWORD"

# Note: on DreamHost you avoid a world-readable htpasswd file by
# setting one up via panel.dreamhost.com->Goodies->Htaccess/WebDAV.
# This will make htpasswd and htaccess files (overwriting anything
# that's there) that has group dhapache, is group readable, and
# the apache user is in the dhapache group.  Baring this, you need
# to make your htpasswd file word-readable (or email support for
# some chgrp action as root)
chmod 644 ${HTPASSWD}

echo ---------- SITE INSTALL COMPLETE! ----------

The worst part about being proficient with vi is when you use anything else.  It’s all annoyingly slow to have to move your fingers away from the home position, or (gasp) move your whole hand off the keyboard to use the mouse.  The user’s hands/fingers are the bottleneck for this whole human-computer interaction thing.  We want to remove as much complexity as practical from that task to speed the whole process up.

VIMperator does just that.  Highly recommended.

:o fivethirtyeight.com
ctrl-d
ctrl-d
k
ctrl-u
/obama predicted victory margin
/mccain antidepressants
j
j
:q

See, I’m getting more productive already!

At some point, this just starts getting ridiculous.  Wifi access, anyone?

wifi networks

Yup, you’ll notice that 1200 vertical pixels isn’t enough to even display them all.  A little iwlist wlan0 scan reveals 32 networks in range.  Talk about redundant access.  80% of these likely funnel through the same 3 or 4 bottlenecks a few hops up anyway.  But, I have to say… 32 networks?  Sweeeeeet!

Taken at the intersection of Cowper and University, Palo Alto, at Gyros and Gyros, sitting and enjoying a lamb & beef gyros – inside.

Best name for a Wifi network ever: MyLawsuit.  lol! Only topped by… MyDivorce.

My new T61p shipped with this awesome beep that would go off whenever the power state changed. Beep when it comes out of hibernation. Beep when you plug it in. Beep, beep beep beeeeppppp…. annoying & embarrassing.  I’ve been generally very pleased with my T61p, but seriously, how does a default setting like that get out the door?  And seriously, why did it take two months before I found the time to figure out how to change it?

Let’s turn it off!

  1. It’s a bios beep.  During startup press F1 to get into the bios ulitity (alternatively, press the ‘Blue ThinkVantage Button’ and then press F1 at the first menu.
  2. Config->Alerts and just disable them all.  No more beeps!
  3. Save and Exit.

Here are the steps I took to get Eclipse working with Java on my Debian Lenny more-or-less default install laptop.  I know zero (soon to be non-zero) Java, and I’ve never used Eclipse before.

sudo apt-get install eclipse
sudo apt-get install sun-java6-doc

You will then need to download a zipped file from sun’s servers to your /tmp dir, and then re-run the configuration scripts for that package.  AFAIK, that package just installs the help files in the appropriate places.  It doesn’t do the download for you because Sun makes you check a bunch of boxes off about licenses etc. before letting you download.

Increase your productivity about a billion percent for 15 Euro: viPlugin. It works as expected, so far recommended.  The only thing is I didn’t receive my license via email till about 4 hours after I bought it.  So get it set up now.  I, for one, do appreciate the reasonable pricing for viPlugin as apposed to some other vi IDE plugins.  Reasonable pricing makes the difference between me searching for a crack or just paying for the license… but that’s worthy of a whole rant (er, post) of it’s own.

And I think that’s it.  I’m now on my way to becoming yet another Java monk- er, programmer.

Update:

Hum, why is it never that easy?  So the GNU version of the Java complier doesn’t like you using the Scanner class. I have no idea why and right now, with this project 22 hours overdue, I don’t really care (so why am I writing this up now?).  Anyway:

sudo apt-get install sun-java6-jdk
sudo update-java-alternatives -s java-6-sun
sudo update-alternatives --config java

And you want to select /usr/lib/jvm/java-6-sun/jre/bin/java

sudo update-alternatives --config javac

And you want to select /usr/lib/jvm/java-6-sun/bin/javac

In Eclipse, “Windows” > “Preferences” > “Java” > “Installed JREs”.  You want to ‘Add’ the JRE /usr/lib/jvm/java-6-sun-1.6.0.07  Then you want to make that the default by checking the box and clicking OK.

And now, Eclipse will find that Scanner class for you.

Update #2:

You probably want to use Sun’s javadoc:

sudo update-alternatives --config javadoc

and select /usr/lib/jvm/java-6-sun/bin/javadoc

Update #3:

If you want to use the JUnit4 package, you need to add it to the build path of your project.

sudo apt-get install junit4

In Eclipse, “Windows” > “Preferences” > “Java” > “Installed JREs”.  Select “Edit” on the JRE you’re using – for me, this is java-6-sun-1.6.0.07.  Then “Add External JARs…” and add /usr/lib/eclipse/plugins/org.junit4_4.1.0.1/junit-4.1.jar.  I don’t know why this doesn’t all just happen automagically… I see some hints around that there’s a licensing issue.

Update: I’ve released an updated version of AutoTracOnDreamHost.

Trac 0.11 is out. And it’s awesome – both the usability in enhancements in 0.11 and Trac in general. Trac is one of those tools in my toolbox I use to up my productivity a few notches. For small projects, it’s a nice convenient time saver. For large projects, having the project management tools trac provides makes an astonishing difference in group productivity and allows for a significantly higher quality final product.

On my web host, DreamHost, Trac is non-trivial to install… until now! I’ve written a set of scripts that make it semi-trivial to set Trac 0.11 up on DreamHost. Original inspiration came from the ‘auto-install‘ on the DreamHost wiki, which is great that it’s there, but it was awkward for my configuration and, IMHO, suffers from backward compatibility and feature bloat issues.  So, I wrote up some scripts that work well with my configuration. The README explains how to use them.

You may also want to check out the dreamy-trac project. Both that code and these scripts were originally based off the same code on the DreamHost wiki, so you’ll see similarities. They both get you to a similar end result. I know in these scripts I’ve emphasized simplicity as much as possible at the expense of installing any extra plugins, or customization, or whatnot.

If there’s a fair amount of traffic coming here and it looks like people are using these, I’ll set them up on a public repository for easier access and collaboration. In the meantime, keeping it simple… here they are.

README:

# AutoTracOnDreamHost: README
# Released under GLPv3. http://www.gnu.org/licenses/gpl-3.0.html
# Copyright 2008 Michael Fogel. http://fogel.ca

#################### LICENSE #####################

AutoTracOnDreamHost is free software: you can redistribute
it and/or modify it under the terms of the GNU General Public
License as published by the Free Software Foundation, either
version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

http://www.gnu.org/licenses/gpl-3.0.html

#################### HowTo #######################

Preliminaries:

  1. Assuming you're going to use this with SVN, you need to already
     have an SVN repository setup and running.  The webserver needs
     to have at least read permissions to the repository.

  2. You need to have a complete domain/subdomain set up to use
     with trac or a subdirectory of an existing domain.

  3. A MySQL database ready to use with trac.  This doesn't have to
     be it's own database, but AFAIK, there is no good reason not
     to give each trac site it's own database.

Do once: 

  1. Edit the configure.inc:

     - you probably want the latest and greatest of Trac, Genshi,
       MySQLDB, and Pygments.  Minor version releases of these
       shouldn't break this script.

     - alter the trac directory structure to your liking, or just
       run with my setup.

  2. Run the backend.sh.  This will set up all the parts of trac that
     are shared between all your trac sites (even if you have only one).

Do once per trac site:

  1. Run the site.sh.  This script will query you for details about
     the configuration of your database, your directory structure,
     svn repository, an admin trac user etc.

  2. Test it! Go to your new trac url and log in, browse the svn
     repository, create a dummy ticket etc.

#################### Help Me! ####################

I'll post about any major updates or known bugs on my blog.
http://blog.fogel.ca  In event of enough interest in these
scripts, I'll set up a public repository for it so we can
all contribute.

If you find any major bugs or want to submit a patch, you can
email me which is my first name (mike) at my domain (fogel.ca).
Requests for personalized help will be answered in the limit
of infinite free time, which I don't have, so no promises.

Elsewise, the best conglomeration of information about Trac
on DreamHost AFAIK is currently at on the DreamHost wiki.
http://wiki.dreamhost.com/Trac

##################################################

configure.inc:

# AutoTracOnDreamHost: configure.inc
# Released under GLPv3. http://www.gnu.org/licenses/gpl-3.0.html
# Copyright 2008 Michael Fogel. http://fogel.ca

# Abort on any errors
set -e

TRAC_VERS=0.11.1
GENSHI_VERS=0.5.1
MYSQLDB_VERS=1.2.2
PYGMENTS_VERS=0.11.1

# trac dir structure
TRAC_ROOT="${HOME}/trac"
PKG=${TRAC_ROOT}/packages
EGG=${TRAC_ROOT}/egg_cache
INSTALL=${TRAC_ROOT}/install
SITES=${TRAC_ROOT}/sites
SVN=${HOME}/svn
TRAC_SITE_PACKAGES=${PKG}/lib/python2.3/site-packages
TRAC_HTDOCS=${TRAC_SITE_PACKAGES}/Trac-${TRAC_VERS}-py2.3.egg/trac/htdocs

EXP_CMD1="export PYTHONPATH=$TRAC_SITE_PACKAGES"
EXP_CMD2="export PYTHON_EGG_CACHE=$EGG"
EXP_CMD3="export LD_LIBRARY_PATH=$PKG/lib"
EXP_CMD4="export PATH=$PKG/bin:\$PATH"

cat <<OutputDreamTracInstallReminder

==== Put the following in your ~/.bash_profile ====
Where trac/packages=PKG
$EXP_CMD1
$EXP_CMD2
$EXP_CMD3
$EXP_CMD4
===================================================

OutputDreamTracInstallReminder

# modify those env vars for the duration of this script too.
$EXP_CMD1
$EXP_CMD2
$EXP_CMD3
if [[ "$PATH" != *"$PKG/bin"* ]]; then export PATH=$PKG/bin:$PATH; fi

# Update version information here and DIRs below.

TRAC=http://ftp.edgewall.com/pub/trac/Trac-${TRAC_VERS}.tar.gz
GENSHI=http://ftp.edgewall.com/pub/genshi/Genshi-${GENSHI_VERS}.tar.gz
SETUPTOOLS=http://peak.telecommunity.com/dist/ez_setup.py
MYSQLDB=http://switch.dl.sourceforge.net/sourceforge/mysql-python/MySQL-python-${MYSQLDB_VERS}.tar.gz
PYGMENTS=http://pypi.python.org/packages/source/P/Pygments/Pygments-${PYGMENTS_VERS}.tar.gz

TRACDIR=Trac-${TRAC_VERS}
GENSHIDIR=Genshi-${GENSHI_VERS}
MYSQLDBDIR=MySQL-python-${MYSQLDB_VERS}
PYGMENTSDIR=Pygments-${PYGMENTS_VERS}

#### function getInupt - used primarily in site.sh #####
# arg 1: message
# arg 2: initial value
function getInput {
	MES="$1"
	eval "VAL=\$$2"
	echo ""
	echo "Press enter to accept the current value, or input a new value."
	TMP="$VAL"
	while [[ -n "$TMP" ]]; do
		VAL="$TMP"
		echo "$MES: $VAL"
		read TMP
	done
	echo "Using $MES: $VAL"
	eval "$2=\"$VAL\""
}

backend.sh:

# AutoTracOnDreamHost: backend.sh
# Released under GLPv3. http://www.gnu.org/licenses/gpl-3.0.html
# Copyright 2008 Michael Fogel. http://fogel.ca

source ./configure.inc

echo -e "\n==== Creating need dir structure ===="
[ ! -d ${PKG} ] && mkdir -p ${PKG}
# the egg_cache dir must be writable by your apache cgi/python user
[ ! -d ${EGG} ] && mkdir -p ${EGG} && chmod 770 ${EGG}
[ ! -d ${INSTALL} ] && mkdir -p ${INSTALL}
[ ! -d ${SITES} ] && mkdir -p ${SITES}

echo -e "\n==== Retrieving installation files ===="
cd ${INSTALL}
[ ! -f ${TRACDIR}.tar.gz ] && wget ${TRAC}
[ ! -f ${GENSHIDIR}.tar.gz ] && wget ${GENSHI}
[ ! -f ${MYSQLDBDIR}.tar.gz ] && wget ${MYSQLDB}
[ ! -f ${PYGMENTSDIR}.tar.gz ] && wget ${PYGMENTS}
[ ! -f ez_setup.py ] && wget ${SETUPTOOLS}

echo -e "\n==== Installing Setup Tools ===="
#Create site-packages directory. Script will fail without it.
mkdir -p ${TRAC_SITE_PACKAGES}
[ -z `which easy_install` ] && cd ${INSTALL} && python ez_setup.py --prefix=${PKG}

echo -e "\n==== Installing Pygments ===="
cd ${INSTALL} && tar xzf ${PYGMENTSDIR}.tar.gz
cd ${PYGMENTSDIR} && python setup.py install --prefix=${PKG}

echo -e "\n==== Installing MYSQLdb ===="
cd ${INSTALL} && tar xzf ${MYSQLDBDIR}.tar.gz
cd ${MYSQLDBDIR} && python setup.py install --prefix=${PKG}

echo -e "\n==== Installing Genshi ===="
cd ${INSTALL} && tar xzf ${GENSHIDIR}.tar.gz
cd ${GENSHIDIR} && python setup.py install --prefix=${PKG}

echo -e "\n==== Installing Trac ===="
cd ${INSTALL} && tar xzf ${TRACDIR}.tar.gz
cd ${TRACDIR} && python setup.py install --prefix=${PKG}
mkdir -p ${PKG}/share/trac
cp -fr ${INSTALL}/${TRACDIR}/cgi-bin ${PKG}/share/trac

echo -e "\n==== Setting permissions for Trac htdocs ===="
DIR=${TRAC_HTDOCS}
while [ "$DIR" != "$HOME" ]; do
	chmod o+x $DIR
	DIR=`dirname $DIR`
done
find ${TRAC_HTDOCS} -type d -exec chmod 751 {} \;
find ${TRAC_HTDOCS} -type f -exec chmod 644 {} \;

echo -e "\n==== Backend install complete ===="

site.sh:

# AutoTracOnDreamHost: site.sh
# Released under GLPv3. http://www.gnu.org/licenses/gpl-3.0.html
# Copyright 2008 Michael Fogel. http://fogel.ca

source ./configure.inc

# Defaults
PROJECT=somesvnproject
DOMAIN=trac.somedomain.com
DOMAINDIR=${HOME}/http/$DOMAIN  # default refreshed after sampling DOMAIN
TRACPATH=/trac
MYSQLHOST=mysql.$DOMAIN         # default refreshed after sampling DOMAIN
MYSQLUSER=trac_username
MYSQLPASSWD=trac_password
MYSQLDBNAME=trac_$PROJECT       # default refreshed after sampling PROJECT
TRAC_USER=admin
TRAC_PASSWORD=password

# Prompt on those defaults
getInput "Subversion Project ID"                 PROJECT
getInput "Domain for Trac"                       DOMAIN
DOMAINDIR=${HOME}/http/$DOMAIN
MYSQLHOST=mysql.$DOMAIN
getInput "Path for domain root"                  DOMAINDIR
getInput "Path for Trac relative to domain root" TRACPATH
getInput "MySQL hostname"                        MYSQLHOST
getInput "MySQL username"                        MYSQLUSER
getInput "MySQL password"                        MYSQLPASSWD
MYSQLDBNAME=trac_$PROJECT
getInput "MySQL DB name"                         MYSQLDBNAME
getInput "Trac Admin username"                   TRAC_USER
getInput "Trac Admin password"                   TRAC_PASSWORD

# using these values
echo "PROJECT:${PROJECT}"
echo "DOMAIN:${DOMAIN}"
echo "DOMAINDIR:${DOMAINDIR}"
echo "TRACPATH:${TRACPATH}"
echo "MYSQLHOST:${MYSQLHOST}"
echo "MYSQLUSER:${MYSQLUSER}"
echo "MYSQLPASSWD:${MYSQLPASSWD}"
echo "MYSQLDBNAME:${MYSQLDBNAME}"
echo "TRAC_USER:${TRAC_USER}"
echo "TRAC_PASSWORD:${TRAC_PASSWORD}"

# Vars for this site
WEBDIR=${DOMAINDIR}/${TRACPATH}
INDEX_CGI=${WEBDIR}/index.cgi
TRACINI=${SITES}/${PROJECT}/conf/trac.ini
HTACCESS=${WEBDIR}/.htaccess
HTPASSWD=${WEBDIR}/.htpasswd
NAME="Trac: ${DOMAIN}${TRACPATH}/"

echo "Setup site"
if [ ! -d ${SITES}/${PROJECT} ]; then

	#Setup Trac Environment for MySQL
	${PKG}/bin/trac-admin ${SITES}/${PROJECT} \
		initenv ${PROJECT} \
		"mysql://${MYSQLUSER}:${MYSQLPASSWD}@${MYSQLHOST}/${MYSQLDBNAME}" \
		svn \
		${SVN}/${PROJECT};

	# set admin user to premissions
	${PKG}/bin/trac-admin ${SITES}/${PROJECT} \
	permission add $TRAC_USER TRAC_ADMIN
fi

echo "Make Trac Web Accessible"
# Make Trac Web Accessible
mkdir -p ${WEBDIR}
chmod 751 ${WEBDIR}

if [ -f "${INDEX_CGI}" ]; then
	rm ${INDEX_CGI}
fi
echo "#!/bin/bash" >> ${INDEX_CGI}
echo "export HOME=\"/home/${USER}\"" >> ${INDEX_CGI}
echo "export TRAC_ENV=\"$SITES/${PROJECT}\"" >> ${INDEX_CGI}
echo "$EXP_CMD1" >> ${INDEX_CGI}
echo "$EXP_CMD2" >> ${INDEX_CGI}
echo "$EXP_CMD3" >> ${INDEX_CGI}
echo "$EXP_CMD4" >> ${INDEX_CGI}
echo "exec $PKG/share/trac/cgi-bin/trac.cgi" >> ${INDEX_CGI}
chmod 755 ${INDEX_CGI}

# logo in trac.ini
sed -i "s/^alt = .*$/alt = trac_banner.png/" ${TRACINI}
# some fancy sed to escape forward slashes... simplier patches are welcome.
TRACPATH_S=`echo ${TRACPATH} | sed -e "s/\/$//" -e "s/\//\\\\\\ \//g" -e "s/ \//\//g"`
sed -i "s/^src = .*$/src = ${TRACPATH_S}\/chrome\/common\/trac_banner.png/" ${TRACINI}

#Pretty URLs
mkdir -p ${WEBDIR}/chrome
chmod 751 ${WEBDIR}/chrome
ln -sf ${TRAC_HTDOCS} ${WEBDIR}/chrome/common

# .htaccess fun
if [ -f ${HTACCESS} ]; then
	rm ${HTACCESS}
fi

touch ${HTACCESS}
chmod 644 ${HTACCESS}

echo "AuthType Basic" >> ${HTACCESS}
echo "AuthUserFile ${HTPASSWD}" >> ${HTACCESS}
echo "AuthName '${NAME}'" >> ${HTACCESS}
echo "require valid-user" >> ${HTACCESS}
echo "" >> ${HTACCESS}
echo "DirectoryIndex index.cgi" >> ${HTACCESS}
echo "Options ExecCGI FollowSymLinks" >> ${HTACCESS}
echo "" >> ${HTACCESS}
echo "" >> ${HTACCESS}
echo "RewriteEngine On" >> ${HTACCESS}
echo "RewriteCond %{REQUEST_FILENAME} !-f" >> ${HTACCESS}
echo "RewriteCond %{REQUEST_FILENAME} !-d" >> ${HTACCESS}
echo "RewriteRule ^(.*)\$ ${TRACPATH}/index.cgi/\$1 [L]" >> ${HTACCESS}
echo "" >> ${HTACCESS}

#Create .htpasswd file for trac admin with password
htpasswd -bc ${HTPASSWD} $TRAC_USER "$TRAC_PASSWORD"

# Note: on DreamHost you avoid a world-readable htpasswd file by
# setting one up via panel.dreamhost.com->Goodies->Htaccess/WebDAV.
# This will make htpasswd and htaccess files (overwriting anything
# that's there) that has group dhapache, is group readable, and
# the apache user is in the dhapache group.  Baring this, you need
# to make your htpasswd file word-readable (or email support for
# some chgrp action as root)
chmod 644 ${HTPASSWD}

echo ---------- SITE INSTALL COMPLETE! ----------

I just got back from three weeks of traveling across Europe – about half bike touring across Iceland and Holland, the other half more normal hostel-hoping via train/plane/bus/boat.

I brought a friend with me:

friendz with the eee pc

Wallet included in the picture to give you a sense of scale… it’s fricking tiny!  It weighs about as much as the ‘Europe on a Shoestring’ Lonely Planet guide.

I am soooooooo glad I brought a mini-laptop with me.  Not only did it allow me to do stuff like:

  • buy a cheap flight to Berlin from Reykjavík at the last minute.
  • organize a 24 hour sprint from Amsterdam to Dublin involving two ferries, three trains, three bike connections – at rock-bottom price.
  • stay in touch.  blog.

It also kept me sane when I got locked down in southern Iceland in a storm for three days during the bike tour part.

So, I really can’t recommend the idea of bringing a mini-laptop with you for traveling enough.  It really made a huge difference in my whole experience… then again I am one of those people who the internet is my ‘comfort food’.  Some people need chocolate or cheetos to feel good.  Others need to watch that special show to fall asleep at night.  I need my internet fix… and a vacation ain’t a vacation if you can’t get your fix.

Now, my Eee PC.  First off, best color ever:

pink, biatch.

Yes, it’s pink.  Yes, I’m comfortable with my manhood.  And yes, I bought it at the last minute and they only had pink left.

It’s the 2G Surf 701.  Linux-based (Xandros) with 512 MB ram, 900 MHz Celeron M processor, 2 GB hard drive – solid state, super fast.  It has 802.11b/g and an ethernet plug, and a few USB ports.  When it’s plugged in, the USB ports pump out enough power to charge an iPod/iPhone.  No CD/DVD drive (or any moving parts at all, for that matter).  Less to burn battery, less to break.

I only have two (make that three) complaints:

  • It’s a little too tiny.  The keyboard is at 83% of the normal size.  That requires a few hours of learning curve to get used to.
  • The standard gmail with it’s bazillion K of javascript is a little too much for the 900MHz Celeron M.  You can do it, but it’s slow as balls.  Switch to the HTML version.
  • The screen (800×480) isn’t quite big enough to display all sites correctly.  Also, it doesn’t quite max out the form factor… those speakers on the side are taking up vauble real estate that could be used for more screen.

So, I think next time I’ll upgrade all the way up to the 1000.  The screen is substantially larger, the keyboard less compressed (92%), and the processor is almost twice as fast.  Of course, that one costs more than twice as much as this one which was only….

250 USD.  Which is exactly half what my phone cost.  Meaning – if my Eee PC grows legs and walks away at one of the hostels – that would suck, but it’s not the end of the world.  If I had brought a ‘real’ laptop with me, I would have had to practically sleep on top of it to relax.

So, final verdict:  It’s awesome.  And it’s for sale.  You know you want it.  Again, if you win and I know you, no shipping charges and we’ll grab lunch.

Update:

Upon further procrastination – ur, consideration – I think next time I travel I’ll get the 901.  Same screen resolution, processor and battery as the 1000, and with the same tiny form factor as the 700 series.  Awesome.  And a good chunk cheaper than the 1000.  But… how can I get that in pink?

I’m on the Stena Line ferry right now heading from Hoek Van Holland to Harwich, England. They have wireless!

Kinda.

As is common in captive-audience no-competition environments, (read: airports) wireless goes for outrageous prices. But even given that peer set, this is ridiculous. The only logical justification I’ve been able to come up with for charging this much for access is to purposely limit the number of users so that the satellite link doesn’t get clogged. But I doubt that’s the case. I’m willing to bet 100 bucks (and my pride) that they’re off the ‘maximum profit peak’ (I dunno econ) by at least a factor of two.

As an end-user, you have two choices:

  • One device, one hour: 6 euro (~8.50 USD)
  • One device, three hours: 9 euro (~13 USD)

I have two devices (a phone/camera and a laptop) I need to both be connected to the internet to publish content effectively. I want to be connected the whole trip. It’s a 6.5 hour ride. I arrived an hour early. So for internet access, I need:

Two devices, three three hour segments each, for a total cost of… 2×3x9 = 54 euro (~77 USD). Are you on crack?! I paid 33 euro for this trip! I have a sneaking suspicion that the person/people making the decisions here know about as much about the internet and computing as John McCain

So, hello VIP lounge!

Only 16 euro, and for the whole trip I get as much bandwidth as a I can drain, free drinks, plush seats, and no screaming kids and drunk guys. Except maybe me. Rock n’ roll. This could get addicting…

I’m very happy to note that OpenDNS just recently cracked the Alexa Top 500. They edged up over some hard hitters like perezhilton.com and rapidshare.de.

If you haven’t taken the time to check out OpenDNS, do so. A safer and faster internet – for free. If it sounds too good to be true, well, that’s why they’re still growing quickly. These internets, they’re a-changing, a-changing fast, and OpenDNS is one of the players pushing them in the right direction.