Update: There is a new effort to create a decent Windows Ruby installer. You can get the new downloadable installers from http://rubyinstaller.org/ though as of August 2009 these are still in preview form. It seems from my brief experiment that you'll still have to set your PATH manually, as per my manual instructions below. This installer also promises a faster Ruby as it builds using superior tools, so might well be worthwhile if only for that. Below are my original manual instructions for installing Ruby on Windows, which should still be just as valid as they always were. The installer is probably worth a look though.
The following worked for me on Windows XP, but maybe I'm yet to run into problems I don't know I've got:
- Download the Windows binary release from http://www.ruby-lang.org/en/downloads/
- Unzip it, in my case to C:\ruby191\
- Also download readline.dll (e.g. from http://www.econsultant.com/dll-database-r/readline.dll-download.html) and put the DLL in C:\ruby191\bin
- Put C:\ruby191\bin and C:\ruby191\lib on your PATH
That got ruby working in a basic sense for me, but I wasn't able to install gems. If I tried, I got two errors in sequence: "The ordinal 277 could not be located in the dynamic link library SSLEAY32.dll" and "This application has failed to start because zlib.dll was not found."
The ssleay32.dll problem was solved by getting hold of a couple of DLLs and putting them in the right place, as follows:
- Download "Win32 OpenSSL v0.9.8k Light" from http://www.slproweb.com/products/Win32OpenSSL.html.
- Run the installer, but take note of the following:
- You can ignore any initial warning about not having Microsoft Visual C++ 2008 Redistributables.
- You can ignore any warnings about command prompts being open.
- Install to somewhere like C:\OpenSSL – it doesn't really matter, we just need a couple of DLLs.
- When prompted, choose to Copy OpenSSL DLLS to The OpenSSL binaries (/bin) directory.
- Once the installer has completed, you can go to C:\OpenSSL\bin (or wherever you installed it) and copy the two files ssleay32.dll and libeay32.dll to your Ruby bin directory, C:\ruby191\bin in my case.
The zlib.dll problem was solved by in much the same way:
- Download the compiled zlib 1.2.3 DLL from http://www.zlib.net/ (about two thirds of the way down the page).
- Unzip it to get the zlib1.dll file.
- Put that file in your Ruby bin directory, but rename it to zlib.dll
Et voila – gems can now be installed successfully! Note that you may have had copies of some of these DLLs in your \WINDOWS\system32 directory already (I certainly did) but the problem is that they are too old. I prefer to put the newer ones directly in the Ruby bin directory, so only Ruby picks them up and it can't break anything else on the system.
Rather mysteriously, my bluetooth mouse suddenly stopped responding with no warning. I assumed it was duff batteries, though I'd normally get a warning a good while before they conk out completely. Changed them, but still no dice. I attached a wired mouse and did some digging – basically Bluetooth no longer seemed to exist on my Mac! The menubar widget claimed bluetooth was 'not available' and the System Preferences Panel said similar. Restarting didn't help – in fact it made the menubar widget and System Preferences Panel disappear entirely!
- sudo mv /var/root/Library/Preferences/blued.plist ~/Desktop/
At the same time I shutdown the computer, removed all attached cables, opened it up and pressed the PMU/SMC reset button down near the RAM (this is a PowerMac G5 tower) then restarted. It seems to be OK for now. It did mean the clock resetting to 1970 and me having to wait for all my iCal notifications to stream in once I'd reset to 2009.
I've been experimenting with Ruby 1.9.1 and trying to make it my natural home recently. Crucial to that was getting the mysql gem installed. Actually it's fairly straightforward with the 2.8.1 version of the gem and only very minor mods to the official instructions at http://www.tmtm.org/en/mysql/ruby/ were required.
- Downloaded 2.8.1 source tgz from RubyForge, linked from http://www.tmtm.org/en/mysql/ruby/ downloads section.
- Expanded the tgz with Finder, then opened a command prompt…
- > cd mysql-ruby-2.8.1
- > ruby extconf.rb –with-mysql-config=/usr/local/mysql/bin/mysql_config -with-mysql-dir=/usr/local/mysql
- > make
- > sudo make install
I advise every programmer out there to read lots of other people’s code. Pick an open source project that you’re a fan of (and perhaps use every day), download the source and then sit and try and figure out how it works. You may find the following things:
- It’s interesting to see how other people write code, from their specific syntactic style to the level of commenting, overall design and code layout, common idioms etc. You’ll probably learn something – either good things that you can copy, or bad things that are tough to read and warn you off doing the same.
- You may find the code frustrating and difficult to figure out, not only initially but no matter who long you work through it, though if that’s the case then it’s probably poor code. Hopefully that will influence how you write your own code, for the better.
- If it is a product that you use regularly, you may gain insights into what it’s really doing and how, that empower you to use it more effectively. You may even be able to modify it to make some improvement that matters to you.
- Once you’ve got past the initial difficulty and started to understand things, you acquire a sense of power. No longer are these complicated pieces of software opaque and mysterious. They can be broken down, understood and messed with. A whole world of possibilities opens up and you no longer need to be afraid.
I’ve recently been reading the Ruby source code of Innate – the new underpinnings of next generation Ramaze, a Ruby web app framework that I particularly enjoy using. Innate is built on top of Rack, so I’ve been reading that too. The mystery is ebbing away and it’s making me more powerful. Stand back! 🙂
It's easy to just pull out the big non-stick half-wok half-frying pan thing for most meals that involve frying anything (especially if you're going to add liquid later as its high sides mean a good overall capacity), but it's not always best. A good stainless steel thick-bottomed frying pan has some important qualities that you're missing out on. In particular you'll be missing out on building a layer of tasty brown fried-on stuff as you do your onions and meat, which you can then de-glaze into the sauce as you add liquid. In a non-stick pan that just doesn't really happen.
We got a great deal on a set of Prestige stainless steel cookware a couple of years back and it's been a real eye opener. My biggest worry was that it would be a complete pain to wash up, but this really isn't the case at all. Generally things don't stick much anyway, and a short soak soon sorts out even the worst offence. And they look dead professional 🙂
One of the things in Cornwall that you have to visit by law is the Eden Project. It's quite pricey to get in (notably more than the Lost Gardens of Heligan for instance) and dare I say that rankled a bit. It's reputation precedes it, so it had a lot to live up to. To be honest it fell a little short, but that might be because we'd been to Heligan just two days before which had set a high bar, and our expectation were a bit unrealistically set from all the media coverage that it gets.
I've always struggled to tell the difference between Rook, Crow and Raven, though I've had Jackdaws sorted for years (notably smaller – black cap above more slightly silvery head and neck). To remedy this situation I've really been trying to get to grips with the differences and positively identify large black birds over recent months. Here's what I'm fairly sure is a rook, on a feeder at the Lost Gardens of Heligan in Cornwall.