[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

Find loop where iteration *lock up*

JT

5/18/2015 8:34:00 PM

Is there a way to trace where an iteration do lockup in a javascript?
Could they not printout the row executed when you break script?
12 Answers

JT

5/18/2015 9:01:00 PM

0

Den måndag 18 maj 2015 kl. 22:34:31 UTC+2 skrev jonas.t...@gmail.com:
> Is there a way to trace where an iteration do lockup in a javascript?
> Could they not printout the row executed when you break script?

I've put console.log(¨1¨),console.log(¨3¨),console.log(¨3¨), etc within all while loops.

Is there anything i further can do to find out where it lockup?

Ben Bacarisse

5/18/2015 9:26:00 PM

0

jonas.thornvall@gmail.com writes:

> Den måndag 18 maj 2015 kl. 22:34:31 UTC+2 skrev jonas.t...@gmail.com:
>> Is there a way to trace where an iteration do lockup in a javascript?
>> Could they not printout the row executed when you break script?
>
> I've put console.log(¨1¨),console.log(¨3¨),console.log(¨3¨), etc
> within all while loops.
>
> Is there anything i further can do to find out where it lockup?

Most systems have some form of debugger. I can't help much with how to
use them because I prefer to use lots of tests. Your code is almost
untestable because all the parts are tied together through globals.

--
Ben.

Michael Haufe (\"TNO\")

5/18/2015 9:54:00 PM

0

On Monday, May 18, 2015 at 3:34:31 PM UTC-5, jonas.t...@gmail.com wrote:
> Is there a way to trace where an iteration do lockup in a javascript?
> Could they not printout the row executed when you break script?

In the Firefox debugger you can tell it to pause on exceptions. I suspect the other popular browsers support this functionality as well.

JT

5/18/2015 9:59:00 PM

0

Den måndag 18 maj 2015 kl. 23:25:51 UTC+2 skrev Ben Bacarisse:
> jonas.thornvall@gmail.com writes:
>
> > Den måndag 18 maj 2015 kl. 22:34:31 UTC+2 skrev jonas.t...@gmail.com:
> >> Is there a way to trace where an iteration do lockup in a javascript?
> >> Could they not printout the row executed when you break script?
> >
> > I've put console.log(¨1¨),console.log(¨3¨),console.log(¨3¨), etc
> > within all while loops.
> >
> > Is there anything i further can do to find out where it lockup?
>
> Most systems have some form of debugger. I can't help much with how to
> use them because I prefer to use lots of tests. Your code is almost
> untestable because all the parts are tied together through globals.
>
> --
> Ben.

Well i decided to make a counter within main, from what i can see it do not lockup on bases less than 10 and it is sporadic but the higher the base and higher the number the higher chance for loop lockup.

So using base 11 and counter from 1 to first lockup number, and take it from there.

JT

5/18/2015 10:19:00 PM

0

Den måndag 18 maj 2015 kl. 23:53:56 UTC+2 skrev Michael Haufe (TNO):
> On Monday, May 18, 2015 at 3:34:31 PM UTC-5, jonas.t...@gmail.com wrote:
> > Is there a way to trace where an iteration do lockup in a javascript?
> > Could they not printout the row executed when you break script?
>
> In the Firefox debugger you can tell it to pause on exceptions. I suspect the other popular browsers support this functionality as well.

I just implemented a counter, and get strange maybe even impossible result.

I use base 11 and start to convert from 0 using a counter.

But the program decides to loop at different numbers at different executions, is that even possible?

Javascript is not threaded, it is linear execution?

JT

5/18/2015 10:40:00 PM

0

Den tisdag 19 maj 2015 kl. 00:19:02 UTC+2 skrev jonas.t...@gmail.com:
> Den måndag 18 maj 2015 kl. 23:53:56 UTC+2 skrev Michael Haufe (TNO):
> > On Monday, May 18, 2015 at 3:34:31 PM UTC-5, jonas.t...@gmail.com wrote:
> > > Is there a way to trace where an iteration do lockup in a javascript?
> > > Could they not printout the row executed when you break script?
> >
> > In the Firefox debugger you can tell it to pause on exceptions. I suspect the other popular browsers support this functionality as well.
>
> I just implemented a counter, and get strange maybe even impossible result.
>
> I use base 11 and start to convert from 0 using a counter.
>
> But the program decides to loop at different numbers at different executions, is that even possible?
>
> Javascript is not threaded, it is linear execution?

It do bug out at 29 ones or nines. But when i use a counter it can bug out on any number between 117-1000

JT

5/18/2015 10:42:00 PM

0

Den tisdag 19 maj 2015 kl. 00:40:33 UTC+2 skrev jonas.t...@gmail.com:
> Den tisdag 19 maj 2015 kl. 00:19:02 UTC+2 skrev jonas.t...@gmail.com:
> > Den måndag 18 maj 2015 kl. 23:53:56 UTC+2 skrev Michael Haufe (TNO):
> > > On Monday, May 18, 2015 at 3:34:31 PM UTC-5, jonas.t...@gmail.com wrote:
> > > > Is there a way to trace where an iteration do lockup in a javascript?
> > > > Could they not printout the row executed when you break script?
> > >
> > > In the Firefox debugger you can tell it to pause on exceptions. I suspect the other popular browsers support this functionality as well.
> >
> > I just implemented a counter, and get strange maybe even impossible result.
> >
> > I use base 11 and start to convert from 0 using a counter.
> >
> > But the program decides to loop at different numbers at different executions, is that even possible?
> >
> > Javascript is not threaded, it is linear execution?
>
> It do bug out at 29 ones or nines. But when i use a counter it can bug out on any number between 117-1000

If i just could find the smallest number it bugs out for in base 11.
But the counter approach does not work because it locks up on different numbers different execution which to me is ape weird.

Ben Bacarisse

5/19/2015 12:20:00 AM

0

jonas.thornvall@gmail.com writes:

> Den tisdag 19 maj 2015 kl. 00:40:33 UTC+2 skrev jonas.t...@gmail.com:
>> Den tisdag 19 maj 2015 kl. 00:19:02 UTC+2 skrev jonas.t...@gmail.com:
>> > Den måndag 18 maj 2015 kl. 23:53:56 UTC+2 skrev Michael Haufe (TNO):
>> > > On Monday, May 18, 2015 at 3:34:31 PM UTC-5, jonas.t...@gmail.com wrote:
>> > > > Is there a way to trace where an iteration do lockup in a javascript?
>> > > > Could they not printout the row executed when you break script?
>> > >
>> > > In the Firefox debugger you can tell it to pause on
>> > > exceptions. I suspect the other popular browsers support this
>> > > functionality as well.
>> >
>> > I just implemented a counter, and get strange maybe even impossible result.
>> >
>> > I use base 11 and start to convert from 0 using a counter.
>> >
>> > But the program decides to loop at different numbers at different
>> > executions, is that even possible?
>> >
>> > Javascript is not threaded, it is linear execution?
>>
>> It do bug out at 29 ones or nines. But when i use a counter it can
>> bug out on any number between 117-1000
>
> If i just could find the smallest number it bugs out for in base 11.
> But the counter approach does not work because it locks up on
> different numbers different execution which to me is ape weird.

Your code has reached the point where it is no longer comprehensible
even to you, its author. I think you need to spend a portion of the
time on this project to learning how to program.

--
Ben.

Michael Haufe (\"TNO\")

5/19/2015 12:34:00 AM

0

On Monday, May 18, 2015 at 5:19:02 PM UTC-5, jonas.t...@gmail.com wrote:
> I just implemented a counter, and get strange maybe even impossible result.
>
> I use base 11 and start to convert from 0 using a counter.
>
> But the program decides to loop at different numbers at different executions, is that even possible?
>
> Javascript is not threaded, it is linear execution?

Without looking at your code (wherever it is), I am going to assume you are reusing your loop variable in multiple places.

what happens when you paste your code in a linter such as the following:

<http://jshin...

I don't need to see the results...

Michael Haufe (\"TNO\")

5/19/2015 12:35:00 AM

0

On Monday, May 18, 2015 at 5:19:02 PM UTC-5, jonas.t...@gmail.com wrote:

> Javascript is not threaded, it is linear execution?

If you're asking, it's probably safe to assume you're running code that is single threaded.