Faint insights into (mostly) the world of automation

Using Bitnami’s Rubystack on VirtualBox Linux With Vagrant

| Comments

In my Software Engineering Projects class, we are going to do a RAILS-based project. Based on feedback from last year’s class, I am furnishing students with an almost configured RAILS system for development. The system is based on

Create the base machine

The Vagrantfile is configured to support networking from the host machine and to run a configuration script ( as part of the provisioning. There is a small bit of logic to avoid re-provisioning things each time the machine is brought up.

I make it by following roughly the following procedure:

  1. Install Virtualbox
  2. Install Vagrant
  3. Create a directory to place files add in
    • The bitnami linux installer file
    • Vagrantfile
  4. Do an install: vagrant up
  5. SSH into the running host: vagrant ssh
  6. Use Linux as needed
  7. Exit back to the host OS: exit
  8. Shutdown the virtual machine (saving the contents): vagrant halt
  9. Package the machine post configuration with vagrant package default --output

  10. Restart the machine and continue work: vagrant up

Install the base machine on student computer

OS X/Linux commands are given here, change the direction of the / (to \) for Windows.

  1. Install Virtualbox
  2. Install Vagrant
  3. Create a vms directory for your development use mkdir vms
  4. Create a machine1 directory mkdir vms/machine1 It will be accessible to both Linux and your operating system.
  5. cd vms/machine1
  6. vagrant init url_to_image
  7. uncomment :private_network, ip: "" in Vagrantfile
  8. vagrant up # first time will download the vm machine
  9. vagrant ssh # if this fails, you need to put SSH on the path

SSH for Windows

Windows does not include SSH by default. Two options are to 1) install Git locally and then use it’s SSH implementation and 2) install PuTTY.


The file .bashrc has a line at the end of it that maps the rails commands onto the path along with library linkage as well. This messes up some local commands nano and others. One solution is to comment out the line and re-log into the VM.

