An Open Letter to Hard Candy Cases

UPDATE: They responded on the 17th, and will replace the case. Looks like I get to pay to ship it though.

(CC'ed from email, please reach out via Twitter or comment)

Hello, this is my third request for assistance from your company regarding the defective product you shipped me. I have yet to receive any response. My Bubble Case for the iPad 3 arrived with the rubber coating of one of the zippers is snapped in half. What are my options regarding repair, replacement or refund? The case was shipped to Canada.

Here's the order number: order yhst-XXXXXXXXXXXXXX

I look forward to your prompt reply,

My own thing

I reached a bit of a turning point in my training a couple of months ago, and have been away from formal martial arts instruction since. I took the break for a couple of reasons: first, to examine what I've learned so far and hopefully get a better idea of what I would like to learn in the future. Second, to explore other ways of working toward my fitness goals.

Re-examining what I've learned so far has been incredibly rewarding.

I've trained in around half a dozen martial arts over the years (probably not a good thing), and this period of reflection has allowed me to distill the motley collection of movements and forms I've learned down to the small number of motions, postures and principles that hopefully work best for my spirit and body shape. As a side effect, I feel more comfortable in my own skin now. I'll write more about that subset that works for me in a future post.

From a fitness perpective, it's been more of a mixed bag. Basically, making real time to train had been a challenge. When I do train, it's been a combination of cardio and weights. I've seen my strength go up, and aspects of my cardio get better. I've also seen my core strength drop, the amount of fat on me increase, and my flexibility get worse. Overall, I definitely felt more fit when I was training under an instructor. Also, it turns out that non-martial arts related excercise (or at least, gym training for training's sake) is really boring.

So will I go back? I'm still not sure. It'll probably be that or a team sport.


I'm finally starting to see the storm clouds clear from my life, and with their departure, I have enough breathing room to start thinking about projects again. There are currently three that I want to work on; two web apps and another thing more ... grandiose. First the simple stuff:

Web app one: a humane planner and goal management system. This would implement my interpretation of Covey's 4th generation scheduler, as outlined in 7 Habits of Highly Effective People. In his scheme, tasks are organized in terms of roles and goals, and then plotted in 2-space, with one axis for importance and another for urgency.

Web app two: a tool for collecting objective data about yourself. Basically a way to collect and plot data points for things like mood / recurring events / physical attributes and so-on. Using it, people could discover and manage trends in their own lives. I have a domain for this one:

The next big thing: this is potentially bottomless, but let's just start with a manifesto:

All of my devices, data, and software should be readily available in the cloud; the cloud should be implemented using network connections / hardware in my physical control.

For the sake of discussion, let's call this project the CloudKit; a set of tools and standards to allow individuals and small groups to setup and manage their own clouds on commodity hardware with residential internet connections. I'll write more about this one later.

Test Post

I've decided to move my blog to Blogger. This is a first test post.

Network Audio Streaming on OS X

This article collects what I have learnt about streaming network audio with OS X. We’ve been using an Airtunes Express for our home audio needs, but the mini-plug connector has become extremely sketchy. One of the audio channels cuts out unless the connector is positioned just so, and it never stays, so I started looking into alternatives.

We also have a Mac Mini which we use as a home server, so the natural inclination was to stream sound to it instead. All we really need is to be able to stream from iTunes to it, so I first looked into somehow emulating an Airtunes Express with it. Long story short, not possible at this time. In more detail:

Airport Express uses RAOP, a run of the mill audio streaming protocol that encrypts the stream (presumably to make it harder to rip) with Asymmetric Keys. Client side keys are widely known and available as audio clients (Airfoil, JustePort), but nobody has cracked the server (Airport Express) key.

The alternative that everyone else is using is the Enlightenment Sound Daemon. The are lots of articles out there on setting it up (one, two, three), but they’re all missing the critical step of ensuring that the server audio is being streamed to binds to an IPv4 address.

So, the steps:

  1. Install MacPorts on the client and the server
  2. On the client and the server: sudo port install esound
  3. Install SoundFlower on the client
  4. Reboot the client
  5. Set SoundFlower (2ch) as both the default input and output devices in sound preferences
  6. On the server
    1. run: esd -tcp -public -port 5001 -bind [server ipv4 address]
    2. open port 5001 on your Firewall. Leopard should simply ask if you want it opened when you start esd. Tiger needs the port explicitly opened.
  7. On the client
    1. run: esd -tcp -bind ::1 &
    2. run: esdrec -s ::1 | esdcat -s [server ipv4 address]:5001

Coming soon: some scripts to wrap the command line stuff and start eSoundD automatically on the server.

On Javascript Scope

Just when I was starting to become really confident in my abilities as a Javascript programmer, I realize that I have misunderstood one of the fundamentals of the language this whole time.

Here’s a snippet of my broken code:

for (var i = 0; i < developments.length; i++) {
var development = developments[i];
GEvent.addListener(marker, 'click', function() {
map.openInfoWindowHtml(point, window.developments.infoHTML(development));

Can you tell I used to live in C++?

The idea is that I have a list of stuff, each of which gets a marker on a Google Map. Click on a marker and get an info window about the corresponding element in the list.

Instead, I would get an info window for the last element in the list.

This is because Javascript, unlike many programming languages, has no concept of block scope. In the browser, there is basically window (global) scope, and function scope. Declaring “var development = ...” defines that variable the first time it is run, later iterations through the loop simply assign to it.

The fixed code (a la Prototype):

developments.each(function(development) {
GEvent.addListener(marker, 'click', function() {
map.openInfoWindowHtml(point, window.developments.infoHTML(development));

The Way Forward

I first popped my head into Academie Duello a little over a week ago. I was looking for used fencing masks to buy on the cheap, as I’m tired of using loaners for Dog Brothers and Krabi Krabong training. They didn’t have used masks for sale (though they sell new ones at a very reasonable price), but naturally we got to talking, and before I knew it I had been offered a complimentary month of training in order to get a feel for the place. Today was my first lesson, and my head is buzzing with new knowledge and ideas.

The obvious question is … do I really need another martial art to study? Well, here’s my path so far …

I started with Chito Ryu Karate, and went as far as brown belt, then played around with a variety of stuff at university, eventually staying with Jiu-jitsu. After university I tried Aikikai Aikido for a little while, then discovered Uechi-ryu, which I stayed with to 2nd dan (and still practice to a limited degree today). I would still be fully committed to Uechi-ryu if I lived in Halifax – maybe that would have been enough to take me to the end of my days. Instead, I moved to Vancouver for career reasons, and at the same time began training with Maelstrom.

Maelstrom is a very different animal from what I was familiar with up to that point. At a given time, they are training at least three very different martial arts. Until my beginning with them, I had only training a single martial art at a time. They have a heavy (though not complete) focus on sticks, swords and knives. It has been my first taste of serious weapons fighting, and I am still surprised sometimes by how different it is from empty-hand. The hard-won gems from previous training (structure, body kinetics and flow, and fast powerful hand technique) are still useful, but with weapons you cannot get away with weak footwork. Weapons change the range game in both the large (hey, they can reach further than I thought …) and the small (that block that so nicely cuts the line of attack does not cut it enough when there is a knife in play). Weapons take away many of the strengths of good structure (an opponent with weak position or structure can still badly hurt you).

And so here I am today. Maelstrom occupies me for about 9 hours a week right now as I try to expand my foundations to meet these new challenges. Academie Duello will require another 2 – 3 hours per week on top of that. My goals are as follows:

1) Develop mental agility. With Uechi-ryu, I had achieved a decent balance of mind/body/spirit. My kata was fast and powerful (though kind of messy), and I could perform with enough presence of mind to process corrections internal and external, and update my technique on the fly. I reached this point because Uechi-Ryu is a small martial art, consisting of 8 kata, plus a handful of bunkai and kumite. I worked it through rote-learning until I nailed it. Once I had it, there was a good mental structure to hang any further exploration and learning on. I need to develop a similar mental structure for fighting, and I’m still trying to figure out what it’s even going to look like. One thing is for sure: it won’t involve any specifics of a martial arts style.

2) Build a strong foundation for footwork. This is a really tough one, because I am not built for agile footwork. My legs are too long, and my feet are too big. Damned if that’ll stop me though. Ironically enough, my current approach here is to play with weaker/lighter postures. Once I get used to floating around, I’ll put the gravity back on and (hopefully) find a new, better middle ground.

3) Develop a deep understanding of position and range. I used to think of this in simple terms: out of range, kicking, punching, elbows / clinch, ground. It is fantastically deeper and more subtle than that, and then weapons get thrown into the mix.

So, do I need another martial art? In the end, the quest is deeper than any specific martial art, but I need experience painted with the broadest strokes possible to get a sense of the new picture that is emerging, and European weapons fighting will provide a new and hopefully useful perspective on it.

Beware! (Or, why I finally started paranthesizing method arguments in Ruby)

I was tripped up by a seemingly innocuous piece of code today. Here was the form of it:

foo = {}
puts foo['bar'] or 'bar'

=> nil #!

I expected to see ‘bar’, but instead I got nothing. After some head scratching, I tried:

foo = {}
puts foo['bar'] || 'bar'

=> foo # that's more like it

Long story short, these two forms of the ‘or’ operator behave differently here because they differ greatly in precedence. Due to the difference in precedence, they bind differently:

puts(foo['bar']) or 'bar'

puts(foo['bar'] || 'bar')

That’s the last straw for me. I’ve always preferred leaving out parantheses whenever possible, and up until now, have considered the comfortable readability to be a win over any possible ambiguity. Precendence wierdness like this is too subtle though.

Review: Practical Ruby Gems

Disclosure: I received a review copy of this book.

Practical Ruby Gems, by David Berube (APress) digs into Rubygems – the Ruby package management system. David presents a quick overview of Rubygems and its usage, then offers an overview of 29 popular gems, and finally shows you how to roll your own.

Overall, this is a solid book. The writing is almost alarmingly to the point – think O’Reilly Pocket Reference style, but it does cover the material reasonably well. There is a pleasant variety in the gems presented, and I saw a few that I wasn’t aware of (like FastCSV) which will definitely be useful to me. Each gem is presented with a short application that carefully balances meatiness against ease of comprehension. I’m happy to report that Practical Ruby Gems is fairly well indexed.

Some of the more complex gems (like ActiveRecord, FxRuby and Ruby on Rails) are given a very thin treatment, and I think that’s fair enough, given the format of the book. ActiveRecord, let alone Rails, is large enough to have its own book. Other than that, my only complaint lies in the amateurish page layout. The transition from prose to sample code is delimited with only a change of font, and sample output is separated from code with a simple horizontal rule. This means that my eye must hunt and peck through the page when I’m skipping around, looking for that particular line of sample code that I need.

I would recommend this book to anyone looking for a high level overview of what’s out there in the way of free Ruby libraries. I will also probably refer to the book if and when I roll my own gems.

A deep analysis of sub-pixel font rendering

Font rendering has had some prominence in tech blogs recently, spurred by Apple’s release of Safari for Windows (which very noticably does not use Win32 to render its fonts). Safari on Windows is a wash for me - I can’t see any customer-centric reason for Apple to release it. On the other hand, I am definitely enjoying the discussion because font rendering is a Big Deal for me. I used to be a hardcore Debian user before I switched to OS X. Horrible, horrible font rendering was one of largest factors that drove me away.

Maxim Shemanarev’s contribution to the discussion has been a comparison and analysis of font rendering on Windows, Linux and OS X. It is so thorough that I can’t imagine anyone adding substantially to it. Enjoy!

Panantuken with Guro Andy Wilson

Last thursday, Maelstrom was graced with the presence of Guro Andy Wilson, from Seattle. Andy trained under Guro Rick Faye, who is considered to be one of North America’s foremost Panantuken authorities, and also with Guro Dan Inosanto. Lots of material was covered, but I was happy to note that Guro Inosanto’s seminar had prepared me reasonably well for it.

Here is what we covered, as best as I remember it:

  • forward and backward triangle stepping in combination with the “standard” Panantuken finish of cross-hook-cross. It’s noteworthy that Panantuken will often change the leading foot mid-flow (especially on a finish). I found it quite tough at first to make myself step after having drilled a strict left-lead for so many years. I like it, though. Moving around the opponent using simple body manipulation is really, really strong.
  • other standard finishing combos; cross-body hook-cross, overhand-uppercut-overhand, cross-groin slap-cross, one other that I forget
  • responses to a jab (done with the rear guard):
    • palm it
    • parry it
    • cut the line with crossing palm-heel
    • parry it, then stick and ride it back into the clinch (jamming the right with the other hand)
    • parry it, simultaneously jabbing the opponents rear guard with the forward hand to buy a moment to close
    • parry it, simultaneously jabbing straight fingers to the throat with the forward hand
  • responses to a jab (done with rear guard parry, then front guard)
    • seeking hand from the outside (also called a “blind” since it’s left there to cover the finish coming behind it)
    • seeking hand from the outside, but too late to maintain structure, so slap the attacking arm down with the other hand, then project the blind through
    • seeking hand from the outside, too late again, palm heel or cross with the opposite hand, then project the blind forward again
  • responses to a right (done with forward guard)
    • straight arm inside block
    • straight arm jamming the shoulder, close while controlling opponents lead, head manipulation with the lead hand and finish
    • straight arm jamming the shoulder, close while controlling opponents lead and jam other should with rear guard, head manipulation with same hand and finish southpaw
  • one of the hubad drills; punch-parry-check-slap-punch-parry …
    • inside, outside variants
    • variations, including destruction with the elbow
    • change of handedness with wasilik / counter-punch
  • focus pads were used for many of the above drills, and were also used for a pad specific drill were one player alternates jab cross, putting power on one or the other depending on the others call.

Green Threads, Performance Ruby and Mysql

Today I got curious and tried a little experiment. I’m currently responsible for a Ruby application with a performance requirement. Without getting into too much detail, it needs to do a fair amount of analysis on text moving through it, and log that text to a database.

An obvious optimization is to do the analysis and logging in parallel, but Ruby uses green (cooperative) threading, so this will only help if the Mysql DLL is smart enough to yield while it is waiting for a query.

This is the rub of green threading, of course: you’re only really threaded if the calls you are making explicitly support it.

Let’s find out …

db = Mysql.connect 'localhost', 'foo', 'bar', 'baz', nil, '/tmp/mysql.sock'

db.query <<-END
create table delete_me (id integer auto_increment not null, primary key(id))

insert = "insert into delete_me values #{(['(NULL)'] * 100).join(',')}"

thread = do
while true
puts 'hello from thread'
sleep 0.5

db.query 'select * from delete_me as one join delete_me as two join delete_me as three'

So. If I see “hello from thread” while the last query is running, then db.query is a good green threads citizen and yields. The result? No dice, I’m afraid. Nothing prints until the query is done.

Given that, what are your options? Clearly the following doesn’t actually save you anything (create_many bashes many inserts into one):

writer = {LoggedMessage.create_many messages}

Instead, you’re left with:

writer = Process.fork {LoggedMessage.create_many messages}

and later …

Process.waitpid writer

This is pretty wasteful – clearly the better way would be to modify the Mysql module to work asynchronously. Maybe some day I’ll spend some of my copious free time on that.

Guro Inosanto in Seattle

In case you were wondering, I’m the goofy looking guy on bottom who isn’t even pointed at the right camera. That’s ok though, because behind me is Dan Inosanto!

Last weekend, I travelled to Seattle with my fellow martial artists from Maelstrom to learn what I could from this legendary man. In the photo, from left to right, are Lakan Guro Zack, Guro Inosanto, Steve, and Guro Loki.

We left Vancouver at 8 in the morning, crossed the border without difficulty (though we were surprised to be quized on the particulars of Dan Inosanto’s seminar and academy – turns out that our guard’s father trained Kali), and arrived just in time for the seminar to start. Guro Inosanto did not disappoint.

My instructor, who also happens to be Inosanto-certified, likens training with Inosanto to “drinking from a fire hose.” This was exactly right. He would demo a fighting flow with his assistant, then three or four variations on it, at about half speed. He would run through them twice, then ask “Got it? Good!” We would get a few minutes to review it in our heads while he chatted a bit about training philosophy, phillipino history, and his general outlook. We’d see the flows one more time, and get 5 minutes to try to reproduce them. Then a quick (30 second) combination drill, as fast as possible to get our blood flowing, then it was onto the next flow. It was like that, steadily, for the entire seminar. We all left literally numb, our brains crammed way past overflowing.

So, what did I get out of it? Other than the pleasure of meeting and training with an incredible martial artist, that is harder to quantify. The seminar was divided in two, with the first part focused on Panentuken and JKD, while the second focused on knife disarms of the “stripping” variety.

Guro Inosanto broke the drills down into an entrance, a finish, and some meat in the middle. He described these stages as a good framework to think about mixing martial arts within. In this case, the entrance would usually be some variation on a JKD seeking hand, and the finish would always be a right, a hook, and another right. In between would be elbows, punches, straight finger strikes, small foot sweeps, jams, and destructions. I really enjoyed this material, and it worked well with my body type.

For the second (shorter) part, we drilled knife against knife, and empty hand against knife. The disarms were all variations on a wrist grab and forearm strip. When Inosanto and his assistant were demoing these, they literally used a pile of knives, and did it kneeling on the floor so that they would not fly far when disarmed. They did it so comfortably and smoothly that it looked more like a bizarre sort of juggling act, with knives steadily flying out of their hands in a smooth arc, instantly replaced by one from the floor. I would have to really drill this stuff hard to even think of trying to use it though. The traditional Kali approach of just cutting your opponent until they can’t come at you any more feels easier and safer.

In the end, the seminar laid some strong foundations for future exploration. Thanks very much to Guro Inosanto for visiting Seattle, and thanks to my travelling companions and fellow martial artists for making the day as exciting, fun, and interesting as it was.

Convenience Methods for Time

Our system of timekeeping (the whole damn thing, from 60 second minutes through to leap years) is a pet peeve of mine. If only the metric people could have done for time what they did for everything else!

Ruby has very robust support for date and time manipulation, but for reasons I don’t understand, it is broken up across multiple classes (chiefly Date, Time, and DateTime). So far, this is the only fundamentally broken thing I have found in the standard library.

Time stores date and time information, and does arithmetic in seconds. Date and DateTime are primarily about parsing and manipulating dates, and do arithmetic in days and months. Date and DateTime are very robust at parsing and arithmetic (smart enough to roll April 31 to May 1 and so on), while Time is fussy (Time will raise if you try to create April 31). Date and DateTime are implemented in Ruby, and are especially inefficient at string parsing. Time is implemented in C, and parses date strings very quickly, but not as well effectively as Date and DateTime.

In a better world, we would get the benefits of Time, Date, and DateTime all rolled into one class. Everything would be in Time, and Time would be smart enough to fall back to Date and DateTime as needed.

Since this is Ruby, we could do exactly this, easily and transparently in our code. Let’s start with something a little more modest. Here are some convenience methods for time management in Ruby:

require 'date'

module TimeRounding
def day_start
Time.local year, month, day

def day_end
day_offset(1) - 1

def day_offset offset
date =, month, day) + offset
Time.local date.year, date.month,, hour, min, sec

def month_start
Time.local year, month, 1

def month_end
month_offset(1) - 1


def month_offset offset
date =, month, day) >> offset
Time.local date.year, date.month,, hour, min, sec

class Time
include TimeRounding

And the usage:

=> Wed May 09 18:48:11 GMT 2007
irb(main):035:0> 3
=> Sat May 12 18:48:14 GMT 2007
et 3
=> Thu Aug 09 18:48:22 GMT 2007
irb(main):037:0> 14
=> Wed May 23 18:48:31 GMT 2007
irb(main):038:0> -20
=> Thu Apr 19 18:48:41 GMT 2007

Iteration and Collation

Suppose you have two or more arrays, in Ruby, and need to iterate over them together. Naturally, there are lots of ways to do this.

First, there is the obvious way:

foo = %w{one two three}
bar = %w{A B C}

foo.size.times {|i| do_something foo[i], bar[i]}


foo = %w{one two three}
bar = %w{A B C}

foo.each_with_index {|number, i| do_something number, bar[i]}

This is reasonable enough. It is efficient, and short to type. On the down side, you can’t use Enumerable with it.

I originally wrote the following code to cleanly get collation with Enumerable support:

foo = %w{one two three}
bar = %w{A B C}

class Collation
include Enumerable

def initialize *arrays
raise 'Must include at least one array' if arrays.empty?
@arrays = arrays

def each
@arrays[0].each_with_index do |elt, i|
yield [elt] + @arrays[1..-1].map {|array| array[i]}
end, bar).each {|number, letter| do_something number, letter}

This isn’t really necessary though. It turns out you can collate just fine using the standard library (and with a C implementation, too):

[foo, bar].transpose.each {|number, letter| do_something number, letter}

The moral of the story? Hmm. How about (1) you can have your cake and eat it too, and (2) odds are very high that there is library support for what you are trying to do. Don’t give up easily on the search for a standard way to do what you are trying to accomplish.

In Memory of Kurt Vonnegut

When the last living thing
has died on account of us,
how poetical it would be
if Earth could say,
in a voice floating up
from the floor
of the Grand Canyon,
“It is done.”
People did not like it here.