Building Thunderbird on OS X Lion (10.7) and XCode 4.2

A few people recently asked me about building Thunderbird on the latest version of Mac OS X. Since I have it working, and to give myself a place to point to the next time they ask, I figured it would be a good idea to blog about it.

So, here’s my .mozconfig.

 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
# Debug .mozconfig
mk_add_options MOZ_MAKE_FLAGS=-j4
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../objdir-`basename \`pwd\``-`hg branch`
# mk_add_options AUTOCONF=autoconf213
ac_add_options --enable-application=mail
ac_add_options --enable-extensions=default,inspector
ac_add_options --enable-inspector-apis

# Compilation options
ac_add_options --disable-optimize
ac_add_options --enable-debug
ac_add_options --enable-tests
ac_add_options --disable-jemalloc
#ac_add_options --enable-trace-malloc
ac_add_options --enable-chrome-format=symlink

ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.7.sdk
ac_add_options --enable-macos-target=10.7

# For NSS symbols
export MOZ_DEBUG_SYMBOLS=1
#ac_add_options --enable-debug-symbols="-gdwarf-2"

#Use ccache
#ac_add_options --with-ccache=/usr/local/bin/ccache

# We don't have GCC anymore, since XCode 4.2, so use clang instead.
CC=clang
CXX=clang++

There are probably a bunch of things I don’t really need in there, so if anyone wants to take it, and cut it down to the minimal set, I would definitely appreciate it. But in the meantime, this works for me, and will probably work for you, too.

We Did It! Washing Machine Edition

About a week and a half ago our cheap little washing machine started making an alarming grindy noise when it was draining, and then the day before Blake left on business it decided it wasn't going to drain at all; the clothes were left to wallow in a puddle of soapy water at the end of the load.

There's a drain outlet with a filter on the front of the machine which catches little bits of crap you've left in your pockets, fluff and soapy slime; we opened that and a whole wash-load of water flooded out. Fortunately the washer lives in our unfinished basement right by a drain, so the water found a good home without destroying anything on the way. The filter had caught a whole lot of safety pins, beads and bobby pins (damn you, ballet); I guess they mean it when they say you have to clear it out every month.

