Page 1 of 1
saving stacks to db
Posted: Tue Sep 11, 2012 12:06 am
by sturgis
Does anyone know of a way to save a stack in memory to a database without saving to drive first? Or ftp the stack live without saving first? Or even stuffing a stack into a property?
Re: saving stacks to db
Posted: Tue Sep 11, 2012 12:25 am
by sturgis
Figured out a method that seems to work well enough.
If anyone is interested heres a description of the method
copy the stack to the clipboard
copy stack "stackname"
At this point simply stuff the clipboarddata wherever you want it saved. A property, or database, or send it to a web server for handling or whatever.
To get it back, retrieve the data, stuff it back into the clipboarddata and "paste"
set the clipboarddata["objects"] to <what ever ccontains the saved data>
paste
Voila', up pops the stack. Interestingly enough, since paste is smart, it checks to see if the stack already exists and if it does, changes it to "copy of stack..." as if you hadn't gone through all the steps. If the stack isn't in memory already, the name remains as it was.
Re: saving stacks to db
Posted: Tue Sep 11, 2012 12:45 am
by FourthWorld
Good work, Sturgis. It would never have occurred to me that the copy command will work on a stack. Very handy....
Re: saving stacks to db
Posted: Tue Sep 11, 2012 10:31 am
by Klaus
Cool, didn't know this, thanks for the info!
Re: saving stacks to db
Posted: Tue Sep 11, 2012 1:03 pm
by sturgis
Opens up some interesting possibilities. LIke a versioning system, or what I am trying to work up, a plugin so that a class working on write locked systems (public lab, systems are overwritten every night with a fresh clean image) so that stacks can be saved to a central db tagged by user. Accessible from any station etc.
No builds without a real save of course so something will have to be figured out for that.
Re: saving stacks to db
Posted: Tue Sep 18, 2012 5:32 pm
by sturgis
If anyone is interested, this works great for stacks with no substacks.
To copy a stack and all its substacks to an array, loop through the substacks and shove them into the array first, set their mainstack to themselves, when the substacks are done, the mainstack is now a single stack. Save it to the array tagged as main some way. THen loop through the subs again and set their mainstack back to normal.
Seems pretty fast, works well. I have a test stack so far that will backup any named stack and its substacks to an array that is stuffed into a property. Database backup with date stamps next hopefully.