cc licensed flickr photo shared by zenobia_joy

Against every sane, rational, “I’m so over committed I’m gonna explode” thought, I have decided to plunge my hand again into National Novel Writing Month (NaNoWriMo), the challenge where aspiring, and maybe aspired, writers take on the goal of writing a 50,000 word novel over a one month time span.

I have always liked writing, but had never done anything substantial or larger than a long blog post, so it was one of those items I listed long ago on 43 Things. I had heard of NaNoWriMo, and it seemed analogous to running a marathon — a goal you keep telling yourself you cannot do– until you try.

Last year I made my 50,000 mark (I burned a lot of adjectives up in the process), finished, and got through about 1 1/2 rounds of later edits before hanging it out to dry (see reflections on 2009). It never got discovered, I never got a book deal, and I still have a day job (none of these were primary aspirations, but heck, I’d not mind being surprised).

The typical way one does this is mostly solitary- you write and write and write in most commonly a word processor (I did), and you update your NaNoWriMo site with your word count. There’s really no vehicle (by design I think) where your novel goes; that one is up to you. Yes, they do offer a lot of tools to make friends and there are local discussion boards where there are options to meet up with other writers in your ‘hood.

I was fence sitting this year– if I follow my running my running analogy, I ran the marathon once, finished, and never will do THAT again.

But writing was a mental challenge that can be taken on, IMHO, easier than physical ones. IT’S IN YOUR HEAD.

So I decided to do it this year to play more with the How I write more than the Drivel I Do Write. I decided I would not use Word this year, but do the writing in a blog to see how it works as a composition platform. I got myself the idea I could use it as one more Opportunity to Monkey with WordPress, and add some code in to do word counts and progress. And since the Anthologize plugin came out a few months ago, it would be a new experiment in publishing to ePub and/or HTML.

Even better, just last weak Patrick Murray-John offered up his new extension of Anthologize geared to publish NaNoWriMo content.

My writing site is now fluttering in the open breeze at http://nano.dommy.com/

Like my running efforts, writing in the open becomes another impetus to finish as you don’t want to bee seen failing in public. Below I will outline some of the tinkering I have done in WordPress over the last 2 days to get myself set up. I’ll say my novel really is not novel and idea, I am a Dog is the working title and it purports to be the insider view to the Canine world fur Humans to get past their naive assumptions of the dog-verse.

I actually am so far hoping a plot emerges.

But this was less about trying to Write a Great Story but just to try and also run some technical experiments.

I did the automatic WordPress install on my Dreamhost-ed site, and pawed through the themes it provided, settling on the sparse Journalist theme.

The code bits I hacked first was finding a way to add a word count to each post, and a method of summing the total words written. It ought to be a few database queries. After consulting the GoogleVerse, I found that MySQL has no function to count words, but I did find a blog that had a method for listing posts and word counts, and as the author says:

MySQL doesn’t have a built-in word count function for MySQL, but as with every other unanswered question, some smart guy on the blogosphere already answered how to use MySQL to get a Word Count.

It’s a little bit of a hack- a query that first sums the character length of a text column’s contents and subtracts from it the character length of the same text with blank spaces replaced by null characters — e.g. a word is defined by blank space.

First I would need a function that would return the word count for a single post, so I could add to the meta content for each post:

In my functions.php template, I added my new function- it merely takes an id as a parameter and runs the word count query on the database using the WordPress function to run a raw query,

I then monkeyed the part of the templates that output the author and date/time of post publishing to be more on line with what I need (not referring to posts)– I lost the original part of template, but this is what produces the example above

I use my own custom function to generate the word count for an individual post.

The next part was to do something to create a running total of all words written across all published posts, put into my side bar. I could have done the calculation every time the sidebar loaded, but that seemed un-needed as the number would change only when a change was made, so I went for a cheap cache method.

Again, modding the functions.php template, I first add a hook that will be called when a post is saved.

This will call my own private function nano_save_post whenever anything is published or updated. The database query is similar, but we run it across all published posts. The last part is a way to write to a text file on my server. I’ve obscured my own path, put it is a directory named YYYY inside wp-content that contains writable file named XXXXX. it would likely be more sensible to stuff it ins a meta field of the database, and maybe I will get around to that later.

