Thursday, September 27, 2007

Remote Build Light

The machine that our CC build runs on is stashed away in a server room somewhere so we can't use the CC x10 plugin to control our build light. To get around this we have a cron job on one of our pairing stations that runs a jRuby script. The script does a screen scrape of our cruise status page and turns the build light on (when any project is failing) or off (when all projects are happy). Three cheers for the build light!

Code for this is here

Monday, September 10, 2007

Sketchy documentation for people too lazy to tie their own Shoes


Shoes is so new and in flux that unless you are comfortable cracking open some Ruby code and lots of C you will have a hard time getting started. I made a little cheat sheet of Shoes for the presentation I gave. It is moth eaten and worse yet, half-assed. I apologize in advance, but maybe somebody will find it useful.

The format here is that method names are in bold. An english description of the arguments (I know it is a terrible thing to do) follow, along with a description of what it does.

background - takes a filename or a color created by rgb(r,g,b) followed by an array of :top, :right, :left, :height, :width

rgb - takes 3 parameters 0-254 and returns a color

width - gives you the width of an element

button - takes a String label and a block and draws a button to the screen

show - make an element that is not visible, visible.

alert - takes a String message and pops up an alert box.

title - takes a String and prints out some big text

contents - returns an array of the elements in this Shoes Object.

ask_color - takes a String which is the title of the color selection dialog that pops up

width= - looks like it lets you set width (but it doesn't resize the base window)

rect - Takes a hash :left, :top, :width, :height and draw a rectangle

quit - close the application window

click - I think it takes a block like keypress, but i just get segfaults.

incident - causes your app to segfault

rotate - takes a number of degrees. and rotates things you have drawn.

height - gives you the height of the element.

flow - A style element that takes an array with :margin and a block consisting of other elements to display. Flows fill left to right. When they hit max width they go down to the next row.

gray - takes an integer, but nothing happens.

border - takes a rgb() color and an array of :strokewidth

display - not sure, think it has something to do with debugging messages you see.

list_box - a selection element that takes a hash of :items where items is a list of options.

height= - set the height of the element.

clear - can take a block. clears what was drawn in the block or without a block clears the whole window.

ask_open_file - takes a string which is the title of the file open dialog box.

goto - takes a url string and redirects you to some url.

text - take a string and display it on the screen. Understands html markup.

subtitle - takes a string and displays some larger than normal text.

stack - A style element that takes an array with :margin and a block consisting of other

image - Takes a filename and displays that image.

edit_line - An element that takes text input

nostroke - the things you draw won't have a stroke line.
release

smalltitle - takes a string and displays some largeish, but not too large text.

stroke - i don't know what parameters it takes, i think maybe a stack or flow, but it sets the stroke width on things you draw.

strokewidth - takes a number that becomes the width of the strokes you make

hide - make an element invisible

animate - takes a number representing frames per second and a block that happens that many times per sec.

confirm - takes a string that is the confirmation message for the confirmation dialog that pops up.

progress - show a progress bar. I have no idea how to fill it up.

keypress - takes a block that gets the value from the keypress. pretty much segfaults every time.

If you have the time I really recommend digging into the C code behind shoes. It practically documents itself!

Why Shoes? at The Ruby User Group


Presentation at chirb tonight. Huge audience! (Over 50 people braved the rain.) Ryan Platte gave an eye opening talk on using GWT with Rails, and Mike Ward talked up a very cool Rails Gem/Plugin called Argible. It took me a few minutes to understand what Argible was about, but once I saw how it was using annotations to get rid of that business of accessing the parameter map in rails I was impressed.

My talk on Shoes was rough going: I put off the research, no documentation for it yet, and half the audience couldn't get the code to compile. Everyone made the best of it. (Thank you everyone!) I gave them a good taste of what a fun little toolkit Shoes is, and some interesting discussion resulted. A question that came up over and over was "Why Shoes?" The following were the major benefits as promulgated by myself, Andy, and Evan
    • You work purely in Ruby, so there aren't other languages or technologies to learn.
    • Your application can be nice, neat OO code.
    • Simple syntax, small files.
    • Apps are easy to distribute since shoes is entirely self contained.
    • Apps are easy to distribute because of the .shy files.
We talked several times about the point of shoes, and if you consider that the intended application is in Hackety-Hack. The above benefits are trememdous. But Why brings up the following in the Shoes README

Shoes is strictly inspired by stuff like REBOL/View, HyperCard,
the web itself and, of course, Processing and NodeBox.

I don't like the bulkiness and the layers and layers of wxWindows,
FOX, QT, GNOME. They are big, big libraries and all the apps look
identical, devoid of spirit.

The unique thing about the web is that it gives you very few
controls, but people are able to build wildly different pages
with it that are still immediately accessible to people.

My final position on Shoes is that I'm all in, and I can't wait for it to pump life back into HacketyHack.

mr_luc Broke Ruby's Heart


Doing research for a presentation on Shoes in a forum. Sifting through matted layers of conversation. Listlessly digging, late into the night, in a manner not quite like shuffling your feet through fallen leaves, just for the sensation of it. When suddenly from the decay I turn up a lover's handwritten note! In this case a certain mr_luc was confessing his own duplicity, confessing to Ruby that his heart belongs to another.

I now reproduce the promiscuous mr_luc's confession as overheard here
I like Camping.

I think I will probably like Shoes.

The reason I like them? I am having a very hard time fighting between my Lisp side and my Ruby side. My little language side and my object side. My OMGrails side and my OMGmacros side.

So right now I'm a total code slut.

I'm exclusive and classy (no Microsoft rednecks or Perl stoners, please), but everything has got to be totally commitment-free. I have this respite, I don't know for how long, where I'm not coding for money and I get to play around with stuff I like and decide how I really want to code. I don't want to invest in a massive architecture, and when compared to Lisp, Ruby's syntax and macrolessness and object centrism are already big mental investments without learning the Rails architecture, as you really need to do to be capable with it.

Lisp lets me work as elegantly as I can think. Ruby lets me be productive and play with the latest toys with a lower amount of pain than other options, but it doesn't have my heart.

And for that reason, I like Camping and (probably) Shoes. I'm a whore right now, Ruby. I'm not really yours.
This is as intimate as it gets with programming languages. Thank you for coming clean Mr. Luc, whoever you are.