For Good

I’ve heard it said
That people come into our lives for a reason
Bringing something we must learn
And we are led
To those who help us most to grow
If we let them
And we help them in return
Well, I don’t know if I believe that’s true
But I know I’m who I am today
Because I knew you.

– “For Good” from Wicked Musical

It’s beautiful :).

This is the solo version (original is duet), sang by Kristin, one of the original singers/actors. She played Galinda, the pretty witch =P.

One of my favourites from Wicked.

It’s weird. Quite a few people have changed me throughout my life. Yet most of them probably don’t know it (I have a feeling the hamster does…). Some of them aren’t even good friends.

It’s just something about them that makes me want to emulate. To change.

And then there are people I never knew, but keep hearing about. Makes me very curious.

Like BIG Kerri’s lilbro*

They just go on my list of 100 things to see before I die =P.

* Tiny font as required by the Underage Protection Act. If you can still see it, your eyes are breaking the law (by the DMCA).

Making your own PCB

To my non-ECE friends: Sorry this post won’t make any sense. Please stop reading now :).

My next project – a 100Msps/20-40MHz USB Oscilloscope.

I’m making it mainly to learn about a few things – high speed circuitry (EVERYTHING becomes a capacitor + inductor, and 45 degrees bent traces are better than 90), some more VHDL with FPGA, and making my own PCB!

The PCB making part I’m most excited about. If you don’t know already, some companies will make “prototype” PCBs for you for ~$20-$30. Just need to draw your PCB in an electrical CAD program (gEDA, EAGLE, KiCAD, etc), and send them the file along with your credit card details. Wait a few days/weeks, and you’ll get your little green board in the mail, professionally made.


There are ways to make your own PCBs at home, using smelly chemicals and hand drills, but for $20-$30, I would just get someone to make it for me. No need to deal with nasty chemicals, and MUCH higher quality.

One very popular and the cheapest prototyping service is BatchPCB. $10 setup/handling + $2.5 / sq in for 2 layers board (you can have traces and components on both sides). Apparently quality is pretty good. Downside is it takes forever (up to more than a month).

The other one I’m considering is Olimex. EUR 30 (~$40) for a 16cm*10cm panel (HUGE!). You can divide it up any way you want. Cheaper if you are making bigger boards, or need more than one board. 3-5 days turnaround time. If you want to make some PCBs too maybe we can share a panel?

One major advantage of making a PCB vs breadboard/prototyping board is surface mount chips. All the fun chips (FPGAs, newer microcontrollers, USB interface chips, etc) are only available in surface mount packages. Contrarily to popular beliefs, it IS possible to hand-solder SMD chips. I’ve successfully soldered a 28-pin TSSOP. It’s pain in the rear end, but doable with a clean, fine soldering tip with a lot of flux, and mad soldering skills of course :). QFP should be similar (same lead spacing, just on 4 sides). I wouldn’t try QFN, though, I heard they are very hard due to the lack of extended leads. SOIC should be very easy due to huge lead spacing.

That’s about all the common chip packages.
DIP (the kind we used in labs, very easy to solder) –

As you can see, most ARE actually hand solderable. Just need to make your own PCB.

Some chips with hundreds of pins (huge FPGAs, microprocessors, etc) use other packages like BGA or LGA (where the pins form a “grid”). I’m not worrying about those yet =P. Even the newest FPGAs are available in QFP (at least the smaller ones).

There are many tutorials online for SMD hand soldering.

Coincidentally, there’s an article in IEEE Spectrum about this exact same topic.
(The picture above was stolen from there shamelessly :)).

Have fun!

(BTW, the segway project has been put on hold until I learn more about control theory next year… right now it’s able to balance itself for a second or 2 before falling down. I think it’s to do with the large delay in the PID feedback loop, but I don’t know what to do with it yet =P)

Mostly Harmless

I have been involved in an alarming number of religious debates over the past few weeks. With people in “real life”, on random forums, etc. It seems like the world just likes to disagree with me =P.

