Eulogy

At covenant group a while back, we had a session based around this reading from Victoria Safford, called “Set in Stone”:

In a cemetery once, an old one in New England, I found a strangely soothing epitaph. The name of the deceased and her dates had been scoured away by wind and rain, but there was a carving of a tree with roots and branches… and among them the words, “She attended well and faithfully to a few worthy things.” At first, this seemed to me a little meager, a little stingy on the part of her survivors, but I wrote it down and have thought about it since, and now I can’t imagine a more proud or satisfying legacy.

“She attended well and faithfully to a few worthy things.”

Every day I stand in danger of being struck by lightning and having the obituary in the local paper say — for all the world to see — “She attended frantically and ineffectually to a great many unimportant, meaningless details.”

How do you want your obituary to read?

“He got all the dishes washed and dried before playing with his children in the evening.”

“She balanced her checkbook with meticulous precision and never missed a day of work — missed a lot of sunsets, missed a lot of love, missed a lot of risk, missed a lot — but her money was in order.”

“She answered all her calls, all her e-mail, all her voice-mail, but along the way she forgot to answer the call to service and compassion, and forgiveness, first and foremost of herself.”

“He gave and forgave sparingly, without radical intention, without passion or conviction.”

“She could not, or would not, hear the calling of her heart.”

How will [yours] read, how does it read, and if you had to name a few worthy things to which you attend well and faithfully, what, I wonder, would they be?

Then we all took some time to write our own eulogies. It resulted in some soul-searching.

Today I ran across what I had written that day. Some of the others wrote speeches, organized thoughts. Mine was just a list.

  • He loved to make music, but didn’t.
  • He wanted to write stories, but was seldom brave enough to commit his ideas to paper or screen.
  • He longed to make a difference in others’ lives, but held back because he was afraid he wouldn’t know how.
  • He was beginning to learn that he felt the need to defend others, when they did not feel a need to be defended.
  • He had bad luck with pens. (after the pen I was using gave out and I had to get another one)
  • He gained a sense of humor that he was happy with.
  • He was easily ticked off by other drivers, but he was getting better.
  • He found it awkward to write about himself in the past tense.
  • He spent most of his time in front of a computer.
  • He hated to feel that any time was ever wasted, and that made him late for everything.
  • He valued sleep, but only in the morning.
  • He loved being outdoors to watch the sun rise, but seldom got up early enough to see it.
  • He kept planning to make more time for those he loved.
  • He gave parents a respite from their teenagers for entire weekends at a time.
  • He wanted to be a hero.

Using a worker AppDomain to register a COM assembly

I’ve been coding in .NET since 2002. Today I finally had a reason to use an AppDomain. I had a task that needed to run in a separate AppDomain and then return, so I’m thinking of it as a “worker AppDomain”.

We have a code path that needs to programmatically register one of our assemblies as a COM library (shudder). And yes, there are good reasons why it’s not enough for us to do this at install time. But that’s okay, because the code is pretty simple:

public static class MyRegistrar
{
    public static void Register()
    {
        var assembly = LoadMyComAssembly();
        var registrationServices = new RegistrationServices();
        registrationServices.RegisterAssembly(assembly,
            AssemblyRegistrationFlags.SetCodeBase);
    }
}

(I also could have shelled out to regasm.exe with the /codebase option, and gotten the same result. But that would have required hard-coding the path to the .NET Framework binaries, which is even worse than COM.)

The downside is that, once my process loads the COM assembly, that DLL file is now locked on disk until my process exits. This turned out to be problematic — it’s actually a Windows service that’s running the above code, and I was having trouble building the COM assembly because the service had it locked!

So I had to make sure the assembly got unloaded after we ran the above code. That means either a separate process, or a separate AppDomain. And if I used an AppDomain, I wouldn’t have to add yet another project to our solution. So I dove right in, and after several false starts, got something that worked. Here’s my code to load and regasm an assembly, without keeping the file locked thereafter:

