Viking Hammer

Archive for the ‘Uncategorized’ Category

Cassandra Counter Columns

Cassandra supplies “counter columns”, which are used to store a number that incrementally counts a value. You might use a counter to keep track of pageviews or other events. I couldn’t find much documentation about how to use these, especially through the CLI (which is where I typically start out when trying to investigate a [...]

Using Dependo to help with testing

Last week, I introduced Dependo, my new dependency injection framework for Ruby. Today, I want to demonstrate something that it makes very easy — and something that I wouldn’t know how to adequately test without it. In our OCSP responder, we rely on a Redis database and can configure (at startup) whether we want to [...]

Ruby Dependency Injection: Introducing Dependo

Today, I discovered that I need Dependency Injection in Ruby. Other people who are probably smarter than I am have said you don’t need it, because Ruby is so dynamic and you can just do whatever you want to without having the structure provided by dependency injection. DI frameworks are unnecessary. In more rigid environments, [...]

Ruby OpenSSL::X509::Name throws away unknown subject component names?!

OpenSSL::X509::Name is a class in Ruby’s OpenSSL bindings that lets you deal with the subject line of SSL certificates. It’s useful and necessary, though dealing with it can be kind of annoying. But as of Ruby 1.9.3, there’s a big bug that threatens to be a deal-breaker for anyone doing significant SSL work in Ruby: [...]

Local Time Calculator for Java (Android)

Have you ever noticed that both MLB and NFL only give the starting times of their games in Eastern time? Through their websites, and even through their mobile apps — which I find especially egregious since your phone knows what timezone it’s in. One of the big features, in my opinion, that my MLB Scoreboard [...]

Android ListView: Maintain your scroll position when you refresh

Refreshing an Android ListView is a pretty common thing — but the best way to do it isn’t immediately obvious. Here’s my progress through the different patterns. The Obvious I figured that when I’ve downloaded the new list of stuff I want to show, that I could just create a new adapter and stuff it [...]

Simplified DAO helper for using JDO with Google Appengine

I’ve been playing with Appengine for Java lately, and using JDO (which stands for Java Data Objects) for the first time. All the example code is pretty annoying; apparently, in every DAO method, you have to grab a PersistenceManager from the PersistenceManager factory, use it to build and execute a Query, and then close the [...]