I think I have learned quite a lot about religions, and spirituality in general, and have been enlightened on many accounts.

I have always been an atheist, and still am last time I checked.

However, my view on organized religions have changed drastically. It makes a lot more sense now that I have a deeper understanding of what it entails to be a believer.

I have always secretly despised organized religions in the past, dismissing them as superstition, and occasionally hypocrisy.

Fortunately, I’ve had the honour to talk to some very wise religious people (which I thought would be contradictory), and learned a few things.

1. By definition, faith is a choice to believe. It’s no different from believing, say, general relativity. Many scientific theories we believe today cannot be proven. They are hypothesis taken as truth, perhaps temporarily, for convenience, to explain something we can not yet explain. They form the axioms of our scientific “knowledge”. We accept them as truth, and build on them. If you believe in general relativity, everything else can be deduced – time dilation, black holes, relativistic mass, etc.

But all that is bullshit if you don’t choose to believe in general relativity in the first place.

It’s the same thing for religions. For example, if you accept the existence of the Christian God, all the teachings follows logically.

Science is really no more “scientific” than religion.

Existence of God doesn’t need to be and cannot be proven, because you either choose to believe it or you don’t.

2. … there is really no 2). Everything else follows logically from 1).

Believers are just people who choose to have faith because it helps them become a better person, have a more satisfying life, gives them a purpose or motivation to do good, or a brazillion other reasons. There’s nothing superstitious about that.


As you may remember, a few weeks ago, I set my summer goal to be learning La Campanella.

2 of my musical friends (as opposed to Subway friends, KFC friends, A&W friends, etc) soon very subtly, with their usual elegance and politeness, told me it’s way beyond my reach. And after seeing the score for the first time, I wholeheartedly agree :D.

New goal – Debussy’s Arabesque #1. Delicious impressionism. For real this time!

One cool thing about this piece is that everyone plays it very differently. I don’t think there is a “standard” interpretation. If you go down the youtube result list, and listen to 5 different ones, you’ll get 5 drastically different interpretations. The one above is my favourite. One of the faster ones. And I also observed that the amount of rubato (varying tempo) is inversely proportional to age =P.

The notes are considerably easier to get right, but of course, simpler notes means music must come from elsewhere.

