Re: Church bell app?
On Sat, Aug 23, 2014 at 8:14 PM, Kay C Lan lan.kc.macm...@gmail.com wrote: they tick. If it were me I'd crack the case open, remove the battery and just have it plugged in permanently. The other fire problem you there goes battery backup. You'll need a UPS then. *--* *Stephen Barncard - San Francisco Ca. USA - Deeds Not Words* ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
delete end chars
If I have a certain amount of characters and I want to check the end of another line of characters to see if they are there and if so then delete them what is the fastest way to do delete the characters at the end of the specified line? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
Hi. Are you saying that if you have ABCD and somewhere else you have: AXFRZC that you want to delete the C from the first string? Whatever you want, the chunking and text control within LC is more than adequate to do the job, and will be fun do execute as well. But is this what you meant? Craig Newman -Original Message- From: JB sund...@pacifier.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sun, Aug 24, 2014 10:16 am Subject: delete end chars If I have a certain amount of characters and I want to check the end of another line of characters to see if they are there and if so then delete them what is the fastest way to do delete the characters at the end of the specified line? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
On 24/08/14 17:12, JB wrote: If I have a certain amount of characters and I want to check the end of another line of characters to see if they are there and if so then delete them what is the fastest way to do delete the characters at the end of the specified line? delete last char of XYZ [where 'XYZ is a string] delete last char of fld XYZ Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
Hi, Thanks for the reply. I am saying if I have “ABC” in one string and the other string has “KCFAJFCABC” then I want to delete the “ABC” from the end of the second string leaving “KCFAJFC”. John Balgenorth On Aug 24, 2014, at 8:09 AM, dunb...@aol.com wrote: Hi. Are you saying that if you have ABCD and somewhere else you have: AXFRZC that you want to delete the C from the first string? Whatever you want, the chunking and text control within LC is more than adequate to do the job, and will be fun do execute as well. But is this what you meant? Craig Newman -Original Message- From: JB sund...@pacifier.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sun, Aug 24, 2014 10:16 am Subject: delete end chars If I have a certain amount of characters and I want to check the end of another line of characters to see if they are there and if so then delete them what is the fastest way to do delete the characters at the end of the specified line? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
This seems to work (where you have field one with the letters to check, and field 2 is the letters that might end with those check letters): on mouseUp put fld 1 into f1 put fld 2 into f2 put offset(f1,f2) into offamount if offamount = the number of chars in f2 - the number of chars in f1 + 1 then put char 1 to offamount - 1 of f2 into fld 2 end if end mouseUp ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
Hi Richmond, Wouldn’t that just delete the last char? I need to check for all characters in the first string to see if they all exist in the same order of the last chars of the second string. I know I could use a repeat to see if the characters all exist and then if they do I could use a repeat that many times to delete the last character. I was thinking there might be a faster or at least smaller way to write the code. Would a regex be better and if so how do you write the regex properly? John Balgenorth On Aug 24, 2014, at 8:14 AM, Richmond richmondmathew...@gmail.com wrote: On 24/08/14 17:12, JB wrote: If I have a certain amount of characters and I want to check the end of another line of characters to see if they are there and if so then delete them what is the fastest way to do delete the characters at the end of the specified line? delete last char of XYZ [where 'XYZ is a string] delete last char of fld XYZ Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
That works good! thank you, John Balgenorth On Aug 24, 2014, at 8:21 AM, Colin Holgate co...@verizon.net wrote: on mouseUp put fld 1 into f1 put fld 2 into f2 put offset(f1,f2) into offamount if offamount = the number of chars in f2 - the number of chars in f1 + 1 then put char 1 to offamount - 1 of f2 into fld 2 end if end mouseUp ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
function zapAtEndOfLine tStr, tContainer put cr after tContainer replace tStr cr with cr in tContainer return char 1 to -2 of tContainer end zapAtEndOfLine -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Aug 24, 2014, at 11:12 AM, JB wrote: Hi, Thanks for the reply. I am saying if I have “ABC” in one string and the other string has “KCFAJFCABC” then I want to delete the “ABC” from the end of the second string leaving “KCFAJFC”. John Balgenorth On Aug 24, 2014, at 8:09 AM, dunb...@aol.com wrote: Hi. Are you saying that if you have ABCD and somewhere else you have: AXFRZC that you want to delete the C from the first string? Whatever you want, the chunking and text control within LC is more than adequate to do the job, and will be fun do execute as well. But is this what you meant? Craig Newman -Original Message- From: JB sund...@pacifier.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sun, Aug 24, 2014 10:16 am Subject: delete end chars If I have a certain amount of characters and I want to check the end of another line of characters to see if they are there and if so then delete them what is the fastest way to do delete the characters at the end of the specified line? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
On 24/08/14 18:19, JB wrote: Hi Richmond, Wouldn’t that just delete the last char? I need to check for all characters in the first string to see if they all exist in the same order of the last chars of the second string. I know I could use a repeat to see if the characters all exist and then if they do I could use a repeat that many times to delete the last character. I was thinking there might be a faster or at least smaller way to write the code. Would a regex be better and if so how do you write the regex properly? John Balgenorth If you have a string that is like this: ZZXYQPSPTABC and you want to delete any occurrences of A, B, or C you could do this sort of thing: Well; to make things easier for myself (i.e. so I had visual confirmation of things) I made a stack with a fld TEXXT and a Button DO IT BABY. I put ZZXYQPSPTABC into fld TEXXT I put this script in button DO IT BABY: on mouseUp put fld TEXXT into TEXXT put the number of chars in TEXXT into CHNMB repeat CHNMB times if the last char of TEXXT is A then delete the last char of TEXXT end if if the last char of TEXXT is B then delete the last char of TEXXT end if if the last char of TEXXT is C then delete the last char of TEXXT end if put TEXXT into fld TEXXT end repeat end mouseUp try it. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
What if the field happen to already end with a cr? On Aug 24, 2014, at 11:38 AM, Peter M. Brigham pmb...@gmail.com wrote: function zapAtEndOfLine tStr, tContainer put cr after tContainer replace tStr cr with cr in tContainer return char 1 to -2 of tContainer end zapAtEndOfLine ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
That works really good too! thank you, John Balgenorth On Aug 24, 2014, at 8:38 AM, Peter M. Brigham pmb...@gmail.com wrote: function zapAtEndOfLine tStr, tContainer put cr after tContainer replace tStr cr with cr in tContainer return char 1 to -2 of tContainer end zapAtEndOfLine -- Peter Peter M. Brigham pmb...@gmail.com http://home.comcast.net/~pmbrig On Aug 24, 2014, at 11:12 AM, JB wrote: Hi, Thanks for the reply. I am saying if I have “ABC” in one string and the other string has “KCFAJFCABC” then I want to delete the “ABC” from the end of the second string leaving “KCFAJFC”. John Balgenorth On Aug 24, 2014, at 8:09 AM, dunb...@aol.com wrote: Hi. Are you saying that if you have ABCD and somewhere else you have: AXFRZC that you want to delete the C from the first string? Whatever you want, the chunking and text control within LC is more than adequate to do the job, and will be fun do execute as well. But is this what you meant? Craig Newman -Original Message- From: JB sund...@pacifier.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sun, Aug 24, 2014 10:16 am Subject: delete end chars If I have a certain amount of characters and I want to check the end of another line of characters to see if they are there and if so then delete them what is the fastest way to do delete the characters at the end of the specified line? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
On 24/08/14 18:48, Colin Holgate wrote: What if the field happen to already end with a cr? On Aug 24, 2014, at 11:38 AM, Peter M. Brigham pmb...@gmail.com wrote: function zapAtEndOfLine tStr, tContainer put cr after tContainer replace tStr cr with cr in tContainer return char 1 to -2 of tContainer end zapAtEndOfLine Use my cruder method :) Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
Hi Richmond, That seems to leave me with the string I want to delete. Even so thank you for the code. John Balgenorth On Aug 24, 2014, at 8:46 AM, Richmond richmondmathew...@gmail.com wrote: on mouseUp put fld TEXXT into TEXXT put the number of chars in TEXXT into CHNMB repeat CHNMB times if the last char of TEXXT is A then delete the last char of TEXXT end if if the last char of TEXXT is B then delete the last char of TEXXT end if if the last char of TEXXT is C then delete the last char of TEXXT end if put TEXXT into fld TEXXT end repeat end mouseUp ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
On 24/08/14 18:54, JB wrote: Hi Richmond, That seems to leave me with the string I want to delete. Even so thank you for the code. John Balgenorth On Aug 24, 2014, at 8:46 AM, Richmond richmondmathew...@gmail.com wrote: on mouseUp put fld TEXXT into TEXXT put the number of chars in TEXXT into CHNMB repeat CHNMB times if the last char of TEXXT is A then delete the last char of TEXXT end if if the last char of TEXXT is B then delete the last char of TEXXT end if if the last char of TEXXT is C then delete the last char of TEXXT end if put TEXXT into fld TEXXT end repeat end mouseUp I thought you wanted to 'snip' specific letters off the end of a chain of letter. Iff that is what you wanted, that script will do that. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
Another problem with this approach is that there may be other cases where the letters are in the string, and have a cr after them. All of the cases would be removed, not just the last one. On Aug 24, 2014, at 11:38 AM, Peter M. Brigham pmb...@gmail.com wrote: function zapAtEndOfLine tStr, tContainer put cr after tContainer replace tStr cr with cr in tContainer return char 1 to -2 of tContainer end zapAtEndOfLine ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
Thank you very much! John Balgenorth On Aug 24, 2014, at 9:01 AM, Richmond richmondmathew...@gmail.com wrote: On 24/08/14 18:54, JB wrote: Hi Richmond, That seems to leave me with the string I want to delete. Even so thank you for the code. John Balgenorth On Aug 24, 2014, at 8:46 AM, Richmond richmondmathew...@gmail.com wrote: on mouseUp put fld TEXXT into TEXXT put the number of chars in TEXXT into CHNMB repeat CHNMB times if the last char of TEXXT is A then delete the last char of TEXXT end if if the last char of TEXXT is B then delete the last char of TEXXT end if if the last char of TEXXT is C then delete the last char of TEXXT end if put TEXXT into fld TEXXT end repeat end mouseUp I thought you wanted to 'snip' specific letters off the end of a chain of letter. Iff that is what you wanted, that script will do that. Richmond. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re : Speed
All right, the permutations. Thanks for the responses. My findings so far : Mark wrote : -- In addition, you're losing much of the speed of the repeat for each loops by embedding a repeat with loop at the deepest level (and in addition you're making an unneccsary extra copy of tLine each time through the slowest loop): repeat for each line tLine in TempPerms1 repeat with y = Index down to 1 put tLine into Temp put newElement comma before item y of temp put Temp cr after TempPerms5 end repeat end repeat Something like this should be faster (do this for both upper and lower halves): repeat for each line tLine in TempPerms1 repeat for each item tItem in tLine put tItem comma after TempPerms5 end repeat put cr into char -1 of TempPerms5 end repeat -- Mark, I cannot get your improvement to work. I think there is something missing or maybe I am overseeing something. The inner loop in your script is equivalent to : put tLine into TempPerms5. The total result from the inner outer loop is the same as : put TempPerms1 into TempPerms1 As a total result of the complete script I always get (no matter what the input is) : 1,2 cr 2,1 In my script, I need to ' put tLine into Temp' in every time I pass the inner loop, to renew Temp with tLine. Otherwise I change tLine all the time in the inner loop. In every round in the outer loop, I step the new element (e.g. 3) through all possible positions in tLine (e.g. tLine = 1,2 1,2,3 1,3,23,1,2 ) . Then I go on and do the same with the next element (4 in this case) for each newly formed line (1,2,3 etc). Dick wrote : The Wikipedia entry for permutation says the fastest algorithm for generating permutations is Heap's algorithm. Quite interesting. I still have to understand what's happening completely, but I implemented you LC translation of the Heap algo. And it runs on my system a bit over 2 minutes (165732 millisecs) for 10 elements. To my surprise, my old algo does it in 7515 millisecs. I could improve on that by using chars instead of items (7465 millisecs). Another improvement I could make was by only calculating the upper half of the permutations (all the ones that start with 1,2,) and then copy them and swap the 1's and 2's. This gave as result only 5597 millisecs for 10 elements. I am a bit at a loss, as I would be surprised if my way would be like 25 times faster than the fastest known algorithm. Did I make a mistake in implementing Dicks code (although Dick also reports 2 minutes to do the job, as my way does it in 5.6 secs). What is happening here. I even suspect, that I can improve more on my improved way (by only calculating half of the perms and swapping the 1's and 2's. I might apply that principle more (like only calculating 1/4 of the perms and do some swapping, or even better). I will look into that later. --- Kay wrote : I obtained a 10% speed increase by changing this: repeat with n = 3 to 10 to this: put 3,4,5,6,7,8,9,10 into nList repeat for each item n in nList I haven't been able to try this, but it is very interesting in general. That even such short lists produce such a difference in speed in repeat with or repeat for. I thought that only counted for longer lists. very enlightening though. Thanks. --- Geoff : looks promising. It is in the ballpark where my alto seems to be. I will get back to you letter when I have had a good look and test at your script. New idea : I was hinting at a way of producing permutations in the case that there are duplicate elements in the input. F.i. 1,1,2,3 only gives 12 permutations instead of 24 for 1,2,3,4 as input. Before I calculated all the possible permutations and deleted the duplicates afterwards. I found that if I move the removing of duplicates to an early stage (as early as possible), the speedup is enormous. Thanks for all the input, Beat ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
if tString1 ends with tString2 then delete char (the length of tString1 - the length of tString2 +1 ) to -1 of tString1 end if Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html On Sun, Aug 24, 2014 at 8:12 AM, JB sund...@pacifier.com wrote: Hi, Thanks for the reply. I am saying if I have “ABC” in one string and the other string has “KCFAJFCABC” then I want to delete the “ABC” from the end of the second string leaving “KCFAJFC”. John Balgenorth On Aug 24, 2014, at 8:09 AM, dunb...@aol.com wrote: Hi. Are you saying that if you have ABCD and somewhere else you have: AXFRZC that you want to delete the C from the first string? Whatever you want, the chunking and text control within LC is more than adequate to do the job, and will be fun do execute as well. But is this what you meant? Craig Newman -Original Message- From: JB sund...@pacifier.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sun, Aug 24, 2014 10:16 am Subject: delete end chars If I have a certain amount of characters and I want to check the end of another line of characters to see if they are there and if so then delete them what is the fastest way to do delete the characters at the end of the specified line? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
Pete beat me to the punch. if text of fld 1 ends with text of fld 2 then \ delete char -(length(fld 2)) to -1 of fld 1 Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 8/24/14 9:28 AM, Peter Haworth p...@lcsql.com wrote: if tString1 ends with tString2 then delete char (the length of tString1 - the length of tString2 +1 ) to -1 of tString1 end if Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html On Sun, Aug 24, 2014 at 8:12 AM, JB sund...@pacifier.com wrote: Hi, Thanks for the reply. I am saying if I have ³ABC² in one string and the other string has ³KCFAJFCABC² then I want to delete the ³ABC² from the end of the second string leaving ³KCFAJFC². John Balgenorth On Aug 24, 2014, at 8:09 AM, dunb...@aol.com wrote: Hi. Are you saying that if you have ABCD and somewhere else you have: AXFRZC that you want to delete the C from the first string? Whatever you want, the chunking and text control within LC is more than adequate to do the job, and will be fun do execute as well. But is this what you meant? Craig Newman -Original Message- From: JB sund...@pacifier.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sun, Aug 24, 2014 10:16 am Subject: delete end chars If I have a certain amount of characters and I want to check the end of another line of characters to see if they are there and if so then delete them what is the fastest way to do delete the characters at the end of the specified line? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: OpenField mystery
I think the bug is still there: I just created a stack with one button and one field. I can edit the field and then immediately click the button, but the 'closeField' doesn't fire unless I make it do so explicitly, for example with a 'returnInField' handler, or if the whole stack loses focus and then gets it back. So I plan to report it. Thanks for the confirmation that it is indeed a bug. Graham On 23 Aug 2014, at 23:22, J. Landman Gay jac...@hyperactivesw.com wrote: On 8/23/2014, 3:02 PM, Graham Samuel wrote: It is quite possible for him (her) not to close the last revised field, but simply to go straight to clicking the button. This means that I can't rely on a 'closeField' message being generated even when a field is modified! Hm, that's an old bug that I thought got fixed. I remember a while back noticing that a closefield was sent. If it's broken again, consider putting in a bug report on it. If I remember right, I used to do this in the button: if the selectedfield then send closefield to the selectedfield but it was a long time ago. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
Thank you for the reply and code. I can’t seem to get it to work right. The only thing I could make it do is if ABC is string1 and ABC us string2 it will delete string2 but if chars are before the ABC in string2 nothing is deleted. Even so it is good code and I might need to use it sometime. John Balgenorth On Aug 24, 2014, at 9:28 AM, Peter Haworth p...@lcsql.com wrote: if tString1 ends with tString2 then delete char (the length of tString1 - the length of tString2 +1 ) to -1 of tString1 end if Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html On Sun, Aug 24, 2014 at 8:12 AM, JB sund...@pacifier.com wrote: Hi, Thanks for the reply. I am saying if I have “ABC” in one string and the other string has “KCFAJFCABC” then I want to delete the “ABC” from the end of the second string leaving “KCFAJFC”. John Balgenorth On Aug 24, 2014, at 8:09 AM, dunb...@aol.com wrote: Hi. Are you saying that if you have ABCD and somewhere else you have: AXFRZC that you want to delete the C from the first string? Whatever you want, the chunking and text control within LC is more than adequate to do the job, and will be fun do execute as well. But is this what you meant? Craig Newman -Original Message- From: JB sund...@pacifier.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sun, Aug 24, 2014 10:16 am Subject: delete end chars If I have a certain amount of characters and I want to check the end of another line of characters to see if they are there and if so then delete them what is the fastest way to do delete the characters at the end of the specified line? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
I got that one to work. Thank you. John Balgenorth On Aug 24, 2014, at 9:42 AM, Scott Rossi sc...@tactilemedia.com wrote: Pete beat me to the punch. if text of fld 1 ends with text of fld 2 then \ delete char -(length(fld 2)) to -1 of fld 1 Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 8/24/14 9:28 AM, Peter Haworth p...@lcsql.com wrote: if tString1 ends with tString2 then delete char (the length of tString1 - the length of tString2 +1 ) to -1 of tString1 end if Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html On Sun, Aug 24, 2014 at 8:12 AM, JB sund...@pacifier.com wrote: Hi, Thanks for the reply. I am saying if I have ³ABC² in one string and the other string has ³KCFAJFCABC² then I want to delete the ³ABC² from the end of the second string leaving ³KCFAJFC². John Balgenorth On Aug 24, 2014, at 8:09 AM, dunb...@aol.com wrote: Hi. Are you saying that if you have ABCD and somewhere else you have: AXFRZC that you want to delete the C from the first string? Whatever you want, the chunking and text control within LC is more than adequate to do the job, and will be fun do execute as well. But is this what you meant? Craig Newman -Original Message- From: JB sund...@pacifier.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sun, Aug 24, 2014 10:16 am Subject: delete end chars If I have a certain amount of characters and I want to check the end of another line of characters to see if they are there and if so then delete them what is the fastest way to do delete the characters at the end of the specified line? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: OpenField mystery
I concur. I would never have thought of it. It works very well for me. Thanks Peter Graham On 24 Aug 2014, at 00:24, J. Landman Gay jac...@hyperactivesw.com wrote: On 8/23/2014, 4:10 PM, Peter M. Brigham wrote: I have long been annoyed at the default placement of the insertion point in the first field when the card is opened (I believe it's not just when the stack gains focus). My solution is to group all the fields and set the traversalon of the group to false. This doesn't interfere with the editability of any individual field, but it solves the problem of this annoyance. What a good idea. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
Couple of other ways using regex. get matchText(tString1,(.*) tString2 $,tString1) Or if matchChunk(tString1,(.*) tString2 $,tString1,tStart,tEnd) then delete char tStart to tEnd of tString1 end if Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html On Sun, Aug 24, 2014 at 9:28 AM, Peter Haworth p...@lcsql.com wrote: if tString1 ends with tString2 then delete char (the length of tString1 - the length of tString2 +1 ) to -1 of tString1 end if Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html On Sun, Aug 24, 2014 at 8:12 AM, JB sund...@pacifier.com wrote: Hi, Thanks for the reply. I am saying if I have “ABC” in one string and the other string has “KCFAJFCABC” then I want to delete the “ABC” from the end of the second string leaving “KCFAJFC”. John Balgenorth On Aug 24, 2014, at 8:09 AM, dunb...@aol.com wrote: Hi. Are you saying that if you have ABCD and somewhere else you have: AXFRZC that you want to delete the C from the first string? Whatever you want, the chunking and text control within LC is more than adequate to do the job, and will be fun do execute as well. But is this what you meant? Craig Newman -Original Message- From: JB sund...@pacifier.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sun, Aug 24, 2014 10:16 am Subject: delete end chars If I have a certain amount of characters and I want to check the end of another line of characters to see if they are there and if so then delete them what is the fastest way to do delete the characters at the end of the specified line? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
Thank you very much! I was able to get the first one to work but for some reason and it could be me I could not get the second one to work. thanks again John Balgenorth On Aug 24, 2014, at 10:19 AM, Peter Haworth p...@lcsql.com wrote: Couple of other ways using regex. get matchText(tString1,(.*) tString2 $,tString1) Or if matchChunk(tString1,(.*) tString2 $,tString1,tStart,tEnd) then delete char tStart to tEnd of tString1 end if Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html On Sun, Aug 24, 2014 at 9:28 AM, Peter Haworth p...@lcsql.com wrote: if tString1 ends with tString2 then delete char (the length of tString1 - the length of tString2 +1 ) to -1 of tString1 end if Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html On Sun, Aug 24, 2014 at 8:12 AM, JB sund...@pacifier.com wrote: Hi, Thanks for the reply. I am saying if I have “ABC” in one string and the other string has “KCFAJFCABC” then I want to delete the “ABC” from the end of the second string leaving “KCFAJFC”. John Balgenorth On Aug 24, 2014, at 8:09 AM, dunb...@aol.com wrote: Hi. Are you saying that if you have ABCD and somewhere else you have: AXFRZC that you want to delete the C from the first string? Whatever you want, the chunking and text control within LC is more than adequate to do the job, and will be fun do execute as well. But is this what you meant? Craig Newman -Original Message- From: JB sund...@pacifier.com To: How to use LiveCode use-livecode@lists.runrev.com Sent: Sun, Aug 24, 2014 10:16 am Subject: delete end chars If I have a certain amount of characters and I want to check the end of another line of characters to see if they are there and if so then delete them what is the fastest way to do delete the characters at the end of the specified line? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Android LiveCode stack player
Hi All, Android platform allows to open a stack from Livecode apps compiled for Android (unlike iOS). Does anyone have created an Android Stack Player, similar to Ken Ray's StackRunner? http://www.sonsothunder.com/devres/livecode/downloads.htm Thanks in advance! Al -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Android-LiveCode-stack-player-tp4682406.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Speed
There are significant differences in speed between 5.5 and 6.6. Not so much in deriving the permutations as in displaying the results in a field. To see this run this in the message box: go url https://dl.dropboxusercontent.com/u/47044230/PermutationSpeed3.rev” (Does this only work in LC 6 and up?) To see the difference in earlier vs of RR you will have to open it in 6.0 and then save it as legacy. The difference is significant. It takes about 3 sec to run and display the permutations (using Geoff’s code) and display them in a field in 5.0, but about 30 sec in 6.0 Almost all of that difference is in the display. It takes only about 1 sec to put the permutations into a variable. Jim Mesxxxsage: 12 Date: Sat, 23 Aug 2014 22:21:16 -0500 From: Geoff Canyon gcan...@gmail.com To: How to use LiveCode use-livecode@lists.runrev.com Subject: Re: Speed Message-ID: cakclktpfp7ox0tju6hkpscwyiyto9wu07vf1emnpru285wb...@mail.gmail.com Content-Type: text/plain; charset=UTF-8 This has several restrictions, but it generates all permutations of 10 items in about 6 seconds on my recent macbook. It uses two functions, one to generate a permuted list of single digits, and the other to replace in the actual items to be permuted. The restrictions are: 1. The general permutations function P only works with up to 10 items. It wouldn't be too hard to extend beyond that, but it would sully the very nice (IMHO) use of single digits to store the permutations. 2. The items to be permuted cannot contain the digits 0-9. This could also be worked around by using different characters for the permutation routine, but making it bombproof would be harder than that. gc function P N -- returns all the permutations of the digits from 0-N -- only works to N = 9!!! if N = 0 then return 0 cr put P(N - 1) into T repeat with i = 0 to N - 1 put T into T2 replace i with N in T2 replace cr with i cr in T2 put T2 after R end repeat replace cr with N cr in T return R T end P function PLines L -- returns comma-delimited lines containing -- all the permutations of the lines in L -- The lines in L cannot contain any digits from 0 to -- the number of lines - 1 put the number of lines of L into N put P(N - 1) into R repeat with i = 1 to N replace i - 1 with (line i of L) comma in R end repeat replace comma cr with cr in R return R end PLines ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Speed
Sorry about that last post. Forgot to delete all message above Geoff’s. Jim ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: OpenField mystery
That's been an issue on Macs forever. If you're in a field and then click a button, the field doesn't lose focus so no closeField is sent. I believe the way to get round it is to focus on nothing in the mouseUp code of the button (or the mouseDown). Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html On Sun, Aug 24, 2014 at 9:45 AM, Graham Samuel livf...@mac.com wrote: I think the bug is still there: I just created a stack with one button and one field. I can edit the field and then immediately click the button, but the 'closeField' doesn't fire unless I make it do so explicitly, for example with a 'returnInField' handler, or if the whole stack loses focus and then gets it back. So I plan to report it. Thanks for the confirmation that it is indeed a bug. Graham On 23 Aug 2014, at 23:22, J. Landman Gay jac...@hyperactivesw.com wrote: On 8/23/2014, 3:02 PM, Graham Samuel wrote: It is quite possible for him (her) not to close the last revised field, but simply to go straight to clicking the button. This means that I can't rely on a 'closeField' message being generated even when a field is modified! Hm, that's an old bug that I thought got fixed. I remember a while back noticing that a closefield was sent. If it's broken again, consider putting in a bug report on it. If I remember right, I used to do this in the button: if the selectedfield then send closefield to the selectedfield but it was a long time ago. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Android LiveCode stack player
If I understand what you're after (loading a remote stack?), maybe this will give you some ideas: http://runtime-revolution.278305.n4.nabble.com/Using-DropBox-for-Faster-Mo bile-Development-td4380386.html This isn't limited to DropBox obviously -- you can set up your launcher to load stacks from any URL. And you can load stacks saved as local documents. With published apps on iOS, there's always the question of what Apple will permit. Technically, they say no loading external code, but launching web pages with javascript and other web technologies is fine. Hopefully we'll have a clearer way around this once the HTML5 stuff is in place. Regards, Scott Rossi Creative Director Tactile Media, UX/UI Design On 8/24/14 10:52 AM, Alejandro Tejada capellan2...@gmail.com wrote: Hi All, Android platform allows to open a stack from Livecode apps compiled for Android (unlike iOS). Does anyone have created an Android Stack Player, similar to Ken Ray's StackRunner? http://www.sonsothunder.com/devres/livecode/downloads.htm Thanks in advance! Al -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Android-LiveCode-stack-play er-tp4682406.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
On Sun, Aug 24, 2014 at 10:35 AM, JB sund...@pacifier.com wrote: (tString1,(.*) tString2 $,tString1,tStart,tEnd) My apologies, should have tested it first! It should be: if matchChunk(tString1,.*( tString2 )$,tStart,tEnd) then delete char tStart to tEnd of tString1 end if Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
I still can’t get it to work for some reason. And the first regex one ends up leaving me the letters that I wanted to delete instead of leaving the other part. After getting the others to work in a new stack I tried them in the script I needed it for and the only one that would work is the one Colin Holgate wrote. It seems the ones that used “the text” int the script might need to refer to a field and not a variable so I re wrote the script to use a field and it still did not work. I think it might be due to the place in the script I needed it is nested deep\ in some repeat commands. Once again thank you and everyone else for the help. John Balgenorth On Aug 24, 2014, at 12:35 PM, Peter Haworth p...@lcsql.com wrote: On Sun, Aug 24, 2014 at 10:35 AM, JB sund...@pacifier.com wrote: (tString1,(.*) tString2 $,tString1,tStart,tEnd) My apologies, should have tested it first! It should be: if matchChunk(tString1,.*( tString2 )$,tStart,tEnd) then delete char tStart to tEnd of tString1 end if Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Android LiveCode stack player
Great! I want to open local stacks from Android Internal Storage, microSDHC card or (if LiveCode could read from usb devices on Android) a USB Pendrive (Fat32 or NTFS). I will test this as soon I reinstall android development kit... :( Al -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Android-LiveCode-stack-player-tp4682406p4682413.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
On Sun, Aug 24, 2014 at 1:43 PM, JB sund...@pacifier.com wrote: I still can’t get it to work for some reason. And the first regex one ends up leaving me the letters that I wanted to delete instead of leaving the other part. Strange. They both work fine here. Maybe the variables are the wrong way round? tString1 is the one containing the string to be searched and tString2 is the string to be searched for (ABC in your example) Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
[ANN] LiveCode meeting in the Netherlands
Dear everyone, On 20th September 2014, there will be a LiveCode meeting in the Netherlands. The exact location will be announced shortly. Participants, please contact me as soon as possible. I need to know how many people will participate to determine where to host the meeting. Contact me by e-mail, tomorrow or Tuesday. We expect people from two or three different countries and hope to organise a really international meeting. If you can't make it to RunRevLive, this might be a great opportunity to meet fellow LiveCode users. Two months ago, we had a meeting in Zurich, Switzerland. You can read about it and view a few pictures at http://qery.us/cdv or http://blog.economy-x-talk.com I will make another announcement within a few days. If you have questions, contact me by e-mail, send me a message on Twitter or use Facebook (see below). Kind regards, Mark -- Best regards, Mark Schonewille Economy-x-Talk Consulting and Software Engineering Homepage: http://economy-x-talk.com Twitter: http://twitter.com/xtalkprogrammer KvK: 50277553 Installer Maker for LiveCode: http://qery.us/468 Buy my new book Programming LiveCode for the Real Beginner http://qery.us/3fi LiveCode on Facebook: https://www.facebook.com/groups/runrev/ ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
You are right. Thank you! What happened is the variables were all listed right in my code for the searching and replacing and then I put the wrong variable into the field I wanted to change. thanks again. John Balgenorth On Aug 24, 2014, at 3:07 PM, Peter Haworth p...@lcsql.com wrote: On Sun, Aug 24, 2014 at 1:43 PM, JB sund...@pacifier.com wrote: I still can’t get it to work for some reason. And the first regex one ends up leaving me the letters that I wanted to delete instead of leaving the other part. Strange. They both work fine here. Maybe the variables are the wrong way round? tString1 is the one containing the string to be searched and tString2 is the string to be searched for (ABC in your example) Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Population puzzle
I know that some of the folks on this list enjoy puzzles. A friend sent me this one this afternoon and I thought it would be interesting to see the different approaches folks come up with and how fast it can be solved. enjoy… The 2010 Census puts populations of 26 largest US metro areas at 18897109, 12828837, 9461105, 6371773, 5965343,5946800, 5582170, 5564635, 5268860, 4552402, 4335391, 4296250, 4224851, 4192887, 3439809, 3279833, 3095313,2812896, 2783243, 2710489, 2543482, 2356285, 2226009, 2149127, 2142508, and 2134411. Can you find a subset of these areas where a total of exactly 100,000,000 people live, assuming the census estimates are exactly right? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Population puzzle
Michael- Sunday, August 24, 2014, 4:52:43 PM, you wrote: I know that some of the folks on this list enjoy puzzles. A friend sent me this one this afternoon and I thought it would be interesting to see the different approaches folks come up with and how fast it can be solved. enjoy The 2010 Census puts populations of 26 largest US metro areas at 18897109, 12828837, 9461105, 6371773, 5965343,5946800, 5582170, 5564635, 5268860, 4552402, 4335391, 4296250, 4224851, 4192887, 3439809, 3279833, 3095313,2812896, 2783243, 2710489, 2543482, 2356285, 2226009, 2149127, 2142508, and 2134411. Can you find a subset of these areas where a total of exactly 100,000,000 people live, assuming the census estimates are exactly right? This was in the mongodb certification, if I remember correctly, and the python code was fun to write. -- -Mark Wieder ahsoftw...@gmail.com This communication may be unlawfully collected and stored by the National Security Agency (NSA) in secret. The parties to this email do not consent to the retrieving or storing of this communication and any related metadata, as well as printing, copying, re-transmitting, disseminating, or otherwise using it. If you believe you have received this communication in error, please delete it immediately. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
Not bringing much to the table other than to say that if you are looking into large amounts of data, and need to do this millions of time, and therefore speed is of interest, Peter's grep solution is ever so slightly faster than Colin's. There isn't much in it and both scale well. If you'd like to test, create a new stack, one button and in the btn copy the below script which is one mouseUp handler and one Function fRandomInRange. The script will ask you how long you want your test string to be and how many times to you want to repeat the search. The default values of a string 100 chars long searched a million times (repeated 4 times) takes just over a second so don't be worried about starting with the default values. The search is repeated 4 times, 1st it does Colin's search, then it does Peter's search and just in case there is some kind of advantage/disadvantage regarding being first, I do Peter's search again and end off with Colin's. When run the message box should end up with something like this: For a random string of 100 chars long. Searched 100 times. Colin's 1st run: 362 ms Peter's 1st run: 349 ms Output Identical Peter's 2nd run: 351 ms Output Identical Colin's 2nd run: 356 ms Output Identical BE MINDFUL OF LINE WRAPS on mouseUp ask How many characters do you want in your random string with 100 titled Enter a Number put it - 3 into tAnswer put For a random string of tAnswer + 3 chars long. cr into msg repeat tAnswer times --generates a number between 32 90 and turns it into an ASCII char put numToChar(fRandomInRange(32,90)) after tData end repeat --so we know that the data contains the string to be found put ABC after tData put ABC into tFind ask How many times do you want to repeat the search with 100 titled Enter a Number put it into tAnswer put Searched tAnswer times. cr after msg put the millisec into tStart --Colin's 1st repeat tAnswer times put offset(tFind,tSearch) into tOffset if (tOffset = the number of chars in tSearch - the number of chars in tFine + 1) then put char 1 to tOffset - 1 of tSearch into tFound put tFound into tColin1st end if end repeat put the millisec into tEnd put Colin's 1st run: tEnd - tStart ms cr after msg put the millisec into tStart --Peter's 1st run repeat tAnswer times if (matchText(tSearch,(.*) tFind $,tFound)) then put tFound into tPeter1st end if end repeat put the millisec into tEnd put Peter's 1st run: tEnd - tStart ms cr after msg if (tColin1st = tPeter1st) then put Output Identical cr after msg else put ERROR! cr after msg end if put the millisec into tStart --Peter's Again repeat tAnswer times if (matchText(tSearch,(.*) tFind $,tFound)) then put tFound into tPeter2nd end if end repeat put the millisec into tEnd put Peter's 2nd run: tEnd - tStart ms cr after msg if (tPeter2nd = tPeter1st) then put Output Identical cr after msg else put ERROR! cr after msg end if put the millisec into tStart --Colin's 2nd run repeat tAnswer times put offset(tFind,tSearch) into tOffset if (tOffset = the number of chars in tSearch - the number of chars in tFine + 1) then put char 1 to tOffset - 1 of tSearch into tFound put tFound into tColin2nd end if end repeat put the millisec into tEnd put Colin's 2nd run: tEnd - tStart ms cr after msg if (tPeter2nd = tColin2nd) then put Output Identical after msg else put ERROR! after msg end if end mouseUp FUNCTION fRandomInRange pLower, pUpper return random(pUpper - pLower + 1) + pLower -1 end fRandomInRange ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: Population puzzle
OK - I¹ll take the bait although elegant algorithms definitely aren¹t my forte. As a result this is probably a very half-baked and inefficient solution to the problem but it seems to work and doesn¹t have to resort to recursion (which I can never get my head around) to generate the starting combinations. Instead I just repeatedly randomise the order of the items and sum them in that order until I get the required value. Anyway, here goes (watch out for wrapped lines) Terry... on runIt put the seconds into tTimer put 1 into theTotal put 18897109,12828837,9461105,6371773,5965343,5946800,5582170,5564635,5268860, 4552402,4335391,4296250,4224851,4192887,3439809,3279833,3095313,2812896,278 3243,2710489,2543482,2356285,2226009,2149127,2142508,2134411 into tCityPops put empty into tKeys put 0 into tN repeat for each item tPop in tCityPops add 1 to tN put tPop into tPops[tN] put tN comma after tKeys end repeat delete last char of tKeys put 0 into nIterations repeat forever add 1 to nIterations # randomise the order of the keys put randomiseItems(tKeys) into tX put 0 into tTotal repeat for each item tKey in tX add tPops[tKey] to tTotal if tTotal = theTotal then # we have a winner put itemOffset(tKey,tX) into nItem put item 1 to nItem of tX into tY sort items of tY ascending numeric answer (Items = tY cr nIterations = nIterations cr Elapsed time = (the seconds - tTimer) secs) exit to top else if tTotal theTotal then exit repeat end if end if end repeat end repeat end runIt function randomiseItems theItems put empty into tItems repeat forever put the number of items in theItems into nItems if nItems = 0 then exit repeat put random(nItems) into nItem put item nItem of theItems comma after tItems delete item nItem of theItems end repeat delete last char of tItems return tItems end randomiseItems On 25/08/2014 9:52 am, Michael Doub miked...@gmail.com wrote: I know that some of the folks on this list enjoy puzzles. A friend sent me this one this afternoon and I thought it would be interesting to see the different approaches folks come up with and how fast it can be solved. enjoyŠ The 2010 Census puts populations of 26 largest US metro areas at 18897109, 12828837, 9461105, 6371773, 5965343,5946800, 5582170, 5564635, 5268860, 4552402, 4335391, 4296250, 4224851, 4192887, 3439809, 3279833, 3095313,2812896, 2783243, 2710489, 2543482, 2356285, 2226009, 2149127, 2142508, and 2134411. Can you find a subset of these areas where a total of exactly 100,000,000 people live, assuming the census estimates are exactly right? ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
Re: delete end chars
On Sun, Aug 24, 2014 at 8:09 PM, Kay C Lan lan.kc.macm...@gmail.com wrote: Not bringing much to the table other than to say that if you are looking into large amounts of data, and need to do this millions of time, and therefore speed is of interest, Peter's grep solution is ever so slightly faster than Colin's. There isn't much in it and both scale well. If you'd like to test, create a new stack, one button and in the btn copy the below script which is one mouseUp handler and one Function fRandomInRange. Thanks for checking this out Kay. As you said, there's no practical difference between the two solutions but it's good to know that regex is pretty fast (at least in this case) since it tends to get a bad rap when it comes to performance. Pete lcSQL Software http://www.lcsql.com Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and SQLiteAdmin http://www.lcsql.com/sqliteadmin.html ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode