Mere Code
Hacking, Software Collaboration, Testing and Diverse Other Topics of General Interest to the Practicing Programmer
Thursday, July 3, 2008
Tuesday, July 1, 2008
GMail feature request
First, where should I make these requests?
Second, I'd like to be able to open my GMail without seeing all the new mail in my inbox. Very often, I open up GMail just to look up some fact that I've forgotten, or to put a date to a particular event. Seeing new mail and an unempty inbox distracts me, leading me down a rabbit hole of processing.
I guess a GreaseMonkey hack wouldn't be too hard.
Labels: Uncategorized
Monday, June 23, 2008
Friday, June 13, 2008
Really Satisfying
I have just returned from the shops with a Snickers bar. The packet says that one out of every six Snickers bars will instantly win me a free Snickers bar.
So, statistically speaking, how many Snickers bars do I have? Show working.
Labels: Uncategorized
Aren't code reviews great?
Ben Sussman-Collins writes about programmer insecurity and how a lot of programmers dread having others see their code.
Some of the best programmers I've worked with are in love with code reviews, and all great writers have editors. (The "linked list" is in no way exhaustive.) Personally, I see reviews as being a great opportunity to learn.
Sussman-Collins also writes about how distributed version control can exacerbate the "isolated genius" problem by shielding ones code from the public eye. This is definitely a big potential drawback of DVCS, but one that's largely mitigated by a culture of short-lived branches and an easy-to-use public registry of all branches for a project.
Labels: Uncategorized
Thursday, June 5, 2008
Real Life
Inspired by Mikey, I've set up my own real-life blog.
I've done this one using Blogger's "upload to remote server" feature. It looks nice, has the features I need and means less WordPress & PHP. I'm hoping to migrate this sucker to the same technology.
Labels: Uncategorized
Monday, June 2, 2008
Neat Bazaar feature
Ever find yourself working away on a branch, enjoying yourself and getting just a little carried away? Maybe you're working on a feature and you notice and fix a bug that's not strictly related to that feature.
If you catch yourself in time, there's a nice little feature in Bazaar that can help with this:
bzr merge --uncommitted. It will merge in the changes that you've made to your working tree but haven't committed yet.e.g.
$ cd some-feature-branch
... hack hack hack ... oops!
$ cd ..
$ bzr branch trunk bug-fix-2357
$ cd bug-fix-2357
$ bzr merge --uncommitted ../some-feature-branch
$ bzr ci -m "Fix up bug 2357. Found this while working on some-feature."
$ bzr send
Don't know what
bzr send does? Trust me, you want to find out.Labels: Uncategorized
Monday, April 21, 2008
What I meant
z3p recently blogged about a comment I made in a code review. In the review, I linked to:

