Install ruby 2.0.0, rails 4.0.0 with rbenv on Ubuntu 12.04 LTS

I use rbenv instead of rvm siimply because rails recommended it.  If you had set up rails/ruby/rvm on your machine before, remember to uninstall them first.

To uninstall ruby

$ sudo apt-get remove ruby

To uninstall rvm

$ rvm implode

also remember to clear rvm reference in .profile .bashrc .bash_profile (hope I don’t miss any).

Let’s get started, assuming git is installed.

Update your ubuntu

$ sudo apt-get update
$ sudo apt-get upgrade

Install common libraries: (though I’m not sure whether all are necessary)

$ sudo apt-get install build-essential libreadline-dev libssl-dev zlib1g-dev libxml2-dev libxslt-dev

Install javascript runtime

$ sudo apt-add-repository -y ppa:chris-lea/node.js
$ sudo apt-get -y update
$ sudo apt-get -y install nodejs

Install rbenv

$ git clone ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile
$ echo 'eval "$(rbenv init -)"' >> ~/.profile
$ exec $SHELL -l$ source ~/.profile

check rbenv

$ rbenv

Install ruby-build

$ git clone ~/.rbenv/plugins/ruby-build

Install ruby

$ rbenv install 2.0.0-p247
$ rbenv global 2.0.0-p247
$ rbenv rehash

check ruby

$ ruby -v

Install rails

$ gem install rails --version 4.0.0 --no-ri --no-rdoc
$ rbenv rehash

check rails

$ rails -v

Credit:  I want to thank Tim Abell as I borrow his steps from installing rails. I spent quite sometime on figuring out to use the rbenv rehash after gem install rails. You can check Tim’s post at:


Use Gsyncit to sync Outlook 2010 calendar to Google calendar, then on every mobile devices

Wanted to sync my company calendar on Outlook 2010 to Google calendar for a long time, as if I can do that, then I can centralised all my calendars scattered in my work and home PC, iOS devices and Android devices in one place, and then change and view on all devices.

Previously I cannot do that since the outlook calendar is stored on my work PC which is local so cannot be accessed via Exchange in Google.

Gsyncit is a paid app but allow user to use its unpaid version to sync one outlook calendar to one Google calendar in two ways, which is quite enough for me.

Now I get what I want, feels good~

Enable multiple google calendar’s on iPhone5

Using Safari on iPhone and go to: , sign in your google account.
“Manage devices” page will show and devices you’ve synched with google are listed.  
Select iPhone in my case, check the calendars to be synced in the following page.  Save to confirm changes.
Wait for several minutes for it to sync.  
Go back to iOS calendar, click on “Calendars” at the top left, the checked google calendars should show, otherwise, click the “update” button at the bottom left and try later.  They will be there.   

Install Tracmor on LAMP (ubuntu 12.04 LTS)

1. Install ubuntu 12.04

2. Install LAMP, ref:

$ sudo apt-get install tasksel
$ sudo tasksel install lamp-server

3. Configure LAMP, ref:

$ sudo usermod -a -G www-data 
$ sudo chgrp -R www-data /var/www
$ sudo chmod -R g+w /var/www

log out and log in to reflect changes, also install the extra


$ sudo apt-get install php5-curl

Mod rewrite:

$ sudo a2enmod rewrite

GD2 Graphics Lib:

$ sudo apt-get install php5-gd


$ sudo apt-get install php5-xsl

4. download Tracmor from Github, extract the file to /var/www

5. open MySQL, create database ‘tracmor’ source ‘create.sql’ and ‘data.sql’ in folder /data_model

6. setup in folder /includes, ref: INSTALL in tracmor folder.

Remember to put ‘/var/www’ in __DOC_ROOT__ , and put ‘/<tracmor folder name>  in __SUBDIRECTORY__.

change // Location of tmp directory as DEFINE(‘__TRACMOR_TMP__’, __SUBDIRECTORY__ . ‘/tmp’);

Useful Command:

Restart Apache

$ sudo service apache2 restart

Trouble Shooting

1. If there’s something wrong about PHP, reinstall PHP 5

$ sudo apt-get install libapache2-mod-php5

Enable this module by doing

$ sudo a2enmod php5

2. If you have this error

apache2: Could not determine the server’s fully qualified domain name, using for ServerName

then use a text editor such as “sudo nano” at the command line to create a new file,

$ sudo nano /etc/apache2/conf.d/fqdn

then add

ServerName localhost

to the file and save. This can all be done in a single command with the following:

$ echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn

3. If you happen to encounter this error after signing out

dir(/tmp,/tmp) [function.dir]: The system cannot find the file specified. (code: 2)

add this line to the file “” in folder /includes/:

QFileFormStateHandler::$StatePath = "your path to/Tracmor";