Refactoring

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Refactoring

Post by Klaus » Sat Jan 12, 2019 8:38 pm

Try with "send":

Code: Select all

on openStack
   send "backSave" to me in 120
end openStack

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9285
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

Re: Refactoring

Post by richmond62 » Sat Jan 12, 2019 9:26 pm

The initial script works NOW because I had OVERLOOKED
that you had called the folder "DWP autosaves" rather than "DWP autosave".

This saves backup stacks in the designated location but WITHOUT the "livecode" suffix.

So I changed the code:

Code: Select all

on openStack
   backSave
end openStack

on backSave
   save this stack as ("/Volumes/X1/DWP autosaves/SAVER" && the time && ".livecode")
   send "backSave" to me in 120
end backSave
Why one should have to add the suffix I am not sure.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7214
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Refactoring

Post by jacque » Sat Jan 12, 2019 9:42 pm

Probably a path issue. Do this:

Code: Select all

answer folder "Choose a folder:"
put it
See if what you get matches what you typed into the handler.

Alternately, have you looked at the plug-in in the Development menu called "revSmartSave"? It does what you want.

Edit: never mind, I see you fixed it while I was typing. I still question that 2-second interval though.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Refactoring

Post by Klaus » Sat Jan 12, 2019 10:03 pm

richmond62 wrote:
Sat Jan 12, 2019 9:26 pm
The initial script works NOW because I had OVERLOOKED
that you had called the folder "DWP autosaves" rather than "DWP autosave".
Well, I only copied YOUR script, see viewtopic.php?f=8&t=32003#p175220
So sorry! :D
richmond62 wrote:
Sat Jan 12, 2019 9:26 pm
Why one should have to add the suffix I am not sure.
You don't need a suffix actually, a valid stackfile is a valid stackfile, suffix or no suffix. So LC gives you the choice to leave the suffix out or add it (manually), isn't that a nice touch? :P

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 365
Joined: Mon Jun 10, 2013 1:32 pm

Re: Refactoring

Post by Lagi Pittas » Sun Jan 13, 2019 2:45 pm

I agree with Jacque about the interval but it is 120 milliseconds not 2 seconds -- whole lot of thrashing goin' on .....

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Refactoring

Post by Klaus » Sun Jan 13, 2019 2:51 pm

Lagi Pittas wrote:
Sun Jan 13, 2019 2:45 pm
I agree with Jacque about the interval but it is 120 milliseconds not 2 seconds -- whole lot of thrashing goin' on .....
If you omit the unit, LC presumes TICKS, so 120 in the script are in fact 2 seconds.
But even this interval does not leave much time for changes anyway. :D

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 365
Joined: Mon Jun 10, 2013 1:32 pm

Re: Refactoring

Post by Lagi Pittas » Mon Jan 14, 2019 12:27 pm

Well knock me down with a feather, thanks Klaus.

I ALWAYS assumed right at the start of my Livecode journey that it defaulted to milliseconds so I always put secconds or milliseconds on the end - so I never noticed.

How could I doubt Jacques' recollection of the Livecode basics......

Can we count in Jiffies as well?

Lagi

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Refactoring

Post by Klaus » Mon Jan 14, 2019 12:50 pm

What on earth are "Jiffies"? :shock:

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Refactoring

Post by bogs » Mon Jan 14, 2019 1:17 pm

Must be a time measurement, I've often heard that someone will "be there in a jiffy" :P
Image

Lagi Pittas
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 365
Joined: Mon Jun 10, 2013 1:32 pm

Re: Refactoring

Post by Lagi Pittas » Mon Jan 14, 2019 8:22 pm

I really thought that it was the invention of Commodore (CBM) for their PET computer but years later I found out from Wikipedia that Jiffies where a time measurement invented in the 1800s - and they are also used in the Linux kernal
The earliest technical usage for jiffy was defined by Gilbert Newton Lewis (1875–1946). He proposed a unit of time called the "jiffy" which was equal to the time it takes light to travel one centimeter in a vacuum (approximately 33.3564 picosec
But for our discussion
Early microcomputer systems such as the Commodore 64 and many game consoles (which use televisions as a display device) commonly synchronize the system interrupt timer with the vertical frequency of the local television standard, either 59.94 Hz with NTSC systems, or 50.0 Hz with most PAL systems. Jiffy values for various Linux versions and platforms have typically varied between about 1 ms and 10 ms, with 10 ms reported as an increasingly common standard in the Jargon File.[6]
Not many people know that
t - with apologies to Peter Sellers (and yes it wasn't Michael Caine - Not many people know that either .... ;-) )

http://www.todayifoundout.com/index.php ... t-of-time/

Lagi

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Refactoring

Post by Klaus » Mon Jan 14, 2019 8:46 pm

Ah, I see, thank you!
So no, we cannot count in Jiffies in LC, Lagi. :D

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Refactoring

Post by bogs » Mon Jan 14, 2019 9:40 pm

Well, we can count milliseconds, so in your own mind, you can substitute any ms value < 10 to be a jiffy. Myself, I'm going to call them 'snaps' :twisted:
Image

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

Re: Refactoring

Post by mwieder » Tue Jan 15, 2019 6:22 pm

TIL - thanks for that. Although I admit to being partial to the quantum of time being the time required for light to travel the Planck length.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”