Best way to save a backup of your stack?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Best way to save a backup of your stack?

Post by FireWorx » Sun Sep 25, 2011 4:05 pm

Hi,
When I get to the point where I have a lot of time invested in stack construction and before I experiment with a major change in my stack I like to create a backup. Usualy I create a back up and rename it in the stack preferences a window and then again on my desk top. However I still have to be very carefull about acessing the backup while the original is open or still in memory. Livecode thinks its the same stack no matter what I rename it. It makes it difficult to access a component of the backup to reinstall on the original. You get the "You already have a stack open of that name message what do you want to do "Cancel" or "Purge it from memory" It doesnt seem to matter (from my view) what you press. If you press cancel it doesnt cancel the operation thats for sure. Then all the sudden things get weird in Livecode. (from my view) In other words work gets lost. I find myself working on an old stack copy with a new name. or whatever.... I cant even describe it but it gets ugly.

So what I have been doing is save and close out the current stack. Then close out live code to remove it from memory. Then open the back up. Copy a button out of the backup and past it into a new mainstack. Rename and save the new mainstack. Then close out livecode again to remove the back up from memory . Then open the current copy and new main stack and copy the button to the current stack.

What is the best way to create a backup that can be accessed by the original stack.

Thanks
Dave

Klaus
Posts: 14211
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Best way to save a backup of your stack?

Post by Klaus » Sun Sep 25, 2011 4:32 pm

Hi Dave,

LiveCode does not like stacks with the same name open at the same time,
no matter what the FILENAME of these stacks is.
Get used to avoid this in any case 8)

So you could just "clone" your stack and save it under a different name!
Use the message box: clone stack "xyz"

This way, the cloned stack will be named "Copy of Original_Stack_Name_here"
and can be open at the same time as the original stack!

Maybe this will fit your needs?


Best

Klaus

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Best way to save a backup of your stack?

Post by bn » Sun Sep 25, 2011 5:27 pm

Hi Dave,

as Klaus pointed out and you already discovered Livecode can not open two stacks with the same name at the same time.

What I do for versions of my stacks is that in the property inspector I append a number and then right away I do a "save as". Livecode proposes the new stack name as the file name and I accept. This leaves you with the new stack as the one that is opened.

But be aware of the fact that if you use behaviors this will break your behavior references. They are the long id of a button you assign as the behavior button. You would have to make a script that assigns the behaviors anew, like in an openstack handler. "set the behavior of field "xyz" of card "def" to the long id of button "abc" of card "def".

I never figured out what Livecode does when it comes up with the dialog of the same name etc. I just avoid it.

Kind regards

Bernd

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Best way to save a backup of your stack?

Post by FireWorx » Sun Sep 25, 2011 11:10 pm

Thanks for the suggestions.

An interesting side effect I experienced the other day of this issue between identical stack names open creating havoc was the IOS specialfolderpath("documents") folder that had been populated with several folders full of PDF's was immediately emptied. Lucky for me Dixie had helped me with a script that made reloading the folders from the specialfolderpath ("engine") folder a snap.

Dave

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Best way to save a backup of your stack?

Post by FireWorx » Wed Sep 28, 2011 6:44 pm

Thanks Klaus,
I hope this is not a blonde question but when cloning from the message box as in "clone stack "xyz" where does the clone go? and what does Livecode name it. I looked in the documents folder where live code lives, I looked within the Livecode bundle, its not in the folder that I have been working out of, and I searched under clone and copy of and didn't locate it.
Dave

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7394
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Best way to save a backup of your stack?

Post by jacque » Wed Sep 28, 2011 6:45 pm

The clone is in RAM only until you specifically save it to disk.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

BarrySumpter
Posts: 1201
Joined: Sun Apr 24, 2011 2:17 am

Re: Best way to save a backup of your stack?

Post by BarrySumpter » Sat Oct 01, 2011 10:45 pm

