Blog-o! Notes from latte.ca

Tue, 30 Nov 2010
DOM appendChild error in Gecko 2.0

I was recently modifying an add-on for the upcoming Thunderbird 3.3, and part of what I wanted to do was to run some javascript in a chrome context that added some DOM nodes to a document in a content context. But when I ran the following code:

1
2
3
4
5
6
7
8
9
let browser = document.getElementById('tabmail').getBrowserForSelectedTab();
let doc = browser.contentDocument;
dump("\n\n\n\nXXXXXXXXXX\n");
dump("DOM Content loaded for " + doc.location + "\n");
var topBar = document.createElement("div");
topBar.innerHTML = "We got it!!!!!";
dump("iB = "+doc.body.insertBefore+"\n");
dump("fC = "+doc.body.firstChild+"\n");
doc.body.insertBefore(topBar, doc.body.firstChild);

I got the following error:

WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80530009: file /Volumes/Devel/thunderbird/src-central/mozilla/content/base/src/nsNodeUtils.h, line 304
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80530009: file /Volumes/Devel/thunderbird/src-central/mozilla/content/base/src/nsGenericElement.cpp, line 4077
-- Exception object --
[snip…]
+ message (string) 'Operation is not supported'
+ result (number) 2152923145
+ name (string) 'NS_ERROR_DOM_NOT_SUPPORTED_ERR'

Poking around a little, it seemed like I had reasonable things for the insertBefore method, the firstChild attribute, and the topBar variable, and so since it was late, and I couldn't see what I had done wrong, I went to bed.

That turned out to be a the best thing for me to do, because this morning Jonathan Protzenko came to the rescue, saying (in response to a similar problem with a Firefox 4.0 beta 7 extension):

If you're modifying some content DOM from chrome code, you need to make sure the child you're appending was created using the unprivileged document, not the global document.

// This is chrome code, this is wrong because the span is now chrome
// and you're trying to insert it into content
myContentNode.appendChild(document.createElement("span"))

// This is right, appending a content node to another content node
myContentNode.appendChild(myContentNode.ownerDocument.createElement("span"))

I've hit this issue at least three times when upgrading stuff for Gecko 2.0. Might be what you're looking for .

And sure enough, when I changed var topBar = document.createElement("div"); to var topBar = doc.createElement("div"); , it all started working beautifully.

Thank you, Jonathan!

[Posted at 10:58 by Blake Winton] link
Mon, 29 Nov 2010
Santa

Dear Santa,

