Andrew Lindner     Blog     Archive     Reading     About

The Settler's Dilemma - Betrayed again by a 4 in Catan

Does this situation sound familiar? You decide to play a “casual” game of Settlers of Catan with some friends and begin to set up the board. Throughout the setup process, you study the map and carefully place your initial settlements, maximizing your resource allocation and the probabilities associated...

Can You SQL Inject a Jukebox?

Recently, I was grabbing drinks with a former colleague of mine and placed an overconfident wager. While sipping on a round of vodka tonics at a local Chicago bar, I bet her that I could hack into the establishment’s digital jukebox and force it to play her favorite song, Jarvis...

Rails - Handling Record Insertion Race Conditions

Classic Technique

New Rails programmers typically learn the .find_or_create_by method to avoid inserting duplicate records in the database. When invoking this method, Rails will search the database for a record with the specified attributes, and if it does not return one, it will create a new record.

...

Adventures in PostgreSQL - Extract Epoch

Recently I needed to create a database query that compares the timestamps of several rows of data. It took me substantial detective work and googling, so I figured I’d document the solution in a blog post.

PostgreSQL provides various functions for working with date and timestamp...

Roger Sterling as a Hemingway Character

Apart from his heavy drinking, Roger Sterling appears to have little in common with the outdoorsmen and adventurers often featured in Hemingway novels. Sterling’s coddled upbringing and prominent position atop an advertising agency starkly contrast the rough and dangerous existence of Robert Jordan in For Whom the Bell Tolls. During...