Post Reply 
program backup/restore for android prime
10-03-2015, 09:26 PM (This post was last modified: 10-04-2015 10:17 AM by ji3m.)
Post: #1
program backup/restore for android prime
The android prime crashes randomly and frequently. I hope thats not a feature of tge real calc.

Anyhow, it usually comes back after losing only the latest changes. But it did me bad yesterday when it would not restart. I had to reinstall it. But then i lost all my work.

Files can be saved with the copy/save menues on the left hand android sliding panel.
But this requires a whole lot of work if there are many small programs. And they need to be small due to the primes editor (if it can be called that).

Anyhow, i just finished the included two routines bkup () and rstor ().

Call bkup with a name: bkup ("mybakup"). It will then create a single file in Notes with your name with date appended.

You can then use android copy

(1) open the prime note mybackup2015_1003 (your date)
(2) use prime copy function and select ALL
(3) Prime copy is not necessary
(4) Slide the left panel in on the droid
(5) select copy -- the file is now in the android copy buffer
(6) on the droid, paste it into your favorite editor ans save.

Restore is of course the reverse.

Once the file is back into a prime note file , use

rstor ("filename").

The backup file is a string with a name followed by a list of lists
like this:

{ { "pgmname","pgm body"}, ...... }"

The newline is there after the name since most android editors
Love to use the first line as the filename.

rstor() carefully removes this name (everything to the first space).

You can edit the backup file to remove or add things. But be careful
to not disturb the structure.

WARNING:::USE AT YOUR OWN RISK. RUN bkup FIRST and check the result.
Im not sure what happens if an error creeps into the backup file. It will probably halt but finding the error my be a serious challenge.

Update: I created an error in the backup file in the first program. Then i modified the last pgm. Then i used the modified file for restore. Rstor ran to completion with no error msg. The last program was uodated. The first prgm had the error which appeared upon examining it. So all was ok. You just have to check if you suspect an error. Apparently Program (..) := body which loads and compiles doesnt trap an error. Need to look into this.

Attached File(s)
.txt  bkuprstor.txt (Size: 420 bytes / Downloads: 18)

I work with android Prime only for now on my
Galaxy Tab Pro/Note 2
Find all posts by this user
Quote this message in a reply
10-04-2015, 04:16 AM
Post: #2
RE: program backup/restore for android prime
Thank you very much even I didn't try it yet.
I hope this basic functionality (backup and restoring user data) will be native in next android update and prime will elevate from expensive beta to useable app. :-)

Prime, 15C CE
Find all posts by this user
Quote this message in a reply
Post Reply 

User(s) browsing this thread: 1 Guest(s)