Posts tagged with “”

Remove Conflicted Files from Dropbox

Because I use Dropbox to share selected runtime data (read: Firefox profile information) across machines and because I occasionally forget to exit the runtime environment (read: Firefox) when I move between those machines, Dropbox creates conflicted files from time to time. The conflicted files are saved separately and are named something like this:

places (my.machine.name's conflicted copy 2008-11-13).sqlite

The file above is my Firefox bookmarks database. I have no idea how it came to be in a conflicted state, but the ugly truth is that I don’t care. I assume that Dropbox saves these files as a safety measure against losing their customers’ data and so that the customer can perform a diff on those files if they choose. I don’t choose. I keep convenience files in my Dropbox, not critical files, so the files themselves are not worth the effort it would take to find and evaluate the delta between the “good” file and the conflicted file.

To that end, I’ve taken to simply removing them and because I don’t want to browse the directory structure or do this in any other manual way, I let my operating systems do the work for me. This is easy in Unix and, since two of my machines (my two primary machines) are Unix-based (OS X and Linux), it’s easy for me:

$ cd ~/Dropbox
$ find . -type f -name "* conflicted *" -exec rm -f {} \;

Poof. Now they’re deleted and Dropbox will delete them from my Windows boxes for me. I’m sure that there’s a way to do something similar on Windows, but my DOS skills atrophied many moons ago.

Dropbox, Firefox, Synchronization and Gnome Do

I’ve written about Dropbox, I’ve written about Firefox, I’ve written about synchronizing Firefox through Dropbox. In fact, I’ve written about using Dropbox to sync Firefox twice. I’ve also written about using Gnome Do to launch bookmarks (albeit as an update to a post about using Launchy to do so).

Shortly fter applying a more targeted technique for synchronizing Firefox through Dropbox, I realized that Gnome Do had stopped indexing bookmarks on my Linux machine. After looking around and asking a few questions, I realized that Do had been updated so that it no longer indexed bookmarks.html, but rather included a JSON parser that parsed the Firefox backup files that are created automatically. That required one additional change:

$ cd ~/Dropbox/Application Support/firefox/profile-share
$ cp -r ~/Dropbox/Application Support/firefox/profiles/wg3x0vhj.dropbox/bookmarkbackups/ .
$ cd ~/.mozilla/firefox/erbbyfam.default
$ mv bookmarkbackups bookmarkbackups.orig
$ ln -s ~/Dropbox/Application Support/firefox/profile-share/bookmarkbackups bookmarkbackups

After restarting Do, I was able to launch my Firefox bookmarks without a single click.

Redux: Synchronizing Firefox Through Dropbox

For the most part, the Dropbox-enabled synchronization of Firefox that I wrote about a couple of months ago has been reasonably solid. A few hiccups and a few annoyances, but nothing serious or even significant enough to warrant a change of approach. This morning, though, that changed and I needed to re-evaluate my synchronization strategy.

Yesterday.

Until today, I’ve been running something of a kitchen sink mechanism. You can read the full post for the details, but I was sharing my entire Firefox profile across multiple systems and platforms using Dropbox activity. Bookmarks, extensions, cookies, history and everything else. The transparent and immediate way that Dropbox works made this possible.

Over the last couple of months of using this method across one Mac client, one Linux client and two lesser used Windows clients, I’ve been bothered by several side effects:

  • Sharing profiles is chatty. Really chatty. I noticed this immediately and even mentioned it in my original post, but damn. Sharing an entire profile means a lot of Dropbox activity. Turning off system tray notifications in the preferences helped, but I kid you not when I tell you that the little blue animated icon overlay never stopped spinning. Unless Firefox wasn’t running at all, that thing was spinning like a madman.
  • When I move from machine to machine, I’m not as diligent as I should be about quitting Firefox on the machine I’m leaving. Because of this, I assume, I ended up with a lot conflicted files in my Dropbox-mounted, shared profile directory after a while. This isn’t really a problem, as far as I know, but I hate clutter.
  • Virtually every time I launched Firefox, I got the prompt that tells me my last session quit unexpectedly and asks whether I want to start a new session or restore my last. Because of the difference between how Mac and Windows/Linux order OK/Cancel buttons (even when the buttons don’t actually say OK or Cancel), I’d often find myself hitting the wrong one. Remember, I work in all platforms.

All of these actions by both applications, of course, are absolutely correct. Both Dropbox and Firefox were behaving exactly as expected, but the necessary side effects of the architecture I had concocted were still annoying.

Today.

This morning things got a bit more dire. Firefox simply wouldn’t launch while I was at work on my Linux machine. No matter how I tried – command line, Applications menu, Gnome Do, etc. – Firefox just wouldn’t start. There was no error or indication of an issue, Firefox just, well, did nothing at all. When I launched Firefox into the Profile Manager, though, I was able to select the default profile rather than my Dropbox-ified profile and run Firefox happily.

Knowing that the problem was in my shared profile created a level of severity that I needed to address.

Fixed.

Now that simple annoyance had turned to need, I set about defining a less brutish synchronization mechanism. What I really want synchronized across all of my machines – the profile elements that are most needed and yet the biggest pain to synchronize manually – are my bookmarks, my extensions and my Greasemonkey scripts so I decided to apply a more targeted solution.

Leaving my shared profile directory in place, I created a new Dropbox directory outside of my shared profile directory. To this directory, I copied what I wanted to synchronize from my Dropbox-shared profile. Then, in my default profile – the profile that is local to each machine rather than shared en masse via Dropbox – I created symbolic links to the bits I just copied.

Here’s what it looks like from the shell:


$ mkdir ~/Dropbox/Application Support/firefox/profile-share
$ cd ~/Dropbox/Application Support/firefox/profile-share
$ cp ~/Dropbox/Application Support/firefox/profiles/wg3x0vhj.dropbox/bookmarks.html .
$ cp ~/Dropbox/Application Support/firefox/profiles/wg3x0vhj.dropbox/places.sqlite .
$ cp -r ~/Dropbox/Application Support/firefox/profiles/wg3x0vhj.dropbox/extensions/ .
$ cp -r ~/Dropbox/Application Support/firefox/profiles/wg3x0vhj.dropbox/gm_scripts/ .
$ cd ~/.mozilla/firefox/erbbyfam.default
$ mv bookmarks.html bookmarks.html.orig
$ ln -s ~/Dropbox/Application Support/firefox/profile-share/bookmarks.html bookmarks.html
$ mv places.sqlite places.sqlite.orig
$ ln -s ~/Dropbox/Application Support/firefox/profile-share/places.sqlite places.sqlite
$ mv extensions extensions.orig
$ ln -s ~/Dropbox/Application Support/firefox/profile-share/extensions extensions
$ mv gm_scripts gm_scripts.orig
$ ln -s ~/Dropbox/Application Support/firefox/profile-share/gm_scripts gm_scripts

Details.

Although I thought I knew which files and directories I needed to create my targeted solution, I spent a little time verifying just to be sure. Here are the guts of what I wanted synchronized:

  • In Firefox 3, bookmarks are stored in profile root>/places.sqlite.
  • My application launchers (Quicksilver, Gnome Do & Launchy) key off of profile root>/bookmarks.html, so I needed to synchronize that, too.
  • Extensions are stored in profile root>/extensions/.
  • Greasemonkey scripts are stored in profile root>/gm_scripts/.

The nitty-gritty is pretty readable in the shell syntax above, but here’s the high level:

  1. I created a new directory so I could keep my targeted synchronizations independent of my complete profile synchronization.
  2. From my shared profile, I copied each resource into my new directory.
  3. In my local, default Firefox profile, I renamed its copy of each resource by appending .orig.
  4. In that same local profile, I created a symbolic link for each resource to the shared version in my new directory.
  5. I restarted Firefox and my default profile looked like my old profile in all of the ways that matter to me.

Now.

Hopefully this targeted solution will be much less flaky. Of course, my browsing history, form input history, cookies, etc. won’t be synchronized, but I think I can live without that just fine. The critical path for me, I’m pretty sure, is in the things I use and update frequently: bookmarks, Greasemonkey scripts and extensions.

Epilogue

Once I got home, I logged in and gave Dropbox time to sync up with the Mac. Once sync’d, I edited the Mac’s Firefox default profile and created the same symbolic links I’d created on my Linux machine. After restarting, the default profile loaded up beautifully here too.

I’ll keep an eye over the next few weeks, but hopefully this will be every bit as effective as my kitchen sink solution, but without the annoyances.

Synchronizing Firefox Through Dropbox

Having removed the Mozilla Weave extension from my Firefox install (at least for now), I was again left searching for a synchronization solution. This time I wanted one that really worked for me. I mentioned in yesterday’s post that I might try using Dropbox and, while I was speaking rather tongue-in-cheek at the time, I couldn’t think of any reason that it shouldn’t work so last night I tried it.

I used my Mac as the “master” machine, but given the way that Dropbox works, I don’t think that there’s any preference given to one machine over the other. In this case, “master” just means that it’s the machine whose profile I copied to create the shared profile that other machines will tie into. I’ve now referenced that profile on my Windows XP virtual machine at home and on my Linux machine at work and, though I haven’t thrown any hard tests at it, everything appears to be working fine so I thought I’d document the steps I took in case anyone else is interested in trying this.

Create a New Profile on the Master Machine

It would probably suffice to use an existing profile directly, but in the interest of having an escape plan, I’d recommend creating a new one. This is really the only set of instructions that may vary across operating systems, so I’ve tried to provide links for systems other than Mac where such a link was readily available.

  1. Quit Firefox (On Windows and Linux, close all open windows).
  2. Create a new directory in the Dropbox directory for the shared profile. I created mine as ~/Dropbox/Application Support/firefox/profiles/wg3×0vhj.dropbox. The unintelligible name of the last directory simply follows the typical profile naming convention. It may work just as well to name the last folder “foo”, but I wasn’t sure and it wasn’t worth the effort of attempting to deviate.
  3. Create a new Firefox profile (Windows instructions).
    1. Start the Firefox Profile Manager. There is probably a better way, but not knowing it, I dropped into iTerm:
      $ /Applications/Firefox.app/Contents/MacOS/firefox -profilemanager
    2. Click the Create Profile… button.
    3. Enjoy the wizard process, but be sure to Choose Folder… rather than accepting the default on the second panel.
    4. Select the profile folder created in ~/Dropbox.
    5. Click Finish.
  4. Set the new Dropbox profile as the default profile.
  5. Start Firefox to create “instantiate” the new profile.
  6. Quit Firefox.
  7. The new Dropbox profile directory should now have content. Delete that content (leave the profile directory itself).
  8. Navigate to the directory of the existing profile to be shared. My target profile was located in /Users/myusername/Library/Application Support/Firefox/Profiles/j3a1ovux.default
  9. Select all of the files and directories in this directory and copy them to the Dropbox profile directory.
  10. Wait until Dropbox finishes synchronizing those changes. It could take a few minutes, so be patient.
  11. Start Firefox. The new profile should be executed.

The good news is that the hard part is now over. All that’s left is to wire up the newly shared profile to other machines.

Use the Shared Profile on Windows

Once a profile has been created and shared (by creating it a Dropbox), other systems can tap into it pretty easily. All it takes is a simple edit to Firefox’s profiles.ini file, the profiles configuration file. The first computer I wired up was my Windows virtual machine.

On Windows, the profiles.ini file is located in APPDATA\Mozilla\Firefox. On my machine, that expands to C:\Documents and Settings\myusername\Application Data\Mozilla\Firefox.

  1. Close any open Firefox windows
  2. Make hidden files and folders visible if they’re not already
    1. Open Windows Explorer
    2. Select Tools > Folder Options
    3. Select the View tab
    4. In the Hidden files and folders group, click Show hidden files and folders
  3. Open profiles.ini in a text editor
  4. Add the following lines:
[Profile1]
Name=dropbox
IsRelative=0
Path=C:\Documents and Settings\myusername\My Documents\My Dropbox\Application Support\firefox\profiles\wg3x0vhj.dropbox
Default=1

A few changes will need to be made, of course. First, if there is already more than one profile, the numeric value in Profile1 will have to be changed to the next available integer. Second, the Path value will probably need to change.

That’s it. Windows is all wired up. Restart Firefox.

Use the Shared Profile on Linux

Rinse, repeat. As with Windows, all that needs to be done is a little wiring. On Linux, the profiles.ini file is located in /home/myusername/.mozilla/firefox. Just add the lines below and make the appropriate changes as outlined in the Windows instructions above.

[Profile1]
Name=dropbox
IsRelative=0
Path=/home/myusername/Dropbox/Application Support/firefox/profiles/wg3x0vhj.dropbox
Default=1

Caveats

One thing that I noticed right away is that syncing profiles keeps Dropbox pretty busy. That activity makes Dropbox very, very chatty if allowed to speak. Almost immediately, I turned off Dropbox’s Growl support on the Mac and will soon be doing the same for those annoying status tray balloon notifications on Windows. So far, Linux has been pretty quiet.

On the whole, everything seems to be working exactly as I’d expect with the added benefit (maybe) of retaining sessions across multiple systems. I haven’t yet decided whether I like that unexpected twist.

Interestingly (or not), with respect to Dropbox’s chattiness, the only platform on which I can’t disable notifications through a Dropbox preference is the on the one platform where notifications are the most intrusive and least simple to kill. That’s Windows, of course. Argh.

Later that same night…I installed the latest version of the Dropbox application for Windows and the preference is there. No more balloon notifications.

Dropbox

Like many folks, I have separate computers for work and home. To make life even more complicated, my work system is a PC while my personal computer is a Mac. Over the last few years, I feel like I’ve been constantly prowling about for a good solution to sync files between those two systems and also the Windows XP virtual machine that is a guest on the Mac. I’ve tried a myriad of solutions that range from manual to automated, commercial to cobbled and just plain hacked. Most worked to one degree or another, but I found most to be more trouble than they were worth.

Yesterday, though, Sam Larbi, via Twitter, turned me on to Dropbox. I was absolutely stunned by the introductory video and asked Sam for one of his invites. He hooked me up and I started playing with the tool last night.

Read More »

← Earlier Posts Page 1 of 2