Mountain Lion is not a big deal

Upgraded to Mac OS X Mountain Lion yesterday and it wasn’t a big deal on many fronts:

  • Using the App Store, its so simply to upgrade – Second time round and its now becoming the de facto standard for how large install-base commercial operating systems should be upgraded
  • It only costs $20 (AU$21) – Such a small price to pay to upgrade your OS X, but…
  • It isn’t a huge upgrade – Nice features and all, nice moments of joy but no wow factor. The social aspects of the OS are really baked in now and the incorporation of iOS features (like Notification Centre and Messages) show Apple’s convergence strategy coming together for the two platforms. Mind you, I was really hanging for AirPlay mirroring only to find out that my October 2010 purchase of a MacBook Pro was not compatible. You need 2011 hardware for that feature. There is always AirParrot I suppose, but now that ABC iView supports AirPlay in their iPhone app, I may be able to live without this feature until my next laptop upgrade.
  • It happens every year – Frequently making major upgrades to the OS takes the excitement, risk and price out of it. I’m starting to look forward to Christmas in July now. And like most Christmas presents nowadays, it is always well received but rarely takes my breath away.

Mountain Lion is not a big deal on many fronts and that’s the point.

Goodbye you good egg!

(I starting writing this entry on the train trip home yesterday from North Sydney to Newcastle)

Today is my last day at MLC (NAB). After nearly 9 years with the company I am pulling up stumps as my family and I make the sea change to Newcastle.

I am incredibly excited about the move to Newcastle and starting with my new company on Monday. Having said that, there has been plenty to reflect upon over the past couple of weeks. The event of leaving a company has only happened once before in my professional career. It feels profound, not so much for the legacy that I am leaving behind but more because I won’t be interacting on a regular basis with the people that I spent so much time growing and learning with over an extended period. I won’t be sharing experiences any more, working together, getting through challenges, making improvements, experimenting, laughing!

In more recent times, I was fortunate to be part of a great team led by a brilliant manager who taught me much about what it means to really lead. We implemented a step-change in the way our team operated, pushed the boundaries, shook things up, got ourselves into a bit strife every now and then, learnt heaps and came out the other side with a fantastic outcome… Hopefully a sustainable approach to doing things better.

It is also the place that I met my wife, subsequently got married, and had children – all significant life events! The same place where I got myself fit again, gained a taste (and need) for coffee and lost most of the hair on top of my head (… the kids may have a bit to do with that)!

So this is a formal goodbye, but I know we’ll stay in touch!

Getting started with Heroku and Rails 3.1


  • RVM on your local machine with Ruby 1.9.2
  • Heroku account

Switch to the 1.9.2 version of Ruby, install the rails and heroku gems, create your rails 3.1 application

$ rvm 1.9.2
$ gem install rails
$ gem install heroku
$ rails new tickets
$ cd tickets

Add in the nifty-generators gem:

gem "nifty-generators", :group => :development
$ bundle install

Generate the layout

$ rails generate nifty:layout

Now make compatible with Rails 3.1 asset pipeline (assuming this is only temporary until gem is updated for Rails 3.1)

Rename /public/stylesheets/application.css to nifty.css and move to the /app/assets/stylesheets dir
Delete /public/stylesheets
Update javascript to use “application” instead of :defaults

<%= javascript_include_tag "application" %>

Generate the scaffold for a ticket, migrate the schema, and start the server to test locally at http://localhost:3000

$ rails generate nifty:scaffold ticket name:string description:text
$ bundle exec rake db:migrate
$ rails server

Point to our tickets controller as default
Remove public/index.html
Update root route in routes.rb

root :to => 'tickets#index'

Initialise the git repository and perform first commit

$ git init
$ git add .
$ git commit -m "Initial commit"

Create the app on heroku using the cedar stack (its the only stack that currently supports Rails 3.1)

$ gem install heroku
$ heroku create --stack cedar

Notice that there is now a new remote on our git repo

$ git remote -v

Heroku uses postgresql by default, update gems

gem 'sqlite3', :group => :development
gem 'pg', :group => :production
$ bundle install

Commit changes

$ git add .
$ git commit -m "Updated database gems to cater for postgresql on Heroku"

Push app to heroku, migrate the schema on the server, and open a browser to see it running

$ git push heroku master
$ heroku run rake db:migrate
$ heroku open

Installing the custom domain Add-on

Notice that it has a unique subdomain, lets give it our own sub-domain name through the Custom Domain add-on

heroku add custom_domain
heroku domains:add

Add a CNAME record on the DNS for the preferred subdomain (note that top level domain DNS rules are different) that we want to use and now try it out!