In case you're real, this is my Christmas list.

  • I would like a name necklace—a coloured one.
  • I would like a cat buddy. (That's a stuffie.)
  • I would like some chapter books.
  • I would like some long-sleeve shirts,
  • a butterfly net,
  • and binoculars.
  • I would like a little Pokémon stuffy,
  • and a toy Pokéball.
  • A craft set.

Sincerely,
Delphine

[Typed by Amy.]

[Posted at 16:24 by Delphine Winton] link
Sun, 28 Nov 2010
Dear Santa

Dear Santa,

I know I don't actually believe in you, and no-one buys me Christmas gifts except my mother who doesn't have Internet access, and my husband who refuses to buy me anything I ask for on account of "it wouldn't be a surprise". But I'm putting this up here anyway. Just in case.

  • I've always wanted a name necklace, and I especially like this red acrylic one.
  • Electric pencil sharpener. I know it's not eco. I just want one.
  • Squirrel-proof bird feeder
  • Jo Malone perfume. You choose the fragrance. (Scented lotion would be fine too.)
  • Votive candles. Now that the children are old enough to not do anything stupid, I've rediscovered candles. I like the expensive ones with good quality fragrances.
  • 24-pack ultra-fine tip Sharpies. All those lovely colours.
  • Quality Street chocolate. Always welcome.
  • I'd love a clicky IBM-style keyboard. ThinkGeek has one, although I'd be just as happy with one with labelled keys.

Thanks in advance, Santa. Remember, I'm the house with the cookies and brandy.

Respectfully yours,
Amy

[Posted at 16:29 by Amy Brown] link
Fri, 26 Nov 2010

Yesterday's meal was Cordelia's "favourite meal ever! Can you make this every day!?"

  • sausages - we had lean turkey sausages, which the children declared they didn't love. "They're not very juicy."
  • mashed potatoes mashed with plain yogurt
  • frozen peas and corn (I was running out of time!)

Simple and popular.

[Posted at 08:29 by Amy Brown] link
Sun, 21 Nov 2010
A Weekend Away

Ten years ago (well, ten years and ten days) Blake and I got married. Since we're still married we decided to celebrate by taking a grown-up holiday, a weekend away. Last Friday night we left the girls with Baba and Zaida and checked into the Novotel downtown. Our room was on the third floor, room 314, and it was a little disappointing, to be honest. A paltry selection of free toiletries, a teeny bathtub, and the best view of a gravel roof and building mechanics I, for one, have ever seen.

And also engineers. Undergrad engineers. The Novotel happened to be hosting the Organization of Professional Engineers Student Conference (or something) that very weekend. And most of them seemed to be on the third floor. We settled into our room just as the engineers were massing to go to dinner. Noisily. I called the front desk to ask whether there was perhaps a room on a different floor, a floor with fewer engineers.

They moved us up to the top floor, and in so doing, upgraded us to a deluxe room which satisfied many more of my hotel room desires: flat screen TV, schmancy bathroom, superfluous toiletries. The bathtub was still lame; I've realized that if you want a hotel with an awesome bathtub you need to go to a hotel which advertises their awesome bathtubs. And the view... well, it turns out the Novotel in Toronto doesn't have any good views. After settling in again, we went out for dinner and beer at C'Est What.

The next morning we availed ourselves of the breakfast buffet, another of my hotel must-haves. This one was exquisite: fresh, flaky pastries, assorted cereal, French toast, bacon, sausages (such good sausages!), ham, cheese, at least five kinds of bread, yogurt, fruit, coffee, tea, hot chocolate, chocolate milk, fruits. I was in breakfast heaven.

After eating about three breakfasts worth of breakfast, we waddled over to the St Lawrence Market to shop, window shop and sample things. I got some earrings, some strange grains, and gifts: genmaicha for Tanya and Douglas, and mince tarts for Andy.

Our next mission was to find a Shopper's Drug Mart, which you usually can't walk a block without stumbling over but were uncharacteristically thin on the ground over by the market there. So we carried on to the south end of Sherbourne and Toronto's newest waterfront delight, Sugar Beach. It was a gloomy day and we had the waterfront to ourselves as we walked back towards Yonge Street. We eventually wandered back to the hotel for an afternoon of lying around reading newspapers and books. Later we walked up to Dundas and over to Spadina for delicious Chinese food at E-Pan. (As it turns out the girls were having dinner just a block south of us.) We walked back to the St Lawrence Market area for uninspiring ice cream at Lettieri, then back to the hotel.

Sunday morning I woke up early and went down to the restaurant for a cappuccino while Blake slept in. Once he came downstairs we crossed the street to sit in the sun and wait for Scotland Yard to open for breakfast. An hour later we breakfasted in the company of some very vociferous football (soccer) fans. Then back to the hotel to check out, and we took the TTC home.

It was a lovely weekend but kind of ephemeral. I wish we had done something spectacular like go to a concert, but after paying for the hotel we didn't have the budget for any grand gestures. Still, it was lovely to spend time together without any pressing demands on our time.

[Posted at 15:29 by Amy Brown] link
Sat, 20 Nov 2010
An Uncertain Thing

I made a book! Okay, I didn't write it, and I didn't really edit it, but I sure turned it from a giant RTF into three beautifully formatted, stylishly covered volumes:

Support independent publishing: Buy this book on Lulu.

[Posted at 21:47 by Amy Brown] link
Fri, 19 Nov 2010
Abundance Is Our Nemesis

Here in North America we have a lot of stuff. Mainly we have a lot of energy (not the "let's play go to the park and play Ultimate!" kind, but the "turn up the heat, Martha, I don't want to put on a shirt" kind), and we have a lot of food. And when people have access to a lot of something which is required for survival, like food, or which makes life easier, like energy, we consume as much of it as possible. It's our nature. We evolved in an environment where calories were scarce and precious and anyone who didn't leap on food (more calories in), or seize the opportunity to do less work (fewer calories out) was a fool. A dead, extinct fool.

There's an article in the 11 November 2010 New Scientist which says that 40% of the US population will be obese by 2050. Oh, that's terrible, those disgusting Americans. But Americans are just like everyone else, except they are constantly surrounded by huge quantities of cheap, high-calorie food. And so they eat it and they get fat, just as we all evolved to do.

At the same time energy is cheap and abundant; there are labour-saving devices for almost every task imaginable, from changing the channel on your TV to raising your blinds to feeding the cat, to say nothing of that ultimate calorie-intake-optimizing innovation: processed food. And we avail ourselves of every one — there are precious few people who will say no to a labour-saving device on principle, and most of them are so cheaply run we add them to our lives without qualms. No-one ever rejected an automatic can opener on the grounds that it would cost too much to run.

The only way to control this process is legislation — by making overconsumption so much more expensive than austerity that austerity begins to look good. We need enforced privation.

Show me a politician who will run on that platform and I will show you a politician with a very short career indeed.

So to conclude, we're screwed. The only way off this rollercoaster of plenty is to run out. Run out of oil, run out of soil. And then lots of people will die (hopefully none of my descendants) and maybe enough of us will survive (and the planet will be habitable, because of course there's enough fossil fuel left to ruin the place completely if we burn it fast enough) to start the whole merry-go-round again.

