What I Want

February 7th, 2009

  • my files and other resources in the cloud
  • my devices exposed to the cloud
  • the ability to run programs in the cloud, against cloud resources and devices
  • control of the cloud; for it to live on computers that I and my friends in my inner circle have physical access to

Network Audio Streaming on OS X

September 2nd, 2008

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.

Javascript Scope

June 18th, 2008

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

October 28th, 2007

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.

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.