Looking for my family blog?

If you are looking for JeremyandDarcy.com, please click here: http://jeremyanddarcy.com.

Jul 10 13:42

Simplifying your test code

Robby, one of the developers I worked along side at BlueSpire, used a pattern in our test suite to simplify the setup of objects under test. I thought it very useful and it made the code so much more readable.

The idea is, when setting up an object n different ways, it's nice to set only the parameters you need on the same line as the instantiation.

Jul 08 22:18

Using method_missing in Ruby

I first learned about method_missing when Christopher Bennage asked me about it. Even after looking it up and explaining it to Christopher, I didn't find any practical use for it in the things I was doing.

At least until tonight, that is.

I've been working on expanding Hair Forecast into Canada. I have the Canadian weather data described in active record like so:

    create_table :canadaforecasts do |t|
      t.column :fcstdate, :date
      t.column :lat, :float
      t.column :lon, :float
    end

Jun 11 21:47

Hello Drupal!

I became frustrated with blogger lastnight. It refused to publish to my server, and didn't throw any errors. I was watching my log files on the server and blogger wasn't even attempting to connect and publish.

Jun 10 23:00

Discovering a compromised server

I took a freelance job today helping someone with his compromised server. He wasn't sure what the problem was, but he knew he was getting emails from his ISP about abuse reports naming his IP address.

Jun 09 16:14

Simple templates in RHTML

I'm creating a very simple site (4 static pages) for some friends and didn't need to do anything fancy (yet), so I elected to use plain HTML and Javascript and not use a framework (like Rails). I like Rails, but I just can't see myself deploying the whole Rails tree just for a 4 page static site.

May 23 11:23

Simple Webrick server for testing plain HTML

Sometimes I find myself in need of a quick and dirty HTTP server when I'm working in plain HTML with a little Javascript. For example: when I'm building banner ads that use scriptaculous. Rather than mess with lighttpd and get the files where it can see them, I found myself wanting to the do the old "ruby script/server" as we do in Rails.

So I looked at the Webrick home page, and ended up with this:

require 'webrick'
include WEBrick
s = HTTPServer.new(
 :Port => 3000,
 :DocumentRoot => Dir::pwd
)
trap("INT"){ s.shutdown }
s.start