That's a negative and grumpy way of phrasing an idea that I've come to value a lot: good code expresses its intent clearly.
When looking at a patch, the reviewer needs to understand two things: the intent of the code and the intent of each change to the code. To be clear on the former, you need:
- intent-revealing names.
- good abstractions / interfaces.
- good, small tests.
- simple implementations where possible.[1]
- docstrings where appropriate
- comments where appropriate.
That's not exhaustive, but it's in a rough order.
To be clear on the intent of your change to code, you need:
- Small patches.
- A good bug / spec with a good, short summary.
- A review request letter, summarizing your implementation strategy, any compromises you made, gaps in testing, future work etc.
That's not exhaustive either. In #2037, I didn't understand the motivation for lots of the code, nor for some of the changes to the code.
I'm indebted to Andrew Bennetts for teaching me that the first duty of a reviewer is to ensure that the code is clear and to Tom Berger for reminding me that compromises are worth noting.
----
[1] Actually, this reminds me of something I heard a preacher say, "before I give a sermon, I go through it, find everything clever, and take it out" (I paraphrase, not having a reference on hand).
In as much as sermons and code should both be ego-free communications of ideas, I think this is sound advice for hackers.
Labels: Uncategorized
bzr-removable
The plugin I talked about in a previous post is now at https://launchpad.net/bzr-removable. Please file bugs.
Thanks to Michael Hudson and Daniel Watkins for submitting patches.
You can get the plugin by typing 'bzr branch lp:bzr-removable' on the command line.
Labels: Uncategorized
Tuesday, March 18, 2008
OK I lied
The next post is actually about a Bazaar plugin that I've now got ready to share. To get it, 'bzr branch lp:~jml/+junk/merged-branches'.
Once you've got it, run 'bzr merged-branches' in the trunk of your project. It will then show you all branches in sibling directories that are safe to delete. That is,
- They have no uncommitted changes.
- They have no "unknown" files. (Files outside of version control that haven't been explicitly ignored.)
- They have no shelved changes. The plugin will only check for this if it can find bzrtools.
The branch is now at the point where it works for me, but it still belongs in '+junk' — here's why:
- It assumes that you have a trunk branch in the same directory as all of your other branches.
- It assumes that branches and working trees are the same thing.
- It's called 'merged-branches' when it really means 'safe-to-delete'.
- It doesn't make it easy to see why a branch is not safe to delete.
- It doesn't let you customize the conditions of the search. Maybe you want to see all branches with uncommitted changes.
Still, if you are like me and make a lot of branches, it's quite useful. I'll tolerate bugs, accept patches and welcome encouragement.
Labels: Uncategorized
Monday, February 18, 2008
Friday, February 15, 2008
Monday, February 11, 2008
The Economist Index
The Economist occasionally publishes a "Big Mac Index" — how much the world's favorite "burger" costs in each country, translated into a common currency.
Why they don't publish an index of how much an issue of the Economist costs? All of my issues have the price of the newspaper in lots of Asia-Pacific currencies. A small sample:
- Australia, 9.39855 USD
- Cambodia, 6.00 USD
- China, 10.43655 USD
- Hong Kong, 7.6917 USD
- India, 5.0522 USD
- Japan, 10.70535 USD
- New Zealand, 8.6669 USD
Can anyone tell me why the price varies so much?
Labels: Uncategorized
Monday, December 10, 2007
WoW account temporarily suspended
Howdy Partners,
My World of Warcraft account is temporarily suspended for silly administrative reasons. I'm not in any rush to clear those up, so don't expect to see me on Khaz'goroth or Frostmourne any time soon.
Regards,
jml
Labels: Uncategorized
Thursday, November 15, 2007
Tuesday, October 23, 2007
Fake Plastic Tests
Ever wondered what's the difference between a
FakeReactor, a StubReactor and a MockReactor? Find out in this brief article on test doubles.Labels: Uncategorized
Tuesday, October 16, 2007
Cracked Mac
OK, I've started with this whole
photographything, I might as well run with it.
My Mac cracked:

Labels: Uncategorized
Around like Grover
What's up hep-cats?
I've been travelling around the world, weaving in and out of timezones like Jason Bourne navigates facial expressions. Last week's adventure took me to tropical Dunedin — the southiest outpost of Canonical Ltd. (I'm trying to get a mention on Language Log.)
Those few Hobartians who keep reading will notice that Dunedin, well, umm... here's a photo:

Pay careful attention to the hills in the background.
Labels: Uncategorized
Monday, September 17, 2007
Five Years
That's not quite how long it took Glyph to write a post explaining what he meant when he told me that xUnit should use the visitor pattern instead of the composite pattern.
I'm going to write a more detailed response later, God willing. I just wanted to flag the post and say thanks to Glyph for finally posting it — the hassling must have worked.
Labels: Uncategorized
Monday, September 10, 2007
It's a Gibbon
Over the weekend I upgraded my laptop to Ubuntu 7.10 aka "The Gutsy Gibbon".
Obvious improvements include having Pidgin installed and a much superior version of Deskbar. There's also a swanky new panel to actually control display settings (dual monitor and all that jazz). Unfortunately, I can't quite get it to work just yet. My 22" 1680x1058 LCD will just have to sit there, gathering dust :(
In another weirdness, all of my fonts are suddenly much, much bigger. I had to resize everything down to 8 or 9 to make them sane.
My pretty Emacs has also stopped working, but that's to be expected. It's a third-party package that hasn't yet been built for Gutsy.
Other than that, seems to be a fairly routine upgrade. Is there anything exciting that I've missed?
Labels: Uncategorized
Wednesday, September 5, 2007
Merging New trunk Features to a Development Branch (redux)
Oubiwann has recently posted about the joys of using Combinator to do branch-based development using Subversion. I thought it'd be fun to do the same post, except this time with Bazaar.
Background
You're working on a project called "Project", you have a copy of the mainline branch (i.e. 'trunk') in your
src directory.
~$ cd ~/src/Project
~/src/Project$ ls
trunk
You want to implement a new feature, so you branch trunk to work on it:
~/src/Project$ bzr branch trunk viking-feature-836
Bazaar is a version control system, not a PYTHONPATH-managing system, so it doesn't maintain a global list of projects and the branches that are currently active for each project.
Perhaps your company focuses on historical invasions of Britain. You decide to start work on another feature:
lass objects.
~/src/Project$ bzr branch trunk norman-feature-1066
You multi-task for a bit, until you finish 'viking-feature'. You decide to merge 'viking-feature-836' into trunk.
~/src/Project$ cd trunk
~/src/Project/trunk$ bzr merge ../viking-feature-836
~/src/Project/trunk$ bzr ci
At this point, you begin to suspect that Bazaar treats branches as first-class objects. However, at this point, a developer on the obverse side of your continent calls you,
"Where's your viking feature? I need it to invade Britain!"
"I've just put it into trunk. Have you got the latest copy?"
"Yeah, I do, I just pulled from trunk."
"It's in trunk, you fool! ... Oh, wait, gimme a sec."
~/src/Project/trunk$ bzr push
Pushing to bzr+ssh://bzr.example.com/Project/trunk...
~/src/Project/trunk$
"Try now."
Merging
OK, enough background, let's merge.
Say you need some of the changes in trunk in order to finish work on your norman feature. No problems.
~/src/Project$ bzr merge trunk norman-feature-1066
~/src/Project$ bzr ci -m "Merge from trunk."
It's hard not to feel smug at this point.
Wait a second, you also want to look at the experimental branch that a friend is working on:
~/src/Project/norman-feature-1066$ bzr merge bzr+ssh://yourfriend.example.com/branches/sealion-1946
~/src/Project/norman-feature-1066$ bzr diff | less # better double check this one
~/src/Project/norman-feature-1066$ bzr revert # nope, doesn't seem like a good idea
Summary
Bazaar treats branches as first-class objects and treats trunk just like any other branch. Although Combinator is great for branch-based development in Subversion, it is more complex and less flexible than doing branch-based development in Bazaar.
With Combinator, you lose history when you merge in changes from trunk, with Bazaar you don't.
With Combinator, you can only merge in changes from trunk, with Bazaar you can merge from any branch.
With Combinator, merging from trunk leaves a bunch of changed files in the trunk checkout on your system (this has tripped me up more than once). With Bazaar, this doesn't happen.
Labels: Uncategorized
Monday, August 20, 2007
Let the Beat Drop
Didn't get around to posting last weekend, sorry. Next weekend I'll be at a conference in the north of Tasmania, so no post then either.
Things in the works:
- Automated testing as a community builder
- Asynchronous functions
- Asynchronous development methodologies
Also, glyph thinks that xUnit sucks, but hasn't bothered to explain why. So I want you to:
- Tell me why xUnit sucks
- Hassle glyph until he does 1.
Labels: Uncategorized
Tuesday, August 14, 2007
Monday, August 13, 2007
7
My headphones broke and I'm chasing down an erratic test failure with no real leads.
And yet Prince stands:
All 7 and well watch them fall
They stand in the way of love
And we will smoke them all
With an intellect and a savoir-faire
No one in the whole universe
Will ever compare
I am yours now and u are mine
And together well love through
All space and time, so dont cry
One day all 7 will die
Labels: Uncategorized
Saturday, August 4, 2007
That's Not Me
This blog started life as "Petty Pace". Blech. Too wanky and too quiet. "awesome radtastic ninjacore" is a stop-gap measure.
What do you reckon should be the name for this blog?
Labels: Uncategorized