I’m on third page already! The notes are pretty easy, except for the eighth against triplets. I can never get them remotely close to even :(.

I’ll worry about musicality later =P.

bool WantHug() const {

     return true;

One good thing about game programming – randomly browsing the code makes you chuckle =P

I was reading through code for some NPC managing class.

I think I saw functions that try to determine whether a NPC is drunk (using something like mAlcoholContent member variable), whether he should be puking, or passed out.

and an IsEmoting() or something to that effect.

Way too much fun =P.

Survival, Inquiry, Sophistication

3 stages of every major Galactic civilization –

Survival – How can we eat?
Inquiry – Why do we eat?
Sophistication – Where shall we have lunch?

(random profound hitchhiker wisdom of the day)

I am beginning to appreciate the hour-long bus ride to work everyday now.

When work gets repetitive, when life becomes regular, when even trying a different tea at work everyday (they don’t have lemon in the fridge!!! =() doesn’t make life exciting enough, the bus ride is the only thing that changes.

Same bus, same time, same seat, with the same people, from the same place to the same place. Everyday.

But that doesn’t matter. It’s the only piece of true free time I have in my life now. All other times there’s always something with higher priority.

It’s the only time I can let my mind wonder, and think about all kinds of things.

That and the sun.

It’s an amazing feeling! Relaxing and enriching.

BTW, in case you are wondering, the topic of the day was PID control algorithm for my segway :).

It was somewhat difficult today, though. There was a pretty girl sitting next to me. Very distracting.

My usual daily dose of pretty girl exposure consists of saying hi to the receptionist.

The Fast, the Slow, the Passed Out

#48133, Matthew Lai, Richmond
1:02:11, 6:14/km, Place: 13127

Down from 1:05:30 3 years ago. And I have gotten so out of shape since then!

That’s not TOO bad =D, considering there are TONS of hills.

It really is easier with distractions =P. Would’ve never finished it without someone to talk to along the way. Thanks!

Goal for next year: 55:00.

At this rate I’ll get my seed status in 2015 or something =P. Can winter not come? Pretty please?

Pics! Sorry I don’t know how to post them on facebook (I’m bad with computers).

And sorry for the phone quality. Didn’t run with a camera. I had a race to win, you know? 🙂

The crowd

Long time no see, start line!

Not photoshopped! I think I took this one while sprinting =P Love the distortion.

Always burn bridges behind you. Never know if anyone’s trying to follow.

No pic of the finish line because I was sprinting full speed =P.



59:05 / 10km.

Broke my personal record!! (which was DNF =P, or 1:05 from 3 years ago)

Racing against time is a great feeling.

“55:30, one more lap, I’m so making it!”

Sprinted the last km in 4 minutes!

I think I’m ready for the RealThing on Sunday. My goal this year is to break 1 hr, and I did it!

Too many failures recently. Good to see some success for a change =D.

Tango Down

It has become a tradition that at the end of every year, I make a post bragging about my marks to induce jealousy, hatred, suicidal tendencies, and being a some kind of hole in general.

My marks are usually above average.

Unless you are Murtadha, of course, in which case you get a free morale boost. (at least for math :))

Rumours have it that in IB (yes, there are many rumours about IB. if you have a free afternoon, I can tell you all about them), when they post marks, they order it in decreasing order of grade. And everyone gets to choose a pseudonym for themselves, and my friend reportedly chose “Noobs below this line —————-“.

I wish we have that at UBC =P.


Math was just… epic fail :). So is APSC. Feel free to laugh.

I wish I did better for PIP, too. But I think I did get the highest mark, at least in module 4, so I won’t complain… too loudly. 1 person beat me on the final exam, though. I wonder who s/he is.

BTW, I got 101% in cpsc, but they capped it at 100% =( (=P).

In Soviet Russia, Game Plays You

When I opened my blog yesterday, I really meant to make this post =P. But obviously got a little carried away.

First (second) day at work, ever!

Believe it or not, I’ve never worked anywhere before. Not even part time jobs.

So this is all very exciting =D

The people and the place are great, but the work is hardcore!

They have more PS3’s and XBoxes than employees, and anywhere you look, there are people gaming =P.

I love how in developer meetings, they go over everyone’s progress, and say things like “50 bugs! down from 70 last week. good work!”. It’s like we are competing against QA people making bugs.

So much to learn. I’ve never been involved in this kind of huge scale development before. >1000 files, I would guess ~1 million lines? Version control with > 100 users, few hundred bugs closed and opened everyday.

It will take some getting used to. Usually, when I code, I know how the program works inside out. Of course that’s not possible at this scale. And everything happens so quickly.

A few epiphanies –
1) they lied to us at school. there is no commenting. at all. in an average 3000 lines file, you’d find about 5 lines of comments in total. no pre/post conditions, no function descriptions, no nothing =P usually the fastest way to figure something out is to talk to the guy who wrote it, if they still remember. self-documenting code is by necessity.
2) hitting rebuild every time I write something (lazy syntax checking) is very inefficient, because the game takes about a minute to do a partial rebuild. 15 minutes for the xbox!
3) the fridge right beside my desk has beer hiding inside.
4) satisfaction reaches a whole new level when you finally get to play your very own self-compiled version of the game on the xbox. killing zombies has never been so much fun!

BTW the game we are making, Dead Rising 2 is great! Try it when it comes out in Sept or something :D. It’s great even with debug texts flying.

I can’t say much, but, touching story. Very traumatizing. Good character development, too. Unusual for this kind of games.