Happy Friday!

[Posted at 11:02 by Amy Brown] link
Wed, 17 Nov 2010

Here's a recipe I typed in for a friend yesterday. It's not really a recipe, just something I throw together. Those are always the hardest to write down.

Ingredients

1 butternut squash (or any other squash, probably, except spaghetti)
some butter
some oil, probably not olive
1 onion (or more) - chopped
cumin, cinnamon, nutmeg maybe?
black pepper
chicken broth
cream
sour cream
crusty bread and more butter

Instructions

  1. Peel the squash. Yes, really, just with a regular vegetable peeler. Then cut it in half and scoop out the seeds. Cut it into 1 inch blocks (about) and set aside. Chop the onions.

  2. Warm the butter and oil over medium heat and add the onions and some salt. Saute until the onions are soft and translucent. You could brown them a little bit if you like.

  3. Stir some cumin and black pepper and maybe cinnamon or nutmeg (not both) into the onion and cook it a little bit until the kitchen smells really good.

  4. Add the cut-up squash and enough chicken broth to cover everything plus maybe an inch. Bring it to a boil and simmer for twenty minutes or so until the squash is soft.

  5. Take it off the heat and blend everything with your hand blender. If it's too thick add some more broth. Add a splash of cream — maybe half a cup — and stir it in. Put it back on the heat for a while to warm it up again if you like, but don't let it boil.

  6. Serve with a dollop of sour cream and lots of crusty bread with butter. And maybe a nice light ale.

Enjoy!

[Posted at 15:01 by Amy Brown] link
Tue, 16 Nov 2010

Usually the dinners I cook are greeted with something between indifference and disgust by my children, but occasionally I put something on the table which is greeted with delight and devoured with gusto. Yesterday was one of those days; this is what I served:

  • crockpot chicken and salsa (throw boneless skinless chicken thighs in the crockpot with a jar of salsa, cook until done)
  • brown rice (I use Dainty Time-Wise (tm) brown rice which only takes 15 minutes to cook)
  • avocado mashed with lime juice and salt and pepper
  • Ace Bakery ciabatta (aka "the world's best bread" according to Delphine) and butter
  • cherry tomatoes from this summer's backyard harvest

