Author Archives: force

Run Sinatra App in a Subdirectory with Rack::Builder.map

Thank god I found Tanner Burson’s blog. I was about to explode. I recommend reading Tanner’s original post, but the short answer is that you want Rack to do some routing for you via Rack::Bundler.map. Here is a super simple … Continue reading

Posted in Sinatra | Tagged , , , , , , , , , , , , , , , | Leave a comment

That’s Profiling!

I want to see if one string exists in another, case-insensitive. What’s faster? Making the strings both lower case then comparing them with String.match? Comparing the first string to a case-insensitive regular expression of the other? Making them both lower … Continue reading

Posted in javascript | Tagged , , | Leave a comment

Are You Still There?

A scenario: you want to update some content on your page periodically, but you don’t want to waste requests, resources, cycles, etc. on running your script while the user is obviously not interacting with the page. What do you do? … Continue reading

Posted in javascript | Tagged , , , , , , , , , | Leave a comment

Add Stable Merge Sort to Array and jQuery Prototypes

Some browsers’ JavaScript implementations don’t implement a stable sort, but stable sorting can be so handy if you want to, say, sort a table by multiple columns. So here’s a quick and easy way to add an efficient, stable merge … Continue reading

Posted in javascript | Tagged , , , , , , , , , , | Leave a comment

Request Tracker Watchdog

I recently upgraded from Request Tracker 3.8.0 to 4.0.2 and started running it with FastCGI. Works great except for the odd Bad Gateway message from nginx (still haven’t figured that one out). While v4 makes a lot of improvements over … Continue reading

Posted in scripts | Tagged , , , , , | Leave a comment

Beyond setTimeout: Delay Your JavaScript with Closures

Have you ever wanted to delay something with JavaScript? So, of course, you look to window.setTimeout. But maybe this is interactive, or you want to be able to interrupt it? Then you save a reference to it, and you pass … Continue reading

Posted in javascript | Tagged , , , , , , , , , | Leave a comment

Delete a Line from a File by Its Line Number

I keep having this problem. You know how ssh will tell you when the host’s keys have changed? For example, you try to ssh to example.org $ ssh example.org and you get @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! … Continue reading

Posted in fixes | Tagged , , , , , | 2 Comments

Running Rails 2.3.14 on Ruby 1.9.2

While trying to run Rails 2.3.14 on Ruby 1.9.2, I was getting an error page with ActionView::TemplateError (invalid byte sequence in US-ASCII) Turns out Rails 2.3.14 on Ruby 1.9.2 was trying to read my UTF-8 data as US-ASCII. Solution Don’t … Continue reading

Posted in fixes | Tagged , , , , | Leave a comment

Run Wireshark as Non-Privileged User in Ubuntu

This has been annoying me for a while, so I researched it. I wrongfully submitted a bug to Launchpad, and finally was directed to an answer. It was bugging me that there was no simple way to add a gksu … Continue reading

Posted in fixes | Tagged , , , , , , | Leave a comment

Augmenting Intelligence?

I read (most of) this book called What the Dormouse Said: How the Sixties Counterculture Shaped the Personal Computer Industry, and it discussed this really neat idea of computers as augmenting human intelligence. It’s not so much that we use … Continue reading

Posted in editorials | Tagged , , , , | Leave a comment