Archive for the 'JRuby' Category

RubyConf 2007 Second Day Morning

Saturday, November 3rd, 2007

John Lam: State of IronRuby

Photo by dwortlehock
Who works on IronRuby? The core is: John Lam, Hiabo Luo, Tomas Matousek, & John Messerly.
Why did John move from Toronto to Seattle to start working at Microsoft on IronRuby? He was in love with RubyCLR and couldn’t turn down the opportunity to work on a “real” implementation.
Goals
John [...]

Stacked Bar Charts in JRuby using JFreeChart

Thursday, July 12th, 2007

I was getting some comments on a previous post asking about building stacked bar charts in JRuby using JFreeChart, so here’s another example:

# Mostly inspired by
# http://left.subtree.org/2007/01/15/creating-sparklines-with-jfreechart/
# have JFreeChart in your classpath, obviously, as well as jcommon.jar
require ‘java‘

module Graph
class StackedBar
include_class ‘java.io.File‘
include_class ‘org.jfree.chart.ChartUtilities‘
[...]

JRuby + Jetty

Wednesday, June 6th, 2007

I finally figured out how to get JRuby to serve a Jetty servlet today (thanks to Charles). The key was flipping what I’d been trying to do for a while (getting Jetty to run JRuby). Here’s code that implements the AbstractHandler interface pretty trivially:
$ cat jetty_example.jrb
require ‘java’
include_class ‘javax.servlet.ServletException’
include_class ‘javax.servlet.http.HttpServlet’
include_class ‘javax.servlet.http.HttpServletRequest’
include_class ‘javax.servlet.http.HttpServletResponse’

include_class ‘org.mortbay.jetty.Server’
include_class ‘org.mortbay.jetty.servlet.Context’
include_class ‘org.mortbay.jetty.servlet.ServletHolder’
include_class ‘org.mortbay.jetty.handler.AbstractHandler’

class [...]

JRuby + JFreeChart = Sparklines

Friday, April 13th, 2007

Inspired by how easy it was to get JFreeChart working and some code from former colleague Andrew Bruno, I thought it’d be nice to write some JRuby to generate Edward Tufte’s Sparklines.
Here’s some simple example code on a semi-random dataset:

# Mostly inspired by
# http://left.subtree.org/2007/01/15/creating-sparklines-with-jfreechart/
# have JFreeChart in your classpath, obviously, as well [...]

More JRuby Play: JFreeChart

Thursday, April 12th, 2007

I’ve been messing around at work trying to make some automated scheduling charts (basically Gantt-like) in Ruby. I’ve implemented it a couple of times using SVG::Graph, which is close to what I need, but I end up having to rewrite a lot of methods whenever I really start using it. It occurred to me today [...]

Borrowing Java’s XSLT Support for Ruby

Friday, March 2nd, 2007

Well, I finally caught up with the crowd and got JRuby running on one of my dev boxes. The reason I’d been interested in it from the getgo was because Ruby lacks any support for internal XSLT processing. All those system()s were starting to get me down, especially as I’m trying to get a DocBook->PDF [...]