Blog-o! Notes from

Tue, 30 Mar 2010
Programming Thunderbird in Visual Studio.

For your reading pleasure this week, we have a guest post from Wei Xian Woo. Wei is a student working on Thunderbird as part of UCOSP, and has just had his first bug marked as FIXED. Anyways, that’s enough out of me. Here’s Wei’s post:

Programming Thunderbird in Visual Studio.

During this term’s Undergraduate Capstone Open Source Projects (UCOSP) Code Sprint held at the University of Toronto in January, I wrote a simple Python script for the Thunderbird team to make setting up a Visual C++ project for Thunderbird slightly easier for those of us working on Windows. Blake suggested making this script public so others could benefit from it, so here it is! The script is generic enough to be used for any project, not just Thunderbird. Feel free to use it and make modifications as you see fit :)

Using the script to create a Visual C++ project for Thunderbird

Create an empty Visual C++ project in Visual Studio.

From the command prompt launched by mozilla-buildstart-msvc9.bat, do:

python /path/to/
--vcproj=/path/to/thunderbird.vcproj --dir=/path/to/gecko-sdk

All files in the specified directories will be included in the project. I suggest including only the directories you will be working with.

Configuring the project for debugging:

Open the VC++ project file in Visual Studio, and then open the project's Properties.

Go to: Configuration Properties -> Debugging.

Set Command to pathtoobjdirmozilladistbinthunderbird.exe

Set Environment to XPCOM_DEBUG_BREAK=warn

And… you’re done!

For better C++ IntelliSense, you might also want to consider getting Visual Assist X (an add-on for VS).

Happy coding!

And you can find the script over here.

Thanks, Wei!

[Posted at 10:11 by Blake Winton] link
Fri, 26 Mar 2010
Something's Gotta Go—For a While

I went to Starbucks this morning to treat myself to my usual decaf tall non-fat with-whip mocha (personal), and there was a lady behind me in line with a baby and a five-year-old boy. The boy was a handful—at one point he disappeared into the kitchen, and he didn't want to stand still and wait in line. The mom was obviously tired, anxious and overwhelmed. Meanwhile, baby in one hand, Blackberry in the other, she was calling friends cheerily asking what kind of coffee they took. You know when you watch someone make a phone call and their whole mood changes when they're on the call? It was like that: tired grumpy tired HAPPY BRIGHT HAPPY tired grumpy tired

First of all, why would you put on yourself the extra work of getting coffee for all your friends when you have your hands full with your kids? It's okay to drop a few things when you have little kids. Maybe not cleaning the toilet and showering, but bringing coffee is definitely expendable. And second, why be all happy and "Hey, I'm bringing you coffee!" to your friends while only the strangers in Starbucks get to see how anxious and overwhelmed you are. Your friends don't care about coffee, they care about you. (The strangers at Starbucks don't care about you, they care about coffee.) It's okay to tell your friends that you're overwhelmed and you're going to beg off bringing coffee for a while. You can be the coffee and treats bringer again when your little one is old enough to carry a bag of croissants.

I guess I have two points. First, if you're feeling overwhelmed, you're not doing anyone any favours pretending everything's fine. Mostly people will believe you, and you won't get the help you need, which sucks. But just as bad is the overly optimistic impression you're giving other parents of the level of busy-ness and achievement they should be able to manage.

And second, when you have little kids you have to set aside some of your old identity. (Unless your old identity included about ten hours a day of absolute sloth, in which case parenting will fit in just fine. Except you'll have to set aside the "I'm slothful" part of your old identity. No, I'm going to stick with my original claim—when you have kids you have to set something aside.) Maybe it's being a great housekeeper, maybe it's being an employed person, maybe it's being a gym rat, maybe it's being someone who sees all the latest movies, maybe it's being the one who brings the coffee. When you add a baby to your life something has to give.

But it doesn't have to give forever: when you're stuck at home with a four-month-old and you're staring down the abyss of babyhood and toddlerdom and preschoolerness it seems like everything you ever loved about your old life is gone for good, or at least unrecognizably mangled. But if you just wait, you'll get it back. Your kid will be able to walk so you can carry an extra coffee; your kid will go to preschool so you can go to the gym; your kid will start school or daycare so you can work.

When you have a baby it seems like you have to hang on to everything about yourself until your fingernails bleed, that if you don't you'll lose yourself completely in snot and diapers. But all that stuff that made you you is still in there. It will still be there for you in three or four or five years when your hands are free and you have a minute or two to yourself.

Wow, that turned way more profound than I meant it to.

[Posted at 10:00 by Amy Brown] link
Sun, 14 Mar 2010

I posted this as a comment over at Hollie's blog and thought I should put it here too.

We were at the grocery store today and Blake and Cordelia were having conversations on the pretend phone – you know the one you make with your little finger and thumb outstretched?

Well, Cordelia called Blake and said, “Is Mummy there?” Actually, what she said was “Give it to Mummy”, but she meant “Is Mummy there?”

So Blake held his pretend phone up to my face, and I said, “Hello?”

Cordelia paused, giggled, and said, “Bye!”

That’s right, she prank-called me on the pretend phone.

[Posted at 21:09 by Amy Brown] link
Wed, 10 Mar 2010
How to (not quite) fix a bug.

I’ve run into a bug. It’s a really annoying bug, because it prevents me from changing folders when I try to test any of my Thunderbird changes.

I tried putting dump statements everywhere, to see if I could figure out what was going on, but they were to no avail. Then, I thought about looking for the error code.

So the error lookup page says that the error that’s reported is:

Module          Severity        Number
CONTENT (25)    Failure (1)     6

And DXR says that Content Error 6 is: NS_ERROR_CONTENT_BLOCKED

Which occurs, among other places, here

But when I set a breakpoint there, it didn’t hit it. So instead of trusting mxr or dxr, I did a grep (well, an ack, but same thing), and started setting breakpoints on a few of the hits.

The one that hit my breakpoint ended up being this one which, weirdly enough, isn’t even listed in the mxr results of this search

Now that I’m at the breakpoint, we’re halfway there, I hope. ;)

