CouchDB, DayBed, etc.

Alex Tweedly alex at
Wed Aug 23 10:28:50 EDT 2017

Just a quick thank you to Greg for the info on his Daybed library, and 
for the Udemy course on CouchDB. I found the course fascinating - and I 
watched it first so I had the overview before watching the Daybed 
specific talk in Livecode Global.

(And I have to admit I watched it all on 1.5x speed, and skipped one of 
each of the 'Futon'/'Fauxton' parts, so it was only only about 2-1/2 
hours :-)  I wish we had that speeding capability on the Livecode Global 
webinar replays rather just on the (crippled) Youtube version.)

I found the Daybed library fascinating - and as soon as it can cover 
Couchant (so I have an easy, free way to try it out :-), I will be 
playing with it.

BUT - I have a fairly fundamental problem that I don't know how to 
resolve - so I'll throw it out here and see if there's an obvious 
solution I've missed.

With the exception of a couple of things that basically scraped data off 
some web pages, every app I've done in the last couple of years (all for 
personal use by myself or friends - I'm a hobbyist) have shared one 
characteristic : they have local storage, and that data is subsequently 
synched to "the cloud" to be shared with other devices/users, or at the 
very least backed-up to the cloud (i.e. my on-rev or HostM server account).

I haven't yet done anything on mobile - but because of where I live and 
other circumstances, even for laptops I *need* to have things work 
without an Internet connection and synch up when available.

This doesn't seem to fit well with, say, CouchDB; the REST API lets me 
do great things when I talk to the server - but when working locally I 
have to forego all those features, and, for instance, revert to an array 
which I 'manually' search / filter / etc.

Currently, what I do is:
  - local SQLite database, and use Andre's DBLib, including selecting 
etc. for filtering
  - remote MySQL accesses through my own server page  (with a few added 
  - home-grown synch process that asynchronously uploads / downloads 
changes (*).

Is there a NoSQL equivalent ?
Or has anyone written a LC library that does array searching / filtering 
/ etc. that would provide similar, even if less extensive, features ?

Thanks for any comments, suggestions, etc.

(*) my homegrown synch process:
  - I use a "data model layer", and all changes to the DB go through it. 
As well as writing to the SQLite database, it adds an update record to 
the end of a queue of changes (each held in a separate textfile).
- each record has an UUMID (Universally Unique Meaningful ID) - made up 
of the device name where it is being created plus the date/time to the 
- each record has a 'modified' timestamp (local time on the device, so 
not universally comparable)
- each record has a 'accepted' timestamp, which is the time *on the 
server* when the change is synched on to the server (and so they are all 
universally comparable).
- the synch handler runs continuously, is triggered at start-up to 
download changes, or by any DB update or periodically for downloading 
new updates - and re-sends to itself while there are remaining synch's 
to do; i.e. non-blocking, and if there is no Internet connection, it 
simply waits a while and tries again
- for now, conflict resolution is *only* "server wins"

Unfortunately, while the skeleton of the synch handler, and of the 
server page, are reusable, they need to be fleshed out each time. One of 
these days I'll find time to look at this properly, and see how close it 
can become to a fixed, standard library for the synch capability (and 
look at conflict resolution more closely).

More information about the Use-livecode mailing list