Compiling Mysql Gem on Mac OS X 10.6

Is not that easy to get hooked up and working (well it wasn’t for me)…

So in an effort to save you a hunt around google follow these steps:

  1. Download the 64 bit version of Mysql and install
  2. You may need to update your PATH variable with the location of mysql, on my machine its /usr/local/mysql-5.1.40-osx10.5-x86_64/
  3. And then follow this command to compile the mysql gem: export ARCHFLAGS=”-arch i386 -arch x86_64″ ; sudo gem install –no-rdoc –no-ri mysql — –with-mysql-dir=/usr/local/mysql/lib –with-mysql-config=/usr/local/mysql/bin/mysql_config

You’ve hopefully arrived at a working mysql gem.

Good Luck!

Responsive Design

Just been reading an interesting article by Kent Beck in this months Pragprog over at Pragmatic Programmers

http://pragprog.com/magazines/download/3.pdf

The temptation is to put these design ideas in the system now because you just know you’ll need them eventually. Over-designing early leads to delaying feedback from real usage of the system, makes adding features more complicated, and makes adapting the design more difficult. By the same token, under-designing makes adding features more complicated, increases defects, and makes adapting the design more difficult.

Secure Copy How to

Heres a rough and ready introduction to using the power of SSH to perform a secure copy of a file or directory between computers.

> scp 

usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
           [-l limit] [-o ssh_option] [-P port] [-S program]
           [[user@]host1:]file1 [...] [[user@]host2:]file2

So how does this matter for me well if you wanted to move a file from a server called Mojo.com to a server called Louis.com you’d enter

> scp file.txt my_login_name@louis.com:remote_directory

or if I want to copy a folder:

> scp -r my_login_name@louis.com:remote_directory my_files

Hope this helps.

By the way for those on Windows Penguinet has scp built in with a nice looking file browser/selection UI.

Rails localisation bug

I’ve just gone through the challenge of working out what was wrong with the following piece of code:

<% form_tag :controller => '/' do %>
				<%= t(:'txt.language') %> <%= select_tag("locale", options_for_select(LOCALES_AVAILABLE, I18n.locale), { :index => nil, :o nchange => 'this.form.submit()'}) %>
			<% end %>

Our client reported that on a signup page where they choose an alternative language it got redirected and they could never reach the page in their native language.

How can this happen you might ask?

Well the request includes some values within the url which are used as a key. Only if the key is valid is the controller allowed to complete the request. The issue is the combining of maintaining the key and switching the language.

As it happens its a very simple fix and was pointed out to me by Juliana.

<% form_tag :controller => request.request_uri do %>
				<%= t(:'txt.language') %> <%= select_tag("locale", options_for_select(LOCALES_AVAILABLE, I18n.locale), { :index => nil, :o nchange => 'this.form.submit()'}) %>
			<% end %>

In this fixed second example the alteration for the controller has been updated to direct the language selector to the controller of the current page. The documentation for this suggests that its broken on IIS (really should you be even trying to use this?) in fact I found that the source has had a significant amount of work go into it to work around the issue and even make it work on that webserver. Its a great little solution to ensure that the reloaded page is returned to the user in the state it was with the addition of the correct language.

How do I ask Apple to fix this?

Rough Cut: Should I create a song perhaps?

Oh OK perhaps not, since I have absolutely nothing to complain about really. But I would add that perhaps it would be very nice if someone in Apple could try using this interface to traverse massive playlists? With all that spare space around the panel surely it would be trivial to make the selection window bigger?

ITunes - Add Music to iPod/iPhone interface

Just a thought?

SSH – How to proxy connections

Rough Cut: Recently I’ve been in the situation where I need to SSH to a server which I can only reach from a particular location. And of course I’m not always in that location when I need to get into the server.

No problem installing the excellent Dante SSH Socks proxy server allows me to configure my client (the excellent penguinet) to pass all ssh connections to the proxy server.

By following the installation and configuration guide at http://wiki.kartbuilding.net/index.php/Dante_Socks_Server I had the issue resolved inside of 5mins.