Previous month:
May 2011
Next month:
July 2011

Word count in XML documents

I recently had the need to calculate the number of words in an XML-based book I was writing. Because of all the markup, this isn't as simple as it might seem. I eventually found this article:
Tip: Computing word count in XML documents.

The technique works well, although the word count isn't entirely precise. It's close enough for my purposes, though, and here's the command line I use to calculate a single word count across the entire book (which is broken into many separate DITA source files):

$ xsltproc --novalid *.dita |wc -w

The XSL file referenced is a copy of the one from the article, I just posted it to a web server so that I have easy access to it from wherever I'm working. XSLTPROC is pre-installed on Mac OS X 10.6 Snow Leopard.

No thanks, WakeMate (A Review)

WakeMate is an iPhone app and sleep sensor that promises to track and enhance restful sleep. I've considered a few products like this in the past, but the relatively low price ($60) convinced me to give this one a try. I'm sorry to say I've probably never become so disenchanted, so quickly, with a product.

The WakeMate includes a sensor that you wear on your wrist when you go to bed. The sensor communicates, via BlueTooth, with an iOS app. I don't want to turn this into a 1000 word rant, but here are the things I discovered in less than 24 hours with the product:

  • The WakeMate wrist band uses elastic instead of velcro. It's also apparently sized to fit an 11 year old girl. I woke up a few times on my first night wondering WHAT THE HELL IS ON MY WRIST AND WHY ARE MY FINGERS TINGLING? OH, RIGHT.
  • The app shows you the sensor's battery level, which is a nice touch. Before I used it for the first time it reported that the battery was over 50% full, so I didn't charge it. The device was dead by morning. When I recharged it and then tried to download my night's data, I received an error message that there wasn't at least 4 hours of data available. This leads me to conclude that you have to charge the sensor completely full before every use! Also, if a greater than 50% charge can't capture at least 4 hours of data, how will it ever work all night when fully charged? (Update: The manufacturer says this is wrong. See comments on this post.)
  • The promise of WakeMate is that the app will wake you at an optimal time, within the time window that you set. However, you can't change the alarm sound. Hope you like their crappy music. Also, when the alarm does go off, you'll have to unlock your iPhone before you can silence the alarm. This is sure to be popular with your bedmate. (Update: You can set your own music to wake to, but I'm not interested in that. The manufacturer says there are other alarm tones, but this was not apparent to me in the user interface.)
  • To get the functionality promised, you have to sign up for the online service and your data must be uploaded in order for it to be analyzed. All the power of the iPhone, but you have to rely on their servers to let you see any results? Phooey. (Update: See comments on this post.)
  • I encountered at least two messages that told me to "reboot" either the phone or the device. In my opinion this is a sure sign of an error-prone implementation and voodoo troubleshooting. It doesn't give me confidence in the reliability of their alarm app. (Update: See comments on this post.)

So, no thanks WakeMate. A product that can't give a delightful, yet alone functional, experience on its first-use is so very disappointing. The best thing about my experience with it is Amazon's simple product return and refund process.

Book Review: The Wlider Life

Fellow Chicagoan Wendy McClure's new book is a fun and fascinating perspective on the Laura Ingalls Wilder subculture. If you're looking for an unusual and entertaining non-fiction summer read, it's well worth checking out.

The Wilder Life: My Adventures in the Lost World of Little House on the Prairie is a mouthful of title, but don't be intimidated. McClure is a friendly and approachable writer. She comes off as the type of level-headed Midwestern girl that everyone should have as a friend.

Despite my professional training in subcultural studies, I was unaware of the Little House obsessed until about 1997. That's when, on a cross-country road trip, my wife and I suddenly found ourselves unable to find a place to stay in the middle of South Dakota. We had stopped for the night in the vicinity of De Smet (where much of the Little House story took place) during, unbeknownst to us, the annual Laura Ingalls Wilder pilgrimage. As we drove from place to place seeking a room (this was before the rise of the web, remember) a front desk clerk clued us in. "You won't find a room within 300 miles, the Laura people are in town" she said. And she was right.

This book really tickles two aspects of my personality. First, the sociologist loves the insider view of an interesting, and very American, subculture. In that regard, The Wilder Life is like HST's Hell's Angels, but without the drugs and violence.

Additionally, having recently completed a book project related to my own obsession with a collected work, I can fully appreciated McClure's desire to more deeply understand something she loves. Her book not only captures her personal journey, but exposes the truths and self-discoveries she made along the way.

Home automation and the Sabbath

A few years ago I consulted with an Orthodox Jewish group about the use of home automation to keep the Sabbath. It's a viable option, but does require an usual commitment to using technology to satisfy technology-avoidance demands.

An article in The New York Times describes a lawsuit against a lock company whose solution proved to be too simplistic. The door lock they sold could be opened with a simple (albeit large) magnet.

Know when the mail has arrived

One of the classic home automation projects is knowing when the mail carrier has left mail in your delivery box. (See Smart Home Hacks for many others.)

A fresh new approach to solving this problem (which usually involves wireless motion detectors) is discussed at Make's Snail mail push alerts.

The hack uses an Arduino board and the fantastic Prowl notification service for iPhone. As noted in the discussion, the technique is easily adaptable to other problems, and given the relatively low cost of the components used, you can bet that I'll be deploying more than one.

How to import video to iMovie for iPad

The other day I shot a couple of videos using my iPhone, and I wanted to use iMove for iPad to edit them. So, on my Mac, I used iPhoto to import the videos from iPhone.

Next, I wanted to transfer the movies to iPad. So I connected iPad to my Mac, then opened iTunes and used the device's Apps pane to load the files into iMovie. Unfortunately, although it appears to work, it actually does not. iMovie for iPad cannot see the videos that I added.

For my second attempt, I added the videos to an iPhoto album that syncs with my iPad. After syncing, however, the videos were nowhere to be found on iPad. Huh?

Let's cut to the chase. In iTunes, in the device's Photo tab, make sure that the "include videos" option is selected. When this is off, videos in an iPhone album won't sync to the device. After correcting this, I could finally get to work.

Include Videos iTunes