You are NOT a Software Engineer!

I enjoyed You are NOT a Software Engineer! by Chris Aitchison. It’s a fun analogy. Writing software certainly does feel more like something roughly planned and growing organically or evolving rather than something perfectly specified and executed. And I think this is OK.

Another thing we coders often forget: we are also authors. We write code for humans (others and our future selves) to read. I want you to be stoked when you read what I write! And coding is writing.

Avoid trivial merges with github pull requests

I like a clean, boring git history. I prefer this:

* 6ca186e Someone set us up the commit
* f55bcf8 Initial commit

to this:

*   494c94e Merge pull request #1 from kormoc/pr_test
|\  
| * 6ca186e Someone set us up the commit
|/  
* f55bcf8 Initial commit

The latter includes 494c94e, a technically unnecessary commit. I call it a trivial merge, other folks call it a merge bubble.

By default, github will preserve trivial merges when you use the “Merge pull request” button.

If you don’t want these trivial commits in your history, you have to pull (fetch/merge) locally. When someone creates a pull request for you, github sends you a handy email with a command you can cut and paste to perform the merge locally.

You can merge this Pull Request by running

git pull https://github.com/kormoc/pulltest pr_test

Or view, comment on, or merge it at:

https://github.com/meonkeys/pulltest/pull/1

Recall that git pull does an implicit merge. If you merge locally and there are no conflicts, the trivial merge will be omitted.

You may miss the trivial commits because they include a reference to the pull request on github. I won’t. I might ask the patch submitter to refer to the pull request by name/link in their commit log message.

If you want to prevent anyone from pushing trivial merges, more work is required.

Update 2013-06-25

I now prefer what GitHub’s merge button does, namely: preserving the merge history for pull requests.

Wanted: Simple 2D Game Framework

ab_dI want to write a simple kid’s game. It would show something like “A B _ D”, then speak “What letter is missing?”. If you hit the “c” key, it would say “Congratulations!”. If you hit any other key, “Try again!”.

Anyone have pointers on game-creation frameworks? I’m looking for something cross-platform and very high-level. I want to be able to write and play the game in a few hours max.

These look hopeful: ScratchLÖVE, RacketAlice, Pygame.

I want this crawl version to be as simple as possible. Eventually I might want to add score tracking and animations.

I could also create a web-based game that would work, say, in a web browser on an iPad, but this smells a bit more complex than I’m hoping for right now.

Here are a couple other related links I came across while poking around:

Hire This Guy!

I’m looking for work. Here’s my resume.

I’m passionate about doing things that matter, and doing them well. I’m a leader with experience. I lead by serving my business, bosses, and coworkers. I solve problems efficiently and I always add value.

I’m a pro at pretty much any back-end, devops, sysadmin work. I have a strong preference for using Free/Libre/Open Source Software (and contributing back upstream often). Most of my career has been websites: PHP, Python, Java, Perl and the like. I’m experienced with SQL and NoSQL databases. I can do front-end work except graphic design. Most recently I’ve been coding a lot with PHP (specifically, Symfony2), AWS APIs and MongoDB.

I would love to do work right now which involved cloud automation, specifically, Amazon Web Services infrastructure provisioning. I could easily automate the setup for a very robust, high-traffic web/mobile service. I’ve had years of experience with AWS and want to work with it more. But that’s just one idea—I’m pretty flexible.

I love learning new tools and tech. I do so quickly, and I’m generally at my best (performance and happiness) while I’m learning. So if I’m not already versed in whatever tech your business needs to succeed, don’t worry, I will be soon.

Tweet of same

Update 2012-12-14: I’m now seeking full-time work in Seattle

Effectively manage sets of scratch/debug/dev-only changes with git

There are always some changes that you make temporarily but must never make it upstream, such as development-specific debugging instrumentation. The trick is to keep track of these but never send them upstream (to a repository you share with others, for instance).

Unsuprisingly, git’s got a way to handle this. Thank you, Karl Bielefeldt!

Assuming master is the upstream integration branch…

# just once: create branch for dev-only changes
git checkout -b common-dev-changes
 
# get latest upstream changes
git fetch
 
# rewind/replay common-dev-changes on top of master
git rebase origin/master
 
# switch to topic branch for a new feature/bugfix
git checkout -b topic-branch common-dev-changes
 
# ...edit files, debug, commit, etc...
 
# prepare to push - remove dev-only changes
git rebase --onto master common-dev-changes topic-branch
 
# switch back to master
git checkout master
 
# merge feature/bugfix code into master
git merge --ff-only topic-branch
 
# ...do integration testing...
 
# share your work!
git push

I’ve been jumping through all sorts of hoops like always having locally-modified files, git stash, even keeping patch files around. These techniques quickly become unwieldy with larger sets of changes because you forget why you authored a change or you accidentally push it upstream. rebase --onto was hiding in git-rebase(1) all this time, but I just discovered it today thanks to Google and stackoverflow.

If you don’t want the technique I outlined above another answer on that same stackoverflow post outlines using the git index (git add -p and friends) for managing your dev-only changes. That might be a handy stepping stone, and will provide tools you’ll still need later even when you are savvy with branching and rebase.

Tweet of same.

Amazon Prime: Marked Up?

I used to think I was so shrewd and sneaky by shopping at Home Depot with my smartphone in hand, scanning barcodes and finding lower prices on Amazon.com. But during the past few trips I’ve noticed Home Depot has the lowest prices!

Sure, free shipping for Prime, but is Prime stuff marked up?

UPDATE: “prime” was misplaced, above. Really I was just wondering if Amazon prices are marked up to cover shipping costs. Prime needn’t enter into this.

List largest MongoDB collections

I wanted to know the top five largest collections in my MongoDB database in terms of document count. This JavaScript gets the job done.

// config
var dbname = 'dev_bv';
var measure = 'count'; // or 'size'
var numTopCollections = 5;
 
function updateTopCollections(collection, stats, topCollections) {
    var thisCollectionObj = {
        'name' : collection,
        'count' : stats.count,
        'size' : stats.size
    };
    for(var i = 0; i < topCollections.length; i++){
        if (stats[measure] > topCollections[i][measure]) {
            topCollections.splice(i, 0, thisCollectionObj);
            break;
        }
    }
    if (topCollections.length < numTopCollections) {
        topCollections.push(thisCollectionObj);
    }
    if (topCollections.length > numTopCollections) {
        topCollections.pop();
    }
}
 
db = db.getSiblingDB(dbname);
var collections = db.getCollectionNames();
var topCollections = [];
 
for(var i = 0; i < collections.length; i++){
    if (collections[i].match(/^system/)) {
        continue;
    }
    var stats = eval('db.' + collections[i] + '.stats()');
    updateTopCollections(collections[i], stats, topCollections);
}
 
printjson (topCollections);

Save it to a file, edit variables in the config section, and execute like so:

mongo --quiet topCollections.js

Here’s a gist of same: https://gist.github.com/4150940

Go ahead, put it on top of the car

You’re getting in the car, and you’re in a hurry. You’ve got your hands full of important objects, yet, there’s a handy, flat, perilous surface right in front of you: the top of the car. Perilous because of the off chance you forget to remove said important objects from the top of the car before you race off to your destination.

But fear no more. Go ahead and use this handy surface. Just set your keys down, too!

Yeah yeah, you’ve got a spare key in your pocket, one of those start buttons that works when the key is nearby, or something like that. If that’s you, you’re on your own.

But if you’re me, you’re stoked.

BreadVault iPhone app in 2½ minutes

BreadVault is a tool to help you teach a child and yourself fiscal responsibility. It’s also my job! Here’s how to add a goal using our iPhone app.

  1. Install BreadVault using the App Store.
  2. Touch “Log in with Facebook”.
  3. Add a family member. If you don’t have kids, add yourself. Set allocation sliders to 100% Save (you can change this later).
  4. Log in as the family member you just added and scan a barcode (see photos, below). Don’t worry if the price isn’t right, you can change this later, too.

Initiate barcode scan from family member dashboardScan a barcode

The next time you’re in line at the store, add a goal instead of making a discretionary purchase!

Other Tips

  • For some more why and what about BreadVault, see How my 3-year-old bought herself The Lorax.
  • iPhone+Facebook is probably the easiest and most convenient (but definitely not the only) way to use BreadVault. BreadVault HD is the iPad-optimized version. And of course there’s our full-featured website. We’ve got plans to support Android and Windows 8, too, so keep your eyes peeled for those.
  • You added this goal when logged in as a family member. To make progress towards the goal, add funds using the Family Dashboard. Touch the upper leftmost corner of the app, and touch “Family Dashboard”. Try adding, say, $2 per week to the family member. To check goal progress, log out, then in as the family member. Touch the piggy bank to view Save goals.
  • Once the goal is met, a blue Buy button will appear next to the goal progress bar. Use that to purchased the earned item.
  • Saving for discretionary purchases is one facet of fiscal responsibility. Charity and investments are others, so next time check out the Give and Invest channels!

Science Fiction

I like Science Fiction because it scares me. It opens my mind to new ideas.

And sometimes the fiction becomes reality.

Just the other day I finished Robopocalypse (a great read!). Today I thumb through my news feed and hear that California just joined a couple other states in legalizing self-driving cars and Toyota continues to make progress with domestic helper robots.

I don’t see the singularity coming any time soon, but it’s easy to see our tools evolving rapidly. Our responsibility towards each other must grow commensurate with the evolution of our tools.

Amped is great so far, too. I just happened to watch The Hunted lately, which also explores the theme of technology-enhanced individuals being rejected by mainstream society. Like Dr. Steve Mann’s beating in France. Discrimination is certainly old news; I believe we love the familiar, and it follows the unfamiliar generally is harder to accept. But this challenge is exactly what makes the unfamiliar awesome.