Category Archives: My Coding Adventures

I’ve been spending a bit more time to get some real hands on experience with some of the technology I’ve been managing for a while. There’s still nothing more fun and exciting then building something new with your hands. As part of the learning experience, I thought I’d share some of my learning along the way to help others who are in the same stage.

Installing Ruby on Rails on OS X with rbenv

I decided to do a full install of OS X when Yosemite came out and that included installing Ruby and Ruby on Rails on my machine again. Over the last couple of years, I’ve switched from rvm to rbenv because it is a lighter weight solution. Here are the steps that I take to install Ruby on Rails on OS X today

Continue reading Installing Ruby on Rails on OS X with rbenv

Pentaho Data Integration crashing after El Capitan Update

I recently started to play around with Pentaho again for a side project at work and found that it was crashing whenever I tried to edit the database connection details. After doing a number of searches, I came across this Jira ticket in Pentaho. The gist of it is that El Capitan is not officially supported and causes Data Integration to crash. Fortunately there’s a fix out there that seems to work.

Continue reading Pentaho Data Integration crashing after El Capitan Update

Installing Ansible on Ubuntu

The easiest way to get the latest version of Ansible consistently is to not depend on the OS repositories (i.e. homebrew or apt) but rather through PIP.

Install the development tools

sudo apt-get install python-dev python-setuptools build-essentials

With that install, you should get easy_install as well

Install PIP

sudo easy_install pip

Now with PIP installed, you can quickly install Ansible

sudo pip install ansible

I found that I needed to install python-dev and build-essentials to compile any of the necessary files

Hope this helps!

 

Organizing Ansible

While we’ve been using Ansible for almost a year at Kinetic Cafe, I’ve been spending a lot more time with it at a personal level. A big part of it is that I tend to really like being familiar with the tools that my team uses at work and the other is because I actually have a lot of home and cloud servers running because I tend to like being familiar with the tools that the team uses at work. Ansible’s strength stems from the idea that you can ssh to a server and perform a series of tasks based on modules already built for you. At it’s core are concepts like inventories, roles, handlers, dependencies and variables but then allows users to use it in many different ways within that structure. However, this flexibility lead to chaos when I started to use it so I took some time organizing Ansible in a meaningful way for my home infrastructure.

Continue reading Organizing Ansible

RMagick errors when running Rake Tasks in OS X Maverick

We were running into some issues at work so I decided to pitch in. I had trouble listing my rake tasks as my rake tasks was spitting out this error through RMagick – Reason: image not found – /rmagick-2.13.2/RMagic2.bundle.

Continue reading RMagick errors when running Rake Tasks in OS X Maverick

Installing Pentaho Business Analysis Server on Ubuntu

I’ve been experimenting with Pentaho for the past few months to find an easy way to present users with a simple to manage reporting system. The components I’ve been playing with are the Business Analysis Server (Reporting front end), Kettle and Spoon (ETL tool), Reporting Studio and Mondrian (OLAP Server). Here are the install steps that I used to install Pentaho Business Analysis Server on Ubuntu.

Continue reading Installing Pentaho Business Analysis Server on Ubuntu

Installing Ruby on Rails on Ubuntu

I decided to install Ubuntu 13.10 on my current desktop to compare developing on Ubuntu versus OS X. As I needed to install Rails as well I decided to document the steps for future reference as well.

Continue reading Installing Ruby on Rails on Ubuntu

Setting up Sublime Text 3 for Rails Development

When I started programming, IDEs were the norm. I spent much of my time using tools like Microsoft Visual Studio and got very used to features like Autocomplete. However, that also meant I needed to have access to MSDN which for a young professional was very expensive if you wanted to develop on your own dime and time. IDEs also tend to be very prescriptive and require a lot of overhead in order to run the tools themselves. Almost a decade later, I was introduced to the world of developing using open source languages, tools and frameworks and I quickly fell in love with it. One of the biggest changes though was to not use an IDE. While most of my hard core friends use tools like VIM or VI, I use Sublime Text 3 for my Rails development which is a bit of a cop out but it’s still a pretty amazing tool. I decided to document my experience on my setup of Sublime Text 3 for my personal Rails development. Hopefully others will find this equally useful.

Most of influence of setting up Rails for Sublime Text comes from Michael Hartl’s site.

  1. Install Sublime Text
  2. Set up Sublime to run from the command line
    Create a symbolic link for the sublime executable

    ln -s /Applications/Sublime Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime

    Reload your profile

    source ~/.bash_profile
  3. Install Package Control
    From the Sublime console, insert this snippet of Python code

    import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
  4. Go to the Package Controller
  5. Install Rails Tutorial snippets from the command line
     cd ~/Library/Application Support/Sublime Text 3/Packages/
    git clone https://github.com/mhartl/rails_tutorial_snippets.git RailsTutorial
  6. Set up syntax specific settings for Ruby
    • Go to a file with a .rb extension
    • Go to Preferences –> Settings More –> Syntax Specific – User
    • Paste the following into the file
      {
      "tab_size": 2, "translate_tabs_to_spaces": true
      }
  7. Set up syntax specific settings for Ruby HTML files
    1. Go to a file with an .erb extension
    2. And follow the previous steps

For other tips about Rails development type tricks, checkout my Rails cheatsheet or my OS X cheatsheet

Installing Ruby on Rails on OSx

I got myself a Macbook Air today to primarily be a development machine. For those of you who are looking for a shortcut, check out RailsInstaller that does a quick job as well. Personally, I just wanted to give a shot of installing Rails from scratch because it’s a good way of really understanding your system and the appropriate pre-requisites to run Rails. Also, it allows you to specify what version of Rails and ruby you want installed on your system.

I assume that you already have Homebrew installed on your system.

  1. Install RVM
    run curl -L https://get.rvm.io | bash
  2. Re-load your environment
    source ~/.rvm/scripts/rvm
  3. Setup additional pre-requisites
    brew install libyaml
    brew install openssl
  4. Install ruby 2.0.0 and set it as the default version
    rvm install 2.0.0 –with-openssl-dir=$HOME/.rvm/usr
    rvm –default use ruby-2.0.0-p247
  5. Install Rails and Bundler
    gem install rails –version=3.2.14
    gem install bundler
  6. Install SQLite which is good quick database for development purposes
    brew install sqlite3

Rails Rake Database Operations

The operations that I most commonly use are db:create, db:migrate and db:reset. I was working with someone and found db:schema:load. I was pleasantly surprised when I came across this list of operations on Stack Overflow.

  • db:create creates the database for the current env
  • db:create:all creates the databases for all envs
  • db:drop drops the database for the current env
  • db:drop:all drops the databases for all envs
  • db:migrate runs migrations for the current env that have not run yet
  • db:migrate:up runs one specific migration
  • db:migrate:down rolls back one specific migration
  • db:migrate:status shows current migration status
  • db:migrate:rollback rolls back the last migration
  • db:forward advances the current schema version to the next one
  • db:seed (only) runs the db/seed.rb file
  • db:schema:load loads the schema into the current env’s database
  • db:schema:dump dumps the current env’s schema (and seems to create the db as well)
  • db:setup runs db:schema:load, db:seed
  • db:reset runs db:drop db:setup
  • db:migrate:redo runs (db:migrate:down db:migrate:up) or (db:migrate:rollback db:migrate:migrate) depending on the specified migration
  • db:migrate:reset runs db:drop db:create db:migrate