Jump into the console and see under the covers

$ heroku run console

Wow! How cool is that! My goal now is to give up my own VPS for hosting my Rails apps. I’m thinking that it come out cheaper using Heroku.

Note: there are some limitations that you need to be aware of. For example you have limited write access to the file system so if you want your users to upload images then you need to incorporate different cloud offerings for this to work, like Amazon S3. The paperclip gem has support for this. This gives an insight in how your thinking has to change when you start to leverage cloud services and augment them together. Something to discuss further another time…

Shopify – such a compelling offering

Been thinking about the cloud of late. In particular after using Shopify which is a great example of a SaaS (software as a service) offering.  I was blown away by just how easy it is to use the Shopify offering.  The main reasons being:

  1. It is already fully integrated to other services, in particular a plethora of payment gateways.
  2. It is extremely reliable and fast – a CDN for delivering assets – nice!
  3. It has all the features that an administrator and a developer could ever want (love the TextMate integration for developing themes).
  4. It is very cost effective – seriously, $29 a month to run an e-commerce store that is fully supported and highly available, that is incredibly great value.  The amount of time and money that I would spend trying to support an open source offering on my own virtual private server is not justifiable, plus its a not a good outcome for the client.
  5. Scalable (I said it was in the cloud right?)
  6. Secure (I’m assuming – but its their liability)
  7. Always running the latest version of their software
  8. Backwards compatible – Open source projects tend to struggle in this department, but due to the point above, they truly have to backwards compatible.
  9. Agnostic – although it’s written in Ruby on Rails, the liquid tempting language is simple and non-language/platform specific
  10. Extendable – A growing app library that users can plug into their store.  This is platform software which is building an ecosystem around it – to me it says that it is going to be around for a long time too!
  11. Intregatable (is there such a word?) – Full REST API via JSON or XML.

I know that this must sound like an ad for Shopify, but it certainly has had a profound effect on me.  It’s a very polished product that has got me excited about cloud SaaS offerings in general.

Now I’m looking into Heroku as a PaaS (Platform as a Service) – so far so good!

Passenger (mod_rails) updates

When updating Passenger:

sudo gem update passenger

The second command is important as it compiles the apache 2 module (caught me out for a whiles, hence this post). Ensure that the module is properly added to your config file. (e.g. /etc/apache2/apache2.conf) by confirming its pointing to the new directory for the updated version of the gem! An example is given in the blurb one the apache2 module is compiled:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/ext/apache2/
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15
PassengerRuby /usr/bin/ruby1.8

Version controlling WordPress themes on simple hosts

Here’s a quick tip if your WordPress host is quite simple and only provides FTP access and no version control tools (svn, git) or specific syncing tools (rsync)

Use version control for the theme on your local machine (where you run your dev WordPress environment), then use syncing capability of FTP tool (Cyberduck for MacOSX has this feature) to promote the changes to your host.

Remember, version control is the only way to sensibly manage changes to your theme – editing through the WordPress theme editor on your host is a really bad way to manage it!

It’s the people, stupid!

Bill Clinton summed it up beautifully when he used the line, “It’s the economy, stupid.”

It has just become frustratingly obvious to me of late that when it comes to organisations maximising their investment in technology, a lot of their energy is misguided. In the spirit of Bill:

It’s the people, stupid!

Focus on the people first and foremost and everything else will stem from that. However, when I say focus on the people, I don’t mean make hierarchical command and control structures where everyone clearly has a place and protocol rules over productivity. Rather the approach of flat structures where the emphasis is on self-organising teams, getting things done and self-improvement.

Of course, I’m not the first person to think of this, the whole Agile movement is driven on this organisational approach.

Organisations seem to believe that the way to solve problems is based on preferencing technology first, then process, then lastly the people will fall into line. And big technology product vendors go a long way to supporting this type of thinking. Many times they’ll pitch to executives with how they can make their technical people work smarter by using their products and tools. But this often results in forcing technology upon talented technical people which will always be met with resistance and frustration. The products may make the execs feel better in the short term but will usually demoralise the people and make them feel powerless.

Reverse this approach around; focus on the people first, and STOP! Empowering people by encouraging them to collaborate and self organise has proven to raise engagement they have with the organisation. It starts to build up one of the most valuable assets that a organisation could hope for, social contracts. People will start to work out what are the most appropriate ways that they can work together. They’ll remove bottlenecks that stop them from getting things done. They’ll work out what technologies are best for the problem at hand.

People will be as stupid as you force them to be and as creative as you’ll let them be.

