i’m famous.

Posted on April 16, 2006

Not really, but it’s kinda cool having my name on a book at Barnes & Noble. Unfortunately, they went through the multipage review I wrote for them and managed to find the one quote that makes me sound like a total tool:

webwork in action

I actually reviewed the book over two years ago. When the book went to print, they were supposed to send me a copy, but I guess that fell through the cracks. I was weeding my inbox and found an old email about it, sent them a quick note, and a few days later two copies showed up. Too bad I’m not working with this technology anymore (or any technology for that matter).

Anybody want a copy of Webwork in Action?

ruby + x10 = crazy delicious

Posted on March 13, 2006

So I upgraded my Sprint DSL service to the 5.0 Mbps service about a month ago. At 3.0 Mbps, the service was rock solid, I never had downtime. Unfortunately, at 5.0 Mbps, that is no longer the case. My connection suffers from a condition called “Sync, No Surf.” Basically, my line is too noisy for that speed, and the DSL modem loses it’s connection, but doesn’t realize it, so it doesn’t try to reconnect, i.e. it still has “Sync”, but you can’t “Surf”.

Needless to say, this sucks. The fact that I host my own email in my basement makes it all the more annoying. I’ve called Sprint, and they sent somebody out who did something, that made it to where it only happens every few days rather than every few hours, but the line still isn’t up to snuff. I considered downgrading, but quite frankly, I really like the speed. Basically, I needed a little gnome to push the power button on the DSL modem whenever the connection was lost.

So two steps to the problem, first something to monitor whether the connection is dropped, and then something to restart the modem when it happens:

So the first player is Ruby. FreeBSD has a nifty little utility in ports called Daedalus. Daedalus simply sits in the background checking to see if things are as you want them, and if not, it runs a command. Although I haven’t had to hack it, it’s written in Ruby if I ever want to. Here’s what the relavant part of my configuration file looks like:

1
2
3
4
5
6
7

<name>dsl</name>
<checkinterval>5</checkinterval>
<checkcommand>ping -c 4 news.com</checkcommand>
<regex>/icmp_seq/</regex>
<failcommand>/root/restart_dsl_modem.rb</failcommand>
<commandtimeout>90</commandtimeout>

Pretty self explanatory. I’m not sure why I picked news.com, it’s just what I always ping to test a connection. But what’s that restart_dsl_modem.rb script…

I’m sure all of you are familiar with X10. They ran the most obnoxious pop-up/pop-under advertising campaign of all time selling their spy cameras and what not. Anyway, many years ago, they were giving out these free (plus shipping) home automation kits they called Firecracker. A little dongle that plugs into a serial port and little modules that you plug into the wall and then plug appliances into. You can still buy one here, but unfortunately they are not free anymore.

So I’ve had this box full of random X10 stuff that I’d been carting around for my last three moves, and I kept telling myself I should just throw it away, since I hadn’t used it. When I was trying to solve this DSL modem problem, I dug through the basement looking for it and was pissed cause I thought I had tossed it. I took one more look though, and it turned up, so all’s well.

Anyway, I plugged the dongle into the serial port of the FreeBSD box, and installed the x10-cm17a gem which provides an easy peasy Ruby interface to control the Firecracker module. So without further adieu, I present to you restart_dsl_modem.rb:

1
2
3
4
5
6
7
8
9
10
11

require x10/cm17a

X10.controller = X10::Cm17a::Controller.new("/dev/ttyd0")

dsl_modem = X10.device(a1)

dsl_modem.off
sleep 10
dsl_modem.on
sleep 60

Again, pretty self explanatory. I tested it out by pulling the phone cord on the DSL modem and then plugging it back in after the restart, and it worked like a champ. Here’s the Daedalus logs:


I, [2006-03-13T21:07:24.647592 #79938]  INFO -- :
    State changed from "found" on monitor dsl - the new state
    is "not found"
W, [2006-03-13T21:07:24.648690 #79938]  WARN -- :
    Regular expression /icmp_seq/ did not match the output of
    "ping -c 4 news.com" for monitor "dsl"
W, [2006-03-13T21:07:24.649623 #79938]  WARN -- :
    Running "/root/restart_dsl_modem.rb" (failcommand) for
    monitor "dsl"
I, [2006-03-13T21:08:44.315012 #79938]  INFO -- :
    State changed from "not found" on monitor dsl - the new
    state is "found"

Now to hook up ActionMailer to get notification emails, and I’ll be all set.

So geek. So awesome.

stupid images

Posted on July 25, 2005

While we were in Charleston last weekend, klk pointed out that the images on my blog were broken. I’d never noticed this since they work if you visit the main link of the blog, but if you use a permalink or are reading in a feed, you just see broken image icons.

This, incidentally, turned out to be a huge pain to fix, and in the end I just went with a workaround. The Textile filter that Typo uses (RedCloth) doesn’t escape tilde’s, so I couldn’t make absolute URL links to the images. My workaround was to convert the article that used Textile to no formatting and adding all the HTML markup myself.

What a pain. I’ll go file a bug now.

So for those of you that couldn’t see the pictures the first time around, go check out Old, Forgotten, and Soon to be Wasted: A Grand Photo Tour of our Leftover Meals, and see it as it was meant to be seen.

best slashdot comment ever

Posted on June 16, 2005

…in yet another article about Rails on Slashdot, I saw this comment, which kicks ass.

RUBY! AJAX! ORGASM! Hit it with a RAIL!
R!
O!
R!
ROOOOOAAAAR!
RUBY ON RAILS! So fucking awsome I gotta, … I, OMFG!!!!!!!! I’m coming, I’m gonna, OMG … say “I like your monkey!!!” SAY IT! – …. OOOOooooohhhh, Rubyajaxrails, yeaaaah!!
I’ve got it! Yeah! I’ve got a vision, people, a vision!
We’re gonna have Ajax and we’re gonna put it on Rails and it’s all gonna be like Lucy in the Sky with Rubys.
Oh my gosh am I seeing some shit….
This is so awesome… …and any Beta mindfart about it is like ten times ten Ajax orgasms!

so awesome.