public class MyRegistrar : MarshalByRefObject
{
    public static void Register()
    {
        var domain = AppDomain.CreateDomain("Registrar", null,
            AppDomain.CurrentDomain.BaseDirectory,
            AppDomain.CurrentDomain.BaseDirectory, false);
        try
        {
            var me = typeof(MyRegistrar);
            var assemblyName = me.Assembly.FullName;
            domain.Load(assemblyName);
            var registrar = (MyRegistrar) domain.CreateInstanceAndUnwrap(
                assemblyName, me.FullName);
            registrar.RegisterAssembly();
        }
        finally
        {
            AppDomain.Unload(domain);
        }
    }
    private void RegisterAssembly()
    {
        var assembly = LoadMyComAssembly();
        var registrationServices = new RegistrationServices();
        registrationServices.RegisterAssembly(assembly,
            AssemblyRegistrationFlags.SetCodeBase);
    }
}

To run code inside an AppDomain, I need an object that lives inside the new domain, but that I can call into from outside it (i.e., from the primary AppDomain); hence the change from static class to MarshalByRefObject descendant, and the move of the actual registration code to an instance method. Then I can just create a new AppDomain, create an instance of my class inside that domain, call the object’s instance method (which then executes inside the new domain), and then unload the AppDomain so that it unloads the assembly. Most of the gyrations are there because there isn’t a generic version of AppDomain.CreateInstanceAndUnwrap — if there was, the inside of that try..finally would be all of two lines long, if that.

Actually, better yet would be if RegistrationServices could take the filename of an assembly, rather than only taking a reference to an already-loaded-and-locked Assembly object. Then it would be a drop-in replacement for regasm. Still, the above code isn’t too complicated, and it seems to work nicely.

50,003

50,003 words, according to yWriter. 50,031 according to the NaNoWriMo word-counting hamsters. I’m going with yWriter since that’s what I was using to decide when to stop.

And yes, I am stopping now, and putting this away for at least a month.

50,000th word: “we”. Sentence that put me over the top: “A few last-minute items, before we march out tomorrow.”

And still, after 50,003 words — 37,861 of which were not bonus material — I have no plot. I think the story’s going to start pretty soon now. Maybe. I know how the last book in the series is going to end, but I still don’t have a clue how the first book is going to start. The hazards of embarking on an epic.

I don’t even feel like I have a first draft yet. Just something that sort of explores the outlines of an idea.

But dagnabbit, I’ve got 50,003 words of it!

I think it’s time to drink some celebratory chocolate milk and do some celebratory laundry.

NaNo: Home stretch – Saturday

Yesterday, when I sat down to write, I had 14,648 words to go in the ~3.25 days remaining in this year’s NaNoWriMo.

Today, right now, I have 5,800 words left to go. After just one and a quarter days of writing, I got well over halfway to the finish line. My goal was to write 5,000 words today; I actually managed 5,927, so one more day like today and I will hit fifty thou! And that was with frequent breaks today — I got four or five hours of DVRed TV watched, and ate my way through half a bag of potato chips (with chip dip) and more than half of a frozen pizza. And Coke. Lots of Coke. Ran the dishwasher so I would have clean glasses so I could have more Coke.

Yesterday I had my doubts, but today, this thing is looking totally doable. And I haven’t even busted open the Little Debbie cakes yet.

I’m trying not to think about my next weigh-in, though.

NaNo: just a bit behind

I started today with 22,787 words on my NaNoWriMo novel. Almost halfway to the goal — but way, way past halfway through the month.

After one marathon writing session this morning, I had broken 25,000. After another marathon this afternoon, I had just edged past 30,000! I wrote 7,234 words today (!!), over probably five or six hours of writing. Wow. My word count currently stands at 30,021.

But my target for today should be 36,667. I would need to double today’s performance to catch up. Eep.

And I’ve been cheating a bit. The last 12,142 words weren’t actually the novel at all — they were the bonus material. You know, the stuff you’d get on disc two of the extended DVD release. Interviews with the characters and so on. Actually, way over half of that was an interview with the narrator, i.e., me interviewing myself. I got the Q and A roles confused more than once.

It’s normal for me to spend a fair bit of time writing out brainstorms, just to sound out my ideas before I start writing, but usually I wouldn’t count any of that toward my wordcount — it would just go in a log that I could look back at later, separate from my actual wordcounted novel. But this year, with as far behind as I was, I figured, what the heck. Those special features ain’t gonna write themselves. (grin)

If I can crank out 2,500 words a day from now until the end of the month, I’ll finish in time. Should be doable in a couple hours a day if I just write, and don’t dwell on what to write. That’ll be tough, though, because I’m pretty much out of ideas for bonus material. I’ve come up with some great ideas for interactions between some of the main characters, but no idea what they’ll actually be doing for a plot. What is their quest? Beats me.

