AWS: Not just a place to run your VMs

I’m on my way out at Micro Technology Services, Inc.. Because of that my current boss has wisely taken me out of the loop of normal day-to-day programming so that my replacement can get plenty of experience before I’m truly “on vacation” as we say. With that in mind I’ve been tasked with stuff that will be interesting to me, valuable to the company, but if something goes sideways it won’t be a big deal if it never ever happens at all.

Posted Sat, May 23, 2015

Converting from SQL Server to Postgres

One of the things that I’ve been working towards for a long time at my current job (which I’m on the way out of) is to have the project work 100% on Linux. The main thing holding it back from that is that it depends on SQL Server. Now of course DBD::ODBC runs on Linux and even nowadays Microsoft distributes their Native Client for Linux. But our project is turnkey and runs on one physical machine, so the database is included.

Posted Tue, May 5, 2015


This has been a pretty big week for me; On Tuesday we listed our house to be sold! On Wednesday night I got what I thought was indigestion, and on Thursday had an appendectomy! Just today, Saturday, I think we have sold the house (pending all required legal grace periods of course.) This all pales in comparison to the really big news this week: this server got hacked. Saturday morning I noticd that Freenode was blocking my IRC client because I was on some blocklist (DroneBL, to be specific.

Posted Sat, May 2, 2015

Announcing DBIx::Class::Candy::ResultSet

Hello all! I just released DBIx::Class::Candy 0.003000, which comes with DBIx::Class::Candy::ResultSet. This should completely resolve the issues I mentioned in my previous post. This is how I use it: package Lynx::SMS::Schema::Candy::ResultSet; use strict; use warnings; use parent 'DBIx::Class::Candy::ResultSet'; sub base { 'Lynx::SMS::Schema::ResultSet' } 1;package Lynx::SMS::Schema::ResultSet::MessageChild; use Lynx::SMS::Schema::Candy::ResultSet; ... 1; If anyone runs into any issues let me know. Sorry that perl didn’t use c3 from day one!

Posted Tue, Apr 14, 2015

MRO's and you; how the distinction between C3 and DFS changed my life

Recently I fixed DBIx::Class::Helpers so that each helper would have a base class. This is actually something that ribasushi had been sorta hounding me to do for years but I could never figure out the case where it mattered. The reason I finally made the change was because a user ran into an issue that fixing the base class actually resolved. Unfortunately I neither documented what it was nor wrote a test.

Posted Tue, Apr 14, 2015

Docker Simplifications: Bugtowne City

I have a fairly complex docker container that I run on all of my machines. I would like to simplify it in a number of ways and for some reason I decided that it would be interesting to start on that project last night. The simplifications that I want to do are as follows: Have all three daemons log to /proc/1/fd/1; this would remove one of my volumes and let me view logs with just docker logs offlineimap

Posted Fri, Apr 3, 2015

Faster DBIC Schemata

Last week I did a talk for the Milwaukee Perl Mongers and this week I did it again for the Los Angeles Perl Mongers. I will do it one more time for DFW Perl Mongers soon, hopefully, if only to get the best version recorded. In the talk somehow near the end I discussed with Steve Nolte how to make a large DBIC schema faster. The best way to solve this is to make Core DBIC lazy load it’s results, but that has historically been hard to get working.

Posted Fri, Mar 27, 2015

Fear and Loathing in SQL-92

Like the tortoise I’ve been slowly but surely working on getting our application working on both SQL Server 2005+ and Postgres 9.4+. The latter is a new addition, hence the “latest and greatest” version. For the most part I’ve been surprised at how easy it has been. Both servers support using " as the identifier quote, which is all that I have to change in the majority of queries. For some dumb reason (there is a real reason, but it is dumb) most things use [, ] for the quotes in SQL Server.

Posted Wed, Mar 4, 2015


This is just a quick post to update you all on a nice new helper. Recently at my work we hired a new programmer and I’ve been showing him the ropes. I noticed him running into the age old confusion of treating a ResultSet like a Result, so I took note and decided to make a helper to give specific error messages when the user makes that mistake. If you plan on hiring new people ever, or you are a mere human yourself, why not add DBIx::Class::Helper::ResultSet::Errors to your base ResultSet?

Posted Fri, Feb 20, 2015

Configuration Station

We’ve all dealt with and implemented configuration systems. I’ve set up a few different kinds over time. I think the very first was something like the following: package MyApp::Util; use strict; use warnings; use JSON; our @DBI_PARAMS = do { open my $fh, '<', "C:/inetpub/myapp.json" or die "couldn't open myapp.json: $!"; @{decode_json(<$fh>)} }; ... 1; It certainly leaves a lot to be desired! At the minimum it at least gave us something better than hardcoded settings, but that’s almost all it gave us.

Posted Thu, Feb 19, 2015

OfflineIMAP Docker

This needs to be a short one as I don’t have a lot of time to write this, but I just wanted to quickly put out some thoughts about one of the more complex Docker setups I’ve made in the past few days. I use offlineimap to sync my mail to all of my local computers. I find that it paired with notmuch is both faster and better at search than vanilla Gmail, plus at some point I’d like to cut the cord with Gmail entirely.

Posted Fri, Feb 6, 2015

Docker: First Impressions

Today I deployed my first Docker based application. I just wanted to get down some basic thoughts about how it went down etc. Nearly all the hosted (ie not turnkey) apps that we have at work have some form of git-based deployment strategy. (Aside: Don’t say something silly to yourself like “git is not a deployment strategy!” It totally is, you just don’t like the tradeoffs.) Each one has it’s own special snowflake of push vs.

Posted Wed, Jan 28, 2015

Asynchronous Musings

Recently at work I’ve been working on our first section of code that is purely asynchronous. It’s pretty exciting! As I’ve discussed before, we’re using IO::Async, which has first class support for Futures. Futures are sorta kinda a way to express callbacks. They aren’t quite as powerful, but they can do nearly everything callbacks can do. (Specifically Futures represent a single action, not a stream of actions like callbacks can.)

Posted Thu, Jan 22, 2015

MORE MORE MORE: 2015 Edition

This is a three part post, but it’s supposed to be short, so lets get to it! Part I: Shorter Blog Posts I like to blog, but my posts tend to get really long and involved, because I sorta like to think from first principles and build up and tend to teach that way also. It’s generally not great; my documentation usually has something to be desired after I’m done.

Posted Sat, Jan 17, 2015

NSIS Sucks

This is the first article of a series on Windows Installers. (Note from the future: I have happily been able to abandon Windows professionally, so there will almost surely be no more of these.) I wrote an installer for work using Nullsoft Installer System (aka NSIS) about 18 months ago. (To be completely honest I wrote most of it but my coworker has to take a good portion of the credit for finishing it all the way.

Posted Thu, Oct 2, 2014

How to replace your CyanogenMod Kernel for Fun and Profit

I’ve recently been on a journey of discovery with respect to “observability” tools. I’m sure many other Linux users have felt the lust after DTrace that first the relatively obscure Solaris (and kids) and now the totally non-obscure OSX users have. After watching various presentations about DTrace features I’ve kept my ear open for features that are similar on Linux. Last month I posted about strace and sysdig. Both strace and sysdig are pretty coarse compared to what can be done with DTrace, though both are pretty great.

Posted Thu, Aug 28, 2014

Concurrency and Asynchrony in Perl

Lately I’ve been in situations where I need to write some event driven, parallel code. Most people call that “async” and I’ll stick to that for now. What I’ve been doing is writing a little TCP service that can accept any number of clients at the same time (though typically only one) and interact with the clients in a single process and with no multithreading. As surely many have remarked before, this is to some extent the future of computing.

Posted Tue, Jul 29, 2014

DBIx::Class: Parameterized Relationships

UPDATE (2017-10-17): The hack in this post no longer works; please check out DBIx::Class::ParameterizedJoinHack for something more likely correct. Probably once a week in the DBIx::Class channel someone asks if there is a way to pass arguments to a relationship. There is an answer but it isn’t pretty or for the faint of heart, so I finally have decided that I should write up a post detailing how to do it and nicely hide it from the user.

Posted Tue, Jul 22, 2014

A Gentle TLS Intro for Perlers

At work we’ve recently been audited for security by one of our customers and one of the takeaways was that we need to encrypt more things. Specifically all things. This lead me on a journey of discovery. In this post I’ll give some basic sample code on how to set up and debug a server using TLS, as well as some basic info on TLS itself. TLS? TLS is what most people think of as SSL.

Posted Thu, Jul 17, 2014

A Few of My Favorite Tools

strace Recently I’ve started branching out some in my debugging style. In the past it was usually adding print statements, reading docs carefully, reading logs, etc. I still mostly add print statements when I’m debugging my own code, but when trying to figure out why some random program isn’t working, instead of reading docs I go straight to strace. If you don’t already know, strace traces system calls, so it effectively gets between the program and the kernel and lists all the system calls being made.

Posted Mon, Jul 7, 2014

Use Travis (and more)

At YAPC last week vanstyn was complaining about the fact that there is so much “assumed knowledge” in Perl. One of the examples he gave was TravisCI. There are a few tools that go with Travis that every Perler should know about. First off, use Travis! Step one is to enable it for your repo at$username. After that add a text file to your repo with the name .travis.yml with the following content:

Posted Sun, Jun 29, 2014

You're Awesome YAPC!

I just got back from this year’s YAPC::NA and boy did I have a good time! I’m trying to just get it down before I get back into the groove of regular life, so don’t expect poetry (like those of us who where in rjbs’ talk were treated to during technical difficulties.) First off, this year I took Rik’s advice from his !!con blog and decided to just walk up to random people and talk to them.

Posted Thu, Jun 26, 2014

Static Site Comments?

A week ago I blogged about how I ditched WordPress for Hugo. One of the (at least temorary) casualties to that conversion was the loss of comments. I did export the comments for later inclusion into the site somehow, but I have yet to see an option I can live with for hosting them. Here I’ll discuss the two obvious options. Disqus My original plan was to start using Disqus immediately.

Posted Tue, Mar 25, 2014

F# has Handy GC

As mentioned previously I was recently learning about F#, a neat mostly functional language for the .NET vm. One of the things I was really impressed with was that it allows the user to take advantage of timely destructors. I was under the impression that except for reference counted GC (perl, cpython, and I think C++) timely destructors were impossible and that the user is instead required to close their filehandles, database handles, or whatever other cleanup they need to do, within a finally block.

Posted Thu, Mar 20, 2014

F# has Weird OO

A little while back I was learning about F#. For the most part F# is a cool language. It’s based on ML and is an impure functional language. Here is how you can do some things with F#: Define a function: foo a b = a + b Call that function: let x = foo 1 2 There is a lot more, like currying, powerful type inference, etc.

Posted Mon, Mar 17, 2014

New Blog Engine: Hugo

Nearly a year ago I started to sour on WordPress, the blog engine I’ve been using since 2007. I have thought for a long time that a plaintext based system would be better, easier to manage, and that I could do more remotely (ie offline) with such a system. At the time I looked around and the best option I saw was ikiwiki. For what it’s worth, as with pretty much any blog engine it can be themed to be pretty, and it has a ton of plugins, and hey, it’s written in perl, so I could hack on it if need be.

Posted Sat, Mar 15, 2014

Announcing ::Helper::ResultSet::DateMethods1

I have had this ready to go for a few days now, but I figured I might as well wait for Mardi Gras; so feel free to celebrate, put on a masque, and enjoy a nice Hurricane Cocktail while you read this. A little over three years ago I got inspired while on vacation to Crested Butte, CO and started a branch in DBIC called merely, “date-ops.” The idea was to allow users to call various date functions, portably, directly in DBIC.

Posted Tue, Mar 4, 2014

Game Review: The Swapper

A friend recently mentioned an idea of a club where you play the games you get in the humble bundle and then talk about it afterwards. Kinda a solution to the whole problem where you get a bunch of games from steam sales, humble indie bundles, or just plain excess but then never play them. I decided to do it with some friends at work who already play games anyway.

Posted Sun, Mar 2, 2014

Use Docker to test your code! (and a subtle announcement)

Lately I’ve been working on code to unify disparate SQL into a small set of abstractions. There is a lot to do, and while testing generated SQL is nice, actually running that SQL and examining the results is the best way to test the code. In the past I would have installed a bunch of database engines locally. More recently I’dve used Travis to test against a bunch of databases. I still think that’s a good idea, but pushing to CI to test your code sucks.

Posted Sat, Feb 22, 2014 hacked

Things never change. Well actually they do, just not much. About five years ago I blogged about PerlMonks getting hacked. They had stored their passwords in plaintext, which basically meant everyone who used the site should have changed their passwords and fixed any situations where they had reused passwords. Also probably abandoned PerlMonks (I know I haven’t been back since.), a relatively recent blogging platform that was slated to replace use.

Posted Thu, Jan 23, 2014

Hash Your Passwords! Finale

A little over a year ago I posted what I hoped would be my last article about hashing passwords in Perl. One of the commentors mentioned a library, though, which in my mind makes things so much easier that it makes the topic worth revisiting. So, as before, here is a DBICDH/DBICM conversion script: #!/usr/bin/env perl use strict; use warnings; use DBIx::Class::DeploymentHandler::DeployMethod::SQL::Translator::ScriptHelpers 'schema_from_schema_loader'; use Authen::Passphrase::BlowfishCrypt; # PROTIP: generally code reuse in migrations is *not* a good idea as changing # the reused code could break future runs of the migrations, or worse, # make the output subtley different, thus meaning regenerated servers # could have frustratingly different results schema_from_schema_loader({ naming => 'v7', constraint => qr/^users$/i, }, sub { my ($schema) = @_; $_->update({ password => Authen::Passphrase::BlowfishCrypt->new( cost => 14, salt_random => 1, passphrase => $account->password, )->as_crypt, }) for $schema->resultset('User')->all }); Here’s a one time script you can use if you don’t have a migration tool:

Posted Sat, Nov 9, 2013


DBIx::Introspector is a refactorization of some DBIx::Class code that detects what database a $dbh is connected to, as well as getting various facts from the $dbh. It is currently very much unborn, but given some feedback and battle testing on my own modules I hope to get it released before Christmas of 2013. (Famous last words?) The gist is that you can do something like the following: my $di = DBIx::Introspector->new; $di->get($dbh, 'rdbms_engine'); That’s certainly nice, as currently there isn’t anything like that on the CPAN that works for more than just mysql, SQLite, and Pg.

Posted Sat, Oct 19, 2013

Leveling Up

This is a blog post about some of the stuff that I’ve learned over the past few months. It’s hard to find causes for things in real life, but I can say at the very least that in this situation the catalyst for my learning was Aphyr’s Jepsen series. If you have not yet read it, you really should. The gist is that distributed databases often promise (or sound like they promise) more than is possible, and many times don’t even execute what they could do.

Posted Sat, Oct 5, 2013

Perl Switches 101

The backstory to this post is a little weird in that it involves rjbs much more than usual. A couple weeks ago I was playing D&D with rjbs and Abigail, and before the game got started somehow we ended up talking about Masterminds of Programming. The book is pretty good so far, you should totally read it! Anyway, the book has a chapter on AWK and for some reason I mentioned to rjbs that I need to buckle down and learn AWK.

Posted Fri, Aug 16, 2013

Event Loops: Useful After All

I’ve had a series of blog posts referring to event loops; the final message ended up being something like YAGNI. Well, I am eating my hat in this blog post; I have seen the light, I am drinking the kool-aide, I am stockpiling weapons… er, how about I just give some details! Tech Aside: IO::Async I have done some research for a blog post comparing AnyEvent, POE, and IO::Async. This is not that blog post, but in researching that post I came to a conclusion.

Posted Sat, Jul 27, 2013

Install and Configure the MS ODBC Driver on Debian

This page is only here for historical interest; the updated guide is here. This was originally written by my coworker Wes Malone and adapted to Ubuntu by my other coworker Geoff Darling. Basically it should get you up and running with Microsoft’s official ODBC driver in Debian based Linuxes. Enjoy! The Microsoft ODBC Driver (AKA the SQL Server Native Client) is Microsoft’s official ODBC driver for SQL Server. Since 2011 Microsoft has provided binary builds officially supported on Redhat Enterprise Linux.

Posted Fri, Jul 5, 2013

I made my own keyboard!

Check out the pictures at flickr

Posted Tue, Jun 11, 2013

l2type nub

Today I found out I have tennis elbow from the stupid way I type. I’m writing this blog so you’ll all not develop my stupid bad habit. Basically I configured awesomewm to use the alt key as the modifier instead of the windows key, because I learned to use the alt key in xmonad… Now, I don’t know about you guys, but all of they keys that share a row with the spacebar are hard to press in general and for some reason my dumb hands decided the only way to press alt was to curl my thumbs inward and press that way.

Posted Tue, May 28, 2013

Some Kickstarters I Have My Eye On

Some fun kickstarters I’ve got my eye on: Blasphemous Cocktails Cocktails inspired by HP Lovecraft stories and others. It is already funded and I am definitely getting it. The Wine Curmudgeons Guide to Cheap Wine The title says it all. Assuming this gets funded I plan on getting it. I love when people don’t have a minimum $20 a bottle to like a bottle of wine. The Whole Story: Winter 2013 I already “got” this one.

Posted Sun, Jan 27, 2013

The Pomodoro Technique

A couple of weeks ago I was frustrated at my own lack of productivity. I decided to purchase Pomodoro Technique Illustrated: The Easy Way to Do More in Less Time. I had actually already attempted the Pomodoro Technique based on what I read on the internet, but it never seemed to work for me. This short, easy read has made a noticeable difference in my productivity. But the book is not the point of this post, The Method is.

Posted Fri, Jan 25, 2013

Announcing Apache::BalancerManager

At work I use Apache as it’s the best thing out there for perl on windows. One of the features of Apache when you are using it as a load balancer is it’s UI for controlling the Balancer Manager. One of my coworkers remarked that it would be nice to have an API for that so that when we restart workers we could tell the balancer manager first so that the worker would not get dispatched to until it finished restarting.

Posted Fri, Jan 11, 2013

Abstraction Levels

One of the decisions we developers must make when writing our modules is at what level to abstract our code. I, for instance, write a lot of DBIx::Class components, which is, for the purposes of this discussion, about the same as a role (and I will just use the term role for the rest of the article.) For a long time that was my standard modus operandi, but I’ve started to think that that is a bad default and that I need to consider more carefully what to use.

Posted Sat, Jan 5, 2013

Go See My DBIx::Class Advent Article!

woohoo! Again, I’ll probably reblog this in January.

Posted Fri, Dec 21, 2012

Go See My Advent Article!

Merry Christmas! (I’ll reblog it next month probably.)

Posted Thu, Dec 13, 2012

ssh tips

As a developer, I use ssh all the time. When connecting to the various servers and even other computers in my house, ssh is my go to. Most writable git servers use ssh. A newish Perl module by mst (Object::Remote) uses ssh for communication. There are a number of tricks you can use to make using ssh as hassle free as possible. I’ll share these tips here. ~/.ssh/config First and foremost is getting intimate with ~/.

Posted Wed, Nov 14, 2012

Announcing DBIx::Class::MaterializedPath

Have you ever wanted to store trees in your database? How about store them and avoid melting your database server at retrieval time? Did you want to use materialized path and were sad when there were no quality modules to do it with DBIx:Class? DBIx::Class::MaterializedPath I recently had a need for storing tree-ish data in a table and I got it working with extended relationships and a helper or two.

Posted Mon, Sep 10, 2012

Hash your passwords!

More than two years ago I blogged about how to correctly store passwords. Recently a number of high profile websites have had their password storage compromised. The storage method I blogged about two years ago is still hugely better than what LinkedIn (SHA1, no salt) and I think Gawker had. If you aren’t already securely storing passwords, this post should get you going on a conversion. First off, here’s a DBICDH/DBICM compatible conversion script

Posted Mon, Sep 3, 2012

Zero DM RPG's

My weekly table top rpg is Changeling, which is one of the World of Darkness templates. This past week some stuff went on sale on DriveThruRPG so I picked up a few things that I’d wanted to look at for a while. For our game I’m the DM or GM or Storyteller or whatever you want to call that. It’s not because I’m overly creative or even wanted to, it’s because I wanted to play and no one else seemed willing to do it.

Posted Sat, Jul 28, 2012


I’ve had a long, sordid relationship with window managers. When I really started with my first computer it was Windows 98 and I somehow decided to put Litestep on it. I remember switching workspaces was often crashy and I pined for something less hacky. Eventually I installed some form of linux. Because Litestep was inspired by AfterStep I knew that’s what I really wanted. But I was wrong. I may have wanted that if I were already a console user, but I was weening myself out of windows.

Posted Wed, Jul 4, 2012

Web::Machine + Web::Simple is awesome

I really like “REST,” which the pedantic of you will realize is really just using more than just basic HTTP. I’ve gotten used to a handy REST-y pattern with Catalyst, which, though verbose, is pretty neat: use Catalyst::Controller::Accessors; cat_has account => ( is => 'ro', namespace => 'MyApp::Controller::Accounts', slot => 'thing', ); cat_has $_ => ( is => 'rw' ) for qw(rs thing id); sub base : Chained('/accounts/item') PathPart('contacts') CaptureArgs(0) { my ($self, $c) = @_; $self->rs($c, $self->account($c)->contacts) } sub item : Chained('base') PathPart('') CaptureArgs(1) { my ($self, $c, $id) = @_; $self->id($c, $id); $self->thing($c, $self->rs($c)->find($id)); } sub contacts :Chained('base') PathPart('') Args(0) ActionClass('REST') {} sub contacts_POST { my ($self, $c) = @_; my $params = $c->request->data; my $foo = $self->rs($c)->create($params); $c->stash->{rest} = { success => 1, data => $foo }; } sub contacts_GET { my ($self, $c) = @_; $c->stash->{rest} = $self->ext_paginate( $self->search($c, $self->paginate($c, $self->sort($c, $self->rs($c)) ) ) ); } sub contact :Chained('item') PathPart('') Args(0) ActionClass('REST') {} sub contact_GET { my ($self, $c) = @_; $c->stash->{rest} = { success => 1, data => $self->thing($c), }; } sub contact_PUT { my ($self, $c) = @_; my $foo = $self->thing($c); my $params = $c->request->data; $foo->update($params); $c->stash->{rest} = { success => 1, data => $foo }; } sub contact_DELETE { my ($self, $c) = @_; $self->rs($c)->search({ id => $self->id($c) })->delete; $c->stash->{rest} = { success => 1 }; } That’s cool.

Posted Wed, Jun 27, 2012