Wednesday, April 22, 2009

How to fix "no such file to load -- openssl" error with Ruby 1.9

If you get an error like this:


/usr/local/lib/ruby/1.9.1/net/https.rb:102:in `require': no such file to load -- openssl (LoadError)

while trying to install a gem or something similar, try this:

  • sudo apt-get install libopenssl-ruby1.9
  • sudo apt-get install libssl-dev
  • cd ~/Downloads/ruby-1.9.1-p0/ext/openssl (assuming you extracted the ruby tar to ~/Downloads)
  • ruby extconf.rb && make && sudo make install

Lame, but works.


Tuesday, March 24, 2009

Java Peristence API (JPA) for SimpleDB

Apparently, I forgot to mention one of my favorite open source projects on this blog, so here goes.


Want to migrate an existing java application to Amazon SimpleDB or just make working with SimpleDB as simple as possible? Check out the SimpleJPA project at http://code.google.com/p/simplejpa/. It's quite full featured at this point and works great. We are using it in production code now.

Super Small, Super Fast Cache - Kitty Cache

I just put another caching library up at http://code.google.com/p/kitty-cache/ for an in memory cache that supports max size and expiry. Very lightweight.


Saturday, March 21, 2009

Gem Install Facebooker on Windows

If you run "gem install faceboooker", you'll get this:


C:\Users\treeder>gem install -f facebooker
Building native extensions. This could take a while...
ERROR: Error installing facebooker:
ERROR: Failed to build gem native extension.

c:/ruby/bin/ruby.exe extconf.rb install -f facebooker
creating Makefile

nmake
'nmake' is not recognized as an internal or external command,
operable program or batch file.

Gem files will remain installed in c:/ruby/lib/ruby/gems/1.8/gems/json-1.1.3 for
inspection.
Results logged to c:/ruby/lib/ruby/gems/1.8/gems/json-1.1.3/ext/json/ext/parser/
gem_make.out

To fix this:
  1. gem install json -v 1.1.1 (only one that works on windows at time of posting, json_pure doesn't work with rails 2.3)
  2. gem install facebooker --ignore-depencies



Tuesday, November 04, 2008

Deleting SVN Directories from a Project

Sometimes you just need to get rid of those pesky subversion folders because you can’t export or something so here’s the quick and easy way to do it in windows:

  • Be sure you can see hidden files and folders (Advanced folder settings)
  • Open Windows Explorer in the root folder of your project
  • Explorer
  • In the search bar (or Ctrl+F for older versions of windows), type “.svn”
  • Sort by name
  • Delete all the ones that are folders (not the ones that are files)

Done.

Tuesday, October 07, 2008

Callable and the Case of the Disappearing Exceptions

If you have a class that implements Callable, but you don't plan on using the Future that is returned after you call Executor.submit(), you may lose any exceptions that are thrown. They literally disappear into the void. No log whatsoever.

So it is good practice to treat it a bit like you would with a Runnable and wrap the code in your call method with a try/catch to print the exception or log it somewhere.

Thursday, October 02, 2008

How To Give a User Root Access on Linux

NOTE: I take no responsibility for using the following and do not recommend using it.

But for those that want it:

usermod -G root username


This changes the user with ‘username’ to the root group and thus gives root access.



And remember, as Uncle Ben says, “with great power comes great responsibility”.