I did some Googling and found some suggestions, some helpful and some not so helpful. From our information, we deduced that the problem was somewhere in the pump and drain system (we're brilliant).

So we headed downstairs and starting taking the thing apart; we removed the back panel, disconnected all the bits of drain pipe we could make sense of, and failed to find any obvious blockages or other visible problems. That left the pump, which looked okay, but then that's the nature of pumps. Having eliminated everything else, we ordered a new pump.

It arrived a couple of days later (I love PartSelect) but Blake was away and I didn't fancy trying to screw the pump to the bottom of the machine without someone to hold it up. So I waited until he got home, and we installed the new pump today. It was tricky and a bit annoying, but not spend-my-debt-paying-money-for-someone-else-to-do-it tricky.

And guess what? It works! The machine is purring happily away, draining like never before, and Blake and I are full of the smug satisfaction that comes from fixing something yourself instead of being suckers and paying someone to unscrew some screws and disconnect some hoses.

The next thing, of course, is to fix the stove...

Doing Science

This afternoon we all went down to the U of T Child Studies Lab (I could be totally making up that name) to participate in some science. We've been on their list since Delphine was a baby, and have participated in a few studies; they're usually fun and interesting—the girls love being guinea pigs. (Except on the way home when they're tired and cranky and hate everything, especially each other.)

Today's study was at a special lab with hidden cameras, in one of those fantastic red brick Victorian (Edwardian?) houses on Spadina.

The study was on lying and tattling. The girls took turns going into the hidden camera room with one of the researchers—I've forgotten all their names because I suck, so let's call her Jenny. Jenny and the girl started drawing pictures, and then another researcher (Michelle!) came in to tell Jenny she had a phone call. Jenny left but not before telling Michelle not to use the paper from the book with stars on it! Only use the paper from the book with the fish on it! Don't forget!

Well, you see where this is going. Sure enough, good old Michelle figured she liked the star paper better, and drew a picture on it; then she decided she didn't like her picture, and threw it out. After all this, Jenny came back into the room and, after Michelle left, asked the girl what had happened when she was away.

(Meanwhile Blake and I were in another room with eight thousand computers, including the monitors for the hidden cameras. We watched the girls while filling out a huge stack of forms and questionnaires on the girls' personalities and our parenting styles.)

Delphine went first. She immediately put her head down and started working intently on her picture. (The kids were asked to draw a picture of their most favourite place; she drew a beach.) She didn't look up or show any sign of noticing the researchers' exchange, to the point that Jenny was very certain to remind Michelle loudly not to use the star paper on the way out the door.

When Michelle used the star paper, Delphine didn't say anything either, and when Jenny later asked what had happened the exchange went something like this:

J: So what happened when I was gone?
D: I just drew a picture.
J: Did Michelle draw anything?
D: Yes, she drew a picture but she threw it away.
J: Did she use the star paper?
D: Yes.

Cordelia was a little different. (Cordelia is a little different.) She also set to work drawing a picture of her favourite place—she drew our house. (*melt*) She was much more voluble and animated, though, talking through what she was drawing and why. When Michelle came in, she looked up and paid attention to the whole conversation. Then when Michelle started to use the star paper, Cordelia was quick to remind her that she wasn't supposed to use it.

After Jenny was back in the room, she asked Cordelia the same questions she had asked Delphine:

J: So what happened when I was gone?
C: I just drew my picture! (She still talks all in exclamations, with lots of body language.)
J: Did Michelle draw a picture?
C: Nope!
J: She didn't draw anything?
C: She didn't draw anything! (This said with a great big "Who can figure?!" shrug.)

So Cordelia fully lied to a quasi-authority figure, to protect someone she had barely met. It was almost just lying for the sake of it. There was a chart in the room we were in that showed the percentage of kids who lie from ages three to, I think, eight, and almost 100% of six-year-olds lie. I call it "peak lying".

This study was interestingly timed, because I've noticed Cordelia lying more lately. The thing is she's much better at it than Delphine. She tends to lie when it's plausible, and she sticks to her story, often with a touch of righteous indignation to make you feel like a jerk for not trusting her. Hopefully she'll either grow out of it or learn to use her power for good, not evil.

After the study was over, the researchers sat everyone down and explained what had happened, and then sent the girls on a hidden camera hunt. Delphine revealed that she had been a bit suspicious about all the fuss over the paper, and Cordelia looked a bit sheepish.

The end of the story is that the girls got to choose a gift out of a treasure chest to thank them for participating. Delphine chose a "make your own bouncy balls" kit, and Cordelia picked through the entire box before finally seeing and pouncing on a ninja action figure with light-up eyes. ($1.25 at Dollarama!)

Money (It's a Gas)

Back in 2008 when we moved into this house, we secured a line of credit to use for renovating. It was a deal we made with ourselves—we would spend less money on a house that wasn't "done", and then use secure credit to fund renovations.

And that's exactly what we did. Soon after we moved in, we took down some walls and totally redid the kitchen. And then we gradually paid the loan down; not all the way, but a lot of the way.

Then last year we redid the bathroom and added a powder room in the basement, and now we're in debt again, deep enough that I'm pretty uncomfortable. I'm not a futurist or an economist, but I don't think now is a good time to be deep in debt, even secured debt; jobs are scarce, housing prices are in a bubble, and the economy is in flux. I would rather be in the black.

So we put together an aggressive plan to pay off debt. It took us four months to get into debt; it's going to take us four years to get out of it, assuming we keep to our plan. And as I said, it's aggressive, quite probably unrealistically so; no vacations, no household maintenance, repairs or new furniture; no clothing; no gifts (except the girls' birthdays and Christmas); no veterinary care for Thomas the cat. When we spend on any of those things, it will either be from the $70/week not-otherwise-specified fund, or it will slow down our debt repayment.

Inevitably, mere days after making this plan, the stove and the washer broke and Thomas had to go to the vet.

But we have cast off our North Toronto helplessness; instead of calling a repairman for the appliances we consulted various websites, and there are shiny and complicated parts being shipped here as I type. When they get here we will get our hands greasy, or sticky, or whatever it is, and install them ourselves.

(I know, the thought of amateurs messing around with water and electricity or natural gas is alarming, but I'm confident that helpful YouTube videos will ensure our safety. Unfortunately there is no YouTube video for how to do expensive bloodwork on a domestic cat, so the professionals still have the upper hand in that one. For now.)

As for money in; well, Blake is making as much as is feasible at the moment (with occasional large and surprising bonuses). Now it's up to me to bring in some bacon of my own—or at least tofu. I took a baby step towards that goal this week by getting an IRS EIN, a magical number which allows me to charge Americans money. (Or more specifically, to charge them money and not have them withhold 30% of it.) This is exciting because so far almost all my clients have been American.

The other thing I'm doing is trying to fit more work hours into my week. I had been using my "work" time (i.e., 9:00 am to 3:00 pm) to run errands and do chores, but I've moved a few errands to the weekend and after school. I really like my work-life balance as it is now, but the fact is when you're freelance, only about half your hours are billable. I need to make the number of hours as big as possible, without making myself or the family miserable.

Sometimes I think it would have been better to have bought a house which was all renovated and shiny, and just suffered (in our shiny, renovated house) with a bigger mortgage. But we didn't, and now we have this shabby little house with no family room, and a huge debt. It is what it is, and at least we're fairly young and have a chance of pulling ourselves out of this mess before it's time to retire!

What angle would you cut a circle at to divide it into thirds?

The other day I was reading a tweet from Neil deGrasse Tyson, and it got me thinking… If you were going to cut a circle into three equal pieces using only two cuts, what would the angle to cut them be? (Θ in the diagram over on the right side there.) So I asked on Twitter, and eventually got a reply. This is my attempt to reconstruct the reasoning behind the answer.

The easiest way to figure this out, I believe, is to cut the circle in half, and then figure out what line divides the semicircle into a 2/3rds to 1/3rd ratio. So let’s do that, and label the points A, B, C, and O (for the origin), as shown on the left. We’ll also label the angle AOB as ɣ, because we'll be using it a little more later.

We know from this page that the area of a segment is r² × (ɣ - sin ɣ) / 2, and we want the segment formed by the line AB to contain 1/3rd of the total circle (or 1/3 × π × r²). Putting those together gives us the equation:
r² × (ɣ - sin ɣ) / 2 = π × r² / 3
multiplying both sides by 2, and diving both sides by r², we get
(ɣ - sin ɣ) = 2 × π / 3
Now all we have to do is simply solve for ɣ to get:
ɣ = 2.60533

That means that the angle BOC is π - ɣ, or 0.53626 radians (or 30.7º). Now, the inscribed angle is half the central angle, so in theory, to get the angle BAD, I should divide that by two, but then I’ll just need to multiply it by two again to account for the other half of the circle, so let’s skip all that, and just call it 30.7º.

Year in Review: 2011

Well, wasn't 2011 a piece of work? Lots of things happened, some great and some lousy. Let's start at the beginning.

In January we were taking Thomas the cat to the vet for excessive skinniness, strange loss of hair and general geriatric decrepitude. It turned out he had fleas, some kind of allergy which was giving him red spots all over, and lots of weird growths here and there: under his tongue, on his head, and probably in his bowel too. We treated him for fleas and gave him antibiotics for a while to clear up his skin problems, and put him on a permanent course of prednisone to treat his various tumours. (He's eighteen years old, so the growths are just because of old age.) We prepared ourselves for his imminent death; however, a full year later he's not dead yet, and indeed seems healthier than ever.

At the end of January Blake took off for Hawaii for work. I wasn't invited, which was particularly galling given that, you know, Hawaii in January. Not to mention, we hadn't been on a proper not-visiting-mum trip since before Cordelia was born. So come March Break I decided we should go to New York for the week. That holiday was more successful and fun than I expected it to be—the girls are at the perfect age to travel with. (Which is a bit ironic, now that I think about it, considering we won't have the money to go anywhere in the forseeable future.)

In May Greg Wilson and I published the paperback edition of The Architecture of Open Source Applications (Volume 1). In the process of publishing the book I learned an immense amount about TeX, typesetting, book production and publishing on Lulu.com, as well as getting a lead on a copyediting job. I enjoyed the whole process so much that I made it into a
business. So far I've had a handful of jobs and made some good connections, and I'm looking forward to growing the business this year.

February through June we were in reno upheaval. Our 80-year-old plumbing started leaking and we somehow decided, with impeccable North Toronto logic, that the only possible solution was to put a powder room in the basement and completely redo the upstairs bathroom. I've been meaning to post about that... It took a long time because our contractor usually runs much bigger jobs, and her trades were sneaking our bathroom in between other jobs. But when it was all finally done it was very satisfying and lovely.

In the middle of June one of the kindergarten students at the girls' school was hit by a car and killed. It shook up the staff and a lot of the parents pretty badly, and it's been on my mind a lot ever since. The little girl who died was the same age as Cordelia, and she was out with her mother when she was killed—actually her mum was hit by the car too. Imagine the fodder for rumination and imagination and nightmares that provided... It's a bit ridiculous that it would take something like this, but it made me understand that the continuing existence of my children is a gift. Anyway, that's a whole post on its own, really.

At the end of June I took a plane to Tokyo (by myself) to visit Dave. I'd never been to Japan, and it was a grand adventure.

By the time I got back from Japan the girls' summer vacation was well underway. The girls were at camp for a couple of weeks, then we went to Saskatchewan for a couple of weeks, then shortly after we came back the girls went to the cottage for a long weekend with Baba and Zaida. I felt like the real mooching-around-Toronto part of summer didn't start until the middle of August, but then we did manage to do our usual round of the Toronto Islands, High Park, Harbourfront, and a few trips to the park. I love summer.

I have to say I don't think anything terrifically interesting has happened since September. Greg and I have been working on the second volume of the software architecture book. (This time I'm actually going to copyedit the book, which will both be fun and educational, and improve the book.) Cordelia likes Grade One, Delphine likes Grade Three, Cordelia likes gymnastics and Delphine likes ballet. We're all pretty content to carry on into the new year as we've been carrying on.

All The Other Books I Read This Year

This poor blog has been sorely neglected, and especially the book blog. I feel like I haven't been reading much—I certainly don't get big blocks of time reading time very often—but I've managed to plough through a few books while brushing my teeth or waiting in line or taking the bus. I think these are most of them, although I always manage to forget a few.

Key:
(**) Loved
(?) Forgot
(x) Did not care for
(hm) Made me think

Books I Read With Delphine
  • All Creatures Great and Small and All Things Wise and Wonderful by James Herriot (**)
  • Harry Potter and the Philosopher's Stone by J.K. Rowling
Kids' and Young Adult Fiction
  • Milo: Sticky Notes and Brain Freeze by Alan Silberberg (**)
  • Scars by Cheryl Rainfield (hm)
  • Better Than Weird by Anna Kerz (**) (hm)
  • Bud, Not Buddy by Christopher Paul Curtis (**)
  • Masked by Norah McClintock
  • Knifepoint by Alex Van Tol
  • Comeback by Vicki Grant (?)
  • Rock Star by Adrian Chamberlain
  • Harriet the Spy by Louise Fitzhugh
Book Club Books
  • The Things They Carried by Tim O'Brien (?)
  • The Uncommon Reader by Alan Bennett (x)
  • Good to a Fault by Marina Endicott
  • The Brief Wondrous Life of Oscar Wao by Junot Diaz
  • The Book Thief by Marcus Zusak
  • The Golden Mean by Annabel Lyon (hm)
  • Annabel by Kathleen Winter (**) (hm)
Pulp and Other Fiction
  • Gideon's Sword by Douglas Preston and Lincoln Child (x)
  • Guilty as Sin by Joseph Teller
  • The Sweetness at the Bottom of the Pie by Alan Bradley
  • Open Doors by Gloria Goldreich
  • Half of a Yellow Sun by Chimamanda Ngozi Adichie
  • Blackout by Connie Willis
Self-Improvement
  • Seven Principles for Making Marriage Work: A Practical Guide from the Country's Foremost Relationship Expert by John Gottman and Nan Silver
  • Health at Every Size: The Surprising Truth About Your Weight by Linda Bacon (I know, right? Mmm, bacon...) (hm)
Non-Fiction
  • Too Safe For Ther Own Good: How Risk and Responsibility Help Teens Thrive by Michael Ungar (?)
  • Lapsing into a Comma: A Curmudgeon's Guide to the Many Things That Can Go Wrong in Print—and How to Avoid Them by Bill Walsh
  • The Battle Hymn of the Tiger Mother by Amy Chua (hm)
  • Losing Our Cool: Uncomfortable Truths About Our Air-Conditioned World (and Finding New Ways to Get Through the Summer) by Stan Cox
  • Wrong About Japan: A Father's Journey with His Son by Peter Carey
  • Ah-choo!: The Uncommon Life of Your Common Cold by Jennifer Ackerman
  • Bury the Chains: Prophets and Rebels in the Fight to Free an Empire's Slaves by Adam Hochschild (**) (hm)

Fun For the Whole Family: Reviews of Three Board Games

Santa was good for family cohesiveness this year — he brought us lots of things to do together. Delphine got a build-your-own-catapult kit, Cordelia got a giant puzzle of Toronto, and we got three board games. We haven't opened the catapult or the puzzle yet, but the games have already seen a lot of use.

Apples to Apples, Jr.

Apples to Apples, Jr. is one of those games that makes you feel slightly stupid for having paid for the game and all the packaging, because there's nothing special about the game parts that you couldn't fabricate yourself. The creator's genius is in coming up with the game and getting it into production. And in this case I don't feel too bad about paying for it, because it's a really fun game.

What you get in the box are two sets of cards: red (nouns) and green (adjectives). Each player gets five nouns, and one player is the judge and selects an adjective. The non-judge players have to select from their hand the noun which most exemplifies the chosen adjective, and submit it without revealing which noun is theirs. Then the judge chooses—using criteria of their own choosing—the winning noun. Players are encouraged to advocate for their cards, and the game is more fun if the judge deliberates out loud.

We've enjoyed this game every time we play it, with every age group. It's best for readers, but even Cordelia can play if she has someone to help her with the words she isn't sure of. There is an adult version of the game which I can only imagine is extremely fun.

Lego Champion

We have Lego Creationary, which I kind of like but I'm not really good at Lego, so I don't love it. I wasn't sure about Lego Champion, but we all like it way more.

The board is a track made (by you) of Lego, and each turn adds another piece to the board. Each turn also involves a challenge, a game the whole team plays to determine who will move forward a bonus amount.

There are five possible challenges which vary wildly in difficulty. In On Target everyone throws a Lego brick and tries to hit a target. Bluffing Bricks is a guessing game where everyone takes three blocks and then players take turns guessing how many of a particular colour there are, or calling the previous player's bluff. In Topple Tower players take turns balancing a successively larger Lego creation to the top of a tower: the first player plays one piece, the second player plays a two-piece object, the third plays a three-piece object, and so on. The trick is that you can't interlock your object to the tower. The last player to add to the tower without toppling it wins the challenge.

In Codebreaker, the challenger (the person whose turn it is) makes a three-brick code, and then other players have to figure it out by asking yes-or-no questions. And finally, in Speed Builder the challenger builds an eight-brick structure in secret, and the rest of the players race to duplicate it exactly.

Our favourite challenges are Topple Tower and Speed Builder. Bluffing Bricks is a little hard to understand, but once you've worked it out it can be a clever and fascinating exercise. I think you have to be quite a big of a game theory nerd, though; last night we played it with some friends and it was so confusing we ended up substituting Lego bowling when Bluffing Bricks came up on the dice. (Lego bowling is surprisingly challenging, it turns out, because the bowling ball (the dice) is cube-shaped and bouncy.)

The game play for Lego Champion is fairly quick and we've played it successfully with ages from six to adult. (Although Cordelia tends to amuse herself between turns by building things with the extra blocks.)

Trivial Pursuit Family Edition

For a long time I've imagined that it would be really nice if there were a trivia game with different questions for kids and adults. I looked here and there (although not on the Internet) for such a game with no luck. At the local games shop (which is admittedly really nerdy, catering mainly to the Chess, Go and D&D crowd and only reluctantly carrying a selection of mainstream board games) they had Nickleodeon and Disney Trivial Pursuits which depressingly advertised, "DVD Included! No reading! No adult participation required!" Well thank goodness for that.

Imagine my surprise when I found Trivial Pursuit Family Edition at Toys! Toys! Toys!, the second tackiest toy store in town. It is exactly as I imagined it, Trivial Pursuit with two sets of cards, one for kids and one for adults. The board is changed slightly to speed up game-play: half of the "roll again" spaces are now shortcuts to pie spaces, but even so Delphine and I have found that our two-person games drag on a little.

The kid questions are pitched perfectly for a well-read eight-year-old, so Delphine really enjoys it and gives me a run for my money. I am not sure how well this game would go over for a kid who doesn't read a lot or watch a lot of education TV. Cordelia basically can't play because there's too much reading and she doesn't know enough yet, although she has a nice time being on someone's team, for a while at least.

My only problem with this game is that it's American and the questions are heavily skewed to American history and geography. I suppose it's too much to ask that there be a Trivial Pursuit Canadian Family Edition...

What the heck am I pushing, anyways?

Much of the new work I’m doing these days is being stored in git repositories. Now, I’m not the biggest fan of git, particularly its UI, but the advantages of GitHub and GitX are hard to ignore. Despite that, I still really missed being able to type hg out to see which patches I would be pushing, so, after a short chat with (and demo from) Ben, I came up with the following:

Somewhere in your path, add a file named git-outgoing which contains the following contents:

# !/bin/sh
# Uh, there shouldn’t be a space between the # and ! in the previous
# line, but the highlighter I’m using seems to require it…
git push --dry-run $1 2>&1 | awk '/^ / {print $1}' | xargs git log

(Make sure it’s executable by whomever needs to use it!)

Then, in your git config, add the following section:

[alias]
    out = outgoing

And finally, you should be able to type git out, and see something like:

commit 7d4c9b89a4663a07bed030669bae2d3c73ec78dc
Author: Blake Winton <bwinton@latte.ca>
Date:   Thu Dec 8 12:22:41 2011 -0500

    Blear 2

commit a4e8c6627bc26d7371fb2614a1c47aaf694957bd
Author: Blake Winton <bwinton@latte.ca>
Date:   Thu Dec 8 12:18:04 2011 -0500

    Bleah.

So, hopefully some of the rest of you will find this helpful, too, and if you know of a better way to do this, please let me know in the comments!

We Invented a Game!

Delphine, her friend Darina and I invented a word game. It goes like this:

  1. The first player says a letter.
  2. The next player says that letter and then another letter to start spelling a word.
  3. The first player says the first two letters then continues spelling the word – maybe the same word as the second player, maybe not.
  4. The players continue to take turns spelling, adding a letter each time.

You win if:
- you finish spelling a word and the other player can't think of a way to make it longer.
- you stump the other player - they can't think of a word which starts with the letters so far.

So we just did:

Amy: A
Delphine: A-W
Amy: A-W-E
Delphine: ... (she didn't know "awesome" has an "e")

Delphine: J
Amy: J-U
Delphine: J-U-N
Amy: J-U-N-I
Delphine: ...

I was going for "junior" but Cordelia reminded me about "juniper".

Then Cordelia gave us "G" as a start letter, and Delphine lead with:

G-E
Amy: G-E-N
Delphine: G-E-N-U
Amy: G-E-N-U-I
Delphine: G-E-N-U-I-N
Amy: G-E-N-U-I-N-E

So I won that round because I got to the end of the word and Delphine couldn't make it longer. But then we decided (when we did "zamboni") that if you're both obviously working on the same word you should both get a point. (We're not much for points, anyway.) It works best if you're playing with someone with about the same vocaulary as you; I kept stumping Delphine with ridiculous words but Delphine and Darina were well-matched.

Anyway, I don't know if it's a brilliant game but we almost never come up with good games so we're pretty pleased with ourselves.