My OS X Programming Blog
Mac OS X Cocoa and CoreMIDI Programming
About Andrew Choi

MIDI Programs

MIDI File Player (External Device)

MIDI Destination Pop-Up Button

MIDI File Player (Internal Synth)

MusicSequence Sample Code

MIDI File Writer

MIDI Name Document Parser


Fish Creek MIDI Framework



Other Programs


FCBlog and Patch

Chinese Checkers Program

jyut6 ping3 Cantonese Input Method

Cocoa Sample Programs

Syntax Coloring Using Flex

NSTextField and Undo


Implementing File Import

Launch Application and Open URL

Saving Uncommitted Text Field Edits


Jazz Chord Analysis as Optimization

Optimal Line Breaking for Music

Optimal Chord Spacing


A blog where I will write mostly about programming in Cocoa and CoreMIDI, and experiences from my ports of Emacs and XEmacs to the Mac OS.

Ten Defining Moments
Friday August 22, 2003

Ten Defining Moments as a Programmer...

  • Took a FORTRAN course in my first semester at USF; changed my major from math to computer science the following semester.
  • Worked as a programmer at the Microcomputer Lab at USF. Hey, people would actually pay for this!
  • Learned Lisp.
  • Worked as research assistant at Davis. A “showcase” was needed at the lab yearly at grant renewal time, which would require a lot of programming.
  • Learned to prove program correctness.
  • Coached HKU's programming contest team. Our team never won when I was coach, but it had been a real experience.
  • Wrote a small MIDI freeware program on the Mac. Got E-mail from all over the world!
  • Learned C++ (OO, exceptions, templates, language design, ...).
  • Read the Design Pattern Book.
  • Ported Emacs to Mac OS.
And no, I don't watch Dr. Phil.

So You Want to Write Cocoa Programs...
Thursday August 21, 2003

Thursday I usually go grocery shopping. I needed a haircut today too. My barbershop is close to the gardening center, where I got some larkspurs, delphiniums, and daisies today. Then Chinatown is sort of on the way, where I got barbecue pork. Then I needed burner covers and other stuffs from Walmart. Oh, and then the groceries. Well, you get the idea why I'm writing this quite late today. Also, am I a great procrastinator or what :-)?

Why am I learning Cocoa? I will be writing MIDI/audio programs on the Mac. I could use Carbon, which I know from the Emacs ports, but I'm curious as to what Cocoa can do. What has put me off working on it for so long is Objective C, which looks funky and isn't applicable anywhere else! I'm more concerned about the wasted effort in learning it rather then portability of programs, because if you write for CoreAudio and CoreMIDI, your programs won't be portable anyway. I once spent some time on OpenDoc. Remember OpenDoc?

There will be another programming language in the programs too: an embedded, scripting language. It will definitely not be AppleScript (it's so ugly). Probably Scheme. Possibly Python or Ruby. Doesn't that sound like an interesting project already? Sort of like “the Emacs” of MIDI sequencers/audio editors?

I've spent the last two weeks or so learning Cocoa programming. I've read documentation, articles, tutorials, even a Wiki, and finally bought a book. After reading all these, I'm left with but one question: why does everyone write in cookbook style nowadays?! What's happened to describing concepts for what they are? Giving examples is one thing, only giving the examples and making that the whole book/article/tutorial is ineffective!

Anyway after that I gave up and start reading some sample code and finally learn much quicker.

So, if you're learning Cocoa, I recommend that you read the book (quickly), then read Apple's documentation (the articles, not the references), then read the sample code. After that, read Andrew Stone's articles for interest, because they are interesting, not because they'll teach you Cocoa. You can probably skip the O'Reilly Network tutorials (poorly written) and use the Wiki only for reference.

Well, I'm sidetracked the past two days building this blog and converting my Emacs page to a blog. Now I'm back to learning some more Cocoa. My next project? A document-based application for viewing postscript files using Ghostscript as the display engine. Why? Because I can :-).

So Who is Andrew Choi?
Wednesday August 20, 2003

Oh, my second day as a blogger! BlogMax has worked quite well. I've played around with it a bit yesterday. It looks like a well-conceived and nicely written piece of software. Thank you, Bill St. Clair, author of BlogMax!

I thought a lot last night about what I should write about today. I decided I will start by introducing myself. Only my family and friends will be reading my blog for now. But eventually I'll link to it from my Emacs page. So a bit of introduction should be necessary.

My name is Andrew Ki On Choi, or 蔡基安. I'm 42. I live in Calgary, Canada. I went to school at Good Shepherd Kindergarten and Primary School (a.m.), Wah Yan College (Kowloon), University of San Francisco, and University of California at Davis. After getting a Ph.D. in computer science at 25, I taught at the Chinese University of Hong Kong and the University of Hong Kong.

I'm currently «taking some time off» to read, study jazz, garden, and write programs. After a year of that and watching every rerun of the X-Files and Star Trek, I now plan to spend all my energy in the next year or so to develop a piece of software on my own. It will be the greatest piece of software I've ever written.

I ported GNU Emacs to Mac OS classic and Mac OS X. I also wrote OMS SysEx Sender and other unimportant pieces of software. Well, they were important at the time.

I had taught various subjects but my favorite ones were always those related to programming, like compilers, OS, design patterns, and of course, C++. I did research on OS, database systems, computational geometry, image processing, DSP, and even computer music. However, my first love has always been writing beautiful programs.

I play the guitar and electric bass. I've read all of Frank Herbert's books (some more than once). I'm learning about gardening, which is interesting because of the presence of deer here. I speak Cantonese, English, and some Mandarin. I read and write English and Chinese. I bake. And I can cook up a simple meal, and a few not so simple ones like a Chinese steamed taro root cake.

This is me, about forty years ago. How can you not like me :-)?

Since this is a programming blog, there should at least be something about programming. Here is a ProjectBuilder project of a clock I wrote in Cocoa the last few days, which will show the current time in any time zone. I release it under the Perl Artistic License. Enjoy! Others will probably charge you a shareware fee elsewhere :-).

A New Beginning
Tuesday August 19, 2003

OK, new blog! Everyone seems to have one nowadays.

Do I have something interesting to put in it? I suppose so. I ported Emacs to the Mac OS (both classic and X) and I have many observations about the process that I can write about. I'm also learning to program in Cocoa so I will write about that experience too.

Since this is a blog on programming, I won't write about my other interests. But occasionally I may post a picture of the flowers in my garden, a piece of music I've played, or a recipe or two. How's that for entertainment value?

I'm writing this using the BlogMax package, which was quite easy to set up and lets me use the web space at my ISP to host the blog. It also runs under Emacs, which always is a good thing.

August 2003
Sun Mon Tue Wed Thu Fri Sat
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
Jul  Sep


Search this blog with


Less-Known Facts About Emacs

Emacs Rants

Chinese Restaurants in Calgary

Calgary/Banff Tourist Attractions

C++ Reading List

Science Fiction Series

Top-10 Reason I Stopped Working on Emacs

Top-10 Types of Questions I Get About Emacs

10 Defining Moments as Programmer


Carbon XEmacs

Emacs for Mac OS X

Copyright © 2003, 2004, 2005 Andrew Choi (Contact Information). Created with FCBlog