Posted by Sean 29 Aug 2008
I’m using the UUIDTools 1.0.3 gem in a Rails 2.1 application to generate globally unique IDs. After migrating the site to run under Phusion Passenger and Ruby Enterprise Edition I began encountering the following error:
StandardError (MAC address could not be autodetected. Set the MAC address manually.):
/vendor/gems/uuidtools-1.0.3/lib/uuidtools.rb:241:in `timestamp_create'
/vendor/gems/uuidtools-1.0.3/lib/uuidtools.rb:229:in `synchronize'
/vendor/gems/uuidtools-1.0.3/lib/uuidtools.rb:229:in `timestamp_create'
...
It seemed UUIDTools was trying to get the the network card’s MAC address (I’d guess to collect entropy), but couldn’t for some reason. I should also note that this is all running on an Ubuntu Hardy Heron 8.04, 512MB slice over at Slicehost (yes, that’s a referral link, use it! :-).
It turns out that UUIDTools was trying to use ifconfig to read the MAC address, but ifconfig wasn’t in the PATH. Since the application is now running under mod_rails, the relevant PATH is Apache’s PATH, which doesn’t include /sbin by default.
So, a quick edit of /etc/init.d/apache2 to change
ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
to
ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin:/sbin"
and a sudo /etc/init.d/apache2 restart was all it took to get the app back up and running.
Posted by Sean 07 Apr 2008
I’ve got a few GitHub invites available if anyone is interested. I’ve started putting a few of my open-source projects up there as well and so far it seems pretty cool.
Email link is in the footer, so come and get ‘em!
Posted by Sean 16 Mar 2008
I’ve updated EnkoderTags to allow HTML attributes in the enkode_mailto tag. The attributes will get passed through untouched into the resulting markup, so you can add CSS classes or IDs to use as styling hooks. For example, this code
<r:enkode_mailto email="example@example.com" link_text="simple email example"
class="enkodedlink"/>
will produce the HTML
<a href="mailto:example@example.com" class="enkodedlink">simple email example</a>
which will be obfuscated through the Enkoder as usual. Thanks to Nick Calladine for prompting me to add this feature!
Posted by Sean 09 Feb 2008
Having moved to git for managing my Rails projects and git submodules for Rails plugins and vendor/rails, I decided to create git mirrors for a couple of plugins whose maintainers use subversion.
If you have a Rails project in a git repository, you might do
git submodule add git://repo.or.cz/has\_many\_polymorphs.git vendor/plugins/has\_many\_polymorphs
git submodule add git://repo.or.cz/acts\_as\_ferret.git vendor/plugins/acts\_as\_ferret
and perhaps
git submodule add git://git.sanityinc.com/rails.git vendor/rails
followed by
git submodule init
git submodule update
Posted by Sean 02 Feb 2008
Wincent Colaiuta has some good, basic instructions for getting Git version 1.5.3.x built and installed on Mac OS X Leopard.
For Git 1.5.4, building git-gui will fail when it tries to build some localization files. The message I got during make prefix=/usr/local all was
GITGUI_VERSION = 0.9.2
* new locations or Tcl/Tk interpreter
GEN git-gui
INDEX lib/
MSGFMT po/de.msg 371 translated.
MSGFMT po/fr.msg 371 translated.
MSGFMT po/hu.msg 371 translated.
MSGFMT po/it.msg 370 translated, 1 untranslated.
MSGFMT po/ja.msg 371 translated.
MSGFMT po/ru.msg 367 translated, 4 untranslated.
MSGFMT po/sv.msg 371 translated.
MSGFMT po/zh_cn.msg 53 translated, 57 fuzzy, 253 untranslated.
SUBDIR gitk-git
GEN gitk-wish
Generating catalog po/de.msg
msgfmt --statistics --tcl po/de.po -l de -d po/
make[1]: msgfmt: Command not found
make[1]: *** [po/de.msg] Error 127
make: *** [all] Error 2
This is because Leopard doesn’t come with the GNU gettext utilities. While I imagine one could build and install gettext, there’s an easier fix. Just set the NO_MSGFMT environment variable to yes and the Git build scripts will use a simple (well, according to the source, “really stupid”) program that does the necessary work in place of gettext’s msgfmt tool.
So, just tack NO_MSGFMT=yes in front of your build and you’re all set.
NO_MSGFMT=yes make prefix=/usr/local all