Archive for the 'Code' Category

O’Reilly Release ePubs

Tuesday, July 15th, 2008

As of today, 30 O’Reilly titles are available as Ebook bundles and many will be in the Kindle Store later today:
As promised last month, O’Reilly has released 30 titles as DRM-free downloadable ebook bundles. The bundles include three ebook formats (EPUB, PDF, and Kindle-compatible Mobipocket) for a single price — at or below the book’s [...]

ISBN10 to ISBN13

Thursday, January 24th, 2008

As of the beginning of 2007, ISBN10 is dead. Now we’re in a world that allows “979″ prefixes, though the following code doesn’t expect them yet…
Here’s some stuff to turn your 10-digit ISBNs into 13-digit ISBNs, naively assuming “978″, following an the API post doing the same from LibraryThing. There’s another one at isbn.org for [...]

RubyConf 2007 Second Day Afternoon

Saturday, November 3rd, 2007

Ed Borasky: Profiling and Tuning Ruby 1.8
Slides are available here. Cougar is the name of the project that this is coming from?
Is Ruby 1.8 Slow?
To benchmark: Collect a set of benchmark times, then normalize them, then compute the geometric mean of the ratios.
Alioth is a popular (if controversial) set of benchmarks. Using gcc as the [...]

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 [...]

RubyConf 2007 First Day Afternoon

Friday, November 2nd, 2007

Nathaniel Talbott: Why Camping Matters
“I don’t know about you, but I am totally psyched about this conference!” Nathaniel has spoken at every RubyConf.

Photo by laurafries.com
Every talk needs a metaphor, and this talk’s will be the bacon, egg, and cheese biscuit.
Bacon
The bacon is the connection to the creator, and to chunky bacon. It’s a 4k [...]

RubyConf 2007 First Day Morning

Friday, November 2nd, 2007

I’m at RubyConf 2007 for the next few days. Here’s a stream-of-consciousness blog of the first morning’s talks. Apparently there will eventually be video of the talks online.

Photo by jremsikjr

David Black kicks it off
This year is bigger than ever, with attendance 15 times greater than the first one in 2001. New tracks have been added [...]

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‘
[...]

DocBook-XSL Sytlesheets have >600 Parameters

Wednesday, June 13th, 2007

Norm Walsh writes:
Stylesheets can have literally hundreds of parameters. The DocBook XSL Stylesheets have more than six hundred.
All I can say at this point is: wow. Grepping the core of our own customization shows 121 <xsl:param>s (about 20 of which we introduced) and 52 <xsl:attribute-set>s (20, again). Thinking about it now (as I haven’t before), [...]

Partial Updates: A Simpler Strawman?

Sunday, June 10th, 2007

James Snell has been working some interesting things as the work on the Atom Publishing Protocol spec winds down. Most recently, he posted some thoughts on how to effectively communicate partial updates to APP servers using HTTP PATCH.
[UPDATE: James points out the obvious drawback to this approach in his response.]
One of the things that [...]

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 [...]