Monthly Archives: April 2005

Parse::RecDescent vim trick

Just thought I’d share this. If you’re using Parse::RecDescent and editing with vim, you’d probably like your grammar to be syntax highlighted (at least I do). Here’s a nice little trick to fool vim (and I don’t consider this a bug; vim folks, don’t fix this!):

    my $grammar = <<'#'EOG';
    grammar goes here

vim doesn’t grok ‘ inside heredoc quoting, so it thinks that the # is the end of the heredoc, and puts normal highlighting back after that.


In order to put off writing my lecture notes for tomorrow until I’m yet more tired, I’m going to write about something that seems appropriate, given my interest in wiki.

I was at a meeting today with some other developers for a RPG I’m working on. Actually, I’m not sure I’m allowed to say it’s an RPG: we haven’t written up the NDAs yet. The project manager suggested that we should make up NDAs, such that we should not say too much about the game lest someone “bigger” get our idea and do it first.

He made a good point, that there are “genre definers” in games. If you make a really good introduction to a new genre, then all other games in that genre are considered imitations. I like that, though I’m not totally sure I agree. What was Command & Conquer imitating again?

To some extent, idea paranoia shows an insecurity in your own skills. What you’re saying when you say, “I don’t want anybody to get my idea or else they’ll steal it,” is in fact, “I believe that if someone else gets my idea, then they’ll be able to do it better than I can.” In software, this is hardly the case. 10% of the people that decide to use your idea for profit will finish with something so incredibly different from what you had in mind that you’ll both be defining your own genre (or they will slip into the genre that they know/like best). The other 90% will never finish.

A bit ironic, when I first got the idea for Miki, the music wiki, I hoped that nobody else had thought of it first. :-)

When you tell someone enough ideas to give them an impression what you’re doing without the important details, they go “that’s cool”. When you tell them enough ideas to give them an impression of the details, they’ll give you ideas back. Actually, that’s how I joined this project. Last summer, Chris, the founder of the project, described to me very passionately and in great detail everything that was going on in his brain about the linguistically-based magic system. I was intrigued. I decided that I must be a part of this, being a computational linguist and all. If he had said “we’re doing a really unique magic system, but I can’t tell you what it’s about because I’m under an NDA”, I’d have said, “good luck,” and gone back to watching Family Guy.

Ideas are free to transmit. The probability of your coming across a world-changing idea grows quadratically with the number of ideas you are previously exposed to (this is reasonable, since new ideas are just unique combinations of old ones). That means that the more ideas you share, the faster the intellectual technology of the Human race progresses. But it doesn’t change your probability of finding anything new. Hiding things for that reason seems awfully selfish to me.

It all ties into this commons sociology that Lawrence Lessig1 studies (whose latest book is free for download after having a widely popular published book previously, that he surely made some money with). It is a natural behavior that comes out of evolution (doesn’t everything?) which is very, very advanced and which I have not been able to simulate in the slightest on the computer after many trials. In a world where we cherish each other’s lives so much so as not to let the stupid, handicapped, or otherwise unfit1 die (assuming for the sake of argument that the United States is the only place in the world), personal “fitness” stops making any difference. We’re not up against any other species anymore, and we’re not up against each other. What are we up against? The limits of our knowledge and understanding, which, as things are going, will cause us to exhaust the planet’s resources and blow each other up with nuclear weapons. So we’re now thinking of the Human race as a single organism that must survive against something that it doesn’t understand. That organism had better learn all it can about its enemy as quickly as it can.


Wiki rocks!

1And he’s even put one of his old books on a wiki for editing, with the intention of republishing with the world’s edits, profits going to the creative commons.

2Oh, except for those who were unfit enough to be indistinguishable to stupid Americans from the people who bombed the WTC in 2001.

No Privacy

I’m publishing my local subversion repository that contains most everything I do (right now just my programming stuff, but once I reboot into Windows, my music, too). I’m even letting people commit to it. The repository is at, and you can give yourself committer privileges here. If you do give yourself committer privileges, it would be nice to put yourself on The list of misc committers.

Slicable Music Format

In my excursion to write a music wiki (which I’m picking up on, because Nguyen, Nathan Stang and I have decided to write a piece together), I’ve decided that I need an intermediate format for music other than MIDI. It would be a big mistake to try to make it a notation format (there are plenty of those), so this format will be largely isometric to MIDI. There are a few differences, though:

  • Mostly human-readable (but not writable, most of the time)
  • Line-based (so that diff and merge like it)
  • Measure-based (times are given in terms of the start of the measure, rather than from the last event)
  • Notes are given in terms of (start,duration) rather than (start, end).
  • Notes are given in the form e.g. c#3, rather than 49.
  • Volume is canonicalized into velocity.

The idea is so that it makes it easy to strip out, say, tempo change events, and so that wikiers don’t have to download and upload to make very simple changes.

Old Server

Well, they refused to set up DAV for me. And they only allowed me to access their server via SSH from my house (I gave them my IP). That’s just not practical for setting up private subversion servers, so I broke up with them. They cried, I laughed. I’m now back on navi (of CIA fame), but I might be moving to a Linode 64, because the navi admins, who are my friends, are a little lazy. I don’t know if linode will be right for me, but it’s been recommended, and I’m willing to pay $30 to find out.


I’ve started Luki, a miscellaneous-purpose wiki where I’ll do all my schoolwork and such (most anything that isn’t code and doesn’t otherwise transcend the markup limitations of wiki). I’m sure most of it isn’t interesting to anybody, but y’all are free to read and contribute anyhow.

Separable MIDI

In Thinking Like a Designer I outlined the plan for creating a new music program. But I forgot to do something that a good designer should always do: determine whether it’s a problem that needs to be solved. And in this case, it has been solved many times before. Each solution has its ups and downs (Overture has MIDI heartburn, Finale makes the Easy Things Hard, Denemo is open source but very unstable). But all of them (ab)use MIDI. So to make a musical Wiki system, my real goal, it seems that MIDI is the way to go, because then each author could use the program that he is most comfortable with.

However, each program mangles any MIDI it edits into the kind of MIDI that it likes. Some programs specify dynamics by Controller 7 (volume) (Overture), others by velocity (Finale). Some programs mark time signature, others don’t. Some programs insert tempo changes all over the place to indicate “inflection”. So we can’t just give them the MIDI to edit and but it back verbatim. We have to make all these programs play nicely together.

You do this by separating out each thing that varies and putting them in layers of the same file. Every program uses notes pretty well (some of them quantize, which is a pain). That will be the first layer. Another layer would be pedal, another layer tempo, etc. Then when someone goes to edit the file, they checkbox which layers they want to be put together for editing, and then when they upload, they checkbox which layers they changed. A backend pulls these apart and puts them together, hopefully keeping things that were logically unchanged (even if the program mangled them) unchanged. To handle the volume/velocity problem, we just normalize to one or the other.

New server

The site is now hosted at Canaca-Com. It’s pretty good so far. The software and perl module selection they provide is pretty limited, but that’s okay, because the server is the same architecture as my home machine, so I just upload whatever is missing. Anyway, they have a “30-day money back guarantee”, so if I end up getting too pissed (for instance, if they refuse to set up DAV for me), then I can just pull out.