Yes, I’ve gotten to 30,000 words without even knowing what my story is. I’m finally experiencing NaNo as it’s meant to be experienced! No Plot? No Problem!

But now I’m going to spoil it by going to get some sleep.

NaNo: on track so far!

It’s November, so I’m writing another novel. National Novel Writing Month, you know.

I think this is the first year I’ve managed to (so far) consistently stay ahead of my word-count targets each day. It’s kind of weird — I’m so used to falling behind and then scrambling to catch back up. Today is the 4th, so I need to end the day with 6,667 words, and I’m already at 6,870. I even had youth group tonight — didn’t get home until about 8:45 — and I still beat my word-count for the day.

If anyone’s interested, here’s my one-sentence story summary. Before you accuse me of cheating, it is technically one sentence. But you do have to imagine Hal Douglas doing the voiceover.

In a time when Light overwhelms the Darkness, and sweeps lives in its path…

four chosen warriors set out to right the balance…

to rescue a love…

and destroy an empire.

Very Final Fantasy, don’t you think?

NaNo and “Book in a Month”

So I’m planning to do NaNoWriMo again this year, and I’ve actually been doing some preparing. You read right — preparing! Me! Ahead of time!

I’ve been trying to work on my story idea a little every day — fleshing out characters, world mechanics, trying to come up with an outline (I’ve already got a cool ending in mind, but it’s occurred to me that I might need a beginning and middle too).

So far, my mood has been going in about one-day cycles: one day I’ll be totally pumped about my idea, the next day I’ll be in a state of abject depression and totally convinced that my idea is hopeless and I don’t have the skill to pull it off and I’ll never, ever make it as a writer. So, about average for NaNo, I’d say. The real test will be whether I can keep dragging myself to the keyboard in November, even when I’m in Maximum Marvin Mode.

Jennie and I stopped by a bookstore last weekend, and one of the books I picked up — on an impulse — was called “Book in a Month“, by Victoria Lynn Schmidt. It has some general advice, followed by a day-by-day plan for developing your plot, characters, etc. throughout the month as you write the story.

The short version: it looks like this is going to be well worth the price.

It’s not solid gold. A lot of the advice was old news, like the tired old “don’t write something just because you think there’s a market for it.” I’ve heard that advice so many times — and I can’t believe anybody even does that. Why would you write something you hated? How would you even come up with an idea that you felt capable of pulling off, if it wasn’t a genre that you loved to read?

There’s also a lot of yammering about “imagine how you’ll feel when you’ve written an entire novel”. Well, I’ve done that. Twice. Doesn’t feel that different, honestly. Now, if I had actually done any revising — or better yet, if I was depositing a hefty advance check — that’d be a different story…

But the book does have some real gems. I really like the advice to “write ‘as if'”: if you’re halfway through the month, and suddenly realize that you need to change something in an earlier chapter, then you just make a note, then keep writing as if you had already rewritten it that way. As she says, “You cannot write and rewrite at the same time if you want to finish a book in 30 days.” You’ll probably change your mind again before you’re done, so why waste time writing what’s likely to get cut or changed anyway? YAGNI as applied to novel writing — cool. And so very NaNo.

And then there’s Chapter 5, which all by itself is worth the cover price. The chapter title is a yawner (“Setting and Keeping Goals”), but what it’s really about is discovering what kind of books you want to write. I’ve found that I write best when I can put my own spin on something and make it my own — but what, exactly, is my spin? Could I explain it? Recognize it? Work consciously (instead of by luck) to apply it to a project? It turns out that maybe I can — and while my one-sentence self-pitch is still only on about its third draft (and needing a lot more), it already gives me a lot better insight into why I like the books and movies that I do, and what it would take for the book I’m writing to actually be the kind of book I’d want to read — and re-read — and re-read again. And that, really, is why I want to write in the first place.

The biggest downside to “Book in a Month” is that it’s spiral-bound. Pretty freakin’ chintzy — I expected better from Writer’s Digest Books, and I almost put it back on the shelf because of it. Heck, I almost didn’t pull it off the shelf in the first place. The spiral binding is easy to lay it flat, I guess (though far from the only choice, if that was their intent); but every time I open or close the book, or just turn a page, I’m deathly afraid that a page is going to tear out. I think they’re thinking of this as a disposable workbook (they come right out and say they expect you to buy another copy of the book for every novel you write), but if they really meant it as a workbook, they’d have left a lot more room to write in answers to the questions. (“What types of books do you enjoy? Movies? Music? Here’s a space half-an-inch high to write your answers.” I filled two pages of a spiral notebook before I got to where I could start seeing the patterns and making sense of them.)

But the book definitely got some sparks going in my head. I think it’s already earned its purchase price, and I’m only up to Day 1 — and it’ll probably earn more the first time I reread it. If you’re doing NaNo, I think this book is worth a look.

NUnit and Silverlight

Unit testing in Silverlight is a persnickety business. The NUnit.Framework binary is built for full .NET, so you can’t easily use it to test Silverlight assemblies. I tried a few different things, but kept running into walls.

Fortunately, smarter people have already figured it all out. Jamie Cansdale made a Silverlight NUnit project template that gets you started right. It’s intended for TestDriven.NET, but it works great with ReSharper’s test runner too. Just download and open his template, and it’ll add itself to Visual Studio. Then the next time you do New Project, there’s an extra “Silverlight NUnit Project” option available under the Visual C# > Silverlight project type. Very cool.

However, the nunit.framework assembly in Jamie’s template is from some unidentified, but old, version of NUnit. There’s no version info in the DLL, but I know it’s gotta be 2.4.x or earlier, because its Is class (from the fluent assertions — Assert.That(2 + 2, Is.EqualTo(4));) is in a different namespace, whereas I know that 2.5 moved it into the main NUnit.Framework namespace.

Since I use the fluent assertions all the time, and since I just don’t want to use an old version, I went hunting again, and found Wes McClure’s NUnit.Framework 2.5.1 for Silverlight 3. It’s only a little old — right now the latest version is 2.5.2 — and his binaries are working out quite nicely so far.

So I use Jamie’s template to create a new project, which includes a lib directory with the old version of nunit.framework.dll; then I grab Wes’s nunit.framework.dll and drop it into the lib directory, replacing the older version. And I’m good to go.

Now, back to those fiddly trig calcs… (See, there was a reason I wanted to add a test project!)

Update, Oct 10 7:30am… Intellisense works great with Wes’s assembly. Building and running are a different story. Much unexplainable behavior from Visual Studio. Short version: I couldn’t get Wes’s assembly to work with the ReSharper test runner. But Jamie’s template is working fine so far.

BarCamp Omaha 2009…

So I’m finally getting around to writing about last weekend’s BarCamp.

My overall impression was “awesome”. Two things that stand out in my mind are:

  • Going to great presentations by people I know;
  • Being able to flag down the conference planners at lunch and bounce ideas off them.

Neither of those are something I’d get at a Microsoft TechEd — or even so much at a Heartland Developers Conference. Great sessions, yes; but I really value the sense of intimacy, and it’s just not the same at big conferences.

They had three tracks — creative, entrepreneurial, and technical — and I wound up splitting my time pretty evenly between them, which surprised me a bit. Erica gave a great talk about the power of conversation. Someone (I’ve got his name in my notes) gave a talk about the nuts-and-bolts of how the brain works… neurotransmitters and all that. Nate had a round-table-ish discussion of how attention deficit disorder affects us as IT workers. Bunch of other sessions that I don’t recall in detail at the moment, but I took notes. Very cool stuff. I was drained by the end of the day, but it was a good kind of drained.

Totally worth $5 and a day of my time.

The biggest downside was that they got donuts, muffins, and bagels for breakfast. All carbs, no protein… a nap waiting to happen. (Turned out the sponsor who was going to provide breakfast fell through at the last minute, so they had to scramble to find something else — so it’s actually pretty cool that there was breakfast.) But I managed to find some peanut-buttery candy to help tide me over till lunch, so it worked out OK. I’ve volunteered to bring a big jar of peanut butter next year.

I did find that, for me as an introvert, the evening-before party wasn’t very interesting. No offense to the people I talked to there; but it takes energy for me to be around people, and mingling doesn’t do much for me. I’ll probably skip the evening parties at HDC again this year for the same reason.

But the conference itself is totally something I’ll do again.

Session notes will be forthcoming as I get around to it.