Counting problem

dunbarx at aol.com dunbarx at aol.com
Fri May 24 22:26:32 EDT 2013


Alex.


I am the kind of guy that is happy to solve a problem without understanding it. But this one is, er, bugging me.


Craig



-----Original Message-----
From: Alex Tweedly <alex at tweedly.net>
To: use-livecode <use-livecode at lists.runrev.com>
Sent: Fri, May 24, 2013 7:11 pm
Subject: Re: Counting problem


I see the same problem on both 5.5.3 and 6.0.1 - but testing in the 
message box.

Oddly, I happened to notice that if I change the script to be

  put "a,b,c,d,e,f,g,h,i,j" into temp
    repeat 10
       add 1 to counter[any item of temp]
       put counter["b"] into tJunk          -- i.e. I add a single useless line 
!!
  end repeat



it works just fine every time.
Don't know if that helps you or makes it worse :-)

-- Alex.

On 24/05/2013 22:56, dunbarx at aol.com wrote:
> I know I am going to feel like a dope, but why does the first script always 
properly give ten counts in the array variable "counter", but the second can 
give anywhere from five to sixteen, and maybe others?
>
>
>
> on mouseUp
>     put "a,b,c,d,e,f,g,h,i,j" into temp
>     repeat 10
>       get any item of temp --always gives ten
>        add 1 to counter[it]
>     end repeat
> end mouseUp
>
>
> on mouseup
>     put "a,b,c,d,e,f,g,h,i,j" into temp
>     repeat 10
>        add 1 to counter[any item of temp]
>    end repeat
> end mouseUp
>
>
>
>
> I have deconstructed the problem line by watching the array in the debugger on 
the sly after each iteration. It goes crazy, sometimes the count of a particular 
char going DOWN.
>
>
> Craig Newman
>
>
>
> -----Original Message-----
> From: Terry Dennis <tedennis at softwaredetails.com>
> To: use-livecode <use-livecode at lists.runrev.com>
> Sent: Fri, May 24, 2013 12:35 am
> Subject: Weird glitch in breakpoint behavior
>
>
> I was testing a 6.0.1 stack when "Step into next statement" after a manual
> breakpoint acted like a 'Continue" ... meaning it didn't stop until the end of
> the script.  I was able to recreate the problem repeatedly, so I began to
> whittle down my script to find what caused the glitch.  In so doing, I checked
> various preference settings to see what might have caused the weird glitch.
>
> I kept whittling away until there wasn't much left in my script, so I finally
> decided to start from scratch with an entirely new app.  It happened again 
with
> a do-nothing script.
>
> Recipe:
> 1) Put the following simple script into a button's mouseUp script in a new 
app.
> 2) Set breakpoints manually on lines 2 and 4.
> 3) Click the button.  It stops on line 2, as expected.
> 4) Click on Edit/Preferences in the LiveCode menu
> 5) The app runs to the hardcoded breakpoint on line 6
>
> First of all, it shouldn't have run when I merely opened the preferences 
dialog.
> Secondly, it missed the manual breakpoint on line 4
>
> OK, so like a good little developer, I tried the same script in a backleveled
> version (5.5.1) to see if recent LiveCode updates created the problem.  That's
> the most likely scenario, right?
>
> Nope.  I got the same results.  Apparently this weird glitch has been around
> since today's pebbles were large boulders.
>
> Lots of testing later ...
>
> There were *some* instances of opening the preferences dialog that didn't 
cause
> the problem.  And, selecting individual preference items didn't cause the
> problem.
>
> However, EVERY time I selected the "Updates" preference item, the script
> "Continue"d.
>
> Yeah, I know. The doctors says if it hurts, then don't do that.  OK, so I 
won't
> open the Preferences dialog and test for "Updates" during debugging sessions.
>
> However ...
>
> This weird glitch *might* be related in some bizarre manner to prior 
(seemingly)
> random and unrecreatable weird glitches I have had with breakpoint executions.
> The good news (I think) is this time I was able to recreate and isolate the
> weird glitch.
>
> Well, I isolated *a* weird glitch.  Whether it is related to my *original* 
weird
> glitch, I don't know.
>
> The original weird glitch with my app would sometimes (randomly?) get 
triggered
> by simply clicking on the "up arrow" in the Variables display of the IDE.  Is 
a
> keystroke being passed through the hierarchy into the app when it shouldn't 
be?
> Unknown.  The (random?) up arrow weird glitch happened only in 6.0.1, so it's
> possible that particular weird glitch occurred because of recent updates to
> LiveCode.
>
> In addition to the above weirdness, the same preferences weird glitch is
> recreatable in 6.0.1 by clicking on Tools/Project Browser.  Am I more likely 
to
> open the Project Browser during debugging than I am likely to open the
> Preferences dialog?  Ubetcha.
>
> Again, is this preferences/browser dialog weird glitch related to my original
> weird glitch?  Heck if I know.  It's just plain weird.
>
> Hopefully this exercise will help others who have experienced (seemingly) 
random
> weird glitches with breakpoints in the past.  It's possible all those weird
> glitches could have a common thread, so fixing this *recreatable* weird glitch
> could solve all those other weird glitches at the same time.
>
> I suppose I could be the ONLY poor soul who has experienced weird glitches 
with
> breakpoints, but I doubt it.
>
> Did I mention it was a weird glitch?
>
> Simple Script:
> on mouseUp
>     put empty into tGarbage1 -- once
>     put empty into tGarbage2 -- twice
>     put empty into tGarbage3 -- three times
>     put empty into tGarbage4 -- a lady
>     breakpoint
> end mouseUp
>
> TED
> _______________________________________________
> use-livecode mailing list
> use-livecode at 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 at 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 at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the Use-livecode mailing list