Thursday 12 March 2009

Newbie guide to setting up a 2.3 rails app with HAML

These are the commands I used to install Rails 2.3 and set up an app with rspec_haml_scaffold.
This assumes you have Ruby and Git installed.

Install rails:

gem install rails --source http://gems.rubyonrails.org
Create your app and cd to it:
rails myapp
cd myapp
Install the plugin
script/plugin install --source git://github.com/dfischer/rspec-haml-scaffold-generator.git
Configure the rails plugin for your app
haml --rails .

Now you can go ahead and new the scaffolding feature to create all the usuall models and controllers but the neat part is, it creates views in HAML.

For Example:
script/generate rspec_haml_scaffold User Email:string Password:string Username:string FirstName:string LastName:string

Resizing Windows Virtual Machine Disks

Here's how I resized my Windows VM's disk from 18GB to 20GB without having to fork out $$$ for partition magic. This should work with ESX Server 2.5 and 3.0 - It also doesn't matter if this is for a Windows Boot partition or not.

Step 1) Power off Virtual Machine

Step 2) Resize the virtual disk of the virtual machine by going to the console of the VMware node and typing the following command: vmkfstools -X xxxxxxM yyyyyy - Note change xxxxxx with whatever size you want it to be. Remember the "M" on the end. And change yyyyyy.vmdk to the virtual disk you want to resize.

Step 3) Power up the virtual machine

Step 4) Go to command prompt type "chkdsk" - This is critical - it may cause issues if you skip this step.

Step 5) Download the latest LiveCD of gParted here

Step 6) Mount the downloaded ISO as the CD-Rom of the Virtual Machine. You can mount the ISO directly or burn it to CD then mount the CD-Rom to the Virtual Machine.

Step 7) Restart the virtual machine and boot from the CD. (You may have to hit ESC to bring up the boot menu.

Step 8) Choose your Language and Keyboard Layout (Note, UK keyboard layout is down the bottom)

Step 9) Highlight "Manual Video Card" and hit Enter then go to "Skip Extra Boot Options" and hit enter.

Step 10) Choose "vesa" as your video driver

Step 11) Click the partition you want to resize (the red arrow) then click "Resize/Move"

Step 12) You can now drag the black arrow all the way to the right to resize your partition.

Step 13) Click Apply

Step 14) Click Close when completed

Step 15) Click the power off button down the bottom right, choose "Reboot" and click "OK"

That should do it!