My Profile Photo

chris.heald.me


My personal blog. Software, devops, security, music, and general nerditry.


  1. Making HAML faster

    Haml’s among my favorite of the Rails technology stack. Clean, self-correcting templates that mean less typing and more doing for me. I love it. …


  2. JRuby Performance: Exceptions are not flow control

    I started playing with JRuby tonight, and got my application up and running on it in under 10 minutes (kudos to the JRuby team!), but when I started measuring its performance, I was seriously unimpressed. This didn’t quite line up with what I’ve read of JRuby, so I decided to do a little digging. …


  3. Mongrations reloaded

    Users of MongoMapper may be familiar with mongrations, a Rails plugin to provide you with ActiveRecord-style migration tools for MongoDB. You don’t need them for schema changes, obviously, since MongoDB is schemaless, and you can define any changes you need to in your model. However, there are times that deploying a changeset will require some data change, or some maintenance stuff to be run. For that, mongrations is super helpful. Or was. …


  4. Rails, Varnish, Cookie Sessions, and CSRF tokens

    Cookies! Delicious and performance-shattering.I’ve recently been trying to figure out how to get Rails to place nicely with Varnish. It doesn’t do that very well. In a nutshell: …


  5. Mobile and secure - setting up OpenVPN with DD-WRT and Android

    So, with all the hubbub about Firesheep lately, and the fact that I’m becoming more mobile in my computing, I figured that it was time for me to get a VPN set up. I didn’t want to pay for one, and hey, it turns out that I have all the tools I need to manage my own. …


  6. Hack night at Gangplank

    So, I finally made it down to Gankplank. I’ve been meaning to get down here for a while, but I’ve just not made it happen. I took the weekend to get my development environment up to snuff on my laptop (so I can actually work anywhere now!) and decided to give it a shot. …


  7. Solving error n8156-6003 when trying to play Netflix Watch Instantly content.

    This is mostly search engine bait, because I couldn’t find a solution on my own when searching, but managed to stumble across it anyhow. …


  8. Write-once read-only fixtures for Rails tests

    In the project I’m currently working on, I’m heavily using factory_girl to generate test data, rather than using the old Rails fixtures standby. However, I still have a set of read-only fixtures (which are used for testing read-only models against a legacy database). I’m using these in my tests, but since they are read only (like, seriously - the models are marked as by using after_find to call readonly!, ensuring that records will not be accidentally written), there’s no need to wipe and re-insert them per-test. …


  9. Pain-free CSS3 with Sass and CSSPie

    So, you have a great design for a site. Lots of rounded corners, soft shadows, and beautiful gradients. “This’ll be fun!”, you think. …


  10. MongoMapper, Development Mode, and Memory Leaks

    If you’ve worked with MongoMapper for a while, you’ve probably noticed that in complex apps, there are horrific memory leaks in development that magically disappear in production mode. While this is all well and good, and it’s rather handy that things Just Work in production, don’t you wish you didn’t have to restart your app server every 15 requests in development? …


  11. Debugging memory leaks in Ruby with GDB, round 2.

    In part 1, I described how I located leaky Sets in MongoMapper by diffing the Ruby ObjectSpace with GDB. Today, I’m going to show you how to solve the problems that those sorts of diffs can reveal. In today’s example, we’re tracking leaky sets. In particular, a set is holding onto class references. We are going to: …


  12. WillPaginate and custom paging.

    will_paginate is the de facto Rails paging plugin, and with good reason - it’s solid, fast, and reliable. Everyone I know uses it, but a lot of people don’t use it to its full power. …


  13. Setting up replica sets with MongoDB 1.6

    Introduction


  14. Click mapping with HTML5 and node.js

    I was recently in need of a click mapping solution, and didn’t like most of the solutions I came across. They had huge dependency chains and were generally unwieldy, or they didn’t work that well, or they were external services that I had to pay for…until I ran across heatmapthing. Now we’re talking. Client-side rendering of JSON location data - we’re in business! …


  15. FlexAuth: Portable authentication for Battle.net

    I’ve just released my first Android app, called FlexAuth. It’s mostly an excuse to learn Android development, but it does something useful, too - it serves as a souped-up mobile authenticator for Blizzard’s Battle.net login infrastructure. If you’d like the gory details, there’s a specification floating around on the internet that’ll help you understand the protocol. …


  16. Serving files out of GridFS, part 2

    Since my initial experiments with GridFS and nginx-gridfs, I discovered a rather downer of a dealbreaker: compiling Passenger and nginx-gridfs into the same nginx binary makes nginx very unhappy. It hard-freezes (as in, blocks forever) when you request a GridFS file with Passenger enabled. Oops. …


  17. Serving files out of GridFS

    GridFS is a nifty little feature in MongoDB that allows you to store files of all shapes and sizes in Mongo itself, getting the benefits of Mongo’s sharding and replication. However, since they’re in a database, and not on the filesystem directly, how do we serve them? …


  18. counter_cache for MongoMapper

    I’ve started playing with MongoMapper, and it’s quite excellent, but it does suffer very much from being young. There are lots of pieces missing that veterans of ActiveRecord will take for granted. I’ve been working around or patching them, for the most part, but I felt that my solution to :counter_cache deserved a post. …


  19. Safe action caching with Memcached

    I’ve started using action caching more aggressively, to handle a large volume of not-signed-in search traffic. It composes a significant chunk of my site’s total traffic, but there’s no good reason to be recomputing full pages for all those long-tail hits. So, the obvious thing is to just implement a quick action cache. …


  20. Eight tips for getting the most out of your Rails app

    Rails does an awful lot to optimize page generation, but there are a number of hacks, tweaks, and usage patterns you should be using to get the most out of your app. …