Porting Palm Pilot to Nexus 7
July 19, 2014

Palm IIIxe
Nexus 7
  1. Summary
  2. My Palm Pilot Plan
  3. Long-Term Problems with Palm IIIxe
  4. Advantages of Nexus 7
  5. Requirements for PIM Software
  6. PIM Software Alternatives
    1. PIM Applications and Services
    2. Outliners
    3. No Existing PIM Software is Good Enough
  7. Building a PIM Application With Vault 3 and Git
    1. Vault 3
    2. Git
    3. Porting PIM Data from Palm Pilot
  8. The PIM Synchronization Problem
    1. How Hard is It?
    2. Simplifying Principle
  9. Synchronization Solution
    1. Synchronization Web Page
    2. Overview of Synchronization Algorithm
    3. The Three Perl Scripts
  10. Conclusion

Summary

A Palm Pilot of the 1990’s was much better than any paper-based organizer; updates, searches, and backups all were far superior. Furthermore, Palm handled synchronization conflicts between the desktop and mobile device correctly, without losing any data.

But Palm, Inc. failed and I needed a replacement. To my great disappointment, no other solutions synchronized correctly, even though the newer devices were much more powerful. Furthermore, too many offerings were cloud-based systems that could not preserve privacy. Finally, I had to write my own synchronization software, built upon Git and the Vault 3 organizer.

My Palm Pilot Plan

I got my first Palm Pilot in late 1997. It was so much better than the paper planners that I had used since the mid-1980’s! Moving an item from one day to another was easy and it did not leave a messy note on the day it was originally scheduled. Old items could be searched electronically rather than found only by laborious, manual reading through numerous pages of paper notes. The Palm Pilot and computer desktop could be synchronized with the push of a button. Whereas paper records always suffered the risk of permanent loss if/when they got lost or destroyed, creating backups of electronic records was easy.

Furthermore, the technology was improving steadily. As the size of my PIM (Personal Information Management) records increased, the newer devices should be able to accommodate all of them. My records since late 1997 should always be accessible easily in the latest Palm Pilots. Eventually, I upgraded to a Palm IIIxe and then waited for technology to advance with my PIM needs.

It did not turn out as I expected. Palm, Inc. failed. The technology moved toward smart phones, which soon sported hardware powerful enough to handle all my PIM data, but the software moved in another direction. Many PIM-related products and services arose, but none could replace the original Palm Pilot applications, mainly because they all failed to handle merge conflicts correctly. For example, if the same calendar item was changed in two different devices, then the synchronization typically would clobber one version with the other version rather than noticing the conflict, saving both sets of changes, and then letting the user resolve the conflict.

Long-Term Problems with Palm IIIxe

One option was to continue using the old Palm IIIxe, but that was not a long-term solution.

Advantages of Nexus 7

For a platform to replace the Palm IIIxe, I chose a Nexus 7. It is much faster, has much more memory, greater screen resolution, WiFi connectivity, is much easier to program, has native support for SQLite, supports full disk encryption, and has a very good price. But what about the PIM software?

Requirements for PIM Software

Given a Nexus 7 mobile device and a desktop computer, in addition to the normal PIM-related operations, the software must support the following features.

PIM Software Alternatives

PIM Applications and Services

Outliners

Since none of the PIM products and services (above) satisfied the requirements, I switched to Outliner applications, which also can be used to support PIM data, with some limitations.

Advantages and Disadvantages of Outliners

Advantages

Disadvantages

Examples of Outliner Applications

No Existing PIM Software is Good Enough

This should be a solved problem already. The Palm Pilot did a credible job in the mid 1990’s and there are many PIM options available for the more powerful devices available today. However:

For my purposes, an outliner provides the best platform for a PIM solution, but it requires some assistance since it was not designed to be used that way.

Building a PIM Application With Vault 3 and Git

Vault 3

Vault 3 is the best outliner application that I found.

Admittedly, Vault 3 is the work of just one person; it does not have the support of an established large company. But even an established large company, such as Palm, Inc., can drop support and even fail completely. Fortunately, the database format is simple enough that it should not be difficult to port the Vault 3 data to another application if/when needed.

Git

With some additional software, Git can support synchronization of changes to a Vault 3 document among two or more (desktop or mobile) devices. It has a built-in capability to merge changes from separate branches. (Handling merge conflicts automatically is tricky, though. See the section on Synchronization below.) It also provides a version history, which a Palm Pilot never did.

Git does add some maintenance overhead. The repository eventually does get large, so periodic “git -gc” commands are needed to keep it from getting bloated. Furthermore, if you do many synchronizations, you may want to keep not only archived annual snapshots of the repository, but also a repository updated just once a month as well as the daily repository.

