Sync Live Writer Local Drafts Across Multiple Machines with DropBox

Introduction

Anyone that blogs should be using Live Writer, end of discussion. It’s brilliant in its own right (and surprisingly doesn’t just support Windows Live blogs!) and its various plugins just make life so much better for bloggers.

One of the features it has, which I’ve always found a little limiting, is the ability to save local drafts. These drafts are saved into your local Documents folder, which is fine if you blog from a single machine, but if you chop and change machines as often as you change your socks like I do, then it’s not a whole lot of use. Admittedly it does give you the option of saving drafts to your blog (with WordPress at least), but I don’t particularly want ALL my inane nonsense cluttering my blog drafts 🙂

Asking The Question

I asked Joe Cheng, one of the Live Writer developers, on Twitter about whether changing the default location was possible. Unfortunately it’s one of those features that’s “on the list” for the next major version, but not implemented this release. Jason Burns was kind enough to point out a solution using Live Mesh, which works a treat; but DropBox is my “cloud storage of choice”, and one of the first things I install on any machine, so I hacked together my own solution.

The Solution / Workaround / Bodge

One of features of NTFS, which isn’t widely used, is the ability to create “junction points”. Junction Points are very similar to symbolic links in the UNIX world – they create a file or folder that “maps” to another file or folder; so when I go to c:\myfakefolder I can actually be looking at files in c:\myrealfolder. They’re not used all that often because Shortcuts generally do a good enough job for linking one place to another; but in this scenario Shortcuts don’t cut the mustard (Live Writer will just ignore it and create its folder again), so a junction point it is!

First things first we need to copy or create the “My Weblog Posts” directory in our Dropbox, which you can just do with Explorer, then delete the original from our Document folder. You might want to back it up in case this goes horribly wrong 🙂

Next we need to create our junction point, which is easy in Vista and Win7, as they both come with utilities to manage them, but for XP or Windows 2000 you will have to download a SysInternals utility called Junction from Technet. The syntax for the two methods is slightly different, but the basic concept is the same. We tell the utility the location of the link we want to create (which will be <your documents directory>\My Weblog Posts) and where to point it to (which will be <your dropbox directory>\My Weblog Posts). E.g.:

Vista / Win7

mklink /D "%UserProfile%\Documents\My Weblog Posts" "%UserProfile%\Documents\My Dropbox\My Weblog Posts"


WinXP / Win2k

junction "%UserProfile%\My Documents\My Weblog Posts" "%UserProfile%\My Documents\My Dropbox\My Weblog Posts"

And that should be that. If you copied existing drafts to your Dropbox you should be able to see them from the Open dialog. There does appear to be a small bug in Live Writer whereby it doesn’t show you the drafts in the shortcut list on the right hand side until you’ve actually saved a draft; but you can access them just fine from the Open menu, and they’ll magically appear once you’ve saved a draft for the first time.

I worked on this post using this workaround on two different machines, so it does seem to work nicely; but as with all workarounds, please make sure you back everything up just in case!

*Update*

If you don’t want to type these commands in manually then Will Charles has created a useful little GUI utility to take some of the pain away. You can grab it over on his blog.

Stack Overflow WordPress Widget

If you haven’t already, you should really check out Stack Overflow; it’s a community driven programming questions/answers site where people earn reputation and badges for contributing.

I wanted to put an XBox Live style "gamertag" on my blog with a link to my Stack Overflow profile and my current "reputation". I couldn’t find anything out there so I thought I’d dig up some Widget sample code and steal adapt it to display what I wanted.

There doesn’t seem to be any API for getting the information I wanted, so it uses a basic screen scrape, which may well stop working if they tweak the pages and may well not work for everyone’s profile page, but it works for mine and that’s all I care about 😉 Seriously though, if anyone else wants to use it and has problems, feel free to drop me a line and I’ll take a look at it. I’m no PHP expert either, so if anyone wants to tell me if my code sucks horribly, feel free 😀

You should be able to see the widget over on the right, and you can grab the widget itself below. Once it’s installed you need to configure it to give it your user number (26507 in my case) and your email address (so it can pull out your Gravatar). The email address isn’t used for anything other than hashing for the Gravatar, but you can read the source if you don’t believe me 🙂

Update: I’ve made a few changes in response to a few comments, and also removed the little place holder and badges in there.  It takes into account badges that have been awarded multiple times, so it *should* be the same as your SO page 🙂

Update2: Thanks to Ólafur Waage for providing an update to add a clear div after the widget and to run the name through htmlentities to handle names with “funky characters” 🙂

Update3: Version 2.0.0 is now available on the WordPress plugin page. It has a simple cachine system and also now pulls its data from the Stack Overflow JSON feed, rather than using screen scraping. More info in the new post: Updated: Stack Overflow WordPress Widget.

New screenshot and download below:

Stack Overflow Widget

sowidget.zip