Digital Sanctum

software development, technology and other square topics

Archive for the ‘Ruby’ Category

iPhone Development with Ruby

with 2 comments

I’m a Java and Ruby developer and I’m interested in starting development on an idea I have which would work great as an iPhone application. Naturally, instead of learning Objective-C I started doing some research on finding out if it’s possible to use another language for iPhone development. Here are some things I found along the way to answering my question:
Read the rest of this entry »

Written by Shane

October 4th, 2008 at 10:05 am

Ruby One-Liner: Download from FTP server through a proxy

without comments

If you need to download a file or view an http page source through a proxy, something like the following one-liner will help:

require 'open-uri'

open("somefile.zip","wb").write(open("ftp://username:password@host:port/remotefile.zip", :proxy=>"http://proxyhost:proxyport").read)

Written by Shane

August 21st, 2008 at 7:00 pm

gem install rjb on mac os x leopard

with 5 comments

If you’ve tried installing the rjb 1.1.x gem on Mac OS X Leopard, you will probably end up with an error like:


lipo: can't open input file: /var/tmp//ccpyNy8b.out (No such file or directory)
make: *** [load.o] Error 1

In order to get around this you have to run the following commands:


sudo su -
export JAVA_HOME='/System/Library/Frameworks/JavaVM.framework/Home'
gem install rjb

Written by Shane

February 2nd, 2008 at 8:22 pm

Ruby Technorati API Client

with one comment

So as part of a pet project I decided to write a Ruby client for the Technorati API. There are several available requests that can be made and each has it’s own options to pass for things like the response format. I should mention there is also a Technorati-Ruby gem available that looks like it was written back in 2004 and weighs in at around 500 lines. Mine weighs in at 130 lines or so but doesn’t provide a response parser.

Read the rest of this entry »

Written by Shane

December 9th, 2007 at 7:14 pm

ActiveRecord Gem Gotchya

without comments

There is a gotchya related to how you require ActiveRecord. Apparently, in older versions of Ruby (eg. the version packaged with Leopard) something like the following will NOT work:

require 'activerecord'

with something like the following error:

CODE:
  1. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- activerecord (LoadError)
  2.     from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
  3.     from main.rb:5

However if you use this form:

require 'active_record'

it WILL magically work.

Look here for a related patch.

Written by Shane

December 5th, 2007 at 8:28 am

Posted in Ruby