Photos from Lunch 2.0 at Appature

Posted on September 27, 2008
Photos from the Lunch 2.0 event at Apparture in September 2008 - great view from their roof.

Quick experiments with JRuby (called from Java)

Posted on September 10, 2008

I keep this file around when I need a quick “so how does that work in JRuby when I call it from Java” kind of thing:

package com.banshee.radoop;

import javax.script.ScriptException;

import com.sun.script.jruby.JRubyScriptEngine;

public class Jrt {
  public static void main(String[] args) {
    JRubyScriptEngine j = new JRubyScriptEngine();
    try {
      Object o = j.eval("class Foo; def initialize; puts \"blarg\"; end; end; Foo.new");
      System.out.println(o);
      System.out.println(o.getClass());
    } catch (ScriptException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
}

Just change the string in the eval statement to whatever it is you’re playing with.

You’ll need the jruby.jar file from jruby (on my machine, /home/james/jruby/lib/jruby.jar) and the JRuby script engine jar.

This particular case spits out:

blarg
#<Foo:0x61ec49>
class org.jruby.RubyObject

A gem-install command that installs the current gems

Posted on September 06, 2008

Here’s a one-liner to get the current gems, in the form of a gem-install command:

gem list | cut -f 1 -d ' ' | grep -v -e '\*\*\*' | xargs echo sudo gem install