If you’re reading this, then you’re probably aware of Twitter’s Bootstrap – an awesome way to save yourself hours of knee-deep CSS & layout hell.
Integrating this with Ruby on Rails 3.1+ is reasonably trivial (ie, stick the files in the right places) – there are plenty of other HOWTOs online so I won’t cover it here. What is more difficult however, is getting the forms to style properly, even more so when your form is reloaded with validation errors. Rails encapsulates errored inputs (and labels) with
which completely shags up any pretty layout you might have had.
Enter jamiepenney’s Form Builder for Twitter Bootstrap 2 Form Elements. Not only does it save you shedloads of HTML hackery, by reducing this:
<%= f.label :year, :class => "control-label" %>
<%= f.text_field :year, :class => "input-xlarge span1", :type => "text" %>
but it also uses Nokogiri calls to destroy and stamp viciously on all of the hideous “field_with_error” divs. Awesomes.
Hello pretty Bootstrap forms. 8=)
My company provides remote access to its staff via Citrix. If you’re a Windows person, then the install for this is pretty straight forward and it “just works” (shame nothing else in Windows does, but hey-ho!). If you’re a Linux person (like me) then you need to fiddle a bit before you’ll be able to use the Citrix client software.
So…here’s how I got it working. Firstly, you need to download the Citrix Receiver. As we’re using Ubuntu, get the .deb version from here.
Open up a terminal and navigate to your download location (probably ~/Downloads), then run:
You’ll see a text-mode license page, accept that unless you really do disagree (how do you ever get anything installed?!). You should then be dropped back to your terminal window.
Next, you need to copy all of the certificates from Firefox into the Citrix Receiver directory. This prevents weird SSL errors when you try and connect to your company’s Citrix setup:
Note that the Citrix Receiver location has moved since version 11 – it used to live in /usr/share/Citrix/…
Next we need to install a few dependencies:
And that should be it. Enjoy working from home!
NB: My company allows me to access to my office PC by exposing the Microsoft Remote Desktop Client over Citrix. I’ve seen weird mouse pointer alignment errors once I get connected to my desktop – if you see this then try setting the Gnome task bar to “auto hide”.
[EDIT 21/3/2012]: I’ve updated this guide to cover the latest version of the Redmine TKLPatch I’ve produced.
I’ve recently discovered Turnkey Linux – they make tonnes of cool VM appliances and distribute them for free. As I’ve recently bought an HP Microserver (and installed VMWare ESXi!), their appliances provide nerds like me something to load up and play around with.
One particular VM that I’ve been using in angst is the Turnkey Linux Redmine VM – I’m currently working on a project that requires “proper” project management, and this is the perfect tool to do it. However, as Redmine itself is quite young, the version of Redmine contained within the VM is really out of date due to the fast development cycles of Redmine.
Enter the TKLPatch!
By far the easiest way to apply the patch is to pull it straight from my GitHub repo straight onto your Turnkey Redmine VM. Instructions can be found in the TKLPatch-Redmine repo.
If you’d rather download and apply it manually, read on…
The Turnkey guys make it really easy to distribute updates to their VMs, using a set of cleverly strung together Python scripts. Here’s how.
Log into your VM via ssh, then update the apt indexes:
Get the patch from here:
Then you should be done. Hit up your Redmine URL and hope that it works
The ReadyNAS Duo is an awesome piece of kit. However, it would appear that Netgear seem unwilling to provide the means to back up to any other offsite storage provider other than to their own “ReadyVault” product – which is a- expensive, and b- pretty naff.
If you want to run a backup to Amazon S3 or something similar, then you’ll need Duplicity – here’s how to get it installed.
NOTE: This guide assumes basic knowledge of installing addons to the ReadyNAS via FrontView, as well as basic Linux command line jiggery pokery. If either of these two things scare you, this guide probably isn’t for you.
ALSO NOTE: By following this guide you’re frigging with the guts of your ReadyNAS. If you follow it line by line, you should be fine. However, if something does go wrong – it ain’t my fault! That said, I am nice, so post in the comments and I’ll try and help you out.
ONE LAST NOTE: I have the older ReadyNAS Duo based on Sparc architecture. These instructions should work ok for the newer i386 based ReadyNAS, but I’ve not got one to test it on. Feel free to add notes in the comments if you spot anything and I’ll incorporate it into the guide.
Boring stuff out the way, let’s get cracking.
Enable SSH access to your ReadyNAS
Do it by installing this addon: http://www.readynas.com/download/addons/4.00/EnableRootSSH_1.0.bin
Apt is a package installer for Linux that automatically works out dependencies of packages you ask it to install. http://www.readynas.com/download/addons/4.00/APT_1.0.bin
Log into the NAS via SSH
If you’re using Windows, get Putty, or from a Linux box:
The password will be the same as your FrontView admin password.
Time to start installing some stuff
Duplicity requires Python (an uber powerful scripting language) which annoyingly is so completely out of date in the ReadyNAS apt repository that we can’t use it and need to compile it from source. First we need to update apt’s library of packages:
Then install the first round of dependencies:
and some more:
and finally one more:
If any any time apt says “I also need to install <blah> then go along with it. It knows what it’s doing.
We need somewhere to store Python’s sources:
then change to our new directory:
Now get Python:
Unzip and untar it:
tar xf Python-2.5.2.tar
Change to the directory that’s been created:
Now we’re on to compiling Python:
Now kick off this next step and make yourself a cup of coffee – it takes about 30 minutes!
This also takes a good 20 mins or so:
If everything went ok, you now have Python installed on your ReadyNAS. Awesomes!
Now we can move on to installing Duplicity, which thankfully, takes a lot less time than Python. We need gnupg, which handles encryption:
As before, accept any dependencies required.
Now change back to our src directory, then let’s get Duplicity to install. At the time of writing, Duplicity 0.6.13 was the most recent. We’re hardcore now, so we’ll download this and compile from source too:
wget http://code.launchpad.net/duplicity/0.6-series/0.6.13/+download/duplicity-0.6.13.tar.gz --no-check-certificate
Now untar and change to the directory created:
Now let’s kick off the Python installer:
Assuming everything went to plan, Duplicity is now installed on the ReadyNAS. Let’s check:
To hook up with Amazon S3, Duplicity requires ‘Boto‘. The latest version doesn’t work with Duplicity 0.6.13, so we’re getting a slightly older one here:
Now untar and change to the directory created:
As with Duplicity, kick off the installer:
To get some extra-useful data size info from S3, we’ll need s3cmd. You install it much the same way as Duplicity and Boto:
python setup.py install
You then need to configure s3cmd. It’s pretty straight forward, and mostly just a case of following the prompts. I’d recommend overriding the default of not (!) using SSL and most definitely enable it.
And that’s it. My next post will concentrate on setting up a Duplicity based backup script to allow us to back up from the ReadyNAS straight to Amazon S3. Stay tuned!
I’ve been hacking around with a bit of Ruby on Rails using Ubuntu Linux. Today I was stupid enough to try setting up RoR on my Windows XP box.
I can confirm that it is possible, but a right PITA! Hopefully this guide won’t need to change too much as all of the versions off downloaded apps are specific and not “get the newest one”.
- If you’re behind a web proxy, start by setting your HTTP_PROXY environment variable. It should be in a full URL format, ie SET HTTP_PROXY=http://daves-proxy.com:8080
- Download Ruby. You need version 1.8.7 (yes, I know this is an old version) as various bits won’t install using Ruby 1.9.2. Choose to add the Ruby executables to your path. If you don’t know what this means, just do it.
- Download the Ruby DevKit from this page and unpack it to a subfolder called “devkit” within your Ruby folder, so probably c:\ruby187\devkit. For some bizarre reason, some gems need this to install, so do this now to save yourself a headache later on.
- Download RubyGems. RubyGems is your package installer for Ruby, a bit like Perl’s ppk. Again, you need an old version to make everything work nicely, hence the link to version 1.6.2. Extract it, then run “ruby setup.rb”
- Now you need to install Rails – run “gem install rails”
- SQLite is great for development purposes – annoyingly you need a specific version of it to work properly (3.7.3). Download SQLite v3.7.3 here, then extract it to your Ruby bin folder, probably something like c:\ruby187\bin if you accepted the default when installing Ruby.
- Change to your development folder then type “rails new my_app”. If all is ok you’ll see it create an application skeleton.
- Change into the my_app subfolder, and type “bundle install”. This ensures you have all the gems installed for the app you’ve just created.
- Run “rails server” – this fires up the development webserver. Assuming no errors…..
- Navigate to http://localhost:3000 – if you see a congratulations page – you’re good to start developing!
It’s the same old story, you buy a computer and within a year you need more storage/RAM/juice to run the latest software. It’s the same for the HTC Desire, released in February 2010 it was pretty much THE phone that really got Android in front of people’s faces and into their pockets. Now that Android use has ballooned exponentially, unfortunately so has device requirements, so you may find yourself with that annoying “Low Disk Space” notification icon more frequently than you’d like.
Fortunately, there is something you can do to extend the life of your beloved HTC Desire, and ensure that your fellow Desirees (I just made that up) coo with space-restricted envy.
- You need to be rooted; this involves giving yourself “full” access to your phone, rather than the restricted user access you have as standard. If you’re wondering what this means, this step by step may not be for you, Google it and see if you fancy giving it a go. Otherwise, have a read of this, and come back here when you’re done. I’d strongly recommend using Cyanogenmod as your Android build of choice, specifically version 7.
- Next, you’re going to replace the bootloader on your phone; think of this as the piece of software that fires up the Android OS. It also controls the partition sizes in android and stops you fiddling with them from within the OS. The main partitions we care about are system (where the OS is stored), data (unsurprisingly where your data is stored, ie apps, email) and cache (where market downloads, OTA updates and other stuff is stored). As standard on an HTC Desire, they are 250mb, 147mb, and 70mb respectively. Cyanogenmod is about 80mb and installs into system. You’ve rooted, so you won’t be downloading OTA updates, leaving a load of redundant space in cache. Are you seeing a potential gain here yet?
- Go to http://alpharev.nl. Alpharev is a custom bootloader that allows you to do clever things like fiddle with the partition sizes – we’re going to do this to pull all of that redundant space into the data partition, giving us loads of space to install lots more juicy apps. Download his utility and follow the instructions to get the custom bootloader onto your phone. Your Desire is now S-OFF – Security OFF, ie, you can fiddle with the partition sizes to your heart’s content.
- Now do a nandroid backup – you do this from the recovery image that you installed when you rooted your phone.
- Install the Android SDK
- Download the relevant HBOOT image file from Alpharev for the rom you flashed when you rooted. If you used Cyanogenmod 7 as I suggested, get the HBOOT for “Bravo CM7″ (the Desire was codenamed the HTC Bravo)
- Follow the instructions on Alpharev to flash the HBOOT relevant to your rom. Specifically, make sure you run an md5sum against the file you downloaded. If this file is dodgy, you will turn your phone into an expensive paperweight! The commands mentioned in the instructions should be executed against your phone using adb (from the Android SDK). The method that negates the use of a PC didn’t work for me.
- Once flashed, boot into your bootloader, and do a nandroid advanced restore. Restore the System and Data partitions only, and you’re done. Say hello to 302mb data space!!
I’ve been running my HTC Desire like this for a few months now, and I have to say, it’s given the phone the extra bit of storage it needed to make it useful once again.
NB: If you brick your phone, don’t blame me, you’re doing this at your own risk!
So…I’m finally taking the time to get stuck into Ruby. I’ve even ditched Windows on all of my PCs in favour of Ubuntu – getting Ruby running on Windows was just too much of a ballache for my liking!
Anyway…Ruby installation seems to have been made a lot easier by using RVM – it allows you to compile and use multiple version of Ruby at the same time.
I found an awesome blog post by Ryan Bigg about how to get it (RVM) and Ruby set up in Ubuntu 10.10 – have a read of it yourself here.
OK…so I HATE running. Most of the time.
More recently however, I’ve started to actually enjoy the feeling that my lungs are going to explode and my legs are going to give way underneath me. There’s something quite satisfying in succeeding in making your body do something it really doesn’t want to!
Today was a bit of a momentous occasion for me, I ran the furthest I’ve ever run without stopping (7.2k). It wasn’t at bionic man speeds, but it was still respectable nonetheless.
Here’s the route:
View Ware River Run in a larger map
Roll on the next longest run