The Martian Principles for Successful Enterprise Systems

I’ve just finished reading a little gem of a book. It’s called ‘The Martian Principles for Successful Enterprise Systems’ with a subtitle of ’20 Lessons Learned from NASA’s Mars Exploration Rover Mission’. The author is Ronald Mak.

Imagine designing an information retrieval, indexing and presentation system for the two Mars rover vehicles that were sent on a one-way reconnaissance mission to Mars for a three month mission. The feisty little vehicles kept going for two years and the information systems had to be designed to cope with this unexpected project over-run.

The book runs to 168 pages and is a ‘should-read’ for anybody involved in designing or buying large-scale enterprise software. From an architect’s perspective, you get a reinforced mental checklist of the aspects of your designs that make them work and ensure they keep working long after you’ve moved on. From a customer’s perspective, you gain an appreciation of the effort put into designing such systems. From a developer’s perspective, now you know why you spend so much time writing and executing unit tests.

The book has short and well directed chapters and is an easy read with coverage of both the technical side of software development and the soft or human side.

As a result of this read, I went back to enhance some application logging classes that I’ve used on a number of projects to provide more granular output and statistics on usage patterns.

Installing MySQL gem on OSX 10.6

Hopefully this will be a time saver for anyone else who goes through the following pain.

I have a brand spanking new OSX 10.6 installation. I installed mysql 5.5.9-OSX10.6-X86 (because I thought everything was still i386 based…watch this space!) I installed RVM and installed ruby 1.92 under RVM control. I then do a ‘bundle install’ and it gripes about not having mysql2 gem installed. I do a manual install using the following command.


sudo gem install mysql2

and after a bit of crunching, we get to the following error:


Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
ERROR: Failed to build gem native extension.
1.9.1/ruby/ruby.h:108: error: size of array ‘ruby_check_sizeof_long’ is negative
/Users/peter/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/ruby.h:112: error: size of array ‘ruby_check_sizeof_voidp’ is negative
In file included from /Users/peter/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/intern.h:29,
             from /Users/peter/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/ruby.h:1327,
             from /Users/peter/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby.h:32,
             from ./mysql2_ext.h:4,
             from client.c:1:
/Users/peter/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/st.h:69: error: size of array ‘st_check_for_sizeof_st_index_t’ is negative

The Solution

  • Uninstall your MySQL using the commands below

    sudo rm /usr/local/mysql \
    rm -rf /usr/local/mysql* \
    rm -rf /Library/StartupItems/MySQLCOM \
    rm -rf /Library/PreferencePanes/My* \
    rm -rf /Library/Receipts/mysql* \
    rm -rf /Library/Receipts/MySQL*

  • edit /etc/hostconfig and remove the line MYSQLCOM=-YES

  • Now go and download the 64 bit version of the MySQL package – get the dmg rather than the gzip file.

The rationale behind this is that your new beaut 10.6 is actually referencing 64 bit modules by default. How to prove this I do not know – I’m confused and still searching for the answer. If I do a uname, I get the following.


$ uname – a
Darwin MacBook-Air.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386

Now, if I’m not mistaken that’s an i386 at the end – go figure. If anyone has any further insights please let me know.

The next step is to download the gem for your ruby/rails use


sudo env ARCHFLAGS="-arch x86_64" gem install mysql2 -- \
--with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
--with-mysql-include=/usr/local/mysql/include
  • The next error encountered is when I try to start the rails server using ‘rails s’

    /Users/peter/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2.rb:7:in `require’: dlopen(/Users/peter/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.16.dylib (LoadError)

  • The answer to this problem is to run the following command

    sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib ~/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle

Bear in mind, I’m running version 1.9.2-p180 fo ruby – you will need to change the command for whatever version you’re running.

Unix Shells by Example

Author Ellie Quigley ISBN 0-13-147572-X

Published by Prentice Hall

Priced in Australia at $87.99 (June 2010)

No matter which shell you run and how ever long you’ve been using it, you’ll probably pick up a trick or two from this book.

Now in it’s 4th edition, this book is stuffed with real world examples of all the useful GNU/Linux shell tools. It focuses on awk, sed, grep and their many variations. It builds from simple examples with extensive use of regular expressions.

Although running to over 1,000 pages, the first 450 are where I found the real meat. The remainder is a comparison of the different shells and their many quirks

As far as I can see, you can approach this book in one of two ways. Firstly as a student, set aside a few quiet Sundays and go through the examples one by one, some of it may feel like repetition, but progressively you’ll get the picture and it will be well ingrained in your brain. Secondly as a reference. I use the bash shell, but I often find useful scripts created on csh or heaven’s forbid zsh. So the trick is knowing what’s different and what needs changing. To this end Unix Shells By Example is very handy to have on the shelf.