Other vagrant commands

  • vagrant destroy eliminate the virtual machine so next time it will be rebuilt
  • vagrant reload combination of of halt then up
  • vagrant suspend pause machine copying state to disk, resume with `vagrant resule“
 -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  # Every Vagrant virtual environment requires a box to build off of. = "precise32"
  config.vm.box_url = ""

  # Create a private network, which allows host-only access to the machine
  # using a specific IP. :private_network, ip: ""

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  config.vm.provision :shell, :path => ""

#!/usr/bin/env bash

set -e      # Exit script on error
set -x      # Print commands and arguments

echo "Starting configuration script"

# Abort provisioning if rubystack is already installed.
test -d /opt/rubystack-1.9.3-10 &&
{ echo "rubystack already installed."; exit 0; }

echo "Provisioning rubystack from bitnami"

# Install bitnami
/vagrant/ --mode unattended \
                                  --disable-components varnish,phpmyadmin,rvm

# install the quiet_assets gem
gem install quiet_assets -f --install-dir /opt/rubystack-1.9.3-10/ruby/lib/ruby/gems/1.9.1

# make vagrant user owner of the install
chown -R vagrant.vagrant /opt/rubystack-1.9.3-10

# install a symbolic link to rubystack directory
ln -s /opt/rubystack-1.9.3-10 /home/vagrant/rubystack

# put ruby / rails code on path
echo ". /opt/rubystack-1.9.3-10/scripts/" >> /home/vagrant/.bashrc

echo "Provisioning complete."

Adding to a Non-privileged Users Path in Windows 7

| Comments

Does it have to be this hard?

Anyway, if you are looking for how to add to a non-privileged user’s search path for command line usage, the command setx is what you are looking for. While it can be used to modify the system search path, users don’t have permission to do that in many enterprise deployments. The paths specified by the user are at the end of the system paths.

To see the existing path

    echo %path%


To put C:\Users\dgreen\bin on the path, use

    setx path C:\Users\dgreen\bin

Once you start a new CMD session, you can see the impact of your changes.

    echo %path%


Tumbling Out!

| Comments

In a long overdue action, I have moved the glimmer blog out of Tumblr. I had been wanting to use (Multi-)Markdown more in blogging to continue my focusing on the format. I also had a student tell me he could not access the Tumblr website at work due to its other content. Tumblr was/is an easy to use site but my purposes and those of other users don’t seem to match. I had been looking at Jekyll for a while and considering what to try when I discovered that GitHub supported web hosting with some support for Jekyll. Finding the Jekyll importer that would do most of the heavy lifting for moving the site, I took the plunge.

Over about 4 hours, I was able to do fixups of the files that the importer brought over. I also changed Jekyll to use Kramdown instead of Maruku based on this hint originally from Brett Terpstra.

After a bit more exploring, I discovered Octopress which wraps Jekyll with additional conveniences (even though it uses an older version of Jekyll). I was able to copy the raw Jekyll work into the Octopress copy.

After trying things out, I also made the decision to host against my Github Account rather than a project (although both Jekyll and Octopress can handle either approach.) This was a bit hard to retreat to. I had to

  1. Re-run scripts
  2. Edit .git/config
  3. Edit Rakefile
  4. Edit _config

but I think I got it.

Most “irritating thing” is to put bundle exec in front of all rake commands as Octopress is not using more current code. I have not generally had to worry about that in the past but I know many others have.

Safe Boot Is Back (in OS X10.8.3) With FileVault

| Comments

Safe booting for FileVault users is now possible again in OS X 10.8.3. As always, you hold down the (left) shift key right after the chime when booting. You are next taken to the unlock/login screen where you must authenticate by one of the accounts that will unlock the disk. I hold the shift key down right after the “return” key is hit. Then you will see the gray progress bar implying booting in safe mode. After a while (probably after the fschk and other things are done but the progress bar only makes it about 40% across), it will go to the spinner for a while, then just the Apple, and then back to the unlock/login screen but you will notice a red “Safe Boot” in the upper right hand corner. After logging in again, one gets to the operating level of Safe Boot. You will notice (as always) that your “start at login” items won’t be loading — one of the features of Safe Boot.

On my old Mac Mini, things are pretty slow in Safe Boot. It must be disk intensive as my SSD-based MacBook Pro is much faster.

Since safe boot is the safe way to fix some things like

Sandboxd: ... mdworker(..) deny mach-lookup

It is great to have this working again.

Exploring Stately for Ruby

| Comments

As someone who has built a hardware-based Morse Code sending system, I am very interested in state machines and their implementation.

I recently found a new ruby gem stately which seemed interesting. Like many packages, the documentation initially seemed confusing so a bit of exploring seemed appropriate. This note documents the little exploring that I did (mostly so I can return to it should I want to use this gem in an application. The two examples left when the dust settled are given in this gist.

My first attempt was to build a counter. I had a bit of problem getting the syntax right and when I retreated to the document’s examples, I found they were incomplete. My first successful attempt (from a syntax point of view was stately_demo_bad (see the gist).

It did not work because the method associated with defining all the details of the state machine appears to change the scope of some of the code into other internally defined classes yielding very unexpected behavior.

Moving everything to method (messages) inside the state machine seems to be the expected (and allowable) approach yielding stately_demo_good (see the gist).

Trading Memory for Functionality (Enough Performance)

| Comments

I was working on a the last note and wanted to check things out under a fresh install. I decided to make a new Mac User to accomplish this. I used GitHub for the Mac, Safari on the Assembla site and the Tumblr site, and the command line. When I finsihed my work, I idlely was thinking about keeping this user account around for the next effort or deleting it. One of the consideration was how much space was in use by the account. I was shocked to see that the home directory took 330MB!

Looking into it, I found the bit space was 300MB in Preferences. The other two large directories was Caches (30MB) and Applications Support (12MB). Inside preferences was a folder SMDHelpData that was the space user. This folder evidently has the help file information: info, caches, and indexes for finding things for all the applications on the system (not just those that had been used). I am guessing there is a distinct copy per user since in theory at least, one could through security settings block different users from various components. There may also be some personalization (highlighting, last location, etc.) capability.

I was very surprised at how much space was taken but I decided my lesson was to also trade space for functionality (enough performance) and leave the user configured so I would not spend time repeating the building of this space.

GitHub With Assembla

| Comments

GitHub has now made a nice simple GUI tool for both OS X and Windows. They have made them freely available for download. They seem to have made careful choices about what to support and not support in order to keep tool as simple as possible. They do support using GitHub1 against other git repositories such as Assembla or a homegrown one. They don’t support multiple remote repositories for a specific local repository but you are free to use for one project2 and Assembla (for example) for another. The two limitations that I have seen that “hurt” sometimes are

  1. There is no graphical view of the change tree (while confusing, if you need it, alternatives are even more confusing)
  2. The Windows and Mac Clients look different and behave a bit different.
  3. Github really knows you by the name/email you list in it’s configuration and does not like/support your having a separate identity on a per project basis.

These limitations are not fundamental and may work on them in the future. There have been frequent updates thus far to Github — perhaps they will continue.

Using GitHub with an existing project hosted in Assembla

If this is your first use of Assembla (but assuming you already have an account), then you will need to update your Assembla profile with your public ssh key. This file may exist on your system ~/.ssh/pub.rsa where ~ refers to your home directory. You probably generated this as part of your git install but if not (and after you possibily install ssh), use

ssh-keygen -C "" -t rsa

substituing your email address. Take the defaults (hit return) on everything unless there is an offer to overwrite the pub.rsa file AND you need the pre- existing one! You will now a the file you need. Go to your profile in Assembla, select manage keys and upload this file to assembla.

If there is no local repository associated with the existing project, you will need to clone it using the command line. Assembla gives the step by step instructions personalized for the repository (see the “git clone” information near the top of the Source/Git tab). Be sure to use the “clone/push URL” if you are planning to push back to Assembla in the future.

After you have a local repository (start here if you already had one), merely start up GitHub, and use the menu to select File | Add Local Repository option selecting the directory containing the project repository.

Starting a new project with GitHub and Assembla

Make your Assembla Space in Assembla selecting an option that includes Source/Git repository. After it is made, you will be on a page that contains very useful “Getting started with Git” instructions. For this note, I assume you have installed git and configured it with your name and email.

If you are starting the project, create your repository folder as you would any folder, perhaps

 mkdir demo

Attach a terminal window to this new directory (new project) or the existing directory corresponding to the top of your existing project.

 cd demo

Then, assuming you have not been using git and a local respository only, initialize git

 git init

If you have a new project, you need at least one file. Create one — prehaps a readme.txt file.

 echo "" > readme.txt

Out of scope for this note but if it is an existing project not yet in git, you may wish to set up a .gitignore file to keep certain files (or file types) from being tracked. We will assume we are tracking everything for simplicity here.

Now, we need to add all new (or changed files)_for tracking and commit the present state of the files to the local repository. We will use “First commit” as the message about this commit. Adjust as desired but limit yourself to one line of information unless you know how to do multiple lines as one command in your terminal (command) program.

git add .  
git commit -m "First commit"

Now configure the repository to know where the remote repository is in Assembla. Be sure to use the customized one on your Assembla instructions.

git remote add origin

where demo is the name of the remote repository as known to Assembla.

Finally, send your first commit up to the remote repository.

git push origin master

Success. You can now switch to Github as noted for an existing git reponsitory above.

  1. I will use “GitHub” to refer to the program and “” to refer to the site or company for the remainder of this note.

  2. Don’t forget to create your account and tell GitHub about this!

CoffeeScript With Select2 Library

| Comments

I had two demons: a new library and a language I was not really familiar with. A formula for puzzles. I did not find quickly the right example to do the jQuery/Select2 JavaScript to CoffeeScript mapping but I did find a reverse compiler which helped.

In case it helps, I was trying to convert a working Javascript solution (derived from the Select2 documentation):

function personFormatResult(person) {
    var markup = "<table class=person-result><tr>"
    if ( !== undefined ) {
        markup += "<td>" + + "</td>";
    if ( != undefined ) {
        markup += "<td>" + + "</td>";
    markup += "</td></tr></table>";
    return markup;

function personFormatSelection(person) {
    var t =;
    if ( != "" ) {
      t += " &lt;" + + "&gt;";
    return t;

// presently hacked in section_id of 1

$(document).ready(function() {
        placeholder: {name: "Search for attendee by email", email: ""},
        minimumInputLength: 1,
        ajax: {
            processData: true,
            data: function (term, page) {
                return {
                    email: term,
                    section_id: 1
            url: "/attendees/match",
            dataType: json,
            results: function (data, page) {
                return {results: data};
        formatResult: personFormatResult,

to CoffeeScript. One translation is

personFormatResult = (person) ->
  markup = "<table class=person-result><tr>"
  markup += "<td>#{}</td>" if != undefined
  markup += "<td>#{}</td>" if != undefined
  markup += "</td></tr></table>"

personFormatSelection = (person) ->
  markup =
  markup +=  " &lt;" + + "&gt;" if != ""

# And with the help of (blank lines optional):

$(document).ready ->
      name: "Search for attendee by email"
      email: ""

    minimumInputLength: 1

      processData: true

      data: (term, page) ->
        email: term
        section_id: 1

      url: "/attendees/match"

      dataType: "json"

      results: (data, page) ->
        results: data

    formatResult: personFormatResult
    formatSelection: personFormatSelection

Hope this is useful to someone else.

The Simple Stuff Can Get You…

| Comments

I was trying out the EPUB export of VoodooPad and figured out I had to make a cover page in the tool as well as a collection. I then filled out the metadata including author information (David Green and then saved with an .epub extension.

Things ran fine but when I moved it over to the iPad as an iBook file, I was told it was an invalid format. Alas, googling did not help me (it has to happen every once in a while).

After a goodly bit of exploring, the problem was the e-mail address in angle brackets as part of the author information. I removed them and things were good to go.