Chris Holtz LABS

Blog

Honeypot captcha

Phil over at Haccked.com has an interesting alternative to typical captcha validation.

"create a honeypot form field that should be left blank and then use CSS to hide it from human users, but not bots. When the form is submitted, you check to make sure the value of that form field is blank."

I really like this approach - it is much less invasive than the usual word verification. I haven't implemented comments here yet, but I'll probably apply this when I do.

Click to continue...

Have you ever had the pleasure of playing family tech support? I do! That's why I'm spending memorial day afternoon running windows updates. Woo! What to do while waiting... browse the Internet, check; clean likely malware candidates off their PCs, check; Zone out while listening to the wind, check. Oh! I can write a blog post about ruby inject!

Actually, I want to talk specifically about using the Hash class with inject. If you have a hash with a bunch of keys that are strings that you would like to convert to symbols, you'd do something like this:

>> x = { "first_name" => "John", "last_name" => "Smith" }
=> {"last_name"=>"Smith", "first_name"=>"John"}
>> x.inject({}){ |hash,(k,v)| hash.merge( k.to_sym => v) }
=> {:last_name=>"Smith", :first_name=>"John"}

Click to continue...

Have you ever been tasked to convert all instances of a URL into a hyperlink from some source of text? Or perhaps you had to pipe all URL instances through a URL shortener?

I've had to do this from time to time over the last several years (the first stab a it was a miserable piece of code but got the job done), and every time I have had to deal with the same quirks: what if the URL is at the end of a sentence, what if it is at the end of a line, what if it is immediately followed by an html page break, etc.

Dear god, what have I done to deserve this?

Click to continue...

Slicehost is an excellent hosting platform - I've been using them for some time now. However, in the interest of trying to drive costs down to absolute zero, I started evaluating Heroku as a platform to host this site.

Slicehost

If you're not familiar, Heroku and Slicehost differ structurally: Slicehost provides you with a virtual instance of Linux - most major distributions are available. It's your job to configure/manage the web application framework.

This opens a world of flexibilty - you can deploy any web-based solution you like backed by the database of your choosing. This is incredibly empowering - but you own everything, including downtime (at least downtime not incurred by Slicehost), maintenance updates, security, etc.

Click to continue...

Comparing web hosts

I have an instance of this site deployed on both Slicehost and Heroku and am running tests on both. I'll post formal results soon; in the mean time, desipite it's restrictions, I'm leaning towards Heroku.