Code
Rovyvon A5R flashlight diagram
2025-11-18 documentation graph graphviz studyI bought a Rovyvon A5R flashlight. It’s a great little flashlight that charges by USB C and has many useful modes. While I’m generally quite happy with modes, I spend a lot less time using a flashlight than editing text and was a little confused about how to switch to the one I wanted. The manual for the flashlight is accurate but not clearly written.
TypeID in Lua
2025-05-21 Ansible Caddy Hatchbox Lobsters Lua TypeID nginxI’ve published a Lua implementation of TypeId:
Google Ad Injection
2024-11-24 Google ad injectionThis post is getting updates - I’m trying to collect ad samples and investigate with a site owner so I can give away js that site owners can use to detect and block the ads. Please help!
Streaming Weekly Lobsters Office Hours
2024-08-12 Lobsters Twitch streamReposting the announcement posted on Lobsters for my blog’s rss feed:
Discord vs IRC Rough Notes
2024-07-11 Discord IRC Libera Chat Lobsters MetaLobsters has had a chat room on Libera Chat for 9 years today. Lobsters itself is 12, and I see Libera Chat as continuous with a rename a few years ago.
Wrapping Large-Scale Refactors
2024-01-27 large codebases practices refactoringI really liked a “Long Term Refactors” by Max Chernyak explaining a nice development practice. I was reminded of a thing that surprised me about refactors and dependency management.
NixOS on prgmr and Failing to Learn Nix
2018-07-04 docs nix prgmrThis is a writeup of my notes on how to get NixOS running on a VPS at prgmr, followed by more general notes on this experiment in learning nix.
MiscPodcast
2017-08-27 PHP podcast projectI have some random episodes of podcasts laying around waiting to get listened to from podcasts I don’t (yet) care to subscribe to. Maybe they had an interesting guest or topic, or came recommended. These downloads will lay around on my computer for months because they’re not in my podcasting app, so they’re not really in my listening queue.
Arithmetic Wrap in GMS2
2017-08-06 gamedev gms2I’m learning GameMaker Studio 2 because my 10-year old nephew wants to make video games (and the 10 year old inside of me wants to make video games, too). It’s a nice toolkit and IDE for games, very beginner-friendly, with a friendly community. It’s even been used in some highly polished and popular games. If you’re curious, there’s a ~90 minute tutorial playlist that’s easy to skim as a demo.
Redshift With Cloudiness Adjustment
2017-01-25 bash redshiftA Lobsters story on the bright blue light of displays reminded me I should post this. I use redshift to adjust the color temperature of my monitor at night so I sleep better, and I wrote a custom wrapper script to include an adjustment for how overcast it is.
Hard Lessons
2016-09-28 email handmade.networkHaving worked on email-related code before, I have been morbidly fascinated by one of the founders of handmade.network writing an email client. Handmade Network is trying to reinvigorate programming by emphasizing small teams and from-scratch performant code. It’s a great way to write small, self-contained projects (games, libraries, utilities) that can be done, but fell out of favor two decades ago for complex user-facing software.
When maintaining a legacy Rails apps, drink every time...
2016-06-29 Rails humor- …the code gives up on basic indentation
- …you find a database access more than four layers deep from the controller/job
- …you find an untouched test, view, or migration file from ‘rails generate’
- …there’s an explicit require to monkeypatch an autoloaded file of the same name
- …you realize a fix is sabotaged by nil
- …you find another model layer
- …you find code that never worked
- …a database schema is justified by legacy code that was decommissioned more than a year ago
- …the only way to prevent a future bug is a sternly worded comment
- …code only works because an invalid model was passed to it
- …someone reverts part of your cleanups
- …you find an implicit, ad-hoc state machine
- …after the second time you find a totalizing js framework (ember, angular, backbone, etc.
- …you find a directory under spec/test/feature the test runner skips
- …a dev misapplied DRY so they could play with metaprogramming
- …a random script is far better written than the app’s core feature (fortress of solitude)
- …a dev justifies a bug in untested code by incorrectly claiming static typing wouldn’t catch it
- …you find an abandoned selenium test suite for functionality with no other tests
- …you hear “I know you’re cleaning things up, but ______ is not worth your time”
- …code deliberately bypasses validations (“why do we even have that lever”)
- …you reify a core app concept for the first time
- …you find another repo that still doesn’t bring the app over 50 KLOC
- …you track a bug to a commit whose entire log message is “squashed”
- …even Rails’s support for database constraints would’ve caught the bug
- …a bug exists in local dev but not in prod
- …a module mixed into only one model depends on another module only mixed into that model
- …you find a new technique for passing data to javascript
- …Rails core is invoked to win an argument (via 355E3B)
- …the last test was added two pivots ago
Vim: highlight word wrap column in insert mode
2016-06-09 vimI like vim’s colorcolumn for highlighting where word wrap will occur, but I consider it a distraction when I’m not in insert mode. After some tinkering, I wrote this in my .vimrc:
Should multiple Rails Apps and APIs share a database?
2016-03-05 ActiveRecord RailsHaving two (or more) Rails apps/APIs talk to the same database is a bad idea I’ve seen a few times in the last few years at larger/older clients. While it is a nice project for a consultant like me to undo (long but not risky = good profitability), you’re better off not doing it in the first place.
How side effects make ActiveRecord models unreliable
2016-03-04 ActiveRecord Rails side effectsThe underlying faults in familar code that breaks in surprising ways
Recursive Sum
2016-02-13 Ruby recursionIn #ruby on Freenode, platzhirsch asked about how to total an array of Transactions when the Transactions may have parents. The two obvious approaches have pitfalls when there are a lot of Transactions, and he said he expects to have 23 million that may be deeply nested. Here’s his sample code:
Battery Longevity
2015-11-16 batteries systemdI switched to a Lenovo X1 Carbon (3rd gen) in January, and one of the delights of a new laptop was a new laptop battery. I chuckle when I get a stern notification that my battery is running low: it’s fallen to 20% charge! And it can only last for another... two hours and ten minutes. Well, I’m not in a big hurry to find a plug when I see that.
ActiveRecord Dangers Cheatsheet
2015-11-14 ActiveRecord RailsOne of my least-favorite Rails experiences goes like this:
Have You Seen This Cache?
2015-11-02 C Python Ruby cache memcached referential transparencyIt looks like syntax highlighting, image thumbnails, and compiling object files. Let me explain.
Replacing Ack with Ag
2015-10-19 ack ag searching vimI used grep to search code for a bit over a decade. I switched to ack to get more quicker searches without the distractions of svn/git metadata and other non-code files. After a very nice five years of ack, I’ve switched to ag. I’ve been recommending it to other devs for a year or two (it’s faster than ack with a couple really nice features like obeying .gitignore configs), but only took the time to switch this week.
POP3 and SMTP via SSH Tunnels
2015-10-05 email privacy ssh tunnelI use Fetchmail to retrieve my email. I have an account that still doesn’t support SSL, but at least I also have an SSH account that on the same network. Here’s the fetchmailrc config to optionally tear down, then build and use an SSH tunnel:
Chicago Code and Coffee
2015-09-21 code and coffee meetupsA quick note for folks who don’t follow me on twitter: I’ve created a homepage for Code and Coffee, the weekly development meetup. Hope to see you soon.
Finished Libraries
2015-09-07 TeX version numbersWhen I evaluate a software library, I typically look first at how recently it’s had a release. Is it being updated, or has it been abandoned? There’s an assumption, here.
Deleting Spam From sup Maildirs
2015-08-24 email spam sup yak shaveA quirk of the sup email client is that it doesn’t sync back changes like deletes to mail sources. “Deleted” messages are only flagged and hidden from the user.
The Harmful Consequences of Postel's Maxim
2015-08-10 Postel's Maxim standardsBe liberal in what you accept, and conservative in what you send. Postel’s Maxim, RFC 1122
Skyscrapers and Doghouses
2015-07-28 ActiveRecord Rails
Against Tedium
2015-07-27As a web dev, I often feel like a ridiculous percentage of my day is spent converting between FooBar and foo_bar in the Ruby server code, foo-bar in the CSS class, fooBar in the JavaScript, and Foo Bar in the documentation. There’s so damn much repetitive plumbing.
Sizing Up My Queue
2015-06-29 Ruby media podcasts yak shaveI have a folder named “queue” that I download podcasts, videos, and books to. It occurred to me that it hasn’t been empty for years. That’s OK, the world is a very interesting place, and I care that I produce things, not just consume them.
Installing You Need a Budget 4 (YNAB) on Arch Linux
2015-05-08 Arch Linux Wine YNAB yak shaveWe only want to advertise YNAB for platforms that we can enthusiastically proclaim, “This will work great for you! We promise! If it does’t, we’ll work until it does.” The fact is, we can’t do that for Linux anymore. YNAB & Linux, 2011
An ActiveRecord Adapter
2015-05-04 ActiveRecord Rails side effectsExtracting side effects like ‘save’ and ‘find’ from AR models
What Comes After MVC
2015-04-23 RailsConf presentationRails apps start out quickly and beautifully, but after a year features are a struggle, tests are slow, developers are grinding, and stakeholders are unhappy. “Skinny controllers and fat models” hasn’t worked, and “use service objects!” is awfully vague.
The Two Kinds of Integers
2015-04-11 Haskell Ruby abstractions assembly valuesA small thing I see tripping up developers is that there are two kinds of integers: numbers and identifiers.
Create localhost Aliases for Different Projects
2015-03-28 DNS debugging domain names scar tissue yak shaveAs a consultant I’m getting set up to develop on a new Rails project every few weeks or months. And I’ll jump back to an earlier project to answer questions, fix bugs, fix typos, etc. Eventually, something overlaps between them. I got bit by this again, so I wanted to write it up.
Case Sensitivity in In-Page Anchors
2015-03-14 HTML5 browsers fuck Internet Explorer yak shaveAs I’ve been working on Chibrary, I ran into a small cross-browser compatability issue: only some browsers treat anchors as case-sensitive. The call numbers that uniquely identify messages would be perfect for linking to in the middle of a long discussion, but some of them only differ by case.
Dual-Booting Arch Linux on Lenovo X1 Carbon 3rd gen
2015-01-26 Arch Linux Lenovo Linux Windows Windows 8.1 X1 Carbon configuration hardware yak shaveI decided to replace my mid-2011 Macbook Air 3,2 with a non-Apple machine, but every laptop I looked at was unsuitable. Most were overpriced, with a big and clunky design. The Lenovo X1 Carbon was promising, but the 2nd generation had a keyboard that was just too weird (and the function keys changing modes means you can't touch-type them anymore). Standard qwerty is bad, but it's the devil I know.
That was a year ago. In January 2015 Lenovo released a third generation of the X1 Carbon with some slightly improved specs and a normal keyboard, so I picked one up. I decided to switch from Ubuntu because I've felt out-of-touch with how it works under the covers and I've been curious about Arch Linux. This post is my notes on setting that up.
2016-04-07: A year and three weeks after I started using this laptop (I know precisely because that put the laptop juuuust out of warranty), without warning or accident, the display stopped working. Lenovo's expensive repair service estimated 6 businesses days for repair but the repair took over 5 weeks. If you might purchase a Lenovo laptop (perhaps the recent X1 Carbon 4th gen), I suggest you consider whether randomly losing hundreds of dollars and access to your laptop for 5 weeks would inconvenience you. 2016-05-16: ...and by "5 weeks" I mean "9 weeks". When Lenovo sent my laptop back with a new motherboard, it was one model down with slower processor, half the RAM, etc. It took another several weeks of dealing with their incompetent bureaucracy before they replaced it. 2016-12-18: Well, shit, the display on the replacement has started flickering.
Isolating Polymorphism
2015-01-13 Ruby encapsulation inheritanceI’m reading [Code Complete, 2nd ed]{href”http:=”” www.cc2e.com=”” “=””} and it’s been like catching up with an old friend. I remember reading the first edition at my first tech job fifteen years ago. At the time a lot of it went by me, but rereading I can see a lot of things I had to learn on my own.
Type-Checking Interface in Ruby
2014-08-27 POODR Ruby boundaries experiment interfacesOne of my favorite parts in Sandi Metz’s excellent Practical Object Oriented Design in Ruby is when she describes how to enforce lightweight interfaces so that multiple objects can play a role reliably. And I thought: how I can I enforce this in a much-more heavy-handed and annoying way?
Prefer: Censorship
2014-08-25 Firefox Mozilla censorshipIn the Mozilla blog post Prefer: safe, I read:
Integration as Composition
2014-07-08 Chibrary composition design functional programming literate programming pointfreeI’m puzzling over the design for a worker and would appreciate your comments on it. I started with the pain of an ugly test, made an interesting refactoring, and decided to drop the test entirely, but I’m not at all sure this is the right decision.
Builder Methods
2014-04-29 Ruby domain-driven design immutability testing validityI was reading Corey Haines’ book Understanding the Four Rules of Simple Design (capsule review on the 2014 book reviews post) when I read:
Two Designs for SequenceIdGenerator
2014-04-18 Chibrary Ruby design object orientation stateIn my previous, marathon post on id generation, I mentioned that I was generating unique sequence numbers. It was straightforward to write a class to generate them:
Distributed ID Generation and Bit Packing
2014-04-14 Chibrary bit packing bit twiddling concurrency design stemwinderThere are two ways for programs to collaborate: they can communicate their shared state or they can partition the work so they don’t need to know each other’s state. As I’ve been rehabbing the code for my mailing list archive Chibrary I ran into this issue, and the design constraints made for an interesting puzzle. I need to generate unique IDs in multiple programs at once, and they need to be short enough to fit in URLs. 2025-05-13: Don’t use this post. I was (re)inventing the wheel and it wasn’t worth saving the bits. Use Snowflake or TypeIDs or one of many other existing solutions that have since been invented by people with more experience.
Extracting Immutable Objects
2013-12-05 ListLibrary.net Ruby design design patterns email mailing lists object orientationIn the last few weeks I’ve been rehabilitating some of the first object-oriented code I wrote in the hopes of bringing my mailing list archive back online. Lately I’ve been refactoring some of the earliest, core code: the Message class. It manages the individual emails in the system and, because I didn’t understand how to extract functionality, had turned into something of a God Class.
The Well-Sorted Version
2013-05-31 LaTeX Well-Sorted Version art books typesettingThe Well-Sorted Version is a longtime project I recently finished. I wanted to blog a bit about the technical production of it, so please check out that link if you want this discussion to make any sense.
Inheriting From Built-In Ruby Types
2013-04-12 ActiveRecord Ruby refactoring strings2015-05-09: While I still want to break down ActiveRecord models, I now disagree with the idea of inheriting from Ruby’s stdlib types and think they should always be wrapped. My RailsConf 2015 talk expands on the thinking below (especially about immutability!) and touches on reasons why not to inherit from stdlib.
Social Media for Programmers
2013-03-14 GitHub Hacker News Lobsters Reddit StackOverflow Twitter learning social mediaA friend of mine has been accepted to DevBootcamp and I’m pleased to see the coursework is beginning even before classes. He’s not so pleased — really, he’s puzzled by the emphasis on social media:
Why I Rarely Use HABTM
2013-01-04 Rails databases design lifecycle schemasI was chatting with Kori Roys about database design and I mentioned offhandedly that I almost never use has_and_belongs_to_many in Rails. Kori’s ears perked up and he asked why that is.
Solving vs. Fixing vs. Introspecting
2012-12-31 bugs design introspectionI liked this blog post Solving vs. Fixing (via). In my first job out of college I did support and maintenance on a medium-sized (250kloc) system that had spent a year looked after by a developer who only fixed things, never solved them. The code had started poor and gotten gotten steadily worse, but I always tried to fix bugs twice and slowly ground out improvements in the system.
Legacy Bitmask Puzzle
2012-07-13 SQL legacy math puzzleMy friend David had a puzzle in his legacy app. There’s a bitmask called ErrorCode. The table ErrorCodes lists the meaning of each bit:
Recreating My Firefox Profile
2011-06-25 Firefox customization nerd pride yak shaveWith the release of Firefox 5 a few days ago, I thought it was time to recreate my Firefox profile. You may not know what it is because you only have one: it’s the set of your add-ons, bookmarks, history, and every other kind of customization you can do to Firefox.
Craftsmanship Tour: New York Times
2011-06-22 New York Times craftsmanship tour idempotency journalismIn May, while visiting New York City, I dropped by the New York Times to code with Derek Willis and, impromptu, Dan Berko. I worked with both at the Washington Post (and saw many other familiar names on doors, online journalism is a small town).
Now Featuring Monsters
2011-06-18 Allabrilyn Fantasy Adventure Game MVC grue so play we allThe So Play We All theme this week was “core game objects” and the time budget was 3 hours. I did did well for myself, time to review the others’ work — both of which included monsters.
Software Craftsmanship Tour: Aidan Rogers
2011-03-30 craftsmanship tour interfaces object orientation open question software developmentA few weeks ago I met up with Aidan Rogers to hack on some code. Aidan and I were coworkers at Cambrian House a few years ago.
Retracting my JungleDisk Recommendation
2011-02-19 JungleDisk backups tarsnapOver the last few years I’ve recommended JungleDisk to a lot of people, so a blog post is the most efficient way to retract that recommendation.
Dropbox and Git Play Well Together
2011-02-15 Dropbox git how to version controlChrys Wu asked me my thoughts about how to have easy access to a software project she’s working on so that she can conveniently access them from the several computers she uses regularly. Not all of them can be set up as development machines, so a standard version control system can’t be used alone.
Craftsmanship Tour: Jim Ray
2011-02-13 Devise Rails craftsmanship tour git vimLast Tuesday I spent the afternoon with Jim Ray at the excellent Hooked coffeeshop in Denver, CO (and then I spent the next several days sick from a bad meal and recovering, so this post got delayed).
Craftsmanship Tour: David W. Allen
2011-01-04 NearbyGamers craftsmanship tour graphs software craftsmanshipI’m in Grand Junction, Colorado because it seemed as good as any a place to start traveling. I have family in Denver and plans to ski, so why not tour the state a while? Once I knew I was coming to Grand Junction, I remembered GitHub can be searched by location and I got curious, so I did the search.
XML Crash Course
2010-12-17 Star Trek XML htmlA non-nerdy friend of mine (yes, they exist, moving on) changed jobs at her company last week and had a question:
Craftsmanship Tour: 8th Light
2010-12-15 8th Light Clojure Groupon Java Limelight craftsmanship craftsmanship tour refactoring vim
{.alignright .size-full .wp-image-1607 .right width=”99” height=”103”}
Craftsmanship Tour: Obtiva
2010-12-07 Obtiva craftsmanship craftsmanship tourLast month when I started planning my travels of indefinite duration, I ran into the blog On Being a Journeyman Software Developer by Corey Haines. He spent the end of 2008 and most of 2009 traveling around the United States pair programming in exchange for room and board, trading knowledge and having interesting discussions. I saw it and thought, “Hey, I could do that.”
Spreadsheet Errors
2010-11-14 bugs spreadsheetsLast week the magazine The Nation hurried to correct a story that they had suffered the worst drop in advertising of any weekly magazine. Their loss was actually in the middle of the pack, but the story was written from a spreadsheet that overstated their advertising for last year, giving them the appearance of a step decline.
Reading 400 Feeds with Newsbeuter
2010-09-07 Linux feeds webI posted a few years ago about looking for a good Linux feed reader and a reader’s email reminded me to revisit the topic. It’s time for another blog post where I talk about how I overthink some part of my daily routine but it lets me do in a few minutes what I could otherwise waste a few hours on.
Globalton
2010-08-26 design patternsIt’s Steve Yegge’s fault that I was rethinking the singleton pattern. I read his Singleton Considered Stupid post in early 2008 with the rest of the proggit before it devolved into a memetic garbage patch. Yegge’s rant ends with a note about design patterns that curled up in my hindbrain and has been whispering to me since:
From Fixtures to Factories
2010-07-06 Mocha Rails Ruby factories factory_girl fixtures testingAutomated tests need example data, and it’s a pain to have to construct a complete object in every test, especially when there are a lot of non-optional fields.
PHP Hex Map Graphics
2010-06-12 PHP hex maps image generation web gamesThis PHP code uses the GD functions to create hex map images (eg. for wargames).
Hackers and Gamers
2010-05-05I’ve been meaning to mention for a while that I’ve been contributing to the tumblelog Hackers and Gamers to share interesting links at the intersection of business, code, and gaming.
One Fine Git Book: Pro Git
2010-04-24 book review git svn version controlAs long as I’m reading too much, let me suggest that you can skip the couple dozen blog posts and half-dozen books about Git. Read this one introductory blog post and, if git sounds like a good tool for you, you can read one fine book about Git and be thoroughly informed.
HTML is Your Markup Language Anyways
2009-11-10 bbcode html markdown markup languagesI hate Wiki markup. I hate BBCode. I hate markdown. I hate the million other custom markup languages that have infested the web.
Redirecting Users' URLs
2009-06-16 URLs human-readable webI got an email in response to an old post on how I designed NearbyGamer’s discussion URLs. It asked how to create readable URLs for a community site where users might edit those URLs. What happens after users have made lots and lots of edits?
JavaScript: The Good Parts
2009-06-09 Douglas Crockford JavaScript book reviewIn JavaScript, there is a beautiful, elegant, highly expressive language that is buried under a steaming pile of good intentions and blunders. The best nature of JavaScript is so effectively hidden that for many years the prevailing opinion of JS was that it was an unsightly, incompetent toy. p2
Investigating Theme Spam
2009-06-05 PHP WordPress decoding obfuscation reverse engineering spamIf you’re interested in what spammers are up to these days, check out Snarky’s blog post Evil Eval() investigating the obfuscated spam code hidden in the new WordPress theme he downloaded.
Developer Day Notes
2009-05-30 IRCI’m attending Developer Day DC and taking notes. They’re fairly rough and sort of only cover the things that catch my attention, but here they are in the hopes that other people find them useful:
- Developer Day Notes 1: Opening Keynote
- Developer Day Notes 2: Give Your Sites a Push with Comet
- Developer Day Notes 3: Natural Language Acceptance Testing
- Developer Day Notes 4: A Ruby 1.9 Case Study on Upgrading RCov
- Developer Day Notes 5: Lightning Talks
- Developer Day Notes 6: Browser-Based Visual Programming with Lily and the Monome
- Developer Day Notes 7: JavaScript Testing in Rails
- Developer Day Notes 8: Making Life More Enjoyable With Python
- Developer Day Notes 9: Programming In Interesting Times ~~more TK as the day progresses~~ I’m not taking notes at Happy Hour, so that’s all. A very friendly little one-day conference, lots of fun. Thanks to Viget for planning and hosting!
Client Logging to AWS
2009-05-29 AWS EC2 Elastic MapReduce Hadoop S3 loggingOver on the BBGameZone forums helderic asked how to deal with exploits:
Game Influences (4/6): Counter-Strike
2009-05-14 Athenge Counter-Strike FPS game design game influences web gamesThis is part of a series of blog posts on the design process of my web game:
Intention and Design
2009-03-23 Athenge Counter-Strike World of Warcraft darkfall game design intention markets systemsThe recently-sorta-released MMORPG Darkfall is having trouble with players macroing (running programs that play their characters to build up characters and resources without a player’s attention).
ListLibrary.net UI Design
2009-03-02 ListLibrary.net graphic design mailing lists user interfaceI wanted ListLibrary.net to have a really nice user interface for browsing and reading mailing lists at length. The design leans towards terseness: get rid of the clutter and assume that people who’ve browsed a page or two will understand how things are sorted out.
Command/Query Separation
2009-02-26 ListLibrary.net command/query separation email referential transparency threadingObjects contain both state (data) and methods, and methods should be classifiable into commands that change state and queries that introspect state. The principle of Command/Query Separation (CQS) expresses a design principle I’ve intuitively used as a rule of thumb. With the conscious consideration that comes from hearing it, I knew how to improve some of my own code.
Worthy of Praise
2009-02-22 IMVU Twitter blogging quality snarkI’ve really enjoyed Timothy Fitz’s new blog, he’s sold me on Continuous Deployment, named the benefits automation I never put my finger on, and more.
Markoff's Gated Community Should Die in a Fire
2009-02-17 Markoff flame net neutrality rant walled gardensA couple friends have asked me about John Markoff’s NYT piece asking after a business and family-friendly Internet. Let me be blunt:
OpenOffice.org Losing Viability
2009-01-24 Django OpenOffice.org Rails community open sourceOpenOffice.org developer Michael Meeks analyzed 2008 commit data to show that the project is losing steam: decreasing numbers of commits, developers, and companies. He rhetorically asks about how the project is losing technical quality:
Inauguration
2009-01-22Through some luck I ended up with a ticket to the Blue Standing Area (mid-south Capitol lawn) of the Inauguration, and through even more luck I was able to get through security to see it. I had a bit of hike to get to that point:
Open Source Communities
2009-01-19 Django Rails community open sourceOpen source projects should be judged as much by their community as by their technological achievements. The code tells you what it’s good for, but the community tells you what its future is.
Django vs Rails: The Dead-Tree Edition
2009-01-18 Django Rails booksDjango
Two Interactions With Amazon
2009-01-17 Amazon Amazon Affiliates EC2 customer serviceOne
Rules of Database App Aging
2009-01-15 databases design lifecycle schemasTagClose “p”
Rails Forum Roundup
2009-01-15I’ve got a Rails project in the works that needs a forum to live alongside it, so I went looking for an existing Rails forum to adopt and customize.
Washington Post Update
2009-01-14 Django Washington Post politics workIt’s been a long time since I’ve written
about what I’ve been up to at the Washington Post, so let me run down the apps
I’ve worked on since September 2007 in roughly linear order. Lots of these apps link different places,
so if you don’t see projects.washingtonpost.com at the start of the
URL, you’ve probably wandered off something I directly worked on.
Why I Write Tests
2009-01-13 bugs testing testsI’ve had a few folks ask me if I really write tests for all my projects, like I mentioned in the last line of my second email in You’re Not Refactoring. Really?
Twitter and Ruby's Open Classes
2009-01-12 Habber Ruby Twitter metaprogramming open classesFor a few years I’ve been using weird, funny, outrageous, bizarre, or just offensive quotes as IM status messages. They used to appear at the bottom of this site, but the Jabber bot that fetched them has been offline for a while. I hooked them up to a Twitter account with a short Ruby script, and I wanted to talk about it a little.
Developers Need IRC
2009-01-11 IRCIf you’re a developer who doesn’t use IRC, you’re not being as productive as you could be. I was thinking about this when I read a blog post on how IRC can be a nice low-interruption news source. It can be handy for that, but the real value in IRC is other developers.
You're Not Refactoring
2009-01-10 Extreme Programming TDD refactoring testingChanging code is a great way to break it, especially in really subtle ways that you won’t pick up on for weeks or months. The maintainer of Unangband, Andrew Doull, wrote that Refactoring Is Hell. I sent him a note in response to that blog post that I think I may just as well have blogged. So:
Greasemonkey Scripts: Gamasutra and Arlington Library
2008-12-12 Arlington Library GamaSutra GreaseMonkey webI signed up to userscripts to share a few of the GreaseMonkey scripts I’ve written. If you’re not familiar, GreaseMonkey is a way of reprogramming websites for your own convenience, and userscripts is where folks can share what they’ve done.
Deploying Crontab With Your Rails App
2008-11-15 Rails cron yak shaveThis is a short one. If cron is an old friend, don’t futz around with weird Ruby. You know the pitfalls of cron (environment variables, long jobs without lock files). So write your crontab and check it into config/crontab.
Now Do You Know It Works?
2008-11-11 reliability testing verificationYou’re writing code to store a file on Amazon S3. It’s a popular, powerful, widely-used and highly-reliable service, and you know the Amazon S3 API pretty well. So you write a function that takes a file and a key name (filename), then calls the HTTP PUT to store the data. Do you know it works?
RailsRumble Postmortem
2008-10-19 AASM Bort ConfReader Paperclip RSpec Rails RailsRumble design haml open_id_authentication planning resource_this restful_authentication scheduling teamwork webI failed to launch my Rails Rumble project ConfReader. Why?
RailsRumbling
2008-10-16 Rails RailsRumble crunch experiment webI’m participating in RailsRumble this weekend, from 8 PM Friday to 8 PM Sunday. The goal is to build a web application in Ruby on Rails in 48 hours, and I welcome the change of pace of a small project. It’ll be a fun weekend crunch to build it, and I hope it will be a long-term resource for the development community.
Don't Play Hurt
2008-10-15 environment motivation work workplacesI love the c2 wiki. At least once a year I’ll dive in for a day or two and read a swath through its accumulated wisdom. As I learn and experience colors my perspective, I always find new things.
256-Color XTerms in Ubuntu
2008-10-05 256 colors Ubuntu screen terminals vim xterm yak shaveIt’s not commonly used, but most Linux terminals can support 256 colors. It’s also a bit of a pain in the ass to set up if it doesn’t Just Work out of the box. Having spent a while today tinkering and searching and cursing and testing and trading mail/IM with folks who understand the eldritch depths of terminals better than I, I thought I’d write up my findings for anyone else who’d like spiffy colors.
14 Years to Unicode
2008-08-28 Google Unicode adoption enterpriseLast August I was chatting with some friends (every coder has an IRC channel with around six nerds they shoot the breeze with, right?) and said:
Rails URL Params as Types
2008-08-26 Rails URLs strings typingYesterday I (belatedly) took my friend Nola Stowe’s advice and picked up a book she tech-reviewed, The Rails Way by Obie Fernandez. It’s been a great read so far (about 85 pages in), and I just realized that routing is largely about type conversion.
WWW Will Never Die
2008-06-26 DNS GTLDs ICANN domain names webICANN is moving steadily to enact a fast-track process for gTLD creation (where “fast” here means “months instead of years”), so there could be a few more competitors for .com, .net, .pro, and the rest of the gang in a year or two. Some of the early candidates are .bank, .nyc, and .paris.
Harkins's Law of Enterprise Software
2008-06-08Bram’s Law cleverly explains why a lot of common software sucks. I was just chatting in #startups and coined my own law to lay alongside it. I think I finally understand why all the gigantic content management systems and “Enterprise solutions” I’ve seen are so terribly bad.
Getting Git
2008-06-03 DVCS PeepCode VCS git source controlI’ve been curious about git for a few weeks. I’ve heard friends recommend it, a lot of big projects (Linux kernel, Xorg, Rails) have switched to it, and I hadn’t yet learned a distributed version control system. I’ve bounced off the blog posts I’ve come across, they weren’t well-organized or assumed some basic familiarity I didn’t have. The man pages were also kind of intimidating.
Finding Value in Bogosity
2008-05-07 Smalltalk football practice programmingI found this post on design constraints to be great food for thought. The restrictions look like they’ll make for great exercises that I wouldn’t have otherwise thought to do. They remind me of poetic forms, in that they’re difficult but perhaps ultimately liberating..
StackOverflow Sounds Pragmatically Postmodern
2008-04-18James Noble and Robert Biddle wrote Notes on Postmodern Programming in 2002, and I was reminded of it Wednesday. In section 13 they describe “A First Example of Scrap-Heap System Construction”.
Turning Wordpress Categories Into Tags
2008-04-17 MySQL SQL WordPress automation insert into selectI recently updated this Wordpress install from 2.2.something to 2.5 and noticed that it now supports tags instead of just categories. I had been using categories as tags, but I’d rather built-in tags than fake it anymore. I didn’t want to manually retag a couple hundred posts with ~200 tags, so I wrote some SQL to do it for me. If you’re in the same boat
Functional Package Management
2008-04-16 functional programming nix nixos system administrationI just read a great paper about NixOS, a Linux distribution with a “purely functional” package manager. I’ve been thinking about the parallels between programming and system administration, and this is a brilliant use of the comparison. They created a package manager named Nix where all packages are built and maintained independently even of other versions of themselves.
Pipe Viewer
2008-03-06 bash console pipesToday I found a really nice program for long-running console commands:
pv, aka “Pipe Viewer”. If you’ve ever strung together a long command with pipes, run it, questioned why it’s taking so long, maybe open another terminal to run top... pv is the answer to that question.
Caching Dictionaries in Python vs. Ruby
2008-02-02 Python Ruby dictionaries metaprogrammingA while ago I made a slightly-underinformed post (see the corrections in the comments) trying to draw a difference between Python and Ruby. I’ve finally got a decent example and can explain what I’m getting at.
Django Template Tag for Dictionary Access
2007-12-19 Django dictionaries hash templatesAbout a million times when writing Django pages I’ve been iterating through a list of objects and wanted to look up a value in a dictionary keyed by object.id. But you can’t, the built-in tags don’t allow it.
My Four-Year Patch
2007-12-18I’d actually forgotten it and had to scratch my head a bit when I got the message my ticket was closed. In August of 2003 I submitted a patch to Fluxbox to allow users to hold Alt and middle-click to push a window to the bottom of the stack. The source to Fluxbox has changed so much I can’t even find the section of code that the patch was written for, so I suspect that my ticket was closed when a developer swept through old tickets and recognized this as done.
Painless Upgrade to Rails 2.0
2007-12-13 ActiveResource NearbyGamers Rails Rails 2.0 Ruby TDD routing test testing tests upgrade webI spent a dead-easy 2.5 hours last night updating NearbyGamers to Rails 2.0. My svn commit message read (with links added here for convenience):
Drifting Into Test-Driven Development
2007-12-07 TDDAbout two years ago I first read about Test-Driven Development on the c2 wiki. It’s a simple plan: before you write code, write the tests that will exercise it.
An Academic Inconvenience of Python
2007-11-08 PythonSometimes Python’s roots in academia bug me. Lots of functions have a computer science feel instead of a software development feel. Here’s an example I just ran into: I wanted to fit as many sentences as possible from a long text into 255 characters. So I wrote:
Because Internet Explorer is a Failure, That's Why
2007-11-07 Firefox Internet Explorer browser support browsers failure support webAbout once a month since Firefox came out and was promptly recognized as a six-gallon bucket of awesome I read a blog post about how developers are lazy, shiftless bastards because they don’t want to support Internet Explorer anymore. Most recently I read Brian Reindel make this claim, so I’m going to pick on him while I rebut this insult.
Keep Ruby Gems in Your Home Directory
2007-11-05 Ruby RubyGems gems install shared hostingI like keeping my Ruby Gems in my home directory. I don’t have to type sudo in front of every gem command, it’s easier to remember the path to them when I want to read their source, and I don’t have to worry about a sysadmin on a shared host updating a gem before I test it. Here’s how to make those benefits yours:
How To De-Asshole-ify Links
2007-11-01 Firefox assholes css design links user experienceI loathe sites that set unvisited and visited links to be the same color. There are exactly two reasons that sites do this:
Simple Ruby Mocking
2007-08-17 Ruby dependency injection mocking mocks testing tests unit testsI mentioned at the end of my last post on testing that I wrote some code to do mocking for my unit tests in Ruby. Writing a small mock library was very much reinventing the wheel, but I needed to do it to earn a deeper understanding of mocks.
Fixtures in Ruby Unit Tests
2007-07-12 Ruby fixtures testing tests unit testsI’m writing some Ruby scripts that sort and store lots of small files. After a day or two of hacking I had the basic code working, ran through a few thousand files, and a malformed file blew up the sorter. That was OK, the sorter was intentionally naive and lacking in error handling; I wanted it to hack it together and try out a few approaches before committing to serious development.
Adequacy is Inadequate
2007-07-04 certification motivation testingThis post started as a comment on Reg Braitwaithe’s post Certification? Bring it on! and metastasized into a post of its own.
Good Timing
2007-07-02 Hostway RegistryPro design sleep workThis morning, at about 4:30 AM, I awoke and just knew the Right Way to rebuild RegistryPro to be completely reliable, even more compact, and provide meaningful reporting. It would take less than two weeks of coding time and the pitfalls are well-demarcated and avoidable. It would be really great if I’d thought of it two years ago when I still worked there. Thanks, brain.
Alphabetical Sorting SQL Without "The"
2007-05-01 SQL alphabetization lexical sorting sortingChris McAvoy asked how to sort alphabetically so that entries starting with “A”, “An”, or “The” end up in the proper place instead of jumbled into the As and Ts.
Logging Internal Server Errors
2007-04-27 500 errors Rails error handling errors internal server errors logging rescueTagClose “p”
Discussion URLs: Opaque, Usable, and Readable
2007-04-05 ActiveResource RESTful Rails Ruby URLs human-readable named routes nested routes resources routes routingI just wrote about Human-Readable ActiveResource URLs, and now I want to examine one example of them more in-depth. Discussion forum URLs have several conflicting goals:
Human-Readable ActiveResource URLs
2007-04-03 ActiveResource RESTful Rails Rails 1.1 Rails 1.2 URLs design human-readable named routes nested routes routesI’ve got URLs on the brain this week. I started NearbyGamers using Rails 1.1 with just gamers and tags. I upgraded to Rails 1.2 (and liked it) , and added discussions after I updated to Rails 1.2. I was able to use ActiveResource for Discussions with Posts as a nested resource. I’m really happy with this code, as it’s very tidy.
Rails: Semicolons Out, Slashes In
2007-04-01 Rails URLs map mapping resources routes routing semicolon slash slashesAs of r6485, Edge Rails resource routes use / as the URL separator for actions instead of ;. This will be in Rails 2.0 (and I like / more), so I wanted to get prepared for the change by updating my URLs now. I didn’t want to move to Edge Rails (too exciting for me), so I grabbed the change, dropped it into a source file, and loaded it into my app (thank you, open classes).
One Laptop Per Chicago
2007-03-09 Chicago Lucene OLPC Python Unicode grassy knoll pyluceneChiPy held our largest meeting yet at Google (again) last night, so here’s a linkriffic post about it.
Add Feed Discovery Links Easily
2007-03-08 Rails Ruby atom auto_discovery_link_tag feedsI’m working on discussion forums for NearbyGamers and I’m building the first feeds into the site. I worked up a clean way to add them from my controllers similar to my tidy stylesheets code. Here’s how to do it.
Colorizing Rails Test Output
2007-03-06 Rails Ruby color redgreen testI love making things easier to read, to skim, to take in at a glance. At last night’s the ChiRb presentation on rspec I noticed the output was nicely colorized.
Epson Perfection V100 in Ubuntu
2007-02-18 Epson GIMP Linux Ubuntu hardware sane scanner scanning shell v100
I just bought an Epson Perfection V100 scanner and wanted to post about how I got it working in Ubuntu for anyone else who noticed it doesn’t Just Work. The drivers are binary-only, so you have to dick around a little to get them installed -- the SANE folks have said they’d integrate them if they were open source, but most hardware companies fail to provide source and doom their hardware to early obsolescence. Tangent aside, here’s how to get your scanner working:
Rails 1.2.1 Impression
2007-02-14 Barking Stapler Rails assert_select assert_tag webI’m updating NearbyGamers to Rails 1.2.1. Nothing broke except my use of assert_tag in my tests; it’s been long-regarded as squicky and has been replaced with assert_select. As I’m tidying up some deprecated code, it occurs to me that this makes for an interesting example of how I feel Rails is changing.
Seeing Subversion Diffs for Commit Messages
2007-02-14 Subversion commit diff scriptingWhen I go to check code into a Subversion repository, I like to review a diff of my changes. I can confirm I’m committing the right files, make sure I didn’t leave in any debugging statements, and take one last chance to ponder the code. Usually this means doing an svn diff in another window or shelling out of vim to run it. This is a bit awkward, so it’s easy to forget the step. That’s backwards, it should be easier to do things right than slack.
Capistrano Task to Load Production Data
2007-02-07I was working on a migration that had a decent chance of messing up my database and wanted assurance it would work with production data, not just my fixtures.
Which Vista Version?
2007-01-30 Apple Linux Microsoft OS X Ubuntu VistaToday Windows Vista is available to customers in seven versions, and I’ve had some friends and family ask which they should buy:
GET and POST variable hashes in Ruby on Rails
2007-01-08 RailsIn Rails, you access GET, POST, and routing variables through the params hash. This works almost all the time, except when you duplicate a variable name: routing overwrites GET overwrites POST.
Making Valid XHTML Easier
2006-11-14 Rails Ruby xhtmlI’m working on a Rails site in my Copious Free Time and I wanted to share a little way that Ruby made my life easier. I’m making my pages valid XHTML 1.0 Transitional because it makes life easier to find bugs and it just feels good to know I’m meeting the spec.
Dual-Head on the 13" Macbook
2006-11-03 Apple MacBook Ubuntu X Xorg dual-head edgySince Ubuntu Edgy came out last week I decided to spend some more time tinkering with getting dual-head display working, and this time it took.
Tidy Stylesheets in Rails
2006-10-27 Rails Ruby css design maintainabilityIt’s very easy for a site’s CSS to grow a single giant, brittle stylesheet. It becomes impossible to change anything because of bizarre interactions between elements, unexpected interactions, and simply because it’s just too big for anyone to understand. Much of programming is managing complexity, and I’ll share a nice technique in that vein.
Clean Up Your Mess
2006-10-05 Arkeia Cambrian House break crash jerk system administration wedgeToo many sysadmins is a bad thing, especially if one of them doesn’t care about keeping the servers up.
ChiPy at Google
2006-09-15 BigTable ChiPy Chicago Google Code Python Selenium Subversion project hostingI had a great time last night at the ChiPy meeting last night that was held at Google’s Chicago office. I suspect a lot of people turned up just to see the venue: usually ChiPy gets 15-20 people but we got 51 last night.
Triple-boot Filesystem Layout
2006-07-27 Linux OS X XPI’ve got a MacBook on the way that I plan to triple-boot and I’m trying to figure out how to lay out the filesystems. I plan on using Linux primarily as I’m a developer. XP has a lousy command line environment* and OS X has a lousy GUI, but I’d like to keep them around for browser testing.
Flintstoning Toasters
2006-07-11 Cambrian House bash cron toasters
I picked up the term “flintstoning” from my visit to Cambrian House. It’s the practice of substituting a little human work for functionality until there’s enough demand for the feature that it’s worth the coder time to implement. Let me give you an example.
Building Clean URLs Into a Site
2006-06-23 Apache PHP webI wrote about building a site with clean URLs, but that’s useless to you. No, you’ve got a creaking hulking monster of a site that coughs up URLs like “render.php?action=list_mailbox&id=42189”, was built “to meet an accelerated schedule”, and eats summer interns whole.
Rails Day 2006
2006-06-17 Rails webI’m sort of participating in Rails Day 2006. I say “sorta” because I’m trying to build an app in one day but I’m not actually in the competition.
Ripping Unicode
2006-06-15 Python design graphics
I love shoving around large amounts of data. Unicode is an industry standard for encoding data in most every written script there’s ever been. It has over 97,000 characters. A while ago I read about a guy who made his own Unicode poster and I realized I had an opportunity for a fun project. I think Unicode is an invaluable and beautiful project, and this is my tribute to it.
Developing With Evil
2006-06-15 PHP Perl design humor web[allaryin]{style=”color: red”}: whee...
[allaryin]{style=”color: red”}: i’ve been given a job to put a simple email address subscription form on a site
[Harkins]{style=”color: blue”}: sounds pretty easy
[allaryin]{style=”color: red”}: and... as far as i can tell, the server has neither php nor perl :P
[allaryin]{style=”color: red”}: i’m running out of options :P
[Harkins]{style=”color: blue”}: cgi, baby
[allaryin]{style=”color: red”}: for db access?
[Harkins]{style=”color: blue”}: Or change the target of the form to a server you control running PHP/perl that saves the data and redirects back to the other server.
[allaryin]{style=”color: red”}: yeah...
[allaryin]{style=”color: red”}: but i really don’t want to commit any of our server resources to their site :P
[BSDCat]{style=”color: green”}: I think a ‘simplicity’ fairy just lost its wings
[Harkins]{style=”color: blue”}: Or make the form GET and write a cron job to scrape access.log.
[allaryin]{style=”color: red”}: ...
[allaryin]{style=”color: red”}: wow.
[Harkins]{style=”color: blue”}: Yes, I’m evil.
[allaryin]{style=”color: red”}: it’s beautiful really
[Harkins]{style=”color: blue”}: bwa
[allaryin]{style=”color: red”}: but yes, evil
Ripping Unicode at ChiPy
2006-06-09 Python design graphicsLast night at the June 2006 ChiPy meeting I gave a presentation on how I wrote a few small Python scripts to take apart the Unicode PDF of all its glyphs and recombine them into giant ascii-art-like posters.
Building a Site With Clean URLs
2006-06-07 Apache PHP design webAs an aside in my post about Cambrian House I posted some code for making pretty URLs. A few people (no, not CH) have asked for a little more info, so I’ve written up an explanation of that code.
Strings are a Domain-Specific Language
2006-05-27 C Perl Python Ruby assemblyQuestion: Isn’t a domain-specific language just the same thing as a library?
Source: Pretty much everyone the first time they hear of DSLs.
Django And The Disappearing Template Tags
2006-05-25 DjangoIf you are defining custom template tags, don’t put them in a file named log.py. You’ll be able to {% load log %} fine in your template, but you won’t be able to use your tags. No, this isn’t documented anywhere.
Know a Good Linux Feed Reader?
2006-05-19 Linux feeds webCould anyone recommend a good feed reader for Linux? I need to be able to organize my ~160 feeds in folders, read an entire feed or set of feeds without having to click incessantly, and get already-read items out of the way.
Ruby Blocks and Blocks
2006-04-28 Ruby design functional programming pointfreeI’m reading Programming Ruby: 2nd Ed. and an example on page 57 has captured my attention. (Code slightly modified for brevity)
Lambda at Work
2006-03-27 Python
Finally, several years after learning lambda expressions, I got a chance to use one at work a few days ago. As long as I’m putting a notch in my nerd belt, I’d like to write about what lambda is and how it can be useful.
Python Flyweights
2006-03-20 PythonWhen I wrote Equality for Python, my example didn't mention how the Card objects could actually be a terrific waste of memory. A commenter named versimilidude (great handle!) beat me to this post, briefly describing the Flyweight Pattern. Luckily he didn't provide example code, so I still get to publish this post.
XmlHttpThrottleRequest
2006-03-07 humor web workToday in #luni we ranted a bit about developers. (I'm "Malaprop" in the exchange.)
Equality for Python
2006-03-03 Python
A few days ago in #chipy, the chat room for the Chicago Python Users Group, we had a chat about how Python determines equality. It's a pretty neat and extensible technique, so I'm going to walk through how I recently used it for playing cards.
Django Gets Transactions
2006-03-01 Django databases webJacob Kaplan-Moss added transaction support to the magic-removal branch of Django just a few minutes ago. It’s one of the many changes to come out of the sprint. Usage will look something like this (based on Jacob’s docs and chatting with him in #django-sprint):
Versioning: The Next Big Thing
2006-02-28 Django databases math webIn the web development world, anyways. So, in the grand scheme of things, maybe not a huge deal to anyone else. Versioning is going to be one of the biggest problems and opportunities there is in web development, and it's going to take us at least five years to get it right.
Defeating Hardware Keyloggers
2006-02-27 crypto hardware security
Last week I saw a nice article on building hardware keyloggers and today I saw a response on how to defeat them.