Everyone had seconds. Some of us might have had thirds.

[Posted at 08:48 by Amy Brown] link
Sat, 06 Nov 2010

I know I've beaten this horse before, but it ain't dead yet. I know because it's always trotting around my head.

Here's the thing. About a year ago I decided to add a bunch of stuff to my plate and see what happened. I managed to keep my shit together until this September, when I added work to the teetering pile and it started to collapse.

So I made a list. It's what I do. I made a list of the stuff I do, sorted by funness and importance:

Stuff I Do Funness Importance  
friends 9 9 Seeing friends is not only fun but essential to good physical and mental health, so this is the top of my list.
family time 8 9 Obviously hanging out with the kids is the most important thing I do, and it's almost as much fun as hanging out with friends, so this is an easy second.
sleep 7 9 I love and need sleep. If I don't get enough sleep not only do I become short-tempered and unpleasant, I also get stupid and sick. Seven hours a night, minimum.
exercise 4 9 As you can see, exercise gets the lowest fun rating so far at a disappointing 4, but it's pretty important. Since I spend so much time sleeping I'd like to recoup that investment by living for a long time, and to do that I need to stay fit. (As fit as possible under the circumstances.) This is one of the things I'd like to do more.
cook 8 8 I cook and bake a lot. I enjoy it and the value that cooking (and baking) brings to the family is worth the time I spend doing it.
work 7 8 Work is not only fun but satisfying and profitable, but it's one of the things I'm having trouble levering in. I am very easily distracted both online and off. I'm getting better at ignoring the outside world and buckling down. It's a process.
laundry 6 8 I spend a lot of time doing laundry. Especially folding. I've started listening to the CBC while I fold, which is at least sometimes educational or thought-provoking.
kid management 6 8 This is stuff like planning activities, sorting out clothes and toys, picking people up, and so on. It takes as long as it takes and I don't mind doing it.
housework 3 8 Hate housework. Hate dirty house. Can't afford housekeeper.
reading 9 7 Reading is one of the things I'm starting to panic about. I have hardly read anything since the read-a-thon and I feel like I'm getting behind. I have a list of interesting non-fiction books I want to read and I feel underinformed because I haven't read them yet. I must know things!
choir 9 7  
blake time 9 7  
local politics 8 7 This is a new one for me, and not actually anything I technically spend much time on, apart from reading the news, but it's an area of interest I'd like to explore further.
school choir and volunteering in the classroom 8 6 I do a lot of volunteering for the school, but choir is most fun, followed closely by working in the classroom.
blog/writing 8 6 Now that Uncle Hershey has passed (may he rest in peace) there are exactly two people in the world who want me to blog more, but I really should write more if I ever want to not suck at it.
farting around 7 6 This seems like an odd thing to include in a post about being awesome and getting things done and organizing myself, but I'm a delicate person and I need my down time. It's not that I need to fart around, per se, but I need some wiggle room in my day: I want to read news online and watch the birds out the back window and hang out with other moms on the schoolyard without feeling guilty and harried.
eco-chair 6 5 Being chair of the Parent Council Eco-Committee is my least favourite school volunteer job. I spend a lot of time dealing with TDSB bureaucracy, and most of the rest of the time trying to convince disinterested parents to think about things they'd rather not think about. It's disheartening and unsatisfying. This is the one thing on this list I'm planning to walk away from as soon as I can.

What I've learned from this exercise is that I probably prioritise activities a little differently than most high-achieving busy people (not to overgeneralize – of course there are HABP who make time for all of these things): I place a high value on reading, sleeping, cooking, and hanging out with friends, all of which tend to elbow out useful things like having meetings and writing proposals and whatever other useful things useful people do. So there's a good chance that I'll never be terribly useful, but at least now I know what I'm working with, what I'm willing to give up and what I insist on keeping, and with that knowledge I can try and spend the limited time I have on things which are really important.

[Posted at 22:31 by Amy Brown] link