Greetings :)

Hi, I'm Louis!
I like to code, but I don't do enough of it.

This blog is about trying my best to keep up with the ever evolving stream of technology.

Saturday, May 26, 2012

Errors installing mysql2 on ubuntu

Upon installing the mysql2 gem I got the following error:

ERROR: Failed to build gem native extension.
I fixed it with:
sudo apt-get install libmysql-ruby libmysqlclient-dev

Thanks to this post here

Sunday, May 20, 2012

Ruby - dynamically create an object :)

Thought this was really cool :)

def create_object(class_name, *args)
  the_class = Object.const_get(class_name)
  the_object = the_class.send :new, *args if !args.empty?
  the_object = the_class.send :new if args.empty?
  
  return the_object
end

Friday, May 18, 2012

Running ruby 1.9.3 on Heroku

I had a few problems trying to get ruby 1.9.3 running on Heroku.

Here's the error I had:
 Heroku receiving push
-----> Removing .DS_Store files
-----> Ruby/Sinatra app detected
-----> Gemfile detected, running Bundler version 1.0.7
       Unresolved dependencies detected; Installing...
       Using --without development:test
       /tmp/build_jpq0amd2bp92/Gemfile:5:in `evaluate': undefined method `ruby' for # (NoMethodError)


Here's what I did to fix it:

     Add the following to Gemfile: 
        ruby '1.9.3'
        gem 'bundler', '1.2.0.pre'

git remote rm heroku
heroku create --stack cedar
gem install bundler --pre
bundle install
git commit -am "fixed heroku problem"
git push heroku master

And some notes to myself for other stuff I need:
heroku addons:add mongohq:free
heroku config:add TWITTER_KEY=`echo $TWITTER_KEY`
heroku config:add TWITTER_SECRET_KEY=`echo $TWITTER_SECRET_KEY`


Tuesday, May 8, 2012

How to make Ethernet work on ubuntu!

So my computer has an Ethernet card which doesn't work out of the box with Ubuntu 11 or 12.04 - which means that I couldn't connect to the internet!


When I ran:


lspci | grep Ethernet 


It showed my card as having a RTL8111 Ethernet controller.


Long story short, this post helped me get the card going properly (for the second time now...)