So why the rant? Well, its time for me to put my money where my mouth is. I’ve banged on long enough about the benefits of adopting a more Agile approach to maximising an organisation’s investment in technology. At Agile’s core is focusing on empowering people. The outcome should lead to what organisations really want – true and sustainable competitive advantage!

As of tomorrow, I’m going to step away from my technical career path and move into a more people focused direction. Time for me to really prove what I believe in, not just for myself but for the people that I work with. I want the win-win situation, the organisation wins and the people win! Here goes…

Git repositories with Slicehost

No doubt I am really happy with my Slicehost VPS, it has been so hassle free!  The best part about Slicehost is all the amazing articles they provide to help you get going with your slice.

I’ve setup my slice to host my private git repositories, particularly since I wanted to use them with Rails and Capistrano.  This article provide to be just what I needed:

The article even shows you how to secure the shell that the git user has to avoid anyone SSHing into your box with their ID.  However, it doesn’t tell you what to do when you want to create another repository as you cannot switch to the git user while ever it is using the git-shell as opposed to a normal shell.  The trick is you need to switch with the root user as only they are allowed to provide an alternative shell.  Here are the commands once you have logged into your slice with a user that is able to sudo:

$ sudo su --shell /bin/bash git
$ cd /home/git
$ mkdir project2
$ cd project2
$ git --bare init
$ exit

Now your repository is good to go and you can follow the steps from “Making your first commit” section.

Installing MySQL, Apache2, PHP, and WordPress with MacPorts

I’ve recently started working on a website project using WordPress.  I’ve got a production environment where I run this blog on my ubuntu server (VPS) hosted by slicehost.  But because I’m going to muck around with themes and plugins I decided that I’m better off doing that locally on my Mac.  So this is the first of a series of blog posts for getting WordPress up and running on my local machine.

I have macports already installed and I prefer its packages over the packages shipped with OSX.  Mostly because they are more up to date and there is more variety.  Plus it feels more native to working with my VPS.  Before we get started, lets ensure that our MacPorts is up to date:

$ sudo port selfupdate
--->  Updating the ports tree
--->  Updating MacPorts base sources using rsync
MacPorts base version 1.8.1 installed,
MacPorts base version 1.8.1 downloaded.
--->  MacPorts base is already the latest version

There will be four parts to this series:

  1. Installing MySQL
  2. Installing Apache2
  3. Installing PHP along with MySQL support
  4. Installing WordPress

I like to chunk these up rather than merge them all into one article as the temptation is to mix information together and then its harder to see where one step stops and the next one starts.  Also it means that you can look at the entries in isolation and they should still make sense.

Installing MySQL

I had a binary distribution of MySQL on machine which I needed to remove before installing the macports distro, this thread was useful as it isn’t particularly clear what to do:,75256,255851#msg-255851

The following article was my main source of inspiration, I’ve pretty much followed these steps:

Install the port and setup the mysql system database

$ sudo port install mysql5-server
$ sudo -u mysql mysql_install_db5

Setup some handy aliases in your shell

$ mate ~/.profile
alias mysqlstart='sudo /opt/local/bin/mysqld_safe5 &'
alias mysqlstop='/opt/local/bin/mysqladmin5 -u root -p shutdown'
$ source ~/.profile

Start the server and set the root password

$ mysqlstart
$ /opt/local/lib/mysql5/bin/mysqladmin -u root password 'root'
$ /opt/local/lib/mysql5/bin/mysqladmin -u root -p -h localhost password 'root'

(Not sure what this second step is for!)

Now we can use the


alias because the password has been set.

And we’re all done!

Installing Apache2

Source of inspiration for this entry is from here:

$ sudo port install apache2

Enabled virtual hosts in main config

$ sudo mate /opt/loca/apache2/conf/httpd.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Updated virtual hosts config

$ sudo mate /opt/local/apache2/conf/extra/httpd-vhosts.conf

The directory part is important as Apache 2.2 directories are by default not browsable so ensure that you enable them!

<VirtualHost *:80>
    ServerAdmin webmaster@myapp.local
    DocumentRoot "/Users/tgmcclen/workspace/myapp/htdocs/site"
    ServerName myapp.local
    ServerAlias www.myapp.local
    ErrorLog "/Users/tgmcclen/workspace/myapp/logs/error_log"
    CustomLog "/Users/tgmcclen/workspace/myapp/logs/access_log" common
    <Directory "/Users/tgmcclen/workspace/myapp/htdocs/site">
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all

Setup an alias for controlling apache and start

$ mate ~/.profile
alias apache2ctl='sudo /opt/local/apache2/bin/apachectl'
$ source ~/.profile
$ apache2ctl start

Add an entry in the hosts file for the virtual host

$ mate /etc/hosts myapp.local

