multi-language text field

Today I asked in #rubyonrails: How can I have a model with a text field and have that text field in multiple languages? Epic thanks to Radar for the answer: http://frozenplague.net/2009/11/scoping-by-locales/

Old stuff?

Just looking through some old blog posts and GitHub archives this evening… and came across SettingsLogic. Now, the guy that wrote this has done some awesome stuff such as SearchLogic and others. SettingsLogic looks pretty similar to my original AppConfig way of doing things, which I like. What I still want, however, is a database-driven … Continue Reading

I had to giggle…

Sorting Multidimensional Arrays

For future reference really: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Controller::loadModel(’Student’); $students = array(); foreach ($courseStudents as $crsstd) { $students[] = array($crsstd, $this->Student->find(’first’, array(’conditions’ => array(’Student.id’ => $crsstd[’student_id’])))); }   function compare($x, $y) { if ( $x[1][’Student’][’lastName’] == $y[1][’Student’][’lastName’] ) return 0; else if ( … Continue Reading

Why I love testing…

test “suicide” do   user = users(:steve)   assert !user.has_life?   assert user.destroy end

CSS colour chart

For reference, a Nice simple CSS Color Chart Takes a little while to scroll down the page, but I like the fact that its very easy to see the colours and that each one is named (even though it is such as gray1,gray2,etc)

Python script to log dhcp leases

Thought I would share this. It is called from DNSMasq in the dnsmasq.conf file: dhcp-script=/home/nate/logdhcp.py enjoy #!/usr/bin/env python import sys, string, array appendLine=1 if sys.argv[4]: f=open(‘/home/nate/dhcplog’, ‘r’) lineArray=f.readlines() for line in f: lineArray.append(line) for line in lineArray: if line == (string.join(sys.argv[1:])+”\n”): appendLine=0 f.close() if appendLine==1: f=open(‘/home/nate/dhcplog’, ‘a’) f.write(string.join(sys.argv[1:])+”\n”) f.close()

IPv6 howto

As Promised, a simple IPv6 howto. So far it is only for windows systems, as that is what I have been using to test on at polytech, but I will add one for Linux as soon as I work out how to get it running on Ubuntu (it hasn’t been working atm, any help would … Continue Reading

Basic Apache Virtual Host Config File

NameVirtualHost example.com <VirtualHost *:80> ServerName example.com ServerAlias www.example.com DocumentRoot /var/www/www.example.com <Directory /var/www/www.example.com> Options FollowSymLinks AllowOverride None </Directory> DirectoryIndex index.php </VirtualHost>