anchor.diff:  
   PouchDB, along with the power of CouchDB replication, makes writing to the remote database incredibly simple. After this line where you initialize the local database: 
   
  - var db = new PouchDB('localdb'); 
  +[source,html]
  +----
  +var db = new PouchDB('localdb'); 
  +----
   
   add a line initializing the remote Cloudant database: 
   
  - var remotedb = 'https://$APIKEY:$APIPASSWORD@$USERNAME.cloudant.com/locationtracker'; 
  -
  +[source,html]
  +----
  +var remotedb = 'https://$APIKEY:$APIPASSWORD@$USERNAME.cloudant.com/locationtracker'; 
  +----
  + 
   Then add the `saveToServer` function shown in Listing 6 to your script. We also add some code to other functions to enable and disable the “Save” button when it makes sense. The code for the full HTML file is https://github.com/rajrsingh/locationtracker[here].
   
   The `saveToServer` function has one major PouchDB call, `replicate.to`. It's only argument is the database to replicate to, which we specified earlier. The anonymous functions that handle callbacks on the ‘complete' and ‘error' return values simply report to the user what is happening. 
  
positive.code: === Step 1: CouchApp Setup
  We're going to write a very simple location recording client using modern Javascript and HTML5. We could accomplish this with a single, short web page that didn't require any special server platform other than your favorite HTTP server of choice. However, we'll eventually want to save the location data in Cloudant using Javascript, and we don't want to get into the complications of http://en.wikipedia.org/wiki/Cross-origin_resource_sharing[CORS (cross-origin resource sharing)], so we need to put our web page on the same server as our Cloudant database.  
  
  The best way to do this is to take advantage of the fact that Cloudant/CouchDB can act as a simple web server in addition to its database serving capabilities. So we'll build our application as a CouchApp. http://couchdb.org[Couchdb.org] says it best:  
  
  ****
  _CouchApps are web applications served directly from CouchDB, mostly driven by JavaScript and HTML5. If you can fit your application into those constraints, then you get CouchDB's scalability and flexibility “for __free__” (__and__ deploying your app is as simple as replicating it to the production server)._
  ****
  
  If you're not familiar with setting up a CouchApp, https://github.com/couchapp/couchapp[follow these instructions] and come back when you're done. Or for a more extensive CouchApp introduction, follow this excellent tutorial on IBM developerWorks, http://www.ibm.com/developerworks/opensource/tutorials/os-couchapp/[Building CouchApps]. 
  
  _insert your favorite elevator music here…_ 
  
  
  OK, great. Now you've got CouchApp set up and you're ready to start writing code. Get to a command line prompt in your favorite terminal emulator, and create the skeleton CouchApp with this command:
  
  
negative.code: 
   $ cd locationtracker/_attachments
  
  and type Listing 2  into a file called `index.html`.
  
  .Listing 2. HTML user interface
  [source,html]
  