And the last part is some code for the sidebar to put a count and display a percentage for progress value. I came across this Simple CSS shiny progress bar technique to add a fancy progress bar that will change as my word count increases:

The progress bar calls for some CSS to be added to the style sheet, but the working parts are in the sidebar.php template. We simply get the contents of our cached wordcount file ($wordcount) convert it to a percent ($wordpercent), and use the values in the output:

The other thing that occurred to me is that the blog format puts the most recently written content first, and rolls back in time, while the way to read the story is the reverse order. I deployed this by using the same (default) category for my “posts”- the category is called writing. I then copied my basic index.php template into a new one category-writing.php which is what is used to generate the output for this single category.

To make the posts go in the order they were written (as opposed to the default reverse chronology), I simply added a modified query above “The Loop”

This trick just recasts the database call for the main loop to pull posts in the order they were written which you can access via the link for this category http://nano.dommy.com/category/writing.

That’s where I site so far- I added some links to the sidebar widget to pount to a file that has the ePub version generated by Patrick’s Anthologize modification — http://nano.dommy.com/wp-content/pub/i_am_a_dog.epub, as long as I remember to redo the Anthologize export each time I write something.

And that’s mostly it (until I decided to tinker tomorrow).

Now, I better make sure I get my 1667words in tomorrow.

The post "NaNoWriMo-ing In the Open" was originally pushed out of the bottom of a purple jar of Play-Doh at CogDogBlog (http://cogdogblog.com/2010/11/nanowrimo-open/) on November 2, 2010.

10 Comments

  • Wow! That’s a lot of work. I’m glad you’re at it again this year. What made you decide to use WP, instead of installing mediawiki or something like that?

  • OogieM

    I’m still on the fence, didn’t finish NaNo yet in all the times I’ve tried. All my ideas have turned into short stories. I’ve got until the end of the week to kick it up and get going if I am going to. When I was on a roll I could write 3k words a day so I can catch up if I go for it. But we’ve got a lot of stuff to do here this month….

  • Alan Levine aka CogDog cogdogblog.com

    @Jen The WordPress writing interface is one I work well with (MediaWiki is butt ugly) but more so, the writing in chunks organized by date matched how I saw this unfolding. Plus, its a chance to dabble into some code I may use elsewhere.

    @Oogie it all seems uphill when you have a lot to do on the farm! But catchup is not fun, except on french fries.

  • Ryan Collins ryancollins.org

    Just an observation, but running a marathon is as much mental as physical. :-)

    Anyway, even as someone who just finished their 7th marathon, I wish I had the motivation and drive to attempt this…. Maybe I’ll think about it, and try to catch up this weekend. Or plan to do it next year. :-)

    BTW, check out JDarkRoom for a full screen editor. It had a word counter and you can also enter a goal for number of words to write and it will show how close you are to your goal.

    • Alan Levine aka CogDog cogdogblog.com

      @Ryan correct on the marathon being mental- that was sloppy. I guess I was aiming for writing is less physical, but that feels wrong too. Sometimes I should just dorp the metaphor!

      Thanks for the JDarkroom link!

  • Harriet

    Try reading The Art of Racing in the Rain by Garth Stein for inspiration–I loved that book!

  • […] NaNoWriMo-ing In the Open (cogdogblog.com) […]

  • Dogging Out of NaNoWriMo - CogDogBlog cogdogblog.com/2010/11/12/dogging-out-of-nanowrimo

    […] It was overly grand ambition (or stupid ass planning) that got me thinking I could do NaNoWriMo again this year. […]

  • Devon dcamd.com

    I did NANO in 04, 05 & 06. @clairemarilee was born in Spring 2005 so by November she was crawling. Bad idea. I’ve not been back since, but those three novels (I succeeded before Thanksgiving dinner each year) are sitting on this hdd just waiting for a nanoEDmo some year.

  • Dog Authors - CogDogBlog cogdogblog.com/2011/04/12/dog-authors

    […] I had an ambition to do another round of NaNoWrimo but fell off the wagon early. It began as an experiment to do the writing in the open– which was fun, but then, alas,, the story part eluded […]

Leave a Comment

All fields are required. Your email address will not be published.