Re: sorting html text with arrays
Use the form sort myContainer by mySortFuction(each, myContainer) -- specify text, numeric, ascending, descending function mySortFunction singleLineOfList, wholeList --apply as many rules as you wish --filter as many times as you wish --build as many arrays or tables as you wish return (a value to sort by) end mySortFunction Jim Ault Las Vegas On Oct 5, 2010, at 8:46 PM, Mark Swindell wrote: Excellent question, and one I only thought of after posting mine! There would need to be a series of precedence rules, and I don't know them. But to simplify, let's say you had unique examples of styled tex, and t that you wanted to maintain their styles. For example, in this mini-dictionary I've got 26 (almost) unique headings: A B C D... etc. bold, larger font, underlined. I want them to maintain their integrity while adding in a batch of new words. Would it be possible to sort while leaving alone the htmlText characteristics of first instance items in a field such as this? Mark On Oct 5, 2010, at 4:09 PM, Dick Kriesel wrote: Hi, Mark. What are the rules for handling words that appear with more than one style? -- Dick On 10/5/10 11:40 AM, Mark Swindell mdswind...@cruzio.com wrote: I'm using the following script to create a glossary/word list of all words appearing in a songbook I'm making in Apple's Pages word processor (over 2,000 unique words). (Thanks to Phil Davis for his help with arrays.) What I am wondering is if the formatted text can be retained in a case like this, and how. My attempts so far have failed, as the htmlText tags are included in the sort... not what I want.) I'd like to be able to paste in from the word processor and do the sort while maintaining formatting (bold, font, font size), and then be able to take that result and copy and paste it back into the word processor. Am I asking too much? Thanks Mark on mouseUp repeat for each word tWord in tStripEm add 1 to aWordCounts[tWord] end repeat put the keys of aWordCounts into tList sort lines of tList put tList into field sorted3 end mouseUp___ ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
sorting html text with arrays
I'm using the following script to create a glossary/word list of all words appearing in a songbook I'm making in Apple's Pages word processor (over 2,000 unique words). (Thanks to Phil Davis for his help with arrays.) What I am wondering is if the formatted text can be retained in a case like this, and how. My attempts so far have failed, as the htmlText tags are included in the sort... not what I want.) I'd like to be able to paste in from the word processor and do the sort while maintaining formatting (bold, font, font size), and then be able to take that result and copy and paste it back into the word processor. Am I asking too much? Thanks Mark on mouseUp repeat for each word tWord in tStripEm add 1 to aWordCounts[tWord] end repeat put the keys of aWordCounts into tList sort lines of tList put tList into field sorted3 end mouseUp___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
RE: sorting html text with arrays
Mark, Are you familiar with setting the htmlText of a field? (I've posted a few questions to this list myself recently regarding various aspects of this feature.) You might try making an entire card for each word, set the htmlText of a field in it to your html, sorting the cards by some criteria-perhaps another field with other data in it, and then getting the htmlText of each field in the new order of the cards. Hope this helps, Ray -Original Message- From: use-revolution-boun...@lists.runrev.com [mailto:use-revolution-boun...@lists.runrev.com] On Behalf Of Mark Swindell Sent: Tuesday, October 05, 2010 2:41 PM To: How to use Revolution Subject: sorting html text with arrays I'm using the following script to create a glossary/word list of all words appearing in a songbook I'm making in Apple's Pages word processor (over 2,000 unique words). (Thanks to Phil Davis for his help with arrays.) What I am wondering is if the formatted text can be retained in a case like this, and how. My attempts so far have failed, as the htmlText tags are included in the sort... not what I want.) I'd like to be able to paste in from the word processor and do the sort while maintaining formatting (bold, font, font size), and then be able to take that result and copy and paste it back into the word processor. Am I asking too much? Thanks Mark on mouseUp repeat for each word tWord in tStripEm add 1 to aWordCounts[tWord] end repeat put the keys of aWordCounts into tList sort lines of tList put tList into field sorted3 end mouseUp___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: sorting html text with arrays
This can be done depending on the text of each line. Can you provide examples of the lines you want to sort? On Oct 5, 2010, at 11:40 AM, Mark Swindell wrote: I'm using the following script to create a glossary/word list of all words appearing in a songbook I'm making in Apple's Pages word processor (over 2,000 unique words). (Thanks to Phil Davis for his help with arrays.) What I am wondering is if the formatted text can be retained in a case like this, and how. My attempts so far have failed, as the htmlText tags are included in the sort... not what I want.) I'd like to be able to paste in from the word processor and do the sort while maintaining formatting (bold, font, font size), and then be able to take that result and copy and paste it back into the word processor. Am I asking too much? Thanks Mark on mouseUp repeat for each word tWord in tStripEm add 1 to aWordCounts[tWord] end repeat put the keys of aWordCounts into tList sort lines of tList put tList into field sorted3 end mouseUp Jim Ault Las Vegas ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: sorting html text with arrays
Hi, Mark. What are the rules for handling words that appear with more than one style? -- Dick On 10/5/10 11:40 AM, Mark Swindell mdswind...@cruzio.com wrote: I'm using the following script to create a glossary/word list of all words appearing in a songbook I'm making in Apple's Pages word processor (over 2,000 unique words). (Thanks to Phil Davis for his help with arrays.) What I am wondering is if the formatted text can be retained in a case like this, and how. My attempts so far have failed, as the htmlText tags are included in the sort... not what I want.) I'd like to be able to paste in from the word processor and do the sort while maintaining formatting (bold, font, font size), and then be able to take that result and copy and paste it back into the word processor. Am I asking too much? Thanks Mark on mouseUp repeat for each word tWord in tStripEm add 1 to aWordCounts[tWord] end repeat put the keys of aWordCounts into tList sort lines of tList put tList into field sorted3 end mouseUp___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: sorting html text with arrays
Excellent question, and one I only thought of after posting mine! There would need to be a series of precedence rules, and I don't know them. But to simplify, let's say you had unique examples of styled tex, and t that you wanted to maintain their styles. For example, in this mini-dictionary I've got 26 (almost) unique headings: A B C D... etc. bold, larger font, underlined. I want them to maintain their integrity while adding in a batch of new words. Would it be possible to sort while leaving alone the htmlText characteristics of first instance items in a field such as this? Mark On Oct 5, 2010, at 4:09 PM, Dick Kriesel wrote: Hi, Mark. What are the rules for handling words that appear with more than one style? -- Dick On 10/5/10 11:40 AM, Mark Swindell mdswind...@cruzio.com wrote: I'm using the following script to create a glossary/word list of all words appearing in a songbook I'm making in Apple's Pages word processor (over 2,000 unique words). (Thanks to Phil Davis for his help with arrays.) What I am wondering is if the formatted text can be retained in a case like this, and how. My attempts so far have failed, as the htmlText tags are included in the sort... not what I want.) I'd like to be able to paste in from the word processor and do the sort while maintaining formatting (bold, font, font size), and then be able to take that result and copy and paste it back into the word processor. Am I asking too much? Thanks Mark on mouseUp repeat for each word tWord in tStripEm add 1 to aWordCounts[tWord] end repeat put the keys of aWordCounts into tList sort lines of tList put tList into field sorted3 end mouseUp___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Multi-dimensional arrays, tutorial?
Can someone point me to an explanation or tutorial on using multi-dimensional arrays, and specifically persistence between sessions? Okay, so I'm a trifle late to the party but I am here now! I am making no headway at all from such information as I can find in the dox so obviously I have my fundamentals in a twist... For example 'put pData into the databaseArray[pCompany][pPerson][pName] of this stack' ain't co-operating. tia Hugh ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Multi-dimensional arrays, tutorial?
Hi Hugh, as of Rev 4 (if I recall correctly) you can store the whole array in a custom property, which you would need to set: local tArray put malte into tArray[1][firstname] put pfaff-brill into tArray[1][lastname] put linus into tArray[2][firstname] put pfaff into tArray[2][lastname] set the cAddressBook of this stack to tArray save this stack --- -- retrieve it local tArray put the cAddressBook of this stack into tArray answer tArray[1][firstname] Hope that helps, Malte ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Multi-dimensional arrays, tutorial?
I only have time for a quick hint. I think you need to create each node before defining the next child level. Kind of like 'create folder' at each level in the directory. When I did this a year ago I recall I used nested repeat loops and the array names in strings. I built the requisite strings, then parsed them as I spun everything into all the dimensions. put pData into the databaseArray[pCompany] put pData into the databaseArray[pCompany][pPerson] put pData into the databaseArray[pCompany][pPerson][pName] Persistence is probably something like arrayEncode() Use the Rev arrayEncode function to convert an array into a string so that it can be saved to a file or sent across a network. On Aug 10, 2010, at 12:53 AM, FlexibleLearning wrote: Can someone point me to an explanation or tutorial on using multi-dimensional arrays, and specifically persistence between sessions? Okay, so I'm a trifle late to the party but I am here now! I am making no headway at all from such information as I can find in the dox so obviously I have my fundamentals in a twist... For example 'put pData into the databaseArray[pCompany][pPerson][pName] of this stack' ain't co-operating. Jim Ault Las Vegas ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Multi-dimensional arrays, tutorial?
Jim, your folder analogy is not correct, as this works fine: put mex into foo[bar][tex] put foo[bar][tex] --yields: mex With multiple arrays, I always run into conceptual problems (aka. brain pain) because in the example above: foo is an array (has keys) foo[bar] is also an array and has keys foo[bar][tex] is not an array and contains text (mex) --damn I have written an advanced tutorial (read: confusing) on various uses for multidimensional arrays when having tab delimited data: http://lessons.runrev.com/spaces/lessons/buckets/784/lessons/9678-How-do-I-convert-tab-delimited-data-into-an-array- On 10 Aug 2010, at 10:15, Jim Ault wrote: I only have time for a quick hint. I think you need to create each node before defining the next child level. Kind of like 'create folder' at each level in the directory. When I did this a year ago I recall I used nested repeat loops and the array names in strings. I built the requisite strings, then parsed them as I spun everything into all the dimensions. put pData into the databaseArray[pCompany] put pData into the databaseArray[pCompany][pPerson] put pData into the databaseArray[pCompany][pPerson][pName] Persistence is probably something like arrayEncode() Use the Rev arrayEncode function to convert an array into a string so that it can be saved to a file or sent across a network. On Aug 10, 2010, at 12:53 AM, FlexibleLearning wrote: Can someone point me to an explanation or tutorial on using multi-dimensional arrays, and specifically persistence between sessions? Okay, so I'm a trifle late to the party but I am here now! I am making no headway at all from such information as I can find in the dox so obviously I have my fundamentals in a twist... For example 'put pData into the databaseArray[pCompany][pPerson][pName] of this stack' ain't co-operating. Jim Ault Las Vegas ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Multi-dimensional arrays, tutorial?
Thank you BvG. Persistence by putting an array into a property makes sense kinda... It was the syntax that had me fooled. If I have understood the system, then 1. set the dinnerNames[mains] of this stack to tex - good 2. set the dinnerNames[mains][spicy] of this stack to tex - bad! because [1] is a single dimension array property [2] is a multi-dimensional array variable but [3] we can 'set' a single dimension property to a multi-dimensional array which is what I need to do. Nice tutorial, by the way... I have written an advanced tutorial (read: confusing) on various uses for multidimensional arrays when having tab delimited data: http://lessons.runrev.com/spaces/lessons/buckets/784/lessons/9678-How-do-I-c onvert-tab-delimited-data-into-an-array- /H ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Multi-dimensional arrays, tutorial?
Yes, you're right because what you're doing is not multidimensional arrays at all. You're simply using custom property sets and want to store stuff in them. I did once make an enhancement requests that ask for making arrays and properties (custom or not) basically be the same, which might that then be possible. I think that the person who made custompropertysets had single dimension arrays in mind, but never came to the idea to just actually _make_ em arrays. Which is hugely confusing, especially considering how abstract all that subgrouping with weird brackets is to begin with. So what you can do is either: a. save your array in a customproperty: set the dinnerNames of this stack to myDinnerArray b. save your array in a custompropertyset's customproperty: set the dinner[names] of this stack to myDinnerArray --equivalent of: set the custompropertyset of this stack to dinner set the names of this stack to myDinnerArray set the custompropertyset of this stack to c. do not use arrays: set the dinner[name1] of this stack to tex d. do not use customproperties put arrayencode(myDinnerArray) into url (binfile: Array.txt) Bjoernke PS: Mentioned feature request: http://quality.runrev.com/qacenter/show_bug.cgi?id=6912 On 10 Aug 2010, at 17:24, FlexibleLearning wrote: If I have understood the system, then 1. set the dinnerNames[mains] of this stack to tex - good 2. set the dinnerNames[mains][spicy] of this stack to tex - bad! because [1] is a single dimension array property [2] is a multi-dimensional array variable but [3] we can 'set' a single dimension property to a multi-dimensional array which is what I need to do. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Multi-dimensional arrays, tutorial?
On Aug 10, 2010, at 12:53 AM, FlexibleLearning wrote: Can someone point me to an explanation or tutorial on using multi-dimensional arrays, and specifically persistence between sessions? Hi, Hugh. If you'd like to see a script locals persistence toolkit, I'd be glad to share the code. The library loads and stores script locals, as you've seen in other replies, but goes further by enabling operations on multiple arrays in a single invocation, and by enabling operations on arrays within arrays. The primary handler in the library starts with this: command scriptLocals_op pOperation, pVariableNames, pKey, pRevObject /* pOperation is among the items of register,load,store,empty,unregister,remove pVariableNames can be a list delimited by cr, comma, or space. pVariableNames is optional; without it, the command operates on all script locals identified in previous executions of the command. pKey can be a string that is a top-level subscript of the array. pKey can be a sequentially-keyed array that determines a compound subscript of the array. pKey is optional; without it, the command operates on whole arrays rather than on elements of arrays. pRevObject can identify any Rev object. pRevObject is optional; without it, the Rev object is the one whose script invokes the command. The command performs the operation in the context of the Rev object on the Rev object's own script locals. */ Please let me know if you have questions or if you'd like to see the library. -- Dick ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
Great responses on the subject of arrays. I gather then that my attempt to trick revolution into giving me a column of data without using repeat loops is ill fated. Since I am working with data grids, I was hoping to get a column of data without going through much trouble. Really, I just need to write a function that does this, or use the example provided by Phil Davis (thanks Phil.) Bob On Jan 9, 2010, at 6:35 PM, Michael Kann wrote: Bob, Maybe we can learn something about arrays together. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
You can use combine split to work with arrays of data, but if you do speed tests, you will find that repeat loops + chunking are just as fast and have more power, such as extracting more that one column, shuffling the column order while gathering, reformatting, error checking, etc Jim Ault Las Vegas On Jan 11, 2010, at 9:07 AM, Bob Sneidar wrote: Great responses on the subject of arrays. I gather then that my attempt to trick revolution into giving me a column of data without using repeat loops is ill fated. Since I am working with data grids, I was hoping to get a column of data without going through much trouble. Really, I just need to write a function that does this, or use the example provided by Phil Davis (thanks Phil.) Bob On Jan 9, 2010, at 6:35 PM, Michael Kann wrote: Bob, Maybe we can learn something about arrays together. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
On 1/10/10 1:25 PM, Phil Davis rev...@pdslabs.net wrote: The things some people do for fun... ;-) ... can make others want to get in on the fun, like by fixing something that ain't broke. Here's an elaboration on your idea that handles your sample data more than twice as fast, primarily by avoiding the do for typical cases. Thanks for the cue, Phil. -- Dick postscript_with_line_wraps function table_split tTable,pLineDel,pItemDel filter tTable without empty set the lineDelimiter to coalesce(pLineDel,cr) set the itemDelimiter to coalesce(pItemDel,tab) switch number of items in line 1 of tTable - 1 -- number of dimensions case 1 repeat for each line tLine in tTable put item 2 of tLine into tArray[item 1 of tLine] end repeat break case 2 repeat for each line tLine in tTable put item 3 of tLine into tArray[item 1 of tLine][item 2 of tLine] end repeat break case 3 repeat for each line tLine in tTable put item 4 of tLine into tArray[item 1 of tLine][item 2 of tLine][item 3 of tLine] end repeat break default repeat for each line tLine in tTable do put last item of tLine into tArray[ replaceText(item 1 to -2 of tLine,the itemDelimiter,][) ] end repeat end switch return tArray end table_split function coalesce -- return the first non-empty parameter repeat with i = 1 to the paramCount if param(i) is not empty then return param(i) end if end repeat end coalesce /postscript_with_line_wraps ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
Thanks Dick - I hadn't thought about handling common cases differently. Good idea! Phil On 1/11/10 12:10 PM, Dick Kriesel wrote: On 1/10/10 1:25 PM, Phil Davisrev...@pdslabs.net wrote: The things some people do for fun... ;-) ... can make others want to get in on the fun, like by fixing something that ain't broke. Here's an elaboration on your idea that handles your sample data more than twice as fast, primarily by avoiding the do for typical cases. Thanks for the cue, Phil. -- Dick postscript_with_line_wraps function table_split tTable,pLineDel,pItemDel filter tTable without empty set the lineDelimiter to coalesce(pLineDel,cr) set the itemDelimiter to coalesce(pItemDel,tab) switch number of items in line 1 of tTable - 1 -- number of dimensions case 1 repeat for each line tLine in tTable put item 2 of tLine into tArray[item 1 of tLine] end repeat break case 2 repeat for each line tLine in tTable put item 3 of tLine into tArray[item 1 of tLine][item 2 of tLine] end repeat break case 3 repeat for each line tLine in tTable put item 4 of tLine into tArray[item 1 of tLine][item 2 of tLine][item 3 of tLine] end repeat break default repeat for each line tLine in tTable do put last item of tLine into tArray[ replaceText(item 1 to -2 of tLine,the itemDelimiter,][) ] end repeat end switch return tArray end table_split function coalesce -- return the first non-empty parameter repeat with i = 1 to the paramCount if param(i) is not empty then return param(i) end if end repeat end coalesce /postscript_with_line_wraps ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution -- Phil Davis PDS Labs Professional Software Development http://pdslabs.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
One bit of shorter code would be deleting the function and using the two lines: set the lineDelimiter to char 1 of (pLineDel cr) set the lineDelimiter to char 1 of (pItemDel tab) Jim Ault Las Vegas On Jan 11, 2010, at 12:24 PM, Phil Davis wrote: Thanks Dick - I hadn't thought about handling common cases differently. Good idea! Phil On 1/11/10 12:10 PM, Dick Kriesel wrote: On 1/10/10 1:25 PM, Phil Davisrev...@pdslabs.net wrote: The things some people do for fun... ;-) ... can make others want to get in on the fun, like by fixing something that ain't broke. Here's an elaboration on your idea that handles your sample data more than twice as fast, primarily by avoiding the do for typical cases. Thanks for the cue, Phil. -- Dick postscript_with_line_wraps function table_split tTable,pLineDel,pItemDel filter tTable without empty set the lineDelimiter to coalesce(pLineDel,cr) set the itemDelimiter to coalesce(pItemDel,tab) switch number of items in line 1 of tTable - 1 -- number of dimensions case 1 repeat for each line tLine in tTable put item 2 of tLine into tArray[item 1 of tLine] end repeat break case 2 repeat for each line tLine in tTable put item 3 of tLine into tArray[item 1 of tLine][item 2 of tLine] end repeat break case 3 repeat for each line tLine in tTable put item 4 of tLine into tArray[item 1 of tLine][item 2 of tLine][item 3 of tLine] end repeat break default repeat for each line tLine in tTable do put last item of tLine into tArray[ replaceText(item 1 to -2 of tLine,the itemDelimiter,][) ] end repeat end switch return tArray end table_split function coalesce -- return the first non-empty parameter repeat with i = 1 to the paramCount if param(i) is not empty then return param(i) end if end repeat end coalesce /postscript_with_line_wraps -- Phil Davis ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
You guys are too white and nerdy! ;-) (reference to Wierd Al Yankovich tune) Bob On Jan 11, 2010, at 1:25 PM, Jim Ault wrote: One bit of shorter code would be deleting the function and using the two lines: set the lineDelimiter to char 1 of (pLineDel cr) set the lineDelimiter to char 1 of (pItemDel tab) Jim Ault Las Vegas ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
At 9:34 AM -0800 1/10/2010, Jim Ault wrote: Yours is not the same syntax as the example in the docs put 1 into myArray[1,1] put 2 into myArray[1,2] put 3 into myArray[2,1] put 4 into myArray[2,2] But theirs does not make sense to me, since 1,1 is like 1comma1 or 1a1 if all keys are strings (except when they fall into a special category of sequential integers) The transpose function and its documentation are both pretty ancient, and date from before the time when Rev had true multidimensional arrays. Back in the olden days (cough), that style of key was how you emulated multidimensional arrays, and transpose was implemented to make that a little easier. -- Jeanne A. E. DeVoto, Transcript Language Curmudgeon revolut...@jaedworks.com http://www.jaedworks.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
In addition to what has been said previously, the default columnDelimiter is TAB, so in your script there would be no columns to split by, unless you set the columnDelimiter to Comma before the split. (Given that split by column is what you wanted. I do mix up rows and cols all the time though. :-) ) All the best, Malte___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
In addition to the good answers above: In Rev, the arrays are 'associative arrays' This means the keys are strings, not integers. Also, there is no particular order to the keys, such as last-in There is no auto-increment by specifying a blank key such as put 12.35 into arrayVar[] The character limit for a key is 255 chars. To store arrays on disk use arrayEncode() to convert to a string Custom properties are the same thing as arrays. Their namespace (parent) can be any object in Rev. The keys are the custom property names. Each Rev object can have unlimited sets of keys. Thus set the custompropertyset of this card to yr2009 set the Jan[21] of this card to payday set the Jan[22] of this card to lunch meeting -- define arrays equal to the properties put the Jan of this card into yr2009Jan put the Feb of this card into yr2009Feb set the custompropertyset of this card to yr1999 set the May of this card to yr1999May Caution when accidentally using a reserved word as a custom property Caution: failure of assigning or storing or getting array values does not produce an error. There is no error if you try to use an element of an array that does not exist. Hope this helps Jim Ault Las Vegas On Jan 9, 2010, at 5:12 PM, Bob Sneidar wrote: Hi all. Apparently I am not getting arrays AT ALL. I would think that given: put 1 comma A comma Green return into theData put 2 comma B comma Blue return after theData put 3 comma C comma Orange return after theData put 4 comma D comma White return after theData which would get me: 1,A,Green 2,B,Blue 3,C,Orange 4,D,White I could then split by column (or by row I get confused) and get a simple array where: theData[1,1] = 1 theData[1,2] = A theData[2,1] = 2 theData[4,3] = White And so forth. However, this is NOT the case! If it were, I could issue a command: put transpose(theData) into myArray and: myArray[1,2] = 2 myArray[1,3] = 3 and so on. If I got the entire row (I think there's a function for that) then I would have effectively gotten the column of the original data. Seems reasonable eh? So can someone please explain to me why I cannot get a simple x,y row,column grid-like array using these simple commands? Revolution seems to think that the first column MUST be the key! I would LIKE for revolution to simply create it's OWN numerical keys and let my data be my data. Maybe in the future add an argument to the split and combine commands to tell it whether or not I WANT Revolution to treat my first column as the key? If arrays worked like I described above, it would be a simple matter to get a single column of an array, just by transposing it and getting an entire row, instead of writing complex repeat loops to get a column of data. Am I missing something here? Thanks for any wisdom you can give. I can save some helpful souls the trouble of responding by saying I am capable of making repeat loops to accomplish this. I was just hoping that maybe I was missing something and I can in fact do what I thought I could. Bob___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution Jim Ault Las Vegas ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
Pardon my question, but I have learned more about arrays in these four posts than I ever thought about before: So given that I would want a multi-dimensional array where theData[2] [3] = Blue as in the examples provided, what is the 'best' way to enter data into this array, or is the way Bob did it the best way? Workflow: First; put 1 comma A comma Green return into theData put 2 comma B comma Blue return after theData put 3 comma C comma Orange return after theData put 4 comma D comma White return after theData Then ; split theData with cr Would this get me theData[2][3] = Blue ??? I thought the delimiter was TAB? Would this be better: put 1 tab A tab Green return into theData OR is this all wrong and if so what is the 'best' way to enter a lot data into a mutli-dimensional array to get these results?? Thank you for this. Tom McGrath III Lazy River Software 3mcgr...@comcast.net iTunes Library Suite - libITS Information and download can be found on this page: http://www.lazyriversoftware.com/RevOne.html On Jan 9, 2010, at 9:37 PM, Phil Davis wrote: Hi Bob, On 1/9/10 5:12 PM, Bob Sneidar wrote: Hi all. Apparently I am not getting arrays AT ALL. I would think that given: put 1 comma A comma Green return into theData put 2 comma B comma Blue return after theData put 3 comma C comma Orange return after theData put 4 comma D comma White return after theData which would get me: 1,A,Green 2,B,Blue 3,C,Orange 4,D,White Actually either of these: split theData with cr split theData by row -- where the rowDelimiter is CR would get you this: theData[1] = 1,A,Green theData[2] = 2,B,Blue theData[3] = 3,C,Orange theData[4] = 4,D,White I could then split by column (or by row I get confused) and get a simple array where: theData[1,1] = 1 theData[1,2] = A theData[2,1] = 2 theData[4,3] = White And so forth. However, this is NOT the case! Right. Technically speaking, comma is not an array index separator. Commas in our array keys help us conceptually represent multiple array dimensions in our own minds, but Rev sees an array with such keys as a simple one-dimensional array with alphabetic keys (since commas are not numerals). Until version 3.0, Rev couldn't handle true multi-dimensional arrays. Since then, the thing that tells Rev this is a multi- dimensional array is multiple keys per element, with each key in its own bracket. Like this: theData[1][1] = 1 theData[1][2] = A theData[1][3] = Green Now do you see why 'transpose()' wouldn't work with your array? In part it's because your keys aren't numeric - they contain commas. (Also they have to be sequential numbers.) Welcome to array re-education camp! ;-) Phil Davis If it were, I could issue a command: put transpose(theData) into myArray and: myArray[1,2] = 2 myArray[1,3] = 3 and so on. If I got the entire row (I think there's a function for that) then I would have effectively gotten the column of the original data. Seems reasonable eh? So can someone please explain to me why I cannot get a simple x,y row,column grid-like array using these simple commands? Revolution seems to think that the first column MUST be the key! I would LIKE for revolution to simply create it's OWN numerical keys and let my data be my data. Maybe in the future add an argument to the split and combine commands to tell it whether or not I WANT Revolution to treat my first column as the key? If arrays worked like I described above, it would be a simple matter to get a single column of an array, just by transposing it and getting an entire row, instead of writing complex repeat loops to get a column of data. Am I missing something here? Thanks for any wisdom you can give. I can save some helpful souls the trouble of responding by saying I am capable of making repeat loops to accomplish this. I was just hoping that maybe I was missing something and I can in fact do what I thought I could. Bob___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution -- Phil Davis PDS Labs Professional Software Development http://pdslabs.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
Split and combine only work on the last level of keys in an array, and they are a little too unwieldy for me, although I use them frequently for two-dimensional arrays and custom properties. I prefer the following: --there is no array named kitchen yet put bacon into kitchen[refrigerator][drawer][top] -- now there is an array with one value and 3 keys put cheese into kitchen[refrigerator][drawer][top] --replaces bacon --assuming 3 trays in the door put eggs into kitchen[refrigerator][door][shelf][top][tray][1] put garlic into kitchen[refrigerator][door][shelf][top][tray][2] put coffee into kitchen[refrigerator][door][shelf][top][tray][3] -- let's put part of the data into another array temporarily put kitchen[refrigerator][door][shelf][top][tray] into foodArr foodArr is two-dimensional and has 3 keys [1] eggs [2] garlic [3] coffee put butter into foodArr[2] put horseradish into foodArr[3] foodArr is two-dimensional and has 3 keys [1] eggs [2] butter [3] horseradish --now let's define a new array and put it into the big one put empty into foodArr put meat into foodArr[1] put lettuce into foodArr[2] put milk into foodArr[6] put cream into foodArr[jar in the door] --now let's put the new data into the big array put foodArr into kitchen[refrigerator][door][shelf][top] --this means that [tray] is gone -- replace by 4 keys1 2 6 jar in the door All the keys in a particular dimension have to be unique. Reusing the key means you are replacing that key's current definition Unless you really want to study multidimensional arrays and learn the code tricks, be prepared for a mind bender as you attempt to debug your code, then wonder if you could ever trust it, let alone come back next year and modify it for version 2.16a Fun, games, and then some. Jim Ault Las Vegas On Jan 10, 2010, at 5:52 AM, Thomas McGrath III wrote: Pardon my question, but I have learned more about arrays in these four posts than I ever thought about before: So given that I would want a multi-dimensional array where theData[2] [3] = Blue as in the examples provided, what is the 'best' way to enter data into this array, or is the way Bob did it the best way? Workflow: First; put 1 comma A comma Green return into theData put 2 comma B comma Blue return after theData put 3 comma C comma Orange return after theData put 4 comma D comma White return after theData Then ; split theData with cr Would this get me theData[2][3] = Blue ??? I thought the delimiter was TAB? Would this be better: put 1 tab A tab Green return into theData OR is this all wrong and if so what is the 'best' way to enter a lot data into a mutli-dimensional array to get these results?? Thank you for this. Tom McGrath III Lazy River Software 3mcgr...@comcast.net iTunes Library Suite - libITS Information and download can be found on this page: http://www.lazyriversoftware.com/RevOne.html On Jan 9, 2010, at 9:37 PM, Phil Davis wrote: Hi Bob, On 1/9/10 5:12 PM, Bob Sneidar wrote: Hi all. Apparently I am not getting arrays AT ALL. I would think that given: put 1 comma A comma Green return into theData put 2 comma B comma Blue return after theData put 3 comma C comma Orange return after theData put 4 comma D comma White return after theData which would get me: 1,A,Green 2,B,Blue 3,C,Orange 4,D,White Actually either of these: split theData with cr split theData by row -- where the rowDelimiter is CR would get you this: theData[1] = 1,A,Green theData[2] = 2,B,Blue theData[3] = 3,C,Orange theData[4] = 4,D,White I could then split by column (or by row I get confused) and get a simple array where: theData[1,1] = 1 theData[1,2] = A theData[2,1] = 2 theData[4,3] = White And so forth. However, this is NOT the case! Right. Technically speaking, comma is not an array index separator. Commas in our array keys help us conceptually represent multiple array dimensions in our own minds, but Rev sees an array with such keys as a simple one-dimensional array with alphabetic keys (since commas are not numerals). Until version 3.0, Rev couldn't handle true multi-dimensional arrays. Since then, the thing that tells Rev this is a multi- dimensional array is multiple keys per element, with each key in its own bracket. Like this: theData[1][1] = 1 theData[1][2] = A theData[1][3] = Green Now do you see why 'transpose()' wouldn't work with your array? In part it's because your keys aren't numeric - they contain commas. (Also they have to be sequential numbers.) Welcome to array re-education camp! ;-) Phil Davis If it were, I could issue a command: put transpose(theData) into myArray and: myArray[1,2] = 2 myArray[1,3] = 3 and so on. If I got the entire row (I think there's a function for that) then I would have effectively gotten the column of the original data. Seems reasonable eh? So can someone please explain to me why I
Re: Simple Arrays
While trying to rassle these arrays to the ground I tried to transpose one. The following script doesn't work. Can anyone see why? (Need some fresh eyes). -- on mouseUp put 1 into myArray[1][1] put 2 into myArray[1][2] put 3 into myArray[2][1] put 4 into myArray[2][2] put myArray[2][1] into fld 1 -- works til here put transpose(myArray) into yourArray -- causes problem put yourArray[2][1] into fld 2 end mouseUp --- From the dictionary: The array is a two-dimensional array variable whose elements are numbers, and whose keys are sequential numbers. It seems like the constraints have been met. In the above examples I assume the elements would be 1,2,3,4 ? Why would the elements be restricted to numbers? All we are doing is switching the two keys. --- Thomas, In answering the question concerning -- the 'best' way to enter Bob's data into an array -- I think the usual concern is that you are given a set of data formatted in a certain way and then you have to shoehorn it into an array. If you want the final array to resemble an Excel spreadsheet (each piece of data gets its own row and column number) then the repeat loop I posted a few messages back would do it. We can call that the easiest way until someone posts an easier one. --- Here's the code for populating an array: --- -- as an example, put your 4 lines into fld 1 --- 1,A,Green 2,B,Blue 3,C,Orange 4,D,White --- -- to get those 4 lines into a multi-dimensional -- array called myArray I think you need code -- like below (which you already know) -- There might be an easier way. --- on mouseUp put fld 1 into v set itemDelimiter to comma put zero into countLine repeat for each line curLine in v add 1 to countLine put zero into countItem repeat for each item curItem in curLine add 1 to countItem put curItem into myArray[countLine][countItem] end repeat end repeat put myArray[1][2] into fld 2 end mouseUp --- -- will end up with A in fld 2 --- --- On Sun, 1/10/10, Thomas McGrath III mcgra...@mac.com wrote: From: Thomas McGrath III mcgra...@mac.com Subject: Re: Simple Arrays To: How to use Revolution use-revolution@lists.runrev.com Date: Sunday, January 10, 2010, 7:52 AM Pardon my question, but I have learned more about arrays in these four posts than I ever thought about before: So given that I would want a multi-dimensional array where theData[2][3] = Blue as in the examples provided, what is the 'best' way to enter data into this array, or is the way Bob did it the best way? Workflow: First; put 1 comma A comma Green return into theData put 2 comma B comma Blue return after theData put 3 comma C comma Orange return after theData put 4 comma D comma White return after theData Then ; split theData with cr Would this get me theData[2][3] = Blue ??? I thought the delimiter was TAB? Would this be better: put 1 tab A tab Green return into theData OR is this all wrong and if so what is the 'best' way to enter a lot data into a mutli-dimensional array to get these results?? Thank you for this. Tom McGrath III Lazy River Software 3mcgr...@comcast.net iTunes Library Suite - libITS Information and download can be found on this page: http://www.lazyriversoftware.com/RevOne.html On Jan 9, 2010, at 9:37 PM, Phil Davis wrote: Hi Bob, On 1/9/10 5:12 PM, Bob Sneidar wrote: Hi all. Apparently I am not getting arrays AT ALL. I would think that given: put 1 comma A comma Green return into theData put 2 comma B comma Blue return after theData put 3 comma C comma Orange return after theData put 4 comma D comma White return after theData which would get me: 1,A,Green 2,B,Blue 3,C,Orange 4,D,White Actually either of these: split theData with cr split theData by row -- where the rowDelimiter is CR would get you this: theData[1] = 1,A,Green theData[2] = 2,B,Blue theData[3] = 3,C,Orange theData[4] = 4,D,White I could then split by column (or by row I get confused) and get a simple array where: theData[1,1] = 1 theData[1,2] = A theData[2,1] = 2 theData[4,3] = White And so forth. However, this is NOT the case! Right. Technically speaking, comma is not an array index separator. Commas in our array keys help us conceptually represent multiple array dimensions in our own minds, but Rev sees an array with such keys as a simple one-dimensional array with alphabetic keys (since commas are not numerals). Until version 3.0, Rev couldn't handle true multi-dimensional arrays. Since then, the thing that tells Rev this is a multi-dimensional array
Re: Simple Arrays
An array with one key and one element (value) is two dimensions myArray[1][1] is three dimensions ( two keys and one element ) Again, Rev uses associative arrays. Transpose means switching the numeric *values* for the numeric *keys*. The keys must be sequential. Excel transpose does not meant the same thing. Excel array notation and functions operate differently. Rev would use a 'table' with item j of line i of tabularData Jim Ault Las Vegas On Jan 10, 2010, at 8:55 AM, Michael Kann wrote: While trying to rassle these arrays to the ground I tried to transpose one. The following script doesn't work. Can anyone see why? (Need some fresh eyes). -- on mouseUp put 1 into myArray[1][1] put 2 into myArray[1][2] put 3 into myArray[2][1] put 4 into myArray[2][2] put myArray[2][1] into fld 1 -- works til here put transpose(myArray) into yourArray -- causes problem put yourArray[2][1] into fld 2 end mouseUp --- From the dictionary: The array is a two-dimensional array variable whose elements are numbers, and whose keys are sequential numbers. It seems like the constraints have been met. In the above examples I assume the elements would be 1,2,3,4 ? Why would the elements be restricted to numbers? All we are doing is switching the two keys. --- Thomas, In answering the question concerning -- the 'best' way to enter Bob's data into an array -- I think the usual concern is that you are given a set of data formatted in a certain way and then you have to shoehorn it into an array. If you want the final array to resemble an Excel spreadsheet (each piece of data gets its own row and column number) then the repeat loop I posted a few messages back would do it. We can call that the easiest way until someone posts an easier one. --- Here's the code for populating an array: --- -- as an example, put your 4 lines into fld 1 --- 1,A,Green 2,B,Blue 3,C,Orange 4,D,White --- -- to get those 4 lines into a multi-dimensional -- array called myArray I think you need code -- like below (which you already know) -- There might be an easier way. --- on mouseUp put fld 1 into v set itemDelimiter to comma put zero into countLine repeat for each line curLine in v add 1 to countLine put zero into countItem repeat for each item curItem in curLine add 1 to countItem put curItem into myArray[countLine][countItem] end repeat end repeat put myArray[1][2] into fld 2 end mouseUp --- -- will end up with A in fld 2 --- --- On Sun, 1/10/10, Thomas McGrath III mcgra...@mac.com wrote: From: Thomas McGrath III mcgra...@mac.com Subject: Re: Simple Arrays To: How to use Revolution use-revolution@lists.runrev.com Date: Sunday, January 10, 2010, 7:52 AM Pardon my question, but I have learned more about arrays in these four posts than I ever thought about before: So given that I would want a multi-dimensional array where theData[2][3] = Blue as in the examples provided, what is the 'best' way to enter data into this array, or is the way Bob did it the best way? Workflow: First; put 1 comma A comma Green return into theData put 2 comma B comma Blue return after theData put 3 comma C comma Orange return after theData put 4 comma D comma White return after theData Then ; split theData with cr Would this get me theData[2][3] = Blue ??? I thought the delimiter was TAB? Would this be better: put 1 tab A tab Green return into theData OR is this all wrong and if so what is the 'best' way to enter a lot data into a mutli-dimensional array to get these results?? Thank you for this. Tom McGrath III Lazy River Software 3mcgr...@comcast.net iTunes Library Suite - libITS Information and download can be found on this page: http://www.lazyriversoftware.com/RevOne.html On Jan 9, 2010, at 9:37 PM, Phil Davis wrote: Hi Bob, On 1/9/10 5:12 PM, Bob Sneidar wrote: Hi all. Apparently I am not getting arrays AT ALL. I would think that given: put 1 comma A comma Green return into theData put 2 comma B comma Blue return after theData put 3 comma C comma Orange return after theData put 4 comma D comma White return after theData which would get me: 1,A,Green 2,B,Blue 3,C,Orange 4,D,White Actually either of these: split theData with cr split theData by row -- where the rowDelimiter is CR would get you this: theData[1] = 1,A,Green theData[2] = 2,B,Blue theData[3] = 3,C,Orange theData[4] = 4,D,White I could then split by column (or by row I get confused) and get a simple array where: theData[1,1] = 1 theData[1,2] = A theData[2,1] = 2 theData[4,3] = White And so forth. However, this is NOT the case! Right. Technically speaking, comma
Re: Simple Arrays
Jim, thanks for the info. I'm really learning a lot sitting here in the coldest room in the house with the little electric heater blowing in my face. How's it in Las Vegas? Thanks for weaning me of the Excel model of transpose. I was going by the RunRev dictionary. Since I can't get transpose to work using almost the exact same example they used I assume I am missing something obvious or the docs need revision. Let's see what the dictionary has to say and see if we can get something working. Thanks again Jim for all your help. Mike --- -- the dictionary entry for transpose: --- Comments: A two-dimensional array is an array whose elements have a two-part key to describe them. You can visualize such an array as a set of rows and columns: the first part of each element's key is the row number, and the second part is the column number. For example, the expression myArray[3,2] describes the element of myArray which is in the third row, second column. The transpose function simply swaps rows for columns. In other words, for each element in the array, the corresponding element in transpose(array) has its two parts switched one for the other. The value in the third row, second column is moved to the second row, third column. The transpose function is its own inverse: you can transpose a transposed array again to recover the original array. Important! If the array has missing elements, the transposefunction will fail to work. For example, an array that contains elements myArray[1,1], myArray[1,2], and myArray[2,2] cannot be transposed because the element myArray[2,1] is missing. --- --- On Sun, 1/10/10, Jim Ault jimaultw...@yahoo.com wrote: From: Jim Ault jimaultw...@yahoo.com Subject: Re: Simple Arrays To: How to use Revolution use-revolution@lists.runrev.com Date: Sunday, January 10, 2010, 11:05 AM An array with one key and one element (value) is two dimensions myArray[1][1] is three dimensions ( two keys and one element ) Again, Rev uses associative arrays. Transpose means switching the numeric *values* for the numeric *keys*. The keys must be sequential. Excel transpose does not meant the same thing. Excel array notation and functions operate differently. Rev would use a 'table' with item j of line i of tabularData Jim Ault Las Vegas On Jan 10, 2010, at 8:55 AM, Michael Kann wrote: While trying to rassle these arrays to the ground I tried to transpose one. The following script doesn't work. Can anyone see why? (Need some fresh eyes). -- on mouseUp put 1 into myArray[1][1] put 2 into myArray[1][2] put 3 into myArray[2][1] put 4 into myArray[2][2] put myArray[2][1] into fld 1 -- works til here put transpose(myArray) into yourArray -- causes problem put yourArray[2][1] into fld 2 end mouseUp --- From the dictionary: The array is a two-dimensional array variable whose elements are numbers, and whose keys are sequential numbers. It seems like the constraints have been met. In the above examples I assume the elements would be 1,2,3,4 ? Why would the elements be restricted to numbers? All we are doing is switching the two keys. --- Thomas, In answering the question concerning -- the 'best' way to enter Bob's data into an array -- I think the usual concern is that you are given a set of data formatted in a certain way and then you have to shoehorn it into an array. If you want the final array to resemble an Excel spreadsheet (each piece of data gets its own row and column number) then the repeat loop I posted a few messages back would do it. We can call that the easiest way until someone posts an easier one. --- Here's the code for populating an array: --- -- as an example, put your 4 lines into fld 1 --- 1,A,Green 2,B,Blue 3,C,Orange 4,D,White --- -- to get those 4 lines into a multi-dimensional -- array called myArray I think you need code -- like below (which you already know) -- There might be an easier way. --- on mouseUp put fld 1 into v set itemDelimiter to comma put zero into countLine repeat for each line curLine in v add 1 to countLine put zero into countItem repeat for each item curItem in curLine add 1 to countItem put curItem into myArray[countLine][countItem] end repeat end repeat put myArray[1][2] into fld 2 end mouseUp --- -- will end up with A in fld 2
Re: Simple Arrays
Yours is not the same syntax as the example in the docs put 1 into myArray[1][1] put 2 into myArray[1][2] put 3 into myArray[2][1] put 4 into myArray[2][2] theirs put 1 into myArray[1,1] put 2 into myArray[1,2] put 3 into myArray[2,1] put 4 into myArray[2,2] But theirs does not make sense to me, since 1,1 is like 1comma1 or 1a1 if all keys are strings (except when they fall into a special category of sequential integers) Sorry I could not be of more help, but I long ago regarded arrays in Rev as NOT useful mathematical constructs. There is no ReDim or ReDim preserve in Rev arrays. Jim Ault Las Vegas On Jan 10, 2010, at 9:23 AM, Michael Kann wrote: Jim, thanks for the info. I'm really learning a lot sitting here in the coldest room in the house with the little electric heater blowing in my face. How's it in Las Vegas? Thanks for weaning me of the Excel model of transpose. I was going by the RunRev dictionary. Since I can't get transpose to work using almost the exact same example they used I assume I am missing something obvious or the docs need revision. Let's see what the dictionary has to say and see if we can get something working. Thanks again Jim for all your help. Mike --- -- the dictionary entry for transpose: --- Comments: A two-dimensional array is an array whose elements have a two-part key to describe them. You can visualize such an array as a set of rows and columns: the first part of each element's key is the row number, and the second part is the column number. For example, the expression myArray[3,2] describes the element of myArray which is in the third row, second column. The transpose function simply swaps rows for columns. In other words, for each element in the array, the corresponding element in transpose(array) has its two parts switched one for the other. The value in the third row, second column is moved to the second row, third column. The transpose function is its own inverse: you can transpose a transposed array again to recover the original array. Important! If the array has missing elements, the transposefunction will fail to work. For example, an array that contains elements myArray[1,1], myArray[1,2], and myArray[2,2] cannot be transposed because the element myArray[2,1] is missing. --- --- On Sun, 1/10/10, Jim Ault jimaultw...@yahoo.com wrote: From: Jim Ault jimaultw...@yahoo.com Subject: Re: Simple Arrays To: How to use Revolution use-revolution@lists.runrev.com Date: Sunday, January 10, 2010, 11:05 AM An array with one key and one element (value) is two dimensions myArray[1][1] is three dimensions ( two keys and one element ) Again, Rev uses associative arrays. Transpose means switching the numeric *values* for the numeric *keys*. The keys must be sequential. Excel transpose does not meant the same thing. Excel array notation and functions operate differently. Rev would use a 'table' with item j of line i of tabularData ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
Jim, thanks for the fresh eyes. My example does differ. I'll give their version a try. When I tested the -- myArray[1,1] -- format earlier I couldn't get it to work -- maybe it was just me. I do agree that the arrays in RunRev aren't that useful when you have the chunk expressions that are so convenient. I guess you need arrays for custom properties, but I never use them, either. Thanks for the reply. --- On Sun, 1/10/10, Jim Ault jimaultw...@yahoo.com wrote: From: Jim Ault jimaultw...@yahoo.com Subject: Re: Simple Arrays To: How to use Revolution use-revolution@lists.runrev.com Date: Sunday, January 10, 2010, 11:34 AM Yours is not the same syntax as the example in the docs put 1 into myArray[1][1] put 2 into myArray[1][2] put 3 into myArray[2][1] put 4 into myArray[2][2] theirs put 1 into myArray[1,1] put 2 into myArray[1,2] put 3 into myArray[2,1] put 4 into myArray[2,2] But theirs does not make sense to me, since 1,1 is like 1comma1 or 1a1 if all keys are strings (except when they fall into a special category of sequential integers) Sorry I could not be of more help, but I long ago regarded arrays in Rev as NOT useful mathematical constructs. There is no ReDim or ReDim preserve in Rev arrays. Jim Ault Las Vegas On Jan 10, 2010, at 9:23 AM, Michael Kann wrote: Jim, thanks for the info. I'm really learning a lot sitting here in the coldest room in the house with the little electric heater blowing in my face. How's it in Las Vegas? Thanks for weaning me of the Excel model of transpose. I was going by the RunRev dictionary. Since I can't get transpose to work using almost the exact same example they used I assume I am missing something obvious or the docs need revision. Let's see what the dictionary has to say and see if we can get something working. Thanks again Jim for all your help. Mike --- -- the dictionary entry for transpose: --- Comments: A two-dimensional array is an array whose elements have a two-part key to describe them. You can visualize such an array as a set of rows and columns: the first part of each element's key is the row number, and the second part is the column number. For example, the expression myArray[3,2] describes the element of myArray which is in the third row, second column. The transpose function simply swaps rows for columns. In other words, for each element in the array, the corresponding element in transpose(array) has its two parts switched one for the other. The value in the third row, second column is moved to the second row, third column. The transpose function is its own inverse: you can transpose a transposed array again to recover the original array. Important! If the array has missing elements, the transposefunction will fail to work. For example, an array that contains elements myArray[1,1], myArray[1,2], and myArray[2,2] cannot be transposed because the element myArray[2,1] is missing. --- --- On Sun, 1/10/10, Jim Ault jimaultw...@yahoo.com wrote: From: Jim Ault jimaultw...@yahoo.com Subject: Re: Simple Arrays To: How to use Revolution use-revolution@lists.runrev.com Date: Sunday, January 10, 2010, 11:05 AM An array with one key and one element (value) is two dimensions myArray[1][1] is three dimensions ( two keys and one element ) Again, Rev uses associative arrays. Transpose means switching the numeric *values* for the numeric *keys*. The keys must be sequential. Excel transpose does not meant the same thing. Excel array notation and functions operate differently. Rev would use a 'table' with item j of line i of tabularData ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
I very much appreciate this discussion about arrays and I too have learned a lot. Any chance someone has done a tutorial? Thanks and cheers, Roger Guay On Jan 10, 2010, at 10:05 AM, use-revolution-requ...@lists.runrev.com wrote: Re: Simple Arrays ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
http://www.runrev.com/developers/lessons-and-tutorials/tutorials/intermediate-arrays/ http://lessons.runrev.com/spaces/lessons/buckets/784/lessons/7810-How-do-I-display-an-array-in-a-table-field- --- On Sun, 1/10/10, Roger Guay i...@mac.com wrote: From: Roger Guay i...@mac.com Subject: Re: Simple Arrays To: use-revolution@lists.runrev.com Date: Sunday, January 10, 2010, 11:43 AM I very much appreciate this discussion about arrays and I too have learned a lot. Any chance someone has done a tutorial? Thanks and cheers, Roger Guay On Jan 10, 2010, at 10:05 AM, use-revolution-requ...@lists.runrev.com wrote: Re: Simple Arrays ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
More goodies: http://www.runrev.com/newsletter/july/issue53/newsletter1.php More baddies: It looks like the extents function only works for one dimension of an array on mouseUp put uno_uno into a[1][1] put uno_dos into a[1][2] put dos_uno into a[2][1] put dos_dos into a[2][2] put the extents of a into fld 1 end mouseUp -- fld 1 will have 1,2 -- just one line -- according to the dictionary we should get 2 lines, one for each dimension Use the extents function to find the minimum and maximum row and column numbers of an array whose keys are integers. Parameters: The array is any array of any dimension whose keys are numbers. Value: The extents function returns one line for each dimension of the array. Each line contains two numbers separated by commas. The first item is the lowest key number in that dimension, and the second item is the highest key number. Comments: If any of the keys of the array is non-numeric, the extents function returns empty. --- On Sun, 1/10/10, Roger Guay i...@mac.com wrote: From: Roger Guay i...@mac.com Subject: Re: Simple Arrays To: use-revolution@lists.runrev.com Date: Sunday, January 10, 2010, 11:43 AM I very much appreciate this discussion about arrays and I too have learned a lot. Any chance someone has done a tutorial? Thanks and cheers, Roger Guay On Jan 10, 2010, at 10:05 AM, use-revolution-requ...@lists.runrev.com wrote: Re: Simple Arrays ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
All this discussion of arrays inspired me to create a general-purpose function that 'splits' table data into an array. It will handle data that has any number of 'lookup key' items before the final 'lookup data' item in each row. Some sample data: 1,1,1,data111 1,1,2,data112 1,1,3,data113 1,2,1,data121 1,2,2,data122 1,3,1,data131 1,3,2,data132 1,3,3,data133 1,3,4,data134 2,1,1,data211 2,1,2,data212 2,2,1,data221 2,2,2,data222 2,2,3,data223 2,2,4,data224 2,2,5,data225 The code (watch for line wraps): on mouseUp put table_Split(fld 2,,comma) into tArray -- then do things with array data end mouseUp function table_Split pTable, pLineDel, pItemDel #--- # pTable = REQUIRED rows of column data, where # .all rows have the same number of columns # .cols 1 to -2 of each row are the lookup keys for the value # .col -1 of each row is the value to be looked up # pLineDel = OPTIONAL non-CR line delimiter used in pTable # pItemDel = OPTIONAL non-tab item delimiter used in pTable #--- local vArray -- make sure variable exists for 'do' command -- prep if pLineDel = empty then put CR into pLineDel if pItemDel = empty then put tab into pItemDel set the itemDel to pItemDel set the lineDel to pLineDel filter pTable without empty -- remove blank lines from data repeat for each line tLine in pTable -- prep key put vArray[ quote item 1 to -2 of tLine quote ] into tArrayElementName replace pItemDel with (quote ][ quote) in tArrayElementName -- store data item in array element do (put last item of tLine into tArrayElementName) end repeat put vArray into tArray delete variable vArray -- so it will be empty next time through return tArray end table_Split You can set a breakpoint at the return tArray line to see the array in the script editor's variable viewer. The things some people do for fun... ;-) -- Phil Davis PDS Labs Professional Software Development http://pdslabs.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Simple Arrays
Hi all. Apparently I am not getting arrays AT ALL. I would think that given: put 1 comma A comma Green return into theData put 2 comma B comma Blue return after theData put 3 comma C comma Orange return after theData put 4 comma D comma White return after theData which would get me: 1,A,Green 2,B,Blue 3,C,Orange 4,D,White I could then split by column (or by row I get confused) and get a simple array where: theData[1,1] = 1 theData[1,2] = A theData[2,1] = 2 theData[4,3] = White And so forth. However, this is NOT the case! If it were, I could issue a command: put transpose(theData) into myArray and: myArray[1,2] = 2 myArray[1,3] = 3 and so on. If I got the entire row (I think there's a function for that) then I would have effectively gotten the column of the original data. Seems reasonable eh? So can someone please explain to me why I cannot get a simple x,y row,column grid-like array using these simple commands? Revolution seems to think that the first column MUST be the key! I would LIKE for revolution to simply create it's OWN numerical keys and let my data be my data. Maybe in the future add an argument to the split and combine commands to tell it whether or not I WANT Revolution to treat my first column as the key? If arrays worked like I described above, it would be a simple matter to get a single column of an array, just by transposing it and getting an entire row, instead of writing complex repeat loops to get a column of data. Am I missing something here? Thanks for any wisdom you can give. I can save some helpful souls the trouble of responding by saying I am capable of making repeat loops to accomplish this. I was just hoping that maybe I was missing something and I can in fact do what I thought I could. Bob___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
Bob, Maybe we can learn something about arrays together. First, the format for a multi-dimensional array is theData[1][1] = 1 NOT theData[1,1] = 1 --- -- as an example, put your 4 lines into fld 1 --- 1,A,Green 2,B,Blue 3,C,Orange 4,D,White --- -- to get those 4 lines into a multi-dimensional -- array called myArray I think you need code -- like below (which you already know) -- There might be an easier way. --- on mouseUp put fld 1 into v set itemDelimiter to comma put zero into countLine repeat for each line curLine in v add 1 to countLine put zero into countItem repeat for each item curItem in curLine add 1 to countItem put curItem into myArray[countLine][countItem] end repeat end repeat put myArray[1][2] into fld 2 end mouseUp --- -- will end up with A in fld 2 Now for the transpose function. From the dictionary: -- The array is a two-dimensional array variable whose elements are numbers, and whose keys are sequential numbers. -- So it looks like transpose will only work for two-dimensional arrays. It won't work for your example. --- On Sat, 1/9/10, Bob Sneidar b...@twft.com wrote: From: Bob Sneidar b...@twft.com Subject: Simple Arrays To: How to use Revolution use-revolution@lists.runrev.com Date: Saturday, January 9, 2010, 7:12 PM Hi all. Apparently I am not getting arrays AT ALL. I would think that given: put 1 comma A comma Green return into theData put 2 comma B comma Blue return after theData put 3 comma C comma Orange return after theData put 4 comma D comma White return after theData which would get me: 1,A,Green 2,B,Blue 3,C,Orange 4,D,White I could then split by column (or by row I get confused) and get a simple array where: theData[1,1] = 1 theData[1,2] = A theData[2,1] = 2 theData[4,3] = White And so forth. However, this is NOT the case! If it were, I could issue a command: put transpose(theData) into myArray and: myArray[1,2] = 2 myArray[1,3] = 3 and so on. If I got the entire row (I think there's a function for that) then I would have effectively gotten the column of the original data. Seems reasonable eh? So can someone please explain to me why I cannot get a simple x,y row,column grid-like array using these simple commands? Revolution seems to think that the first column MUST be the key! I would LIKE for revolution to simply create it's OWN numerical keys and let my data be my data. Maybe in the future add an argument to the split and combine commands to tell it whether or not I WANT Revolution to treat my first column as the key? If arrays worked like I described above, it would be a simple matter to get a single column of an array, just by transposing it and getting an entire row, instead of writing complex repeat loops to get a column of data. Am I missing something here? Thanks for any wisdom you can give. I can save some helpful souls the trouble of responding by saying I am capable of making repeat loops to accomplish this. I was just hoping that maybe I was missing something and I can in fact do what I thought I could. Bob___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Simple Arrays
Hi Bob, On 1/9/10 5:12 PM, Bob Sneidar wrote: Hi all. Apparently I am not getting arrays AT ALL. I would think that given: put 1 comma A comma Green return into theData put 2 comma B comma Blue return after theData put 3 comma C comma Orange return after theData put 4 comma D comma White return after theData which would get me: 1,A,Green 2,B,Blue 3,C,Orange 4,D,White Actually either of these: split theData with cr split theData by row -- where the rowDelimiter is CR would get you this: theData[1] = 1,A,Green theData[2] = 2,B,Blue theData[3] = 3,C,Orange theData[4] = 4,D,White I could then split by column (or by row I get confused) and get a simple array where: theData[1,1] = 1 theData[1,2] = A theData[2,1] = 2 theData[4,3] = White And so forth. However, this is NOT the case! Right. Technically speaking, comma is not an array index separator. Commas in our array keys help us conceptually represent multiple array dimensions in our own minds, but Rev sees an array with such keys as a simple one-dimensional array with alphabetic keys (since commas are not numerals). Until version 3.0, Rev couldn't handle true multi-dimensional arrays. Since then, the thing that tells Rev this is a multi-dimensional array is multiple keys per element, with each key in its own bracket. Like this: theData[1][1] = 1 theData[1][2] = A theData[1][3] = Green Now do you see why 'transpose()' wouldn't work with your array? In part it's because your keys aren't numeric - they contain commas. (Also they have to be sequential numbers.) Welcome to array re-education camp! ;-) Phil Davis If it were, I could issue a command: put transpose(theData) into myArray and: myArray[1,2] = 2 myArray[1,3] = 3 and so on. If I got the entire row (I think there's a function for that) then I would have effectively gotten the column of the original data. Seems reasonable eh? So can someone please explain to me why I cannot get a simple x,y row,column grid-like array using these simple commands? Revolution seems to think that the first column MUST be the key! I would LIKE for revolution to simply create it's OWN numerical keys and let my data be my data. Maybe in the future add an argument to the split and combine commands to tell it whether or not I WANT Revolution to treat my first column as the key? If arrays worked like I described above, it would be a simple matter to get a single column of an array, just by transposing it and getting an entire row, instead of writing complex repeat loops to get a column of data. Am I missing something here? Thanks for any wisdom you can give. I can save some helpful souls the trouble of responding by saying I am capable of making repeat loops to accomplish this. I was just hoping that maybe I was missing something and I can in fact do what I thought I could. Bob___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution -- Phil Davis PDS Labs Professional Software Development http://pdslabs.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Chunks vs Arrays - surprising benchmarking results
Paul Looney wrote: I have nothing to add directly to the chunk vs array discussion (Trevor's reply was very good) but I have often found it helpful to increase the speed of compound selections by breaking them into individual ones. For instance if you have a large database of names and sexes and you want to select every female named Jan (Jan could be male or female). Select all of the Jans first (this will run much faster than the compound selection). Then select all of the females from the result of the first selection (this will run faster because it is searching only Jans - a very small list). This double selection will run faster than a single compound selection. Obviously this requires a known data-set where one filter will eliminate a lot of records (selecting female, then selecting Jan would be much slower in our example because, presumably, half of the list is female and a small portion is Jan). On many lists this can create a much bigger speed difference than chunk vs array variance you noted. One of the tough challenges with this sort of benchmarking is that different methods will favor different test cases. But with delimited rows and columns, I haven't found a way to make a two-pass search run faster than one pass, except in very specialized cases as you noted. There's a temptation to use the filter command for the first pass, but filter is only faster when testing the first few items; filtering on the 10th item is much slower, and attempting to test the 50th item in a sample data set caused Rev to hang. RegEx is a harsh mistress. In my case, I don't often know in advance which item will be searched. The queries I'm running usually come from a Search dialog in which the user can specify criteria. I could make the search function smart enough to special-case certain types of searches to use a two-pass method in which the first pass is the filter command where practical, but the overhead of analyzing both the query and the data to make such determinations may detract from the benefits of doing so, esp. since my continued testing on this is increasingly nudging me toward multi-dimensional arrays anyway. Even with the data bloat and the surprising overhead of moving arrays in and out of storage, with a little extra work to deal with those the performance of arrays seems unbeatable in the broadest range of use cases I've run thus far. -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Chunks vs Arrays - surprising benchmarking results
Richard, Very true. Especially regarding the limitations of the filter. The multiple search works best with hardwired searches and searches where the user selects from a series of pop-up or radio buttons. It works well when you are generating canned lists. PL On Aug 7, 2009, at 10:22 AM, Richard Gaskin wrote: Paul Looney wrote: I have nothing to add directly to the chunk vs array discussion (Trevor's reply was very good) but I have often found it helpful to increase the speed of compound selections by breaking them into individual ones. For instance if you have a large database of names and sexes and you want to select every female named Jan (Jan could be male or female). Select all of the Jans first (this will run much faster than the compound selection). Then select all of the females from the result of the first selection (this will run faster because it is searching only Jans - a very small list). This double selection will run faster than a single compound selection. Obviously this requires a known data-set where one filter will eliminate a lot of records (selecting female, then selecting Jan would be much slower in our example because, presumably, half of the list is female and a small portion is Jan). On many lists this can create a much bigger speed difference than chunk vs array variance you noted. One of the tough challenges with this sort of benchmarking is that different methods will favor different test cases. But with delimited rows and columns, I haven't found a way to make a two-pass search run faster than one pass, except in very specialized cases as you noted. There's a temptation to use the filter command for the first pass, but filter is only faster when testing the first few items; filtering on the 10th item is much slower, and attempting to test the 50th item in a sample data set caused Rev to hang. RegEx is a harsh mistress. In my case, I don't often know in advance which item will be searched. The queries I'm running usually come from a Search dialog in which the user can specify criteria. I could make the search function smart enough to special-case certain types of searches to use a two-pass method in which the first pass is the filter command where practical, but the overhead of analyzing both the query and the data to make such determinations may detract from the benefits of doing so, esp. since my continued testing on this is increasingly nudging me toward multi-dimensional arrays anyway. Even with the data bloat and the surprising overhead of moving arrays in and out of storage, with a little extra work to deal with those the performance of arrays seems unbeatable in the broadest range of use cases I've run thus far. -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Chunks vs Arrays - surprising benchmarking results
Kevin Miller wrote: On 05/08/2009 21:02, Richard Gaskin ambassador at fourthworld.com wrote: Excellent sleuthing, Trevor. Confirmed: with that change I'm getting the same results. Who would have thought there could be so much overhead moving a custom property array into a variable array? Bear in mind that when retrieving a custom property, the engine has to look up whether there is a getProp handler for it. Locking messages should give you an improvement. In my tests here the difference was measurable but minor, but then again I have no getProp handlers in the message path for these tests. The main difference between arrays and chunks is that arrays will continue to access huge data sets in linear time, whereas chunks (depending on exactly what you're doing) will slow down as the data set gets larger. Very true, though the difference becomes most significant only when the data is large enough that it may be a good time to consider SQLite over stack files for storage anyway. :) In my tests I ran three sets of data: small: 5000 records, with 50 items in each record, with 50 chars in each item medium: 10,000 records with 100 items in each record, with 100 chars in each item large: 10,000 records with 100 items in each record, with 200 chars in each item I put both the delimited and array data into the same stack for each, giving me a size for the small stack of about 27MB, medium was about 204MB, and large was over 408MB. The small data set performed well with both methods, as did medium although the medium stack took some time to load (confirming my hunch that 100MB of data is probably a good boundary to consider using SQLite over stack files, but fortunately I'm using this just for document files so it's unlikely I'll ever reach even half that). The large data set could be created and saved, but the resulting stack could not be opened; no corruption warning, just wouldn't open. Have I discovered an undocumented limitation? The results were as we would expect: as the data grows in size, performance of the array search method scales linearly, while performance for chunk expressions degrade in logarithmic proportion to data length. Even so, chunk expressions consistently outperformed arrays in tests which included loading the data from properties. When I altered the test to preload the data into vars before testing, the difference in performance was just under an order of magnitude greater in favor of arrays. While this means changing my setup to preload data when documents are first opened, this one-time hit is more than compensated by ongoing performance enhancement for nearly all other operations. So I'm strongly favoring arrays for this sort of thing, but it would be nice to have three enhancements in the engine to make it even better: 1. faster load time --- Can the operation which moves data from array custom props into array variables be optimized to reduce the surprising amount of time it takes? Grabbing a non-array property is nearly as fast as accessing a global; it'd be nice if accessing array props were at least a bit closer to that stellar performance. 2. operate directly on properties - It would be very handy if we could use the same array syntax to work with properties as we can with variables. Before multi-dimensional arrays there was an enjoyable, learnable, and efficient parity in the syntax used for arrays in both vars and props, and I miss that when working with nested arrays. 3. reduce data redundancy in keys - Given that Rev's arrays are associative every element is a name-value pair, so in addition to storing the value it needs to also store the name as its key. This is necessary because for all the engines knows every array may contain unique keys, but when making nested arrays in which the inner arrays are all uniform the replicated key names just take up space. For example, with the Congress contact info I used in my original example, it's only 530 lines with less than 1/2k per line, so tucking that into a property in a new stack gives me a size for that stack file of about 68k. But when I make an array version of that data and store that into a property in another stack, using meaningful names for those elements (e.g., Name, Address, Telephone, etc.) brings that stack size up to 132k - more than double. So I was daydreaming: what if we could tell the engine that a given array is to be populated only with sub-arrays in which all keys will always be the same? Imagine being able to define something like a struct, a definition of an array which could be assigned to another array so that parent array would be able to store the data more efficiently, tucking only the data into its nifty hash without having to replicate the field names for every element. I would imagine such a struct-like thing would
Re: Chunks vs Arrays - surprising benchmarking results
On 05/08/2009 21:02, Richard Gaskin ambassa...@fourthworld.com wrote: Excellent sleuthing, Trevor. Confirmed: with that change I'm getting the same results. Who would have thought there could be so much overhead moving a custom property array into a variable array? Bear in mind that when retrieving a custom property, the engine has to look up whether there is a getProp handler for it. Locking messages should give you an improvement. The main difference between arrays and chunks is that arrays will continue to access huge data sets in linear time, whereas chunks (depending on exactly what you're doing) will slow down as the data set gets larger. Kind regards, Kevin Kevin Miller ~ ke...@runrev.com ~ http://www.runrev.com/ Runtime Revolution - User-Centric Development Tools ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Chunks vs Arrays - surprising benchmarking results
The Multi dimensional array filtering thread reminded me of a benchmarking test I've been wanting to do for some time, and since I have some tasks coming up on a client project which needs this sort of stuff it was a good time to dive in. The goal is simple enough: one of the most common tasks I need to perform with my data is querying specific fields for criteria, and if there's a match then assembling the data from a given set of fields for display in a list to the user. I've been using simple tab-delimited lists for this data because it was about as compact as it could be and performs reasonably well. But with multi-dimensional arrays, the question is whether Rev's fast hash index into array data might help me gather the data from specific fields in each record faster than using chunk expressions. So I took a minute to put together a simple test stack: http://fourthworldlabs.com/rev/speed%20test%20chunks%20vs%20arrays.rev.zip It has a field containing a list of contact info, another field for displaying the test results, and a third for displaying the gathered data from the query so I can verify that it's doing what I want it to. If you download the stack you'll see that in addition to the Test button there's another one there which converts the list data into an array and stores that in a custom property of the field, needed for testing the array method. The code for the Test button is below, and I would appreciate anyone here who has the time to look it over and see what I may have missed, because the results I'm getting are not what I expected. The test script is typical of many of the tasks I need to perform on this data: it checks one field to see if it contains a value, checks another to see if it contains a different value, and if both are true it collects data from three fields into a tab- and return-delimited list so I can drop it into a list field to display the output. I had assumed that using chunk expressions to access items in each line would be slower than using array notation to get them through the hash in the array. But instead here's the result I'm getting (times are in milliseconds for 100 iterations): GetFromList: 72 GetFromSubArray: 752 GetFromMainArray: 407 All results the same?: true As noted in the code below, the GetFromList handler uses simple chunk expressions to parse the data; GetFromSubArray uses repeat for each element to parse out the second-tier array within each record; GetFromMainArray walks through the keys to get the data from the main array by addressing both dimensions; the last line simply lets me know that all three are returning the same result. I can understand why GetFromSubArray is the slowest, since it has to instantiate an array for the second-tier array each time through the loop (using repeat for each element...). But I had hoped that accessing the main array by specifying the elements in both dimensions would get to the data more quickly than would be needed when asking the engine to count items, but apparently not. Of course there is a scaling issue with chunk expressions. In my sample data there are only eight items in each record, but if there were several hundred I would imagine it wouldn't perform as well as the array methods. But in my case most of the data I work with has fewer than 30 fields and since chunk expressions are measuring about five times faster I would expect I'd need many more than that before chunk expressions drop below arrays in relative performance. The same could be said of the size of the data within each item, since that will adversely affect the time the engine needs to walk through it looking for item delimiters. But again, it's not often that I have field data that's very long (the contact list is a good example, in which the longest field data is under 200 chars), and the engine's seeking of delimiters seems reasonably efficient. Another minor drawback to arrays for this sort of thing is what it does to the size of the data, esp. if you use meaningful names for your fields rather than just numbers: while simple tab-delimited data needs only one set of field names and a function to translate those into item numbers before dropping into any loop that uses them, arrays replicate the field names for each record. The longer the field names, the more impact this will have on data size. I'd be happy to accept this as a trade-off if the speed justified it, but in my test the speed benefit just isn't there for this type of querying task. Any thoughts on how I might optimize the array functions? Did I just overlook something obvious which would make them run faster? -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com -- code for Test button - on mouseUp put empty into fld Results put empty into fld Output wait
Re: Chunks vs Arrays - surprising benchmarking results
On Aug 5, 2009, at 3:05 PM, Richard Gaskin wrote: Any thoughts on how I might optimize the array functions? Did I just overlook something obvious which would make them run faster? Richard, The main slowdown in your test for GetFromMainArray seems to be in transferring the data from the custom property to tDataA. This is consistent with my findings when implementing persistent data storage in the data grid. I changed the code a bit so that the field contents and uData custom prop array were put into script locals outside of the timers. Here is what I got: GetFromList: 30 GetFromSubArray: 244 GetFromMainArray: 27 All results the same?: true So if your data is already in a script local then arrays seem to be faster. Regards, -- Trevor DeVore Blue Mango Learning Systems www.bluemangolearning.com-www.screensteps.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Chunks vs Arrays - surprising benchmarking results
Trevor DeVore wrote: On Aug 5, 2009, at 3:05 PM, Richard Gaskin wrote: Any thoughts on how I might optimize the array functions? Did I just overlook something obvious which would make them run faster? Richard, The main slowdown in your test for GetFromMainArray seems to be in transferring the data from the custom property to tDataA. This is consistent with my findings when implementing persistent data storage in the data grid. I changed the code a bit so that the field contents and uData custom prop array were put into script locals outside of the timers. Here is what I got: GetFromList: 30 GetFromSubArray: 244 GetFromMainArray: 27 All results the same?: true So if your data is already in a script local then arrays seem to be faster. Excellent sleuthing, Trevor. Confirmed: with that change I'm getting the same results. Who would have thought there could be so much overhead moving a custom property array into a variable array? Unfortunately for my case, this data is only one of several tables stored in user documents. I could move all the data out of the stack file I'm using for the document into a global when the document is opened, and could even use a master array within the global to keep the data from different open documents separate, but that adds another layer of management and the increase in data size for a speed gain of 0.03ms per iteration. I had hoped that I might be able to get around the need to copy the data out of the properties by using array notation directly on those properties, but alas it doesn't seem the property array syntax is yet parallel with variable array syntax as it used to be before we got multi-dimensional arrays. I'll think this over, but so far the two methods are so close in performance that I'm inclined to stick with what's in place with chunk expressions for now. Thanks again for finding the bottleneck in the data loading. That's valuable info. -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Chunks vs Arrays - surprising benchmarking results
I had hoped that I might be able to get around the need to copy the data out of the properties by using array notation directly on those properties, but alas it doesn't seem the property array syntax is yet parallel with variable array syntax as it used to be before we got multi-dimensional arrays. Yes, this is unfortunate. Being able to access multi-dimensional arrays as stored in an object would be very useful. Regards, -- Trevor DeVore Blue Mango Learning Systems www.bluemangolearning.com-www.screensteps.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Chunks vs Arrays - surprising benchmarking results
Richard, I have nothing to add directly to the chunk vs array discussion (Trevor's reply was very good) but I have often found it helpful to increase the speed of compound selections by breaking them into individual ones. For instance if you have a large database of names and sexes and you want to select every female named Jan (Jan could be male or female). Select all of the Jans first (this will run much faster than the compound selection). Then select all of the females from the result of the first selection (this will run faster because it is searching only Jans - a very small list). This double selection will run faster than a single compound selection. Obviously this requires a known data-set where one filter will eliminate a lot of records (selecting female, then selecting Jan would be much slower in our example because, presumably, half of the list is female and a small portion is Jan). On many lists this can create a much bigger speed difference than chunk vs array variance you noted. Paul Looney On Aug 5, 2009, at 12:05 PM, Richard Gaskin wrote: The Multi dimensional array filtering thread reminded me of a benchmarking test I've been wanting to do for some time, and since I have some tasks coming up on a client project which needs this sort of stuff it was a good time to dive in. The goal is simple enough: one of the most common tasks I need to perform with my data is querying specific fields for criteria, and if there's a match then assembling the data from a given set of fields for display in a list to the user. I've been using simple tab-delimited lists for this data because it was about as compact as it could be and performs reasonably well. But with multi-dimensional arrays, the question is whether Rev's fast hash index into array data might help me gather the data from specific fields in each record faster than using chunk expressions. So I took a minute to put together a simple test stack: http://fourthworldlabs.com/rev/speed%20test%20chunks%20vs% 20arrays.rev.zip It has a field containing a list of contact info, another field for displaying the test results, and a third for displaying the gathered data from the query so I can verify that it's doing what I want it to. If you download the stack you'll see that in addition to the Test button there's another one there which converts the list data into an array and stores that in a custom property of the field, needed for testing the array method. The code for the Test button is below, and I would appreciate anyone here who has the time to look it over and see what I may have missed, because the results I'm getting are not what I expected. The test script is typical of many of the tasks I need to perform on this data: it checks one field to see if it contains a value, checks another to see if it contains a different value, and if both are true it collects data from three fields into a tab- and return- delimited list so I can drop it into a list field to display the output. I had assumed that using chunk expressions to access items in each line would be slower than using array notation to get them through the hash in the array. But instead here's the result I'm getting (times are in milliseconds for 100 iterations): GetFromList: 72 GetFromSubArray: 752 GetFromMainArray: 407 All results the same?: true As noted in the code below, the GetFromList handler uses simple chunk expressions to parse the data; GetFromSubArray uses repeat for each element to parse out the second-tier array within each record; GetFromMainArray walks through the keys to get the data from the main array by addressing both dimensions; the last line simply lets me know that all three are returning the same result. I can understand why GetFromSubArray is the slowest, since it has to instantiate an array for the second-tier array each time through the loop (using repeat for each element...). But I had hoped that accessing the main array by specifying the elements in both dimensions would get to the data more quickly than would be needed when asking the engine to count items, but apparently not. Of course there is a scaling issue with chunk expressions. In my sample data there are only eight items in each record, but if there were several hundred I would imagine it wouldn't perform as well as the array methods. But in my case most of the data I work with has fewer than 30 fields and since chunk expressions are measuring about five times faster I would expect I'd need many more than that before chunk expressions drop below arrays in relative performance. The same could be said of the size of the data within each item, since that will adversely affect the time the engine needs to walk through it looking for item delimiters. But again, it's not often that I have field data that's very long (the contact list is a good example
Re: arrays
The filter command is one of those things that you can stare at for a while, but it doesn't really click until you have a use for it. Then whole new worlds open up. On major caveat on filter though, and that is that the closer to the left edge of a line the filter is acting on (or the less complex the filter), the faster it will run. For example, let's say you have 2000 lines of data that's formatted into 10 columns (tab-separated). If you want to search for the string test in the first column, the filter is something like: *test* If you want to look to see if it's in the second column, it would be: .* tab *test* and the third column would be: .* tab .* tab *test* etc. Using this approach, filtering in column 10 is WAY slower than filtering in column 1. Anyway, just wanted to bring up that filter can be really fast, but when it gets slow you'll want to pick another method. Ken Ray Sons of Thunder Software, Inc. Email: k...@sonsothunder.com Web Site: http://www.sonsothunder.com/ ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays
Hi Tom, Assuming your data is in a variable called tData, and is structured like this: Elliot and Cooper Roads, sparrow Elliot and Cooper Roads, magpie Elliot and Cooper Roads, dove Elliot and Cooper Roads, owl Downing Street, sparrow this will give you a list of the birds in Elliot and Cooper Roads: put tData into tSubset put Elliot and Cooper Roads into tRoadName filter tSubset with (tRoadName *) replace (tRoadName comma space) with empty in tSubset tSubset now contains a list of bird types from tRoadName. If you want to extract each road name and get the list of birds seen at that place, then you will need to loop over the whole list to associate all the birds from a place with just that name. It would probably be easier to be using an array for this. In case you are having trouble imagining it as an array, I generally think of arrays in Rev as dictionaries. That is, each identifier in the array is unique like the head words in the dictionary, and each has data associated with it. If you used an array (a dictionary) then each road name would be like a word you look up in the dictionary. When you wanted to add an observation made at a particular road it would be as easy as this: put sparrow return after tObservationDictionary[tRoadName] To get all the birds for 1 road you would do this: put tObservationDictionary[tRoadName] into tBirdList To get a list of all the roads, it would be: put the keys of tObservationDictionary Hope that helps. Bernard ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
re: arrays
Thank you Sarah, Mark and the rest! I'm so basic sometimes. Filter? Duh! After all this time, I don't know the basics. With the filter scripting, I can winnow the data down into manageable chunks before I do anything, and there is no speed issue at all. I'm blazing through this data and who the heck needs sql? This is TOO much fun. I'm staying in Rev. ¡Viva la Causa! Many thanks, Tom in Arizona___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: arrays
Tom- The filter command is one of those things that you can stare at for a while, but it doesn't really click until you have a use for it. Then whole new worlds open up. -- -Mark Wieder mwie...@ahsoftware.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays instead of Sql
Tom, sort the data in variable instead of field using field only to display results, not for the data processing, or at least lock screen before sorting and then unlock screen. This will be much faster. When putting data into field again lock screen and unlock afterwards. This will prevent field trying (slowwwly) to display its contents while these are being loaded into it. Viktoras Tom Cole wrote: I've heard that instead of using a backend like sql to manage a database, I could stay in Revolution and use arrays. I know nothing of arrays. I've written here before about a bird database I have. Several times. Forgive. I just have a few items in a record: birdname,birdnotes,place,placenotes,date However, there are about 18000 birds (records) and I've got them all in one field in Rev now and it's too slow to sort. If I have to learn sql and so on, this may never get done, but if I stay in my familiar Rev environment I will be off and running. Is there a sample database stack where someone has used arrays to store the data for fast retrieval or some related script to help me learn how arrays could be used? How can I place those records in arrays and then draw data to make cool sorts and views? I'm not new at all to Rev; only to arrays. I just need ideas on how to sort the data fast. Thanks (again!) Tom in Arizona ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays
Sarah, Thanks. The sorts are MUCH faster when done in a variable. I'm not sure of the advantage of storing data in a custom property, but it's nice to know about. I'm forgetting arrays because now I need do only one thing to be burning through the data. I have bird watching PLACES as one item. One is called Elliot and Cooper Roads. I've been to that street corner hundreds of times, and since I have seen over 8000 birds there, there are more than 8000 records. I can put all of the records for this street corner at the top of the field (actually the top of the variable). Elliot and Cooper Roads FIRST VISIT TO THIS PLACE Elliot and Cooper Roads Elliot and Cooper Roads Elliot and Cooper Roads ... thousands more ... thousands more ... thousands more Elliot and Cooper Roads LAST VISIT TO THIS PLACE Other Places Other Places Other Places All I need is have a way to cut and paste from the first record for Elliot and Cooper Roads to the last and leave out the rest of the places. Of course, I could write a repeating script that would gobble up the data a line at a time, but it would take forever. How can I scoop all the Elliot and Cooper records out of the data in one fell swoop? If someone could show me how to do this, then I could employ it everywhere and my flat database would be screamin' fast and I would stay in Revolution. I'm almost there! Tom in Arizona ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays
Hi Tom, maybe something like this will do: replace Elliot and Cooper Roads with Elliot and Cooper Roads [whatever needs to be paste] return in yourVariableWithData? Viktoras Tom Cole wrote: Sarah, Thanks. The sorts are MUCH faster when done in a variable. I'm not sure of the advantage of storing data in a custom property, but it's nice to know about. I'm forgetting arrays because now I need do only one thing to be burning through the data. I have bird watching PLACES as one item. One is called Elliot and Cooper Roads. I've been to that street corner hundreds of times, and since I have seen over 8000 birds there, there are more than 8000 records. I can put all of the records for this street corner at the top of the field (actually the top of the variable). Elliot and Cooper RoadsFIRST VISIT TO THIS PLACE Elliot and Cooper Roads Elliot and Cooper Roads Elliot and Cooper Roads ... thousands more ... thousands more ... thousands more Elliot and Cooper Roads LAST VISIT TO THIS PLACE Other Places Other Places Other Places All I need is have a way to cut and paste from the first record for Elliot and Cooper Roads to the last and leave out the rest of the places. Of course, I could write a repeating script that would gobble up the data a line at a time, but it would take forever. How can I scoop all the Elliot and Cooper records out of the data in one fell swoop? If someone could show me how to do this, then I could employ it everywhere and my flat database would be screamin' fast and I would stay in Revolution. I'm almost there! Tom in Arizona ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays
Tom Cole wrote: I have bird watching PLACES as one item. One is called Elliot and Cooper Roads. I've been to that street corner hundreds of times, and since I have seen over 8000 birds there, there are more than 8000 records. I can put all of the records for this street corner at the top of the field (actually the top of the variable). Elliot and Cooper RoadsFIRST VISIT TO THIS PLACE Elliot and Cooper Roads Elliot and Cooper Roads Elliot and Cooper Roads ... thousands more ... thousands more ... thousands more Elliot and Cooper Roads LAST VISIT TO THIS PLACE Other Places Other Places Other Places All I need is have a way to cut and paste from the first record for Elliot and Cooper Roads to the last and leave out the rest of the places. Do you mean you want to set the clipboard from a script? Something like this might do it: put myBigPlaceList into temp -- make a copy, because we will alter it filter temp with Elliot and Cooper Roads set the clipboardData[text'] to temp -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays
Tom- Tuesday, May 19, 2009, 9:04:06 AM, you wrote: If someone could show me how to do this, then I could employ it everywhere and my flat database would be screamin' fast and I would stay in Revolution. filter tVariable with Elliot and Cooper Roads* -- -Mark Wieder mwie...@ahsoftware.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays
On Wed, May 20, 2009 at 6:47 AM, Mark Wieder mwie...@ahsoftware.net wrote: Tom- Tuesday, May 19, 2009, 9:04:06 AM, you wrote: If someone could show me how to do this, then I could employ it everywhere and my flat database would be screamin' fast and I would stay in Revolution. filter tVariable with Elliot and Cooper Roads* Just remember that you need to use * to indicate to the filter command that you will accept lines with more than just Elliot and Cooper Roads. filter tVariable with Elliot and Cooper Roads gives only the lines with no data except Elliot and Cooper Roads. filter tVariable with Elliot and Cooper Roads* gives only the lines that start with Elliot and Cooper Roads. filter tVariable with *Elliot and Cooper Roads* gives all the lines containing Elliot and Cooper Roads. Cheers, Sarah ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays
Tom- Tuesday, May 19, 2009, 2:07:32 PM, Sarah wrote: Just remember that you need to use * to indicate to the filter command that you will accept lines with more than just Elliot and Cooper Roads. Yes, Sarah's right about this. I was assuming from the pseudodata that each entry started with Elliot and Cooper Roads, but you know what happens when you assume things... -- -Mark Wieder mwie...@ahsoftware.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Arrays instead of Sql
I've heard that instead of using a backend like sql to manage a database, I could stay in Revolution and use arrays. I know nothing of arrays. I've written here before about a bird database I have. Several times. Forgive. I just have a few items in a record: birdname,birdnotes,place,placenotes,date However, there are about 18000 birds (records) and I've got them all in one field in Rev now and it's too slow to sort. If I have to learn sql and so on, this may never get done, but if I stay in my familiar Rev environment I will be off and running. Is there a sample database stack where someone has used arrays to store the data for fast retrieval or some related script to help me learn how arrays could be used? How can I place those records in arrays and then draw data to make cool sorts and views? I'm not new at all to Rev; only to arrays. I just need ideas on how to sort the data fast. Thanks (again!) Tom in Arizona ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays instead of Sql
On Tue, May 19, 2009 at 10:30 AM, Tom Cole tom.c...@asu.edu wrote: I've heard that instead of using a backend like sql to manage a database, I could stay in Revolution and use arrays. I know nothing of arrays. I've written here before about a bird database I have. Several times. Forgive. I just have a few items in a record: birdname,birdnotes,place,placenotes,date However, there are about 18000 birds (records) and I've got them all in one field in Rev now and it's too slow to sort. Just as a first test, what if you put the data into a custom property instead of a field? Use this CP as the data storage and grab what you need as you need it. e.g. - put the cDataStore of this stack into tData -- grab the complete data set out of the custom property into a variable filter tData with * fld Filter * -- assuming you want to extract a sub-set set the itemDel to tab -- or whatever delimits your columns sort lines of tData by item 2 of each -- choose the column to sort by put tData into fld Display -- show the final results - Even if you end up with the complete set of data after the filter, sorting a variable is enormously faster than sorting a field. And getting data out of or into a custom property is again, greatly faster than for a field. I have done this successfully with multiple CPs each holding about 40,000 records and operations only take miliseconds. Cheers, Sarah ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays instead of Sql
Sarah Reichelt wrote: On Tue, May 19, 2009 at 10:30 AM, Tom Cole tom.c...@asu.edu wrote: I've heard that instead of using a backend like sql to manage a database, I could stay in Revolution and use arrays. I know nothing of arrays. I've written here before about a bird database I have. Several times. Forgive. I just have a few items in a record: birdname,birdnotes,place,placenotes,date However, there are about 18000 birds (records) and I've got them all in one field in Rev now and it's too slow to sort. Just as a first test, what if you put the data into a custom property instead of a field? Use this CP as the data storage and grab what you need as you need it. e.g. - put the cDataStore of this stack into tData -- grab the complete data set out of the custom property into a variable filter tData with * fld Filter * -- assuming you want to extract a sub-set set the itemDel to tab -- or whatever delimits your columns sort lines of tData by item 2 of each -- choose the column to sort by put tData into fld Display -- show the final results - Even if you end up with the complete set of data after the filter, sorting a variable is enormously faster than sorting a field. And getting data out of or into a custom property is again, greatly faster than for a field. I have done this successfully with multiple CPs each holding about 40,000 records and operations only take miliseconds. Cheers, Sarah Paul Looney's Ahsomme multi-user business system is built on this CP approach to data storage, and its speed is quite acceptable - and all the data stacks are on a network file server! All the system's brains are in the client apps. -- Phil Davis PDS Labs Professional Software Development http://pdslabs.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays instead of Sql
Tom, As Phil said, we get acceptable speed using Custom Properties - even on databases with 100,000+ records - usually served by a Mac Mini. Compliments to Richard Gaskin who originally suggested the approach. By the way: no SQL, no C, no extensions! Paul Looney On May 18, 2009, at 6:02 PM, Phil Davis wrote: Paul Looney's Ahsomme multi-user business system is built on this CP approach to data storage, and its speed is quite acceptable - and all the data stacks are on a network file server! All the system's brains are in the client apps. -- Phil Davis PDS Labs Professional Software Development http://pdslabs.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Serialising arrays
Hi Mark, Writing it out to a binfile did the trick. Thanks! I wonder why would anybody use an open, write and close process rather than put URL? Thanks, Steve ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Serialising arrays
Steve Checkley wrote: Hi Mark, Writing it out to a binfile did the trick. Thanks! I wonder why would anybody use an open, write and close process rather than put URL? Those commands are good when you need to keep a file open and read it in sections, or append data to it, or search it, or any other thing that requires reading or writing the file in segments. If you just need to read or write an entire file all at once, then the URL syntax is the way to go. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Serialising arrays
Hi Steve, arrayEncode outputs an array in binary form (for binary storage or transfer), not text. When you need to transform array into list do: combine myArray using return and tab. After this array myArray becomes a list of key-value pairs: keyvalue key value key value ... key value Now if you do split myArray by return and tab myArray becomes an array again. regards Viktoras Steve Checkley wrote: Hi all, I'm storing data in an application using arrays and I need to save these out to a file. I've serialised the data using the arrayEncode function but can't decode it back again. The structure of the save file is to place a marker such as productList, add a return character, then the serialised array, another return character and then a closing marker, /productList in this case. When viewed in a text editor, it looks like: productsList random characters more randomeness /productsList Using lineOffSet, I'm finding the first and last lines of the serialised array. It's when I come to decode the array that it falls over. Any pointers? Is this the best way to save arrays to text? Thanks in advance, Steve ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Serialising arrays
Hi all, I'm storing data in an application using arrays and I need to save these out to a file. I've serialised the data using the arrayEncode function but can't decode it back again. The structure of the save file is to place a marker such as productList, add a return character, then the serialised array, another return character and then a closing marker, /productList in this case. When viewed in a text editor, it looks like: productsList random characters more randomeness /productsList Using lineOffSet, I'm finding the first and last lines of the serialised array. It's when I come to decode the array that it falls over. Any pointers? Is this the best way to save arrays to text? Thanks in advance, Steve ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Serialising arrays
Steve, when you write the serialised array to the file, are you using binary files? The output of arrayencode is binary, so if you're not writing binary files, you'll probably get your data munged up... Best, Mark On 13 Apr 2009, at 20:50, Steve Checkley wrote: Hi all, I'm storing data in an application using arrays and I need to save these out to a file. I've serialised the data using the arrayEncode function but can't decode it back again. The structure of the save file is to place a marker such as productList, add a return character, then the serialised array, another return character and then a closing marker, /productList in this case. When viewed in a text editor, it looks like: productsList random characters more randomeness /productsList Using lineOffSet, I'm finding the first and last lines of the serialised array. It's when I come to decode the array that it falls over. Any pointers? Is this the best way to save arrays to text? Thanks in advance, Steve ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
You don't know Apple very well. It will be something like Y2. Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Feb 17, 2009, at 6:06 PM, Kay C Lan wrote: Sounds like a full 12/12 warranty to me. 12 or 12 sec, whichever comes first ;-) Oh, and you sure it won't be OS Y ? ;-) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
On Tue, Feb 17, 2009 at 1:43 PM, Richard Gaskin ambassa...@fourthworld.comwrote: So while these various different parts are technically in the same file, this is merely a clever trick of the legacy file system which still supports resource forks. As such, it's just one level of misdirection away from being more or less the same as a bundle in terms of code and data being separate. As I said, I have no clue on what's going on under the hood, so thanks for taking time to 'pop the bonnet' and explain what the 'half ball and svetzer valve' do. ;-) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Kay C Lan wrote: On Tue, Feb 17, 2009 at 1:43 PM, Richard Gaskin ambassador at fourthworld.comwrote: So while these various different parts are technically in the same file, this is merely a clever trick of the legacy file system which still supports resource forks. As such, it's just one level of misdirection away from being more or less the same as a bundle in terms of code and data being separate. As I said, I have no clue on what's going on under the hood, so thanks for taking time to 'pop the bonnet' and explain what the 'half ball and svetzer valve' do. ;-) Ah, but it's more than mere techie gadgetry: Using Rev's built in resource functions you not only have another means of accomplishing your original goal, but indeed the very one AppleScript uses. See the Dictionary: getResources getResource setResource Good for as long as Apple continues to support resource forks (I give it until OS XI). -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
On Wed, Feb 18, 2009 at 9:41 AM, Richard Gaskin ambassa...@fourthworld.comwrote: See the Dictionary: getResources getResource setResource Which I have. Thanks again to this List, I don't think there would be any other way I'd ever have conceived as to why I'd ever look these up. Good for as long as Apple continues to support resource forks (I give it until OS XI). Sounds like a full 12/12 warranty to me. 12 or 12 sec, whichever comes first ;-) Oh, and you sure it won't be OS Y ? ;-) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Lists to arrays and back again
I apparently do not understand arrays at all. I have a 2 row list, called myVar. Each line contains 1,2,3 and 4,5,6 respectively. I want to use the split command to make an array so that myVar[1,1] = 1 and myvar[2,1] =4. split ALWAYS seems to think that the first item it encounters in each line is the key I want to use to reference it, and everything after that are the elements of the array. I JUST want to convert a list to an array an reference the elements by row and column. Eventually I want to delete whole columns of the array and recombine the array back to a list. If I have to use repeat loops to populate the array, why then that's like paying for a glass of orange juice with a bottle of orange juice. Any ideas? Bob Sneidar IT Manager Calvary Chapel CM Sent from iPhone ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
WHOA THERE TONTO! I thought the whole idea to properties was persistence?? That means that I cannot save, for instance, the database settings a user entered? I have to create an external file for all of that? And so many card and object properties in my app DEPEND on persistence through runtime. This means that I have to put a kabosh on the whole project! Say it ain't so Sam! Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Feb 13, 2009, at 3:53 PM, Jim Ault wrote: I think of arrays as.. Arrays, like variables, evaporate on quitting, Custom properties, like button names, are stored in the stack file. (note: this is not true for compiled apps since they cannot be modified You store data in custom properties before compiling and they become part of your app, such as jpgs, sounds, even whole stack files) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
And persistent they are, if the stack file the custom properties are in is saved with a simple save command. A stack file can hold any number of custom properties. Even arrays, stacks and images can be turned into a custom property and restored. Persistence = a file somewhere!The file can be in any directory that can be written to by the user. On a macintosh, it's especially easy, as the .app package provides a place that files can be read and written to but yet out of reach for most users. Stephen Barncard - San Francisco 2009/2/13 Robert Sneidar slylab...@me.com WHOA THERE TONTO! I thought the whole idea to properties was persistence?? That means that I cannot save, for instance, the database settings a user entered? I have to create an external file for all of that? And so many card and object properties in my app DEPEND on persistence through runtime. This means that I have to put a kabosh on the whole project! Say it ain't so Sam! Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Feb 13, 2009, at 3:53 PM, Jim Ault wrote: I think of arrays as.. Arrays, like variables, evaporate on quitting, Custom properties, like button names, are stored in the stack file. (note: this is not true for compiled apps since they cannot be modified You store data in custom properties before compiling and they become part of your app, such as jpgs, sounds, even whole stack files) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Bob, Think of custom properties as fields - without some of the field overhead. Putting information in custom properties and retrieving it is much faster than using fields. And you can create and delete custom properties on the fly much more easily than with fields - with less code. Two field features that cps lack are visibility (which is probably an advantage for the storage you want) and chunk handling (you can not refer to line 3 of uMyUniqueCustomProperty - but you can load the property into a variable to get this information). Like with fields, you can not store user information in a custom property in an application (or standalone). This is actually a good thing. By storing the user information in cps in a separate (call it Preferences stack?) these settings not only survive the current session, and subsequent sessions, they even survive an update of your application (because you send the new app and the user retains the prior Preferences). Plus it is easier to update and test apps without having built-in customer information. If you are only concerned with persistence of some items through runtime, you should probably store these items in globals. Paul Looney On Feb 13, 2009, at 4:24 PM, Robert Sneidar wrote: WHOA THERE TONTO! I thought the whole idea to properties was persistence?? That means that I cannot save, for instance, the database settings a user entered? I have to create an external file for all of that? And so many card and object properties in my app DEPEND on persistence through runtime. This means that I have to put a kabosh on the whole project! Say it ain't so Sam! Bob Sneidar ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Hi Mark. Thanks. I do understand that properties are persistent so long as a standalone is running. I understand that Revolution standalones will not save the state of properties when you quit them. I was saying that Applescript standalones CAN and DO save the state of properties when they quit, so that when you start up again they have the values you set them to before you quit. The only time you lose them is when you recompile the standalone (of course). I was just thinking in some future rendition of Revolution, maybe they could pull that off, by saving the states of the properties internally to the package itself. Barring that, maybe having a seperate runtime engine similar to what Foxpro used to use, which did not allow development, but only allowed execution of stacks would be possible. BTW I tested the theory that an app cannot be modified while running. This is not true. I opened TextEdit and while it was running I opened the package contents and edited a plist file using PlistEditPro. I changed one of the values and saved the plist successfully. Wouldn't an internal property plist file do nicely for just this sort of thing? Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Feb 14, 2009, at 1:48 PM, Mark Wieder wrote: Robert- Saturday, February 14, 2009, 1:27:33 PM, you wrote: I suppose where I was getting confused is that Applescript apps properties are persistent. I just assumed rev apps pulled the same kind of trick. Methinks you're still a bit confused about this. Custom. Properties. Are. Persistent. The problem with standalone apps is that they can't be modified while they're running. So any changes you make in memory aren't (and can't) be saved to the running application. This is an operating system thing, not a rev thing. There are various ways to work around this: preferences files, splash screen apps, separate stack files, etc. -- -Mark Wieder mwie...@ahsoftware.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Bob Sneidar wrote: BTW I tested the theory that an app cannot be modified while running. This is not true. I opened TextEdit and while it was running I opened the package contents and edited a plist file using PlistEditPro. I changed one of the values and saved the plist successfully. You weren't changing the app though. You were changing a separate file inside the bundle. The application bundle is just a fancy folder. The running executable itself is inside the MacOS folder, and it usually looks like a Linux document. Change that, and your program won't even launch any more. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Lists to arrays and back again
Sorry all. This was sent as a duplicate from an address that was not registered with the list. Please ignore it. Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Feb 7, 2009, at 3:01 PM, Bob Sneidar wrote: I apparently do not understand arrays at all. I have a 2 row list, called myVar. Each line contains 1,2,3 and 4,5,6 respectively. I want to use the split command to make an array so that myVar[1,1] = 1 and myvar[2,1] =4. split ALWAYS seems to think that the first item it encounters in each line is the key I want to use to reference it, and everything after that are the elements of the array. I JUST want to convert a list to an array an reference the elements by row and column. Eventually I want to delete whole columns of the array and recombine the array back to a list. If I have to use repeat loops to populate the array, why then that's like paying for a glass of orange juice with a bottle of orange juice. Any ideas? Bob Sneidar IT Manager Calvary Chapel CM Sent from iPhone ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Like with fields, you can not store user information in a custom property in an application (or standalone). This isn't quite right. On the mac, I can save data to a separate stack INSIDE of a standalone package with no problem. Not always the best place to put the data in some situations, but it works. Stephen Barncard - San Francisco Stephen Barncard - San Francisco 2009/2/16 Bob Sneidar b...@twft.com Hi Mark. Thanks. I do understand that properties are persistent so long as a standalone is running. I understand that Revolution standalones will not save the state of properties when you quit them. I was saying that Applescript standalones CAN and DO save the state of properties when they quit, so that when you start up again they have the values you set them to before you quit. The only time you lose them is when you recompile the standalone (of course). I was just thinking in some future rendition of Revolution, maybe they could pull that off, by saving the states of the properties internally to the package itself. Barring that, maybe having a seperate runtime engine similar to what Foxpro used to use, which did not allow development, but only allowed execution of stacks would be possible. BTW I tested the theory that an app cannot be modified while running. This is not true. I opened TextEdit and while it was running I opened the package contents and edited a plist file using PlistEditPro. I changed one of the values and saved the plist successfully. Wouldn't an internal property plist file do nicely for just this sort of thing? Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Feb 14, 2009, at 1:48 PM, Mark Wieder wrote: Robert- Saturday, February 14, 2009, 1:27:33 PM, you wrote: I suppose where I was getting confused is that Applescript apps properties are persistent. I just assumed rev apps pulled the same kind of trick. Methinks you're still a bit confused about this. Custom. Properties. Are. Persistent. The problem with standalone apps is that they can't be modified while they're running. So any changes you make in memory aren't (and can't) be saved to the running application. This is an operating system thing, not a rev thing. There are various ways to work around this: preferences files, splash screen apps, separate stack files, etc. -- -Mark Wieder mwie...@ahsoftware.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Thanks Mark! Just what the doctor ordered (again from you). I thought I remembered something like this. Since the app is mainly going to be used in house that will be perfect. Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Feb 14, 2009, at 2:40 PM, Mark Swindell wrote: On Feb 14, 2009, at 1:18 PM, Robert Sneidar wrote: I thought after I sent the email, is there a runtime engine for rev that would allow stacks to run as documents? Yes, Revolution Player: http://www.runrev.com/downloads/all-downloads/revolution-player/ or Ken Ray's Stackrunner http://www.sonsothunder.com/devres/revolution/downloads/ StackRunner.htm An application's substacks can save changes and can maintain persistent custom properties as long as they are saved as separate stacks when building your standalone. One way to do this is to make your splash screen your mainstack and save substacks as separate files when you build your application. Mark ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
If this is another duplicate from me I apologise. My email keeps defaulting to the wrong account and I don't catch it in time. Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Feb 13, 2009, at 4:24 PM, Robert Sneidar wrote: WHOA THERE TONTO! I thought the whole idea to properties was persistence?? That means that I cannot save, for instance, the database settings a user entered? I have to create an external file for all of that? And so many card and object properties in my app DEPEND on persistence through runtime. This means that I have to put a kabosh on the whole project! Say it ain't so Sam! Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Feb 13, 2009, at 3:53 PM, Jim Ault wrote: I think of arrays as.. Arrays, like variables, evaporate on quitting, Custom properties, like button names, are stored in the stack file. (note: this is not true for compiled apps since they cannot be modified You store data in custom properties before compiling and they become part of your app, such as jpgs, sounds, even whole stack files) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Bob- Monday, February 16, 2009, 10:28:57 AM, you wrote: BTW I tested the theory that an app cannot be modified while running. This is not true. I opened TextEdit and while it was running I opened the package contents and edited a plist file using PlistEditPro. I changed one of the values and saved the plist successfully. Wouldn't an internal property plist file do nicely for just this sort of thing? Yes it would. You're quite correct in that you can edit the plist file while an app is running. But this is like editing a preferences file while an app is running. As Jacque pointed out, the app itself is a separate object in the package. Runrev could easily allow changes to be saved in a plist file or something else in the package and so allow the functionality you're after. But this wouldn't be cross-platform and might run into permissions problems, depending on where the app was stored. You can make this functionality yourself in any of the several ways that have been described here, even to the point of using plist files if you desire. -- -Mark Wieder mwie...@ahsoftware.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Oh gotcha! So you are saying that the properties are something that is a part of the executable inside the package? How odd. Anyway, I don't want to belabor the point. The fact is, there are workarounds, and some with real benefits (such as default restoration) and such that will work nicely for me. Thanks all. Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Feb 16, 2009, at 10:44 AM, J. Landman Gay wrote: Bob Sneidar wrote: BTW I tested the theory that an app cannot be modified while running. This is not true. I opened TextEdit and while it was running I opened the package contents and edited a plist file using PlistEditPro. I changed one of the values and saved the plist successfully. You weren't changing the app though. You were changing a separate file inside the bundle. The application bundle is just a fancy folder. The running executable itself is inside the MacOS folder, and it usually looks like a Linux document. Change that, and your program won't even launch any more. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Bob- Monday, February 16, 2009, 11:01:59 AM, you wrote: Oh gotcha! So you are saying that the properties are something that is a part of the executable inside the package? How odd. Not that odd if you think of the package as a folder. That's what it is and it's up to the OS to show it to you as an application. The executable part is an object within the application folder. So are any other resources needed by the app. -- -Mark Wieder mwie...@ahsoftware.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Bob Sneidar wrote: Oh gotcha! So you are saying that the properties are something that is a part of the executable inside the package? How odd. The confusion stems from OS X lying to us: it tells us that an application is a file, when it's really a folder. :) The actual executable (the runtime engine bound to your stack) is inside that folder in /Contents/MacOS/. That executable is essentially the same as you get on Win and Linux, except that on OS X it's buried inside of these other folders comprising the bundle. This executable cannot modify itself at runtime, and I don't believe any of the supported OSes allow any executable to modify themselves. But as you've found, just about any data file be modified, including those stored in the bundle (with appropriate permissions). While it's possible to write data into the bundle, the OS X HIG suggests using the Application Support folder or Preferences for that. The equivalent to Application Support in Win is Application Data. You can get the paths to these using Rev's specialFolderPath function: -- OS X: Application Support get specialFolderPath(asup) -- OS X: Preferences: get specialFolderPath(preferences) -- Win: Application Data: get specialFolderPath(26) For a complete list of constants for special folders on OS X and Win: http://sonsothunder.com/devres/revolution/tips/file010.htm As Paul noted, one advantage to storing your user's data outside of the bundle is that they can upgrade the application without losing their data. -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Sorry all didn't make myself clear. The oddity was not that Mac apps are packages. The oddity is that the properties cannot be saved when you quit the app because they are (ostensibly) part of the executable. I believe that was the reason given for the fact that a revolution executable property set would not survive a quit and relaunch (when in fact an Applescript executable's properties are saved). If that is not the case, if the properties are not attached to the executable, then there really isn't a reason why the app cannot store properties inside the package, or at least save them on quitting the app. But that is a story for another thread. This is really academic as I can write my own property saving method, or even use low level file functions inside the package to accomplish the same thing. Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Feb 16, 2009, at 11:55 AM, Richard Gaskin wrote: Bob Sneidar wrote: Oh gotcha! So you are saying that the properties are something that is a part of the executable inside the package? How odd. The confusion stems from OS X lying to us: it tells us that an application is a file, when it's really a folder. :) The actual executable (the runtime engine bound to your stack) is inside that folder in /Contents/MacOS/. That executable is essentially the same as you get on Win and Linux, except that on OS X it's buried inside of these other folders comprising the bundle. This executable cannot modify itself at runtime, and I don't believe any of the supported OSes allow any executable to modify themselves. But as you've found, just about any data file be modified, including those stored in the bundle (with appropriate permissions). While it's possible to write data into the bundle, the OS X HIG suggests using the Application Support folder or Preferences for that. The equivalent to Application Support in Win is Application Data. You can get the paths to these using Rev's specialFolderPath function: -- OS X: Application Support get specialFolderPath(asup) -- OS X: Preferences: get specialFolderPath(preferences) -- Win: Application Data: get specialFolderPath(26) For a complete list of constants for special folders on OS X and Win: http://sonsothunder.com/devres/revolution/tips/file010.htm As Paul noted, one advantage to storing your user's data outside of the bundle is that they can upgrade the application without losing their data. -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Bob, You're right, I'm not clear what you're saying. :) First off, I'm not one of the illuminati on this list by a long shot. But I do think I have a grasp of a couple of concepts, and I'll be corrected if I'm wrong. Properties are associated with objects. Objects come with a set of built in properties. (height, width, visible, etc.) On top of that a user can create a new custom property for any given object (button, field, card, stack, etc.) simply by declaring it. These are custom properties. They are associated with the object you associate them with, and remain so. The exception to the above is that if you make any change to an executable (a standalone), including adding a card, a button, changing an objects properties (custom or innate), that change will not be saved when the executable quits. But this only affects the executable stack. A SUBSTACK of the executable, as long as it is saved as a separate file when the standalone is created, can be saved, and it's changes will be saved. You have to save it deliberately by issuing the command save this stack in some form or another, but those changes will be saved. Now, when the executable opens and calls for that substack to open, the substack will appear with all changes intact.That's why the splash stack is often used for this purpose. It is the executable, but all associated substacks, as long as they were saved as separate substacks by checking the move substacks to individual files (or whatever is is) in the application builder are modifiable and those modifications persist. Including custom properties. Maybe this is all clear to you and I'm just not understanding, but in any case... Thanks, Mark Swindell On Feb 16, 2009, at 1:46 PM, Bob Sneidar wrote: Sorry all didn't make myself clear. The oddity was not that Mac apps are packages. The oddity is that the properties cannot be saved when you quit the app because they are (ostensibly) part of the executable. I believe that was the reason given for the fact that a revolution executable property set would not survive a quit and relaunch (when in fact an Applescript executable's properties are saved). If that is not the case, if the properties are not attached to the executable, then there really isn't a reason why the app cannot store properties inside the package, or at least save them on quitting the app. But that is a story for another thread. This is really academic as I can write my own property saving method, or even use low level file functions inside the package to accomplish the same thing. Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Feb 16, 2009, at 11:55 AM, Richard Gaskin wrote: Bob Sneidar wrote: Oh gotcha! So you are saying that the properties are something that is a part of the executable inside the package? How odd. The confusion stems from OS X lying to us: it tells us that an application is a file, when it's really a folder. :) The actual executable (the runtime engine bound to your stack) is inside that folder in /Contents/MacOS/. That executable is essentially the same as you get on Win and Linux, except that on OS X it's buried inside of these other folders comprising the bundle. This executable cannot modify itself at runtime, and I don't believe any of the supported OSes allow any executable to modify themselves. But as you've found, just about any data file be modified, including those stored in the bundle (with appropriate permissions). While it's possible to write data into the bundle, the OS X HIG suggests using the Application Support folder or Preferences for that. The equivalent to Application Support in Win is Application Data. You can get the paths to these using Rev's specialFolderPath function: -- OS X: Application Support get specialFolderPath(asup) -- OS X: Preferences: get specialFolderPath(preferences) -- Win: Application Data: get specialFolderPath(26) For a complete list of constants for special folders on OS X and Win: http://sonsothunder.com/devres/revolution/tips/file010.htm As Paul noted, one advantage to storing your user's data outside of the bundle is that they can upgrade the application without losing their data. -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Bob Sneidar wrote: Sorry all didn't make myself clear. The oddity was not that Mac apps are packages. The oddity is that the properties cannot be saved when you quit the app because they are (ostensibly) part of the executable. I believe that was the reason given for the fact that a revolution executable property set would not survive a quit and relaunch (when in fact an Applescript executable's properties are saved). At the risk of pulpifying this long-dead horse, for clarity's sake I don't believe it's the *executable• within an AppleScript applet bundle that is being modified. AFAIK that isn't possible in any UNIX-based system. It would appear that these properties are stored in a data file within the bundle (the .rsrc file?) and it's the data file that's being modified, just as one can do with any non-standalone Rev stack. With regard to self-modification, Rev has no limitations not imposed on any other app by the OS itself. -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Stephen, You are correct, of course. I was over-simplifying. I completely agree with you that putting user data inside a stack inside a standalone is not a good idea. The most important point I was trying to make was, as Mark had said earlier, custom properties can persist. Paul Looney On Feb 16, 2009, at 10:48 AM, stephen barncard wrote: Like with fields, you can not store user information in a custom property in an application (or standalone). This isn't quite right. On the mac, I can save data to a separate stack INSIDE of a standalone package with no problem. Not always the best place to put the data in some situations, but it works. Stephen Barncard ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Thanks Mark that is probably the methodology I will use when the time comes. Bob Sneidar IT Manager Logos Management Calvary Chapel CM On Feb 16, 2009, at 2:10 PM, Mark Swindell wrote: The exception to the above is that if you make any change to an executable (a standalone), including adding a card, a button, changing an objects properties (custom or innate), that change will not be saved when the executable quits. But this only affects the executable stack. A SUBSTACK of the executable, as long as it is saved as a separate file when the standalone is created, can be saved, and it's changes will be saved. You have to save it deliberately by issuing the command save this stack in some form or another, but those changes will be saved. Now, when the executable opens and calls for that substack to open, the substack will appear with all changes intact.That's why the splash stack is often used for this purpose. It is the executable, but all associated substacks, as long as they were saved as separate substacks by checking the move substacks to individual files (or whatever is is) in the application builder are modifiable and those modifications persist. Including custom properties. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
On Tue, Feb 17, 2009 at 6:11 AM, Richard Gaskin ambassa...@fourthworld.comwrote: At the risk of pulpifying this long-dead horse, for clarity's sake I don't believe it's the *executable• within an AppleScript applet bundle that is being modified. AFAIK that isn't possible in any UNIX-based system. I figured the same, and I really have no idea what's going on 'under the hood', but I did a simple experiment. I opened ScriptEditor and put in the following: property theCount : 0 set theCount to theCount + 1 display dialog The value of theCount is: theCount as string If you 'Run' this over and over the dialog displays an ever increasing number. If you recompile it goes back to 1. I then saved it, but there are a couple of options including 'Application' or 'Application Bundle', I used 'Application'. This produced a single file, I tried to 'cntrl-click' to 'Show Package Contents', but this did not come up, so this wasn't a case of an Application Bundle (a folder appearing to be a file). I then quit ScriptEditor and double clicked on my newly created App. It came up with a dialog with the number 1 and then self quit. I double clicked on it again and it said 2, etc etc. The Modification Time of the file changed with each running of the App. Maybe that horse isn't quite dead yet ;-) ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Kay C Lan wrote: On Tue, Feb 17, 2009 at 6:11 AM, Richard Gaskin ambassador at fourthworld.comwrote: At the risk of pulpifying this long-dead horse, for clarity's sake I don't believe it's the *executable• within an AppleScript applet bundle that is being modified. AFAIK that isn't possible in any UNIX-based system. I figured the same, and I really have no idea what's going on 'under the hood', but I did a simple experiment. I opened ScriptEditor and put in the following: property theCount : 0 set theCount to theCount + 1 display dialog The value of theCount is: theCount as string If you 'Run' this over and over the dialog displays an ever increasing number. If you recompile it goes back to 1. I then saved it, but there are a couple of options including 'Application' or 'Application Bundle', I used 'Application'. This produced a single file, I tried to 'cntrl-click' to 'Show Package Contents', but this did not come up, so this wasn't a case of an Application Bundle (a folder appearing to be a file). I then quit ScriptEditor and double clicked on my newly created App. It came up with a dialog with the number 1 and then self quit. I double clicked on it again and it said 2, etc etc. The Modification Time of the file changed with each running of the App. Maybe that horse isn't quite dead yet ;-) Or maybe just a ghostly apparition from the past: it seems that when you make an application with AppleScript (as opposed to a bundle) the resulting file uses CODE resources (ID 0 and 1). Even knowing what a CODE resource is makes me feel old. :) In ancient times (read Mac OS 9 and earlier g) apps used CODE resource for executable code. This is how HC made standalones, and even older versions of SC and Rev, just binding the CODE and other resouces of the engine to the stack in the data fork. Resources are kinda like separate files, much like the files in a bundle, in terms of being discrete elements. The CODE resources aren't changing between runs, but the scpt resource is (poking around with Rev's getResource function, apparently byte 651 there stores the value of theCount). So while these various different parts are technically in the same file, this is merely a clever trick of the legacy file system which still supports resource forks. As such, it's just one level of misdirection away from being more or less the same as a bundle in terms of code and data being separate. In OS X apps don't commonly use resource forks, and it's only a matter of time before the OS finally ditches them altogether. But in the meantime, if you want to use the dual-fork trick in Rev you can store your data in the resource fork using the setResource function. My main point is simply that there's no special restriction unique to Rev with regard to data storage. If another app has a way to store data in the application, Rev can probably use the same mechanism; where Rev can't store data, neither can any other. -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Kay C Lan wrote: I then quit ScriptEditor and double clicked on my newly created App. It came up with a dialog with the number 1 and then self quit. I double clicked on it again and it said 2, etc etc. The Modification Time of the file changed with each running of the App. Does it have a resource fork? Maybe it saves to that. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Good stuff, Jim. Well thought out. Thanks for sharing it. Gregory On Sun, Feb 15, 2009, at 1:00 PM, use-revolution-requ...@lists.runrev.com wrote: Message: 9 Date: Sat, 14 Feb 2009 16:45:24 -0800 From: Jim Ault jimaultw...@yahoo.com Subject: Re: Arrays and Custom Props --not trivial- agreed To: How to use Revolution use-revolution@lists.runrev.com Message-ID: c5bca5a4.5522c%jimaultw...@yahoo.com Content-Type: text/plain; charset=US-ASCII Jim Ault's good overview in response to this thread shows that strategies for developing a working relationship with custom props is not trivial. Agreed. Just as building a good set of database linked tables (schema) takes some planning, so do custom properties. Accessing database records is very fast, and so is accessing a custom property. Storing very large amounts of data in fields is a much, much slower method of (storage, updating and accessing). Most of us don't build projects of large enough scale to see the difference. One of the great things about Rev is that you have choices. One trick for easy visibility plus fast operation is: --store settings and preferences in a field, -- then on closefield, copy the text to a single custom property -- just as you do the single field -- thus you can have it both ways! Good for the IDE and better for the user on closefield put the short date the short time into line 1 of me --time stamp set the cpPrefsField of this stack to me -- eg. fld prefsAndSettings save this stack get the cpPrefsField of this stack put the lineoffset(backgroundColor, it) into pos put line 1 of it cr line pos of it into msg end closefield Compiling the standalone will lock in both versions of the text, but script access using the custom property will be much faster. Remember, any changes to a field in a standalone can not be saved in the standalone, the same for any changes made by the user or a script. Jim Ault Las Vegas ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
I think people get a little confused when they think of Hypercard and how it always saved changes to the hard drive as they occurred. The key is that Hypercard stacks are like spreadsheets or word processing documents in that you needed the app Hypercard installed on your Mac, and it was free. Most of the time it was already installed on the Mac when purchased. There was the issue of multiple versions through the years. Basically a Rev app could work the same way as the Hypercard app. On launch you would give the user a choice of opening an existing 'document' or stack or create a new one. A spreadsheet .xls file is just a bunch of gobbledy-gook and data that requires the correct version of an app to use. Standalones do the same thing... save lots of data to files on a hard drive and manage the changes in formatting between versions. Are you sure you want to update the format of your document to V3.4.5.6? Save as Photoshop, Jpeg, Compuserve Gif, Tiff Your choice could be to do like Hypercard and Filemaker... save to disk after every change so the user never had to make that step, thus immediate persistence. The app, of course, does not change, just the files in its universe, even if they are on the network, somewhere out there. As far as custom properties, recall that in my first email I mentioned that you could store a whole stack in a custom prop.. well, this is one way you could store a New Stack that opens for the user, just like Excel or Word, or a New card that was not already in the user stack, or a New Group, etc, etc. This way, a new stack does not have to have all of the parts that the app does, and those are only installed when needed from the mother ship. I have not looked, but there are probably some videos and help files on bundling 'resources' with a standalone since so many Rev apps have been created and distributed by pros on this list. My apps are simple, functional, and go to private clients so I am not well-versed in wide distribution. Hope this makes your weekend a bit calmer. Think about it as traveling the oceans as millions of others do.. in a boat on the surface. Very few people ever use a submarine. Revolution builds boats. Jim Ault Las Vegas On 2/13/09 4:42 PM, Richard Gaskin ambassa...@fourthworld.com wrote: Bob Sneidar wrote: WHOA THERE TONTO! I thought the whole idea to properties was persistence?? That means that I cannot save, for instance, the database settings a user entered? I have to create an external file for all of that? And so many card and object properties in my app DEPEND on persistence through runtime. This means that I have to put a kabosh on the whole project! You're no worse off than any other application developer: Windows and Linux have never allowed applications to modify themselves at runtime, and even Mac OS only allowed this back when it still put executable code in the resource fork (though under OS X any app can store files in the bundle). This article at revJournal may be helpful: Saving data in Revolution standalones by Sarah Reichelt http://www.revjournal.com/tutorials/saving_data_in_revolution.html -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Well, Bernard and Scott, good to know I'm not alone. I've always been ambivalent about custom properties. I see their power and usefulness, but more often than not, I spare myself the mental strain of recalling what prop is stored where, what it is called, and how to display all of the ones I have set, by instead using a hidden field dedicated to settings or preferences, which I can call up in a snap or display all the time while I'm scripting, and edit by typing into it. This field of settings can be loaded into one or more arrays at start up. Jim Ault's good overview in response to this thread shows that strategies for developing a working relationship with custom props is not trivial. Regards, Gregory On Fri, Feb 13, 2009, at 11:13 PM, Bernard wrote: Don't feel too bad. So the dictionary does contain an example for what you needed, but after 6 years of using Revolution I still have to look up how do work with custompropertysets arrays almost every time I use them together! Not to mention that I can never remember which way round 'split' 'combine' work. I think I must have been particularly stupid at the time when I was learning how to use arrays, and my confusion has been permanently wired into my brain :-) Bernard on mouseUp put that makes 2 of us into response[Bernard] end mouseUp Regards, Scott Rossi [Jim Ault followed his comment below with a good overview of working with custom properties.] Just a couple hints that might help you in the future.. I hope this can help someone understand a little more. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
I thought after I sent the email, is there a runtime engine for rev that would allow stacks to run as documents? Bob Sneidar IT Manager Calvary Chapel CM Sent from iPhone On Feb 13, 2009, at 16:42, Richard Gaskin ambassa...@fourthworld.com wrote: Bob Sneidar wrote: WHOA THERE TONTO! I thought the whole idea to properties was persistence?? That means that I cannot save, for instance, the database settings a user entered? I have to create an external file for all of that? And so many card and object properties in my app DEPEND on persistence through runtime. This means that I have to put a kabosh on the whole project! You're no worse off than any other application developer: Windows and Linux have never allowed applications to modify themselves at runtime, and even Mac OS only allowed this back when it still put executable code in the resource fork (though under OS X any app can store files in the bundle). This article at revJournal may be helpful: Saving data in Revolution standalones by Sarah Reichelt http://www.revjournal.com/tutorials/saving_data_in_revolution.html -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
I suppose where I was getting confused is that Applescript apps properties are persistent. I just assumed rev apps pulled the same kind of trick. Bob Sneidar IT Manager Calvary Chapel CM Sent from iPhone On Feb 14, 2009, at 8:45, Jim Ault jimaultw...@yahoo.com wrote: I think people get a little confused when they think of Hypercard and how it always saved changes to the hard drive as they occurred. The key is that Hypercard stacks are like spreadsheets or word processing documents in that you needed the app Hypercard installed on your Mac, and it was free. Most of the time it was already installed on the Mac when purchased. There was the issue of multiple versions through the years. Basically a Rev app could work the same way as the Hypercard app. On launch you would give the user a choice of opening an existing 'document' or stack or create a new one. A spreadsheet .xls file is just a bunch of gobbledy-gook and data that requires the correct version of an app to use. Standalones do the same thing... save lots of data to files on a hard drive and manage the changes in formatting between versions. Are you sure you want to update the format of your document to V3.4.5.6? Save as Photoshop, Jpeg, Compuserve Gif, Tiff Your choice could be to do like Hypercard and Filemaker... save to disk after every change so the user never had to make that step, thus immediate persistence. The app, of course, does not change, just the files in its universe, even if they are on the network, somewhere out there. As far as custom properties, recall that in my first email I mentioned that you could store a whole stack in a custom prop.. well, this is one way you could store a New Stack that opens for the user, just like Excel or Word, or a New card that was not already in the user stack, or a New Group, etc, etc. This way, a new stack does not have to have all of the parts that the app does, and those are only installed when needed from the mother ship. I have not looked, but there are probably some videos and help files on bundling 'resources' with a standalone since so many Rev apps have been created and distributed by pros on this list. My apps are simple, functional, and go to private clients so I am not well-versed in wide distribution. Hope this makes your weekend a bit calmer. Think about it as traveling the oceans as millions of others do.. in a boat on the surface. Very few people ever use a submarine. Revolution builds boats. Jim Ault Las Vegas On 2/13/09 4:42 PM, Richard Gaskin ambassa...@fourthworld.com wrote: Bob Sneidar wrote: WHOA THERE TONTO! I thought the whole idea to properties was persistence?? That means that I cannot save, for instance, the database settings a user entered? I have to create an external file for all of that? And so many card and object properties in my app DEPEND on persistence through runtime. This means that I have to put a kabosh on the whole project! You're no worse off than any other application developer: Windows and Linux have never allowed applications to modify themselves at runtime, and even Mac OS only allowed this back when it still put executable code in the resource fork (though under OS X any app can store files in the bundle). This article at revJournal may be helpful: Saving data in Revolution standalones by Sarah Reichelt http://www.revjournal.com/tutorials/saving_data_in_revolution.html -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Robert- Saturday, February 14, 2009, 1:27:33 PM, you wrote: I suppose where I was getting confused is that Applescript apps properties are persistent. I just assumed rev apps pulled the same kind of trick. Methinks you're still a bit confused about this. Custom. Properties. Are. Persistent. The problem with standalone apps is that they can't be modified while they're running. So any changes you make in memory aren't (and can't) be saved to the running application. This is an operating system thing, not a rev thing. There are various ways to work around this: preferences files, splash screen apps, separate stack files, etc. -- -Mark Wieder mwie...@ahsoftware.net ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
On Feb 14, 2009, at 1:18 PM, Robert Sneidar wrote: I thought after I sent the email, is there a runtime engine for rev that would allow stacks to run as documents? Yes, Revolution Player: http://www.runrev.com/downloads/all-downloads/revolution-player/ or Ken Ray's Stackrunner http://www.sonsothunder.com/devres/revolution/downloads/StackRunner.htm An application's substacks can save changes and can maintain persistent custom properties as long as they are saved as separate stacks when building your standalone. One way to do this is to make your splash screen your mainstack and save substacks as separate files when you build your application. Mark ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props
Mark Swindell wrote: On Feb 14, 2009, at 1:18 PM, Robert Sneidar wrote: I thought after I sent the email, is there a runtime engine for rev that would allow stacks to run as documents? Yes, Revolution Player: http://www.runrev.com/downloads/all-downloads/revolution-player/ or Ken Ray's Stackrunner http://www.sonsothunder.com/devres/revolution/downloads/StackRunner.htm ...or any Rev standalone. I use stackfiles almost exclusively for my applications' file format. With the ability to store custom properties and any native controls (images are esp. useful), there's no almost limit to what I can store in them, and parsing what I need out of it lets me use native syntax for rapid, robust access. I can store any mix of textual and binary data, and parse it far more efficiently than if I'd used some custom format. Extra bonus points that you get the automatic temporary backup file (~*) to restore from in the event of an interrupted save operation. If you have the RevCon '08 DVD set, my session there focuses on the benefits of using stack files for documents and preferences, with techniques to managing them conveniently. -- Richard Gaskin Fourth World Revolution training and consulting: http://www.fourthworld.com Webzine for Rev developers: http://www.revjournal.com ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
Re: Arrays and Custom Props --not trivial- agreed
Jim Ault's good overview in response to this thread shows that strategies for developing a working relationship with custom props is not trivial. Agreed. Just as building a good set of database linked tables (schema) takes some planning, so do custom properties. Accessing database records is very fast, and so is accessing a custom property. Storing very large amounts of data in fields is a much, much slower method of (storage, updating and accessing). Most of us don't build projects of large enough scale to see the difference. One of the great things about Rev is that you have choices. One trick for easy visibility plus fast operation is: --store settings and preferences in a field, -- then on closefield, copy the text to a single custom property -- just as you do the single field -- thus you can have it both ways! Good for the IDE and better for the user on closefield put the short date the short time into line 1 of me --time stamp set the cpPrefsField of this stack to me -- eg. fld prefsAndSettings save this stack get the cpPrefsField of this stack put the lineoffset(backgroundColor, it) into pos put line 1 of it cr line pos of it into msg end closefield Compiling the standalone will lock in both versions of the text, but script access using the custom property will be much faster. Remember, any changes to a field in a standalone can not be saved in the standalone, the same for any changes made by the user or a script. Jim Ault Las Vegas On 2/14/09 11:19 AM, Gregory Lypny gregory.ly...@videotron.ca wrote: Well, Bernard and Scott, good to know I'm not alone. I've always been ambivalent about custom properties. I see their power and usefulness, but more often than not, I spare myself the mental strain of recalling what prop is stored where, what it is called, and how to display all of the ones I have set, by instead using a hidden field dedicated to settings or preferences, which I can call up in a snap or display all the time while I'm scripting, and edit by typing into it. This field of settings can be loaded into one or more arrays at start up. Jim Ault's good overview in response to this thread shows that strategies for developing a working relationship with custom props is not trivial. Regards, Gregory On Fri, Feb 13, 2009, at 11:13 PM, Bernard wrote: Don't feel too bad. So the dictionary does contain an example for what you needed, but after 6 years of using Revolution I still have to look up how do work with custompropertysets arrays almost every time I use them together! Not to mention that I can never remember which way round 'split' 'combine' work. I think I must have been particularly stupid at the time when I was learning how to use arrays, and my confusion has been permanently wired into my brain :-) Bernard on mouseUp put that makes 2 of us into response[Bernard] end mouseUp Regards, Scott Rossi [Jim Ault followed his comment below with a good overview of working with custom properties.] Just a couple hints that might help you in the future.. I hope this can help someone understand a little more. ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution ___ use-revolution mailing list use-revolution@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution