Snakes Rubies & Penguins...

IE < 9 HTML 5 compatibility notes

Note to self… if you are using this: http://code.google.com/p/html5shiv/

also do this! header,nav,article,footer,section,aside,figure,figcaption{display:block}

Automatically switching between Django dev and production settings using socket.get_hostname()

import socket
if socket.get_hostname() == ‘my-dev-box’:
#Development Server Settings go here
else:
#Production Server Settings go here

Great article about production Django using Lighttpd and Virtualenv

http://coderseye.com/2010/how-to-run-sandboxed-django-sites-in-production.html

Great video overview of Django

Building content-oriented sites with Django from Simon Willison on Vimeo.

Installing GCC compiler and GNU Screen on Solaris 10

First you need to download these files:

wget ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/gcc-3.3.2-sol10-sparc-local.gz
wget ftp://ftp.sunfreeware.com/pub/freeware/sparc/10/libiconv-1.9.2-sol10-sparc-local.gz

You may want to start by adding wget or curl but I just used a server that had wget already and the sftp'd the files over.

Then you will need to unpack them:
gunzip gcc-3.3.2-sol10-sparc-local.gz
gunzip libiconv-1.9.2-sol10-sparc-local.gz

You will then need to install libiconv: 
pkgadd -d libiconv-1.9.2-sol10-sparc-local

Then GCC: pkgadd -d gcc-3.3.2-sol10-sparc-local

Now to compile and install GNU Screen - which was the original point of this..

There were still some issues related to screen and setenv - I think it is a little happier compiling on Linux.

This is the dirty hack which ended up working:
 #else /* USESETENV */
 # if defined(linux) || defined(_convex_) || (BSD >= 199103)
 setenv(var, value, 1);
 # else
 //setenv(var, value);
 setenv(var, value, 1);
 # endif /* linux || convex || BSD >= 199103 */
 #endif /* USESETENV */

Search Volume of Django vs Rails

Installing Sphinx on OS X

curl -O http://ftp.gnu.org/gnu/libiconv/libiconv-1.12.tar.gz
tar zxvf libiconv-1.12.tar.gz
cd libiconv-1.12
./configure –prefix=/usr/local
make
sudo make install
cd ..

curl -O http://downloads.sourceforge.net/project/expat/expat/2.0.1/expat-2.0.1.tar.gz?mirror=iweb
tar zxvf expat-2.0.1.tar.gz
cd expat-2.0.1
./configure –prefix=/usr/local
make
sudo make install
cd ..

curl -O http://www.sphinxsearch.com/downloads/sphinx-0.9.9.tar.gz
tar zxvf sphinx-0.9.8-rc2.tar.gz
cd sphinx-0.9.8-rc2
./configure –prefix=/usr/local –with-mysql=/opt/local/lib/mysql5
make
sudo make install
cd ..

Ruby on Rails and Sphinx and Thinking-Sphinx and stuff.

I’ve just set up Sphinx on Snow Leopard to use with a Rails app. There are a few kinks to work out but the end result is pretty awesome. Sphinx is an open Source highly optimized fulltext indexing engine that currently works with MySQL and Postgres and apparently even some NoSQL databases. It runs as a standalone daemon and it’s search indexing is accessed by various client libraries. There are clients for Python which I have yet to use and an interesting project for Rails called thinking-sphinx that integrates Sphinx’s indexing with Active::Record.
A few notes:

sudo gem install mysql -v 2.7

I had to downgrade the MySQL gem to 2.7 as there is a path bug in 2.8 that breaks compilation of the MySQL adapter.

The initial rake task to generate the Sphinx config file for Rails:

Quick Fix for MySQL5 on Snow Leopard

echo “export PATH=/usr/local/mysql/bin:\$PATH” >> ~/.bash_login;
sudo mkdir -p /opt/local/var/run/mysql5;
sudo ln -s /tmp/mysql.sock /opt/local/var/run/mysql5/mysqld.sock;

Of 200 comments 7 are not spam.

Time to get Captcha going…