FireWorx wrote:
...
So what I have been doing is save and close out the current stack. Then close out live code to remove it from memory. Then open the back up. Copy a button out of the backup and past it into a new mainstack. Rename and save the new mainstack. Then close out livecode again to remove the back up from memory . Then open the current copy and new main stack and copy the button to the current stack.
...
Thats exactly what happened to me and thats exactly the methodology I've adapted to compensate.
I can't tell you how much work and time I lost trying to sort that out at the time.
I was actually taking the extra step of saving my script in textpad.
Not cool at all.

It still pops us every once in a while but the cancel and relead seems to work.
All my best,
Barry G. Sumpter

Deving on WinXP sp3-32 bit. LC 5.5 Professional Build 1477
Android/iOS/Server Add Ons. OmegaBundle 2011 value ROCKS!
2 HTC HD2 Latest DorimanX Roms
Might have to reconsider LiveCode iOS Developer Program.

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Best way to save a backup of your stack?

Post by BvG » Sun Oct 02, 2011 12:21 am

I do versioning on the filesystem side.

I save the stack in the IDE, then make a copy of the file, often using dates in the name. It's simple, easy, and hard to mess up... As long as one doesn't need to compare two of the stacks in the IDE, that is :)
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Best way to save a backup of your stack?

Post by Mark » Sun Oct 02, 2011 1:31 am

I do more or less the same as BvG. Before I make big changes, I make a copy of my current file by zipping my working folder and giving the zip file a name with a date. Naturally, I also make regular backup copies of all my work on a different machine.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7394
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Best way to save a backup of your stack?

Post by jacque » Sun Oct 02, 2011 2:47 am

FireWorx wrote:Hi,

So what I have been doing is save and close out the current stack. Then close out live code to remove it from memory. Then open the back up. Copy a button out of the backup and past it into a new mainstack. Rename and save the new mainstack. Then close out livecode again to remove the back up from memory . Then open the current copy and new main stack and copy the button to the current stack.
Way too much work. :) What I do is modify the stack name in the inspector (you don't need much, I usually just put an "x" after the stack name,) then open the second copy and do any copy/pasting I need to do. Save the second copy and close it (and remove from memory.) Then either 1) rename the first one back to what it was, or 2) just close it and when asked to save, say "no", which reverts it to the original again.

You can also run two copies of LiveCode if you want, which I also do routinely, usually one older copy and one latest copy. You can copy/paste anything between them, and you can have the same stack open at the same time in both (but be careful if you save in one app and then switch to the other, your saves could overwrite each other.)

For backups, I usually make them right before I'm about to do something potentially dangerous or hard to reverse. I go to the Finder and duplicate the stack I'm working on. Then I keep working on the one that's already open. Until you save it to disk, the one that's open has not yet changed on disk, even if you've changed the content in the IDE, as long as you haven't saved it yet. So it's safe to duplicate the disk copy before committing any IDE changes to it.

I also backup regularly with a backup program, but I do the manual copies whenever I want an additional safeguard.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Best way to save a backup of your stack?

Post by teacherguy » Thu Jan 19, 2012 7:28 pm

Two things I've been doing:

1. Each morning I archive a duplicate of my stack
2. I use Dropbox. Dropbox saves a version of the file every time you save. This has saved my rear end on a number of occasions when I need to move backwards 15 minutes, or even half a day. I just go to the dropbox website, look at the version history, and download the version I want.

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Best way to save a backup of your stack?

Post by mwieder » Thu Jan 19, 2012 8:18 pm

Doh! I keep my work in progress on Dropbox as well, but I keep forgetting about the backup versioning. Brilliant!

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7394
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Best way to save a backup of your stack?

Post by jacque » Thu Jan 19, 2012 8:22 pm

I use Dropbox the same way too, but I just read last week that it only keeps the last 30 days of revisions. I hadn't known that.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

teacherguy
Posts: 379
Joined: Thu Dec 08, 2011 2:43 am

Re: Best way to save a backup of your stack?

Post by teacherguy » Thu Jan 19, 2012 8:42 pm

I had forgotten all about the version history until I got into a real jam one time, then it popped into my head. Boy was I glad to see all of those versions.

Be sure to quit livecode before you restore, just alleviate any confusion.

Post Reply