Store Kindle Clippings in SQL Server with C# and Subsonic 3's SimpleRepository
Back in April, Shelly mentioned having seen a 2nd generation Kindle and that she really wanted one. She happened to say so on a day when I was already admiring them. So, I ordered one.
I liked hers so much that I ordered one for myself shortly thereafter and it's gone with me nearly every day, everywhere. You can read any of several hundred online reviews of the device itself. Of course, most of those will either recommend or pan the device on its own, with no real consideration of how you read.
Lots of the stuff that I saw in reviews before I bought mine goes on a list of features I couldn't care less about. For instance, in the 4 months I've had mine, I've wanted to look up precisely 5 words in the dictionary and NONE of them was in there.
At any rate, I like it and my use probably isn't exactly what people think of when the Kindle gets mentioned. See, for me, the killer feature is the ability to highlight a sentence or paragraph or entire page and save it for later. Most of what I read on it is non-fiction: technical books and stuff like Curious? and Ratio
.
In print books, I've always dog-eared pages and taken notes, but retrieving that information is always less than convenient. So, when I found out that the Kindle makes clipping text from books easy, I was excited. After clipping a couple of things, I went looking at the file format. All of the clippings get dumped into a single .txt file.
While that's fine for opening and looking through or even searching through directly on the Kindle, I wanted something that made it a little more organized. So, I wrote a quick proof of concept app to parse the file and put its contents into SQL Server and thought I'd share it with you.
I'd been wanting to do a little more with Subsonic 3.x's new feature SimpleRepository, which functions somewhat similar to db4o, but still SQL underneath. It strikes me as particularly suited to quick prototyping applications just like this one.
Rather than setting up the database schema, you just create your plain old C# objects (POCO) and SimpleRepository takes care of creating the tables as well as retrieving and storing your objects.
My POC app puts each clipping/quote into the database once and avoids duplication on subsequent runs. The result is much easier to, for instance, pull together everything from one book. The Kindle stores the clippings in the order they were clipped, making a mess if you don't read books linearly. Once written, I can easily keep my database up to date with anything I want to save from anything I'm reading on the device. Now that it's in that form, it could easily sit behind a web front end or be re-mixed in other interesting ways.
Anyway, on to the sample console app. I named it IpseDixit, which is Latin for "he himself said it".
Read the rest of this entry »


