Verbose Logging

software development with some really amazing hair

Proc, Block, and Two Smoking Lambdas

» Posted in Programming
Ruby 1.9 has 4 different ways to deal with closures. Cue music Proc Procs are the weird ones of the bunch. Technically, all of these things I’m going to describe are Procs. By that I mean, if you check the class, it’s a Proc. A Proc is made by using Proc.new and passing a block, Proc.new { |x| x }, or by using the proc keyword, proc { |x| x }. A return from inside exits completely out of the method enclosing the Proc. A Proc doesn...

Rubygems Beyond The Thunderdome

» Posted in Editorial
Stop me if you’ve heard this one before. You get into some new tech over the weekend. With enough excitement to kill a horse, you whip up a ruby gem and put it on Github. You get a few hits, some people using it over the next little while. A few bugs get reported, and you fix them. A few features get requested, and you implement them. A few pull requests get submitted too, and you merge them. You’re using it yourself, so you’...

IE7 Eats Babies

» Posted in Software
But you already knew that, right? These days, in fancy AJAX applications, you frequently want a link on a page to just do asynchronous things. You don’t actually want the link to go anywhere. Let’s just ignore the fact that this goes against progressive enhancement okay? Can I see your ID please? So sometimes the link is important enough, and you throw an id on it and you can do this in jQuery. $('#important-link').click(function()...

Things You Need To Start Caring About Now

» Posted in Editorial
You need to start caring about a few things. Now. Code style Looking through code, you see all sorts of things. Some of them are good. Some of them are downright amazing pieces of code. Some of them are horrible. Some of them are so bad you feel your grip tensing around the keyboard and you have to restrain yourself so you don’t snap the bloody thing in half. They might be bad decisions. They might be caused by someone who didn’t h...

Worst URL Shortener Ever

» Posted in Programming
I was bored last night, so I hacked this up. My original thought was since riak has an HTTP interface, I could just proxy GET requests to it when a short URL was used, but either I was doing it wrong or you can’t set the Location header when you POST documents. Oh well. Anyway, this uses riak just to store the URL, and the riak key as the short URL key. There is no error checking, UI, or anything fancy. It’s pretty much the simples...

Idiomatic Go Channel Timeout

» Posted in Programming
I’ve been doing a lot of Go programming lately, and it’s good stuff. Go is a fairly new programming language coming out of Google from the minds of some really smart people, like Rob Pike and Russ Cox (among others). It’s a C family language, so it has curly braces, has simple yet advanced concurrency features, and garbage collection. It’s both high and low level, and was originally billed as a systems programming langu...