Now place files in the


directory and browse to them in a browser:


Installing PHP along with MySQL support

$ sudo port install php5 +apache2 +pear
Note: php5 installs files outside the common directory structure.
--->  Installing php5 @5.3.0_3+apache2+darwin_10+macosx+mysql5+pear+sqlite
--->  Activating php5 @5.3.0_3+apache2+darwin_10+macosx+mysql5+pear+sqlite
To customize php, copy
/opt/local/etc/php5/php.ini-development (if this is a development server) or
/opt/local/etc/php5/php.ini-production (if this is a production server) to
/opt/local/etc/php5/php.ini and then make changes.
$ sudo cp /opt/local/etc/php5/php.ini-development /opt/local/etc/php5/php.ini

Now enable PHP module with apache2

$ cd /opt/local/apache2/modules
$ sudo /opt/local/apache2/bin/apxs -a -e -n "php5"

and add directives for




in the virtual host entry:

<VirtualHost *:80>
    ServerAdmin webmaster@myapp.local
    DocumentRoot "/Users/tgmcclen/workspace/myapp/htdocs"
    ServerName myapp.local
    ServerAlias www.myapp.local
    ErrorLog "/Users/tgmcclen/workspace/myapp/logs/error_log"
    CustomLog "/Users/tgmcclen/workspace/myapp/logs/access_log" common
    <Directory "/Users/tgmcclen/workspace/myapp/htdocs">
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    <IfModule mime_module>
      AddType application/x-httpd-php .php
      AddType application/x-httpd-php-source .phps
    <IfModule dir_module>
        DirectoryIndex index.html index.php

And then restart Apache to get going…

$ apache2ctl restart

Installing MySQL support for PHP

$ sudo port install php5-mysql
--->  Computing dependencies for php5-mysql
--->  Fetching php5-mysql
--->  Verifying checksum(s) for php5-mysql
--->  Extracting php5-mysql
--->  Configuring php5-mysql
--->  Building php5-mysql
--->  Staging php5-mysql into destroot
--->  Installing php5-mysql @5.3.0_0+mysqlnd
To use mysqlnd with a local MySQL server, edit /opt/local/etc/php5/php.ini and set
mysql.default_socket, mysqli.default_socket and pdo_mysql.default_socket
to /opt/local/var/run/mysql5/mysqld.sock
--->  Activating php5-mysql @5.3.0_0+mysqlnd
--->  Cleaning php5-mysql
$ sudo mate /opt/local/etc/php5/php.ini
; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /opt/local/var/run/mysql5/mysqld.sock

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysqli.default_socket = /opt/local/var/run/mysql5/mysqld.sock

Installing WordPress

Inspiration for instructions from here:

Inside your



$ svn co .

(Latest tag will in URL on page, otherwise just browse to tags dir in folder to determine)

Create the database in MySQL

$ /opt/local/bin/mysql5 -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.40 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql&gt; CREATE DATABASE mydb;
Query OK, 1 row affected (0.05 sec)

mysql&gt; GRANT ALL PRIVILEGES ON myname.* TO "mydb"@"localhost" IDENTIFIED BY "mypassword";
Query OK, 0 rows affected (0.58 sec)

Query OK, 0 rows affected (0.00 sec)

mysql&gt; EXIT

Now setup configuration

$ cp wp-config-sample.php wp-config.php
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'mydb');

/** MySQL database username */
define('DB_USER', 'myname');

/** MySQL database password */
define('DB_PASSWORD', 'mypassword');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */

Open a browser and continue the install:


You’ll most likely notice that you’re getting lots of errors and warnings on the pages, these can be turned off:

$ sudo mate /opt/local/etc/php5/php.ini
; Default Value: On
; Development Value: On
; Production Value: Off
display_errors = Off
$ apache2ctl restart

Now you’re good to WordPress away!

Making your Rails app work on Java

So you’ve written a Rails app and you want to show it off to your boss at work because you know that it will impress them. Problem is that your company only uses Java and won’t consider it for their production environment if it can’t be deployed under a JVM. Let’s go:

  1. Install JRuby
  2. Install the required gems for Ruby on Rails to work with JRuby
  3. jgem install mongrel activerecord-jdbcsqlite3-adapter rails
  4. Install the gems particular to your application
  5. jruby -S rake gems:install
  6. Update your database.xml file, prefixing your adapter with jdbc
  7. development:
      adapter: jdbcsqlite3
      database: db/development.sqlite3
      pool: 5
      timeout: 5000
  8. Start your JVM
  9. jruby script/server
  10. Demonstrate
  11. Sit back and wait for promotion

Some notes on whats going on above: