2007-06-14 @ 08:54

Stream music to your Airport Express with Ruby!

I just released raop-client which lets you stream music to your Airport Express with ruby.

Just install the gem: gem install raop-client ~~~

Here is a sample program which takes decoded input from stdin:

require 'raop-client'

raop = Net::RAOP::Client.new(ARGV[0])
raop.connect
raop.play $stdin
raop.disconnect

Just use the program like this: % lame --decode -q some_song.mp3 - | ruby streamer.rb 192.168.1.173 ~~~

You’ll have to supply your own mp3 and Airport Express IP address. Also, raop-client currently doesn’t decode music, so you’ll have to decode the music yourself.

read more »

2007-06-17 @ 11:36

Graphing Ruby Objects

I’ve been working more on my ObjectGraph project, and I think I’m about ready to release. With a bunch of help from Ryan, and other Seattle.rb folks fixing my dumb errors, I’ve added a couple new features to Object Graph that I think people will enjoy.

First, you can no graph ascendants of your object. Say you have a reference, and you want to know the graph pointing to that reference. You can do it now:

class A; end
a = A.new
struct = { :one => [], :two => [a] }

grapher = ObjectGraph.new(:ascendants => true)
grapher.graph(a)
puts grapher

Which will produce this graph: ascendants

You can also see differences in graphs. Say you want to know what happens to your graph after performing some action. Just pass a block to the graph method, and ObjectGraph will diff the two trees. Green boxes are new objects, pink boxes are one that went away, and red arrows are references that were destroyed.

class A; end
struct = { :one => [], :two => [A.new]}

grapher = ObjectGraph.new
grapher.graph(struct) do |s|
  s[:one] << A.new
  s[:two].pop
end
puts grapher

diff

read more »

2007-06-17 @ 11:55

ograph version 0.2.0 has been released!

ObjectGraph will output Graphviz dot files of your objects in memory. It will ferret out your instance variables and enumerate over your enumerables to give you a graph of your object and its relationships.

For sample output and more sample code see:

  • http://flickr.com/photos/aaronp/tags/graphviz/
  • http://tenderlovemaking.com/2007/06/17/graphing-ruby-objects/
  • http://tenderlovemaking.com/2007/01/13/graphing-objects-in-memory-with-ruby/

Changes:

== 0.2.0

  • ObjectGraph now can graph ascendants of your objects
  • Support for color diffing trees was added

== 0.1.0

read more »

2007-06-17 @ 23:42

raop-client version 0.1.1 has been released!

Net::RAOP::Client is an Airport Express client. It allows you to stream music to an Airport Express.

Changes:

= Net::RAOP::Client CHANGELOG

== 0.1.1

  • Fixing a bug with setting volume.
  • Added options and flush methods
  • Using IO#write instead of IO#syswrite
read more »

2007-06-24 @ 23:09

drawr version 1.0.1 has been released!

DESCRIPTION:

This is a ruby wrapper around Plotr with a similar API to Gruff. You can create graphs with a similar interface to Gruff, but offload the rendering to the browser!

FEATURES/PROBLEMS:

  • Needs more tests!

SYNOPSIS:

An example in rails. Your controller:

class GraphController < ApplicationController def index @drawr = Drawr::Pie.new @drawr.title = “Twan” @drawr.data(“One”, [1]) @drawr.data(‘Two’, [2]) @drawr.data(‘Three’, [2]) @drawr.data(‘Four’, [10]) @drawr.data(‘Five’, [6]) end end

Your view:

<%= javascript_include_tag 'prototype' %> <%= javascript_include_tag 'excanvas' %> <%= javascript_include_tag 'Plotr' %> <%= @drawr %>

Changes:

1.0.1 / 2007-06-24

read more »