Randomness for you since 1976
I am a lover of Minecraft. I go in spurts where I play it obsessively and then forget about it, only to repeat the cycle over and over. Since I have logged so many hours, a lot of the novelty of the game has worn off. Often times I will just create a map, and then wander and wander until I find something really interesting that inspires me to build. A mountaintop lake, a floating island with a waterfall that I can swim up, that sort of thing. Last time I was doing this, I was walking towards a hill when I saw a giant cross at the top. When I got closer, I realized it wasn’t just a cross, it was a floating cross! Clearly my randomly selected seed was infused with the divine!
Pic so you know it happened:
While upgrading Ruby on Rails from 2.1 to 2.3, one of my models threw an ActiveRecord::MissingAttributeError exception when something used exists? to see if it was there. The issue turned out to be our after_initialize hook on the model. In our hook, we rely on looking up the value of one of the object attributes. This fails now because exists? only selects the primary key from the table, leaving the rest of the attributes undefined. Here is how we solved it:
This will cause all the attributes to be fleshed out the second time around.
I wanted an easy way to encrypt and decrypt files in OS X from the command line, so I added the following to my .profile file in my home directory:
Now I can quickly encrypt a file using ‘enc’:
And decrypt it just as easily with ‘dec’:
A couple of things to note. The encrypted file is saved using a _enc suffix, but when decrypting, it assumes you type the original filename, not the _enc version. I don’t mind this, but it could be altered to be a little smarter in this regard. Also, when encrypting it deletes the original file for you, and when decrypting it deletes the encrypted version. I prefer this automatic ‘cleanup’.
Just a quick note to let people know I have started a new blog to follow the progress of my massive home remodel. Join me on my adventure at This Dang House!
While building a Rest API call for our product, we needed the server to respond to a post with a “303 see other” response. Unfortunately, in Rails when you do a redirect_to, it always uses the 302 response code, even when you set the status explicitly:
These don’t fail, but they dont do what you would expect. In my test I asserted that the response code was 303, and the test failed. After some digging I found that I could use the ‘head’ method to force rails to respond correctly:
My response assertion passed. Yay. But it was short lived, because this assertion failed after I made the change:
with an error deep inside response_assertions.rb. Inside the ‘assert_redirected_to’ method, the following line failed because @response.redirected_to returns nil, and then explodes when it tries to call dup.
I did some digging, and it turns out that when I used ‘head’ instead of ‘redirect_to’, the @response.redirected_to was never set. I fixed the test by asserting string equality directly in the response headers:
In general, I find use of the word “bitchin” to be almost inexcusable. The sad fact is, however, that there aren’t very many good rhymes for “kitchen”, and I’m in a rhyming mood. At any rate, we decided to repain the kitchen, and quickly settled on a nice green for the walls, and then later decided to do one wall a darker purple. I am quite please with how it all came out, and hereby submit photographic evidence that I actually completed a project. For reallys. I got all panoramic on you to give a better perspective of the room. Check the purple vent pipe too, it be stylin.
Of course, now that the paint is (almost) dry, I loathe my cabinets, I detest my linoleum floors, I despise my counter tops and I look upon my appliances with disdain. Actually, the plan is to take the cabinets down in the spring, paint them white, and apply some of those stencil looking decals to them. That should help things out a bit. The floors et. al. will have to wait, unless they give out before we are ready.
I also like the way our organization wall looks against the new green color, although the flash really washed the colors out.
So one latest OS X annoyance that I actually stumbled across the solution for. At work I hook up an external monitor to my MacBook Pro, and usually keep all my terminal windows on that one. When I leave, I try to remember to unplug the monitor before I close the lid, because last time I forgot to do that, I had to kill the applications over there and relaunch them to get access to them again.
I tried using expose, but that didn’t show the windows on the now disconnected monitor. I checked out the spaces dialogue as well, but that also didn’t work. I also went into the system preferences to the ‘displays’ screen, hoping to find the ‘gather windows’ button, but it was not present. I think you only get that button when an external display is connected.
The way I actually solved it was through app switching keyboard shortcuts. I used Cmd+Tab to switch to the inaccessible application, then used Cmd+~ to cycle through the windows. As each window received focus, a sliver of it appeared on the edge of my screen and I was able to drag it over.

Poor, poor Snow Leopard...
I imagine this leopard, chillin, enjoying a nice snowy day, when along comes an Apple photo crew.
*FWAP*, they nail him in the head with a snowball, and as he looks at them with annoyance, they snap his picture.
I can only hope that shortly after this picture was taken, the Leopard ate every single one of them.
RFS stands for “Request For Suggestions”. I’m not sure whether I made that up or absorbed it osmosis like from something I read.
For those of you not in the know, I am soon going to be taking on a huge home remodel project, necessitated by some structural problems we are having. In my quest for the ultimate abode, I am looking for inspirational resources. I did the obligatory Google search and was disappointed with what I found. I did find the Home Improvement Blog which has some promising looking content. We all know about Apartment Therapy, which I love, but it’s a little like trying to sip from a waterfall. I have also seen a lot of nice stuff on Inhabitat, but the architecture and design aspects of it are only a small slice of it’s content.
I am looking for blog’s that have the following types of content:
If you can think of anything, please comment and help me out!
I wasted a chunk of time running in circles over this issue. I had assumed that when I loaded the fixtures into my database via ‘rake db:fixtures:load’ or ‘rake spec:db:fixtures:load’ in Ruby on Rails that it was blowing away all the data in all of my tables before creating records. It turns out that it only blows away data in tables for which you have fixtures, leaving any generated cruft in other tables behind.
This blog is a dumping grounds for my experiences as a web developer, a parent, an artist, a writer and a human being. Maybe someday there will be something here that is worth your time, some sort of useful information or words that piece your very soul. Probably not though.