How I got there was:

(gdb) bt
#0  nsDocShell::InternalLoad (…) at …/mozilla/docshell/base/nsDocShell.cpp:7643
#1  0x152d9daa in nsDocShell::LoadURI (…) at …/mozilla/docshell/base/nsDocShell.cpp:1369
#2  0x13dc7581 in nsLocation::SetURI (…) at …/mozilla/dom/base/nsLocation.cpp:316
#3  0x13dc8af3 in nsLocation::SetHrefWithBase (…) at …/mozilla/dom/base/nsLocation.cpp:595
#4  0x13dc8cf9 in nsLocation::SetHrefWithContext (…) at …/mozilla/dom/base/nsLocation.cpp:542
#5  0x13dc9120 in nsLocation::SetHref (…) at …/mozilla/dom/base/nsLocation.cpp:510
#6  0x003fa28e in NS_InvokeByIndex_P (…) at …/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp:179
#7  0x120f88bb in XPCWrappedNative::CallMethod (…) at …/mozilla/js/src/xpconnect/src/xpcwrappednative.cpp:2727
#8  0x1210c0c6 in XPCWrappedNative::SetAttribute (…) at xpcprivate.h:2550
#9  0x12105530 in XPC_WN_GetterSetter (…) at …/mozilla/js/src/xpconnect/src/xpcwrappednativejsops.cpp:1792
#10 0x001141a7 in js_Invoke (…) at jsinterp.cpp:1388

And it looks like we get there because the return value of NS_CheckContentLoadPolicy is 0x80004003, or NS_ERROR_INVALID_POINTER.

Then, after dinner, I tracked it down a little further, and if you place a breakpoint on the “\n\nAAAAAA\nrv5=%x\n” line in this patch, you can see that it’s the folder = do_QueryInterface(subFolder, &rv); line which is causing the failure, because the subFolder’s mRawPtr is null.

But I have no idea why that’s happening, so I posted what I had, and hoped that someone else could take it and run with it. And Bienvenu did, and now it’s much less of a problem for me, and I can go work on other things.

[Posted at 22:17 by Blake Winton] link
Fri, 05 Mar 2010

Twelve Books That Changed the World by Melvyn Bragg is a book that introduces itself. I believe it's a tie-in book to a TV series, the kind of TV series that could only be produced in England. The books range from the St James Bible to Mary Woolstonecraft's A Vindication of the Rights of Woman and, curiously, Rules of Association Football. Each book is described, put into context, and Bragg makes his arguments for why it belongs in this list. This is a great introduction to some seminal written works, but also a brisk and effective overview of some high points of our society's history.

Further Under the Duvet by Marian Keyes was recommended to me by someone on Twitter (I think it was FlossieTeacake) after a discussion of villa-itis, or the fear that you are going to run out of bread while staying at a French villa. (I have a chronic case of villa-itis which is villa-independent.) The book is a collection of personal essays and short stories. Keyes is an Irish writer with an extraordinary Cinderella story of going from abject alcoholism to fame and riches as a writer. The story is told in the book, along with essays on various topics including the joy of writing a makeup column (free samples!), air-guitar championships, shopping and plenty of chocolate. Funny and sweet.

Positive Discipline by Dr. Jane Nelsen is yet another positive/democratic/whatever parenting book. I don't know why I keep reading them, since I more-or-less know what I'm doing by now, but it's good to be reminded, and I do pick up different ideas from the various books. This particular book reminded me of the importance of family meetings, and reassured me that some problems (namely chores) will have to be revisited at regular intervals but are still worth handling democratically. I wouldn't call this my favourite democratic parenting book—it's just not funny enough. But it's worth a look if you need a refresher (or an introduction to positive parenting) or if you want a new angle.

The Gargoyle by Andrew Davidson is our first book club book of the year, and already this year's book club roster is looking better than last year's. The Gargoyle is about a man who gets terribly burned in a car crash, then meets a mysterious woman with a bizarre past while he's recovering. It's about love and redemption and all that good stuff, with a big dose of history. It's beautifully written and I didn't want it to end.

The Checklist Manifesto: How to Get Things Right by Atul Gawande. I have long been a fan of the checklist. I like to-do lists to keep my days focused, I like lists of things to take places, I like to record our daily routines in list form so nothing is forgotten. This book is the validation for my checklist habit: Gawande writes about how checklists can improve the outcome of extremely complex projects, such as construction projects, and surgeries. Checklists are already in use in construction and aviation, and the book centres on Gawande and his team's attempt to create a checklist to reduce the number of fatalities as a result of surgeries. It's not a smooth path, but along the way we learn the kinds of checklists (DO-CONFIRM and READ-DO), what makes a good checklist (not too much information, easy to read), what makes a bad checklist (too long), and the mind-boggling difference that a checklist can make in a process that everyone involved feels is already going pretty well. (Gawande uses his own checklist, and at first he thought it wouldn't make much difference to his outcomes. As it turns out, not a week goes by that the checklist doesn't catch something he would have missed, and it has even saved at least one life on his watch).

As usual, Gawande is engaging and convincing. This was a great read as well as a confirmation (and refinement) of my love for checklists.

[Posted at 22:53 by Amy Brown] link