keeping things simple (hopefully)
February 14, 2009
Filed under: Uncategorized — Jason @ 2:03 pm

Had some issues installing Nokogiri this morning on my slicehost account running Ubuntu (Hardy 8.04). Every time I tried installing the gem, I would get this :


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

/usr/bin/ruby1.8 extconf.rb install nokogiri
checking for #include

... no
need libxml
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/usr/bin/ruby1.8

Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/nokogiri-1.1.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/nokogiri-1.1.1/ext/nokogiri/gem_make.out

Solution?

Not sure really, I did all of these, but it wasnt’ until the last one that the gem successfully installed.



sudo aptitude install libxml
sudo aptitude install libxml2
sudo aptitude install libxml-dev
sudo aptitude install libxml2-dev
sudo aptitude install libxslt
sudo aptitude install libxslt-dev

And that’s it. After that, the gem installed just fine.

February 13, 2009
Filed under: Uncategorized — Jason @ 10:13 pm
December 15, 2007
Filed under: Uncategorized — Jason @ 8:49 pm

This was a good post in getting GMail set up in Rails. But if you follow it exactly you’ll run into a a hiccup if you’re running Rails 2.0.

Rails 2.0 has depricated the ActionMailer::Base.server_settings= function and opted for the more aptly named smtp_settings. So just use this for your settings and you’ll be okay.


ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
  :address => "smtp.gmail.com",
  :port => 587,
  :domain => "mycompany.com",
  :authentication => :plain,
  :user_name => "username",
  :password => "password"
}

Also don’t forget, your username will be your FULL email address (e.g. funkydude@mycompany.com)

Filed under: Uncategorized — Jason @ 8:47 pm

Needed something to generate random numeric strings that were 9 characters long


def random_numeric_string
	length = 1000000000
	(rand(length)+(length)).to_s[1..9]
end

If anyone has a better way, please let me know.