1. Re: Don Cole's Niffty Progress Bar Uploaded Atten: RAD
- Posted by Pete Lomax <petelomax at blueyonder.co.uk> Nov 13, 2006
- 529 views
On Sun, 12 Nov 2006 05:17:23 -0800, Rad <guest at RapidEuphoria.com> wrote: >I am not sure how to use version file from the server. Never done it. As simple as you like. Instead of "file", you may prefer a version table, with a single record/integer field in the server database, and whatever program you use to modify the menus on the server just has to increment the version table data whenever it is run (which I assume is not all that often - if you will always be updating them ten times a day then this all becomes fairly pointless). The client-side code might go something like this:
eCode = db_open("local.edb",DB_LOCK_EXCLUSIVE) if eCode = DB_OK then eCode = db_select_table("version") local_vers=db_record_data(1) else if db_create("local.edb",DB_LOCK_EXCLUSIVE)!=DB_OK then ?9/0 end if if db_create_table("version") != DB_OK then ?9/0 end if if db_insert(1,-1)!=DB_OK then ?9/0 end if -- add dummy version end if remote_vers = get_remote_version() -- from server file or db if eCode!=DB_OK or local_vers!=remote_vers then -- read from server, write to local.edb, create menus etc -- update progress bar db_replace_data(1,remote_vers) else -- just read from local.edb, create menus etc. -- hopefully no need for a progress bar since this should -- all be done and dusted in 0.1 seconds or less. end if
Ought to make it much faster 9/10 times or better. Regards, Pete PS Depending on how paranoid/security conscious you are(?), you may want to take steps to prevent casual tampering with local.edb, eg/ie by encrypting the menu data before writing it, and/or instead of "local".edb you may want to use a login-id/group access rights.