Porting PIM Data from Palm Pilot

Before I could use the PIM solution on my Nexus 7, I needed to port my old Palm Pilot data to Vault 3. The Palm Pilot had four main data types: (1) Datebook (Calendar), (2) Addressbook (Contacts), (3) TODO (Tasks), and (4) Memos. I found software for extracting a text dump of the Datebook. Palm Desktop can export the memos and address book entries in several formats, including some simple text formats. But the TODO items exported only to a TODO archive format. (Fortunately, I did not have many TODO items.) Once I had text representations for the Palm Pilot data, it was easy to write Perl scripts to transform it to a format that could be imported into Vault 3.

The PIM Synchronization Problem

How Hard is It?

How hard is it to synchronize the PIM data in two or more devices? Here is some background reading.

PIM Data Synchronization: Why is it so hard?

For an outliner application, synchronization requires a diff/merge solution for a tree structure, such as XML. A survey of potential XHTML diff/merge algorithms

Simplifying Principle

A simplifying principle is needed, given that the general tree merge problem is difficult, especially when there are merge conflicts. Fortunately, only merges of trees structured for Vault 3 must be supported, not the general tree merge problem. Also, a perfect merge is not needed. What is most important is:

  1. preserve all the changes in a merge conflict so that no change is lost and
  2. point the user to the existence and location of those merge conflicts so that the user can fix them manually in the Vault 3 GUI.

Synchronization Solution

Synchronization Web Page

The synchronization is not performed over any USB "conduits" connecting the desktop and mobile device. Instead, it is performed by scripts running on a web server on the desktop PC (but not in the cloud).

PIM_Sync



To perform a synchronization, do the following:

  1. Start the web server on the desktop PC.
  2. Access the URL for the PIM Synchronization page from your device.
  3. Ensure that the correct device is selected in the dropdown list.
  4. If any changes were made on the device since the last synchronization:
    • Click on the “Browse” button and select the Vault 3 SQLite file.
    • Wait for the synchronization to complete. Check for any messages about synchronization conflicts. Click on the link to download the merged Vault 3 SQLite file.
    • Move the downloaded SQLite file to the location that Vault 3 expects to find it on your device.
    • If there were any synchronization conflicts, resolve them manually and then rerun the synchronization.
  5. If no changes were made on the device since the last synchronization, save time as follows:
    • Click on the “Clobber” button and agree to the “clobber” since no changes will be lost. (There is no need to click on the “Browse” button since no SQLite database file needs to be uploaded.)
    • Click on the link for downloading the latest Vault 3 SQLite file.
    • Move the downloaded SQLite file to the location that Vault 3 expects to find it on your device.
  6. Stop the web server on the desktop PC.

Overview of Synchronization Algorithm

GitLog


Black = master branch, Red = desktop branch, Green = mobile branch

The Git repository has a “master” branch and also a branch for each device. Rather than directly managing versions of the Vault 3 SQLite databases for each device, it manages versions of XML dumps of those Vault 3 SQLite databases.

The synchronization algorithm includes the following steps:

The Three Perl Scripts

The synchronization software is a combination of HTML, JavaScript, PHP, Perl, and Git bash scripts. Here is an overview of the three Perl scripts that the synchronization algorithm (above) uses:

  1. sqlitedb2xml.pl
    Dump a Vault 3 SQLite database to a pretty-printed XML file, using a depth-first pre-order tree traversal. It is formatted so that it can be imported back into Vault 3. That is the XML format saved in the Git repository.
  2. sqlitexml2db.pl
    Convert a Vault 3 XML file into a Vault 3 SQLite database. (Yes, Vault 3 can import the XML file in the GUI, but I wanted a fully automated solution.)
  3. conflict_resolve.pl
    Analyze a Vault 3 XML file with Git merge conflict markers and convert it to another XML file that (1) includes both versions of text in the merge conflict, (2) has distinctive markers that show where the merge conflicts occurred, and (3) also is formatted as a valid Vault 3 XML file. (Note: Git does provide support for a custom merge algorithm that can be called directly from Git, but that proved difficult to incorporate, so this script is run only after a Git merge fails with one or more merge conflicts.)

Conclusion

Although wonderful advances were made in mobile devices since the 1990’s, an important feature of the original Palm Pilots was lost. This project restored the ability to synchronize two or more devices without losing any data when there is a synchronization conflict. It accomplishes that with a modern device (Nexus 7 tablet) and without relying on a vendor offering a cloud-based solution.