Reading List

The most recent articles from a list of feeds I subscribe to.

Install Node.js on Debian Squeeze

I had some issues with libraries installed via npm (such as d3 and jsdom) causing segmentation faults in Mocha tests. Ultimately I realized that it wasn’t a problem with these node modules so much as it was with my node install itself. I had installed from source following this guide, but it wasn’t quit enough to get my node install right on Debian Squeeze. Install Node.js Dependencies Pretty standard stuff – make sure you’re up to date on these.

Set up Nginx and uWSGI

When browsing the web, I often read that setting up nginx with uWSGI is incredibly easy to set up and get running. I absolutely did not find it so, as I had to deal with a lot of configuration issues. So here’s how I finally got these components working together on an instance of Ubuntu 12.04. I ultimately hook this up to Django, but I’m sure the general principle would apply to other python frameworks with a WSGI interface.

Custom event for detecting fetch errors in Backbone.js

One of Backbone’s major strengths as a javascript MVC framework is the way it helps you do event handling. By extension, it’s also great for handling errors that result from failed AJAX calls. As you can see in the Backbone.js documentation, the error event is triggered when a model’s attempt to save fails server-side. However, there is no Backbone event that detects when the fetch event fails. Since a fetch from the server is the first thing that happens when a page is loaded, you would need to know if it fails because that could indicate that the API is down or some other server error.

Quick Tip: Use jQuery to Complete an Arbitrary Number of AJAX Calls Before Firing an Event

Somewhat recently, I encountered an issue where my expected user input is an arbitrarily long list of words. While I could get the word count, I had no reliable way to know whether all of the ajax requests had been completed before firing an event that created a list of definitions for each word. I had several realizations in my quest: I could do the entire process synchronously. However, this meant that one bad ajax return or error could cause the entire process to hang.

Avoiding the OOM Killer by limiting the number of Apache2 processes and clients

Prologue Last week I had the following mortifying experience: I tried to ssh into my box hosted at RackSpace and nothing happened. It simply hung, and never prompted me for my password. Commence panic. I determined that port 22 was, in fact, open, and I was connecting to the machine at some point. nc -zw3 monicalent.com 22 Connection to monicalent.com 22 port [tcp/ssh] succeeded! telnet monicalent.com 22 Trying 198.