Installing Ruby on Rails w/ MySQL on Windows

A friend who has recently been getting into Rails has had issues getting the MySQL gem installed on Windows. He was asking me about it and I figured why not create a screencast that might help others too.

Posted in Web Programming | Tagged , , , | Leave a comment

How to run a script on startup with Mac OSX

I recently upgraded to Lion and wanted to have a script run on startup. I googled this and got back things like launchd and login hooks… Tried a couple of them to no avail. Then I thought I might try creating an /etc/rc.local. Sure enough, it worked.

For those of you not familiar, the commands you enter in rc.local are the last to get run after all the other services start up… Simply create your /etc/rc.local as follows:

# enter commands / paths to scripts here
/path/to/your/script
Posted in Uncategorized | Tagged , | Leave a comment

Rails 3.1 – /usr/bin/ld: cannot find -lv8

Installing Rails 3.1 today I came across this error while installing the therubyracer gem:

g++ -shared -o v8.so v8_locker.o v8_exception.o v8_date.o v8_try_catch.o v8_debug.o v8_v8.o v8_value.o v8_context.o v8.o v8_message.o v8_array.o v8_handle.o v8_object.o v8_weakref.o v8_string.o v8_script.o v8_external.o v8_function.o v8_callbacks.o rr.o v8_template.o -L/usr/local/rvm/gems/ruby-1.9.2-p180@droo/gems/libv8-3.3.10.2/lib/libv8/build/v8 -Wl,-R/usr/local/rvm/gems/ruby-1.9.2-p180@droo/gems/libv8-3.3.10.2/lib/libv8/build/v8 -L. -L/usr/local/rvm/rubies/ruby-1.9.2-p180/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.2-p180/lib -L. -rdynamic -Wl,-export-dynamic -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.2-p180/lib -L/usr/local/rvm/rubies/ruby-1.9.2-p180/lib -lruby -lpthread -lpthread -lrt -ldl -lcrypt -lm -lc -lv8
<code>/usr/bin/ld: cannot find -lv8</code>
collect2: ld returned 1 exit status
make: *** [v8.so] Error 1

Turns out that I was missing the v8 javascript engine development headers and libraries. I’m running Fedora 15 and a yum install v8-devel did the trick.

Posted in Web Programming | Tagged , , | Leave a comment

Jon’s recommended Rails development environment for Windows – Part 1, Installing VirtualBox and creating the VM

Most of us use some sort of Windows variant for our desktops. And even for those of us that are Rails developers, I suspect we likely are using Windows as well on the desktop when not using our macbooks. Over the years, I’ve tried a number of different options but I feel like I’ve finally gotten to a fairly comfortable Rails development environment on Windows. I’m currently running Windows 7 on my desktop and use VirtualBox to run Fedora. Then through Samba, I mount a share that I then use Sublime Text 2 (on Windows) as my text editor.

These instructions will cover, step-by-step, how to install VirtualBox, Fedora 14 with Rails 3/MySQL and Apache (via mod_passenger).

Download and install VirtualBox

  1. Download VirtualBox from here:  http://www.virtualbox.org/wiki/Downloads.  As of this post, version 4.0.8 is the latest available.
  2. Once downloaded, double-click VirtualBox-4.0.8-71778-Win.exe to get the setup wizard started. Click ‘Next’.
  3. Unless you want to make some customizations to the install, simply click ‘Next’ to go with the defaults.
  4. Click ‘Next’.
  5. Click ‘Yes’.
  6. Click ‘Install’.
  7. Click ‘Install’.
  8. Click ‘Finish’. Note to be sure to accept anything, if prompted, to complete the install.

Creating the Fedora VM

  1. With VirtualBox installed and started, we now move on to creating the Virtual Machine or VM. Click on ‘New’ and you should see the New Virtual Machine Wizard start up. Click ‘Next’.
  2. Enter the name of the VM you wish to create. Note, when I entered Fedora 14, the installer recognized which operating system and version to select. Click ‘Next’.
  3. Allocate memory to your VM. Don’t select an amount beyond the green indicator for available memory. Click ‘Next’.
  4. Create new disk, click ‘Next’.
  5. Click ‘Next’.
  6. To keep the disk size only as large as we need it, choose ‘Dynamically expanding storage’. Click ‘Next’.
  7. Choose the disk location and size. Click ‘Next’.
  8. Click ‘Finish’ to create the new Virtual Disk.
  9. Click ‘Finish’ to create the new Virtual Machine.

That brings us to the end of Part 1. Part 2 we’ll be installing Fedora 14.

Posted in Web Programming | Tagged , , , | Leave a comment

Sublime Cucumber

Sublime Text 2 is a text editor worth checking out. One thing missing for me though was support for Cucumber features. Today I found it!

https://gist.github.com/864839

I think it’s time to buy a license. :)

Posted in Web Programming | Tagged , , | 3 Comments

Trouble installing nokogiri on Snow Leopard (libiconv is missing)

Just the other day, I installed Snow Leopard and now, re-installing my development environment I came across this when trying to install Nokogiri.

Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
       ERROR: Failed to build gem native extension.

/Users/jmacdonald/.rvm/rubies/ruby-1.8.7-p174/bin/ruby extconf.rb
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... no
-----
libiconv is missing.  please visit
http://nokogiri.org/tutorials/installing_nokogiri.html for help with
installing dependencies.
...

I spent a bunch of time trying different options on with the ‘gem install’ and then actually decided to follow the instructions on the Nokogiri site. :) Even though it looks like an iconv problem (and maybe it is) running the following updates not only libxml2 and libxslt but iconv as well:

sudo port install libxml2 libxslt
gem install nokogiri # in my case I was using RVM

Sure enough, the install worked.

Posted in Uncategorized | 1 Comment

The F-16 really sucks

The F-16 really sucks

As far as us kids were concerned, the F-16 didn't quite match the aesthetics of the F-14 and based on this plastic toy, we figured it sucked

I recently came across this old toy of mine in my Grandma’s basement. It was just some cheap thing from K-Mart and really, the only reason it survived was because I thought it was piece of junk and didn’t play with it. Seeing it though makes me laugh — reminds me of my cousin flying around the house with it singing (to the theme of Top Gun), “The F-sixteeeeeen really sucks, da-da-daa, da-da-daa, da-da-daa-daa…”

In contrast, I also recall my uncle trying to convince me of the F-16′s merits.

Posted in Uncategorized | 3 Comments