Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22528 > unrolled thread

Eye for bugs

Started byjonas.thornvall@gmail.com
First post2014-01-06 01:56 -0800
Last post2014-01-10 18:17 -0600
Articles 10 — 5 participants

Back to article view | Back to comp.lang.javascript


Contents

  Eye for bugs jonas.thornvall@gmail.com - 2014-01-06 01:56 -0800
    Re: Eye for bugs jonas.thornvall@gmail.com - 2014-01-08 01:48 -0800
      Re: Eye for bugs jonas.thornvall@gmail.com - 2014-01-10 06:48 -0800
        Re: Eye for bugs Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-10 16:20 +0100
    Re: Eye for bugs "Michael F. Stemper" <michael.stemper@gmail.com> - 2014-01-10 14:26 -0600
      Re: Eye for bugs Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-10 22:12 +0100
        Re: Eye for bugs "Michael F. Stemper" <michael.stemper@gmail.com> - 2014-01-10 18:15 -0600
          Re: Eye for bugs Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-01-11 15:53 +0100
      Re: Eye for bugs Tim Streater <timstreater@greenbee.net> - 2014-01-10 23:09 +0000
        Re: Eye for bugs "Michael F. Stemper" <michael.stemper@gmail.com> - 2014-01-10 18:17 -0600

#22528 — Eye for bugs

Fromjonas.thornvall@gmail.com
Date2014-01-06 01:56 -0800
SubjectEye for bugs
Message-ID<06555351-b90c-4a99-8e22-169eebbc1522@googlegroups.com>
I find it very hard to spot logical errors when dealing with Writing out to Canvas, normally i write out values from JavaScript with document.write() line by line in the HTML document as i step thru loops but using the canvas you just plot over values without implementing plotout logic?

Have anyone a good idea?

http://web.comhem.se/jonasth/prime0.3/main.html

The following script bugs out plotting out the values for offset -Y in Anime i am pretty sure it step thru the values but do not plot them out.

Another problem you must press N max to plot out, 
although i call function to plot in canvas frame using onLoad() 

http://web.comhem.se/jonasth/prime0.3/main.html

[toc] | [next] | [standalone]


#22541

Fromjonas.thornvall@gmail.com
Date2014-01-08 01:48 -0800
Message-ID<597d555a-e226-45fc-a911-b94ca1695e68@googlegroups.com>
In reply to#22528
Den måndagen den 6:e januari 2014 kl. 10:56:25 UTC+1 skrev jonas.t...@gmail.com:
> I find it very hard to spot logical errors when dealing with Writing out to Canvas, normally i write out values from JavaScript with document.write() line by line in the HTML document as i step thru loops but using the canvas you just plot over values without implementing plotout logic?
> 
> 
> 
> Have anyone a good idea?
> 
> 
> 
> http://web.comhem.se/jonasth/prime0.3/main.html
> 
> 
> 
> The following script bugs out plotting out the values for offset -Y in Anime i am pretty sure it step thru the values but do not plot them out.
> 
> 
> 
> Another problem you must press N max to plot out, 
> 
> although i call function to plot in canvas frame using onLoad() 
> 
> 
> 
> http://web.comhem.se/jonasth/prime0.3/main.html

Sometimes i just get stuck i can see the values are written out behind, so it seem i move down all way and then write out multiple times. I probably should implemented translation of values to begin with. But i should be able to backtrack the rows, because there seem to be no problem do it with the columns.

[toc] | [prev] | [next] | [standalone]


#22547

Fromjonas.thornvall@gmail.com
Date2014-01-10 06:48 -0800
Message-ID<01b3c329-71d7-4ca5-b30d-789b97f98d47@googlegroups.com>
In reply to#22541
Den onsdagen den 8:e januari 2014 kl. 10:48:21 UTC+1 skrev jonas.t...@gmail.com:
> Den måndagen den 6:e januari 2014 kl. 10:56:25 UTC+1 skrev jonas.t...@gmail.com:
> 
> > I find it very hard to spot logical errors when dealing with Writing out to Canvas, normally i write out values from JavaScript with document.write() line by line in the HTML document as i step thru loops but using the canvas you just plot over values without implementing plotout logic?
> 
> > 
> 
> > 
> 
> > 
> 
> > Have anyone a good idea?
> 
> > 
> 
> > 
> 
> > 
> 
> > http://web.comhem.se/jonasth/prime0.3/main.html
> 
> > 
> 
> > 
> 
> > 
> 
> > The following script bugs out plotting out the values for offset -Y in Anime i am pretty sure it step thru the values but do not plot them out.
> 
> > 
> 
> > 
> 
> > 
> 
> > Another problem you must press N max to plot out, 
> 
> > 
> 
> > although i call function to plot in canvas frame using onLoad() 
> 
> > 
> 
> > 
> 
> > 
> 
> > http://web.comhem.se/jonasth/prime0.3/main.html
> 
> 
> 
> Sometimes i just get stuck i can see the values are written out behind, so it seem i move down all way and then write out multiple times. I probably should implemented translation of values to begin with. But i should be able to backtrack the rows, because there seem to be no problem do it with the columns.

Hint anyone?

[toc] | [prev] | [next] | [standalone]


#22548

FromChristoph Michael Becker <cmbecker69@arcor.de>
Date2014-01-10 16:20 +0100
Message-ID<52d00fc6$0$9521$9b4e6d93@newsspool1.arcor-online.net>
In reply to#22547
jonas.thornvall@gmail.com wrote:

> Den onsdagen den 8:e januari 2014 kl. 10:48:21 UTC+1 skrev jonas.t...@gmail.com:
>
>> Sometimes i just get stuck i can see the values are written out behind, so it seem i move down all way and then write out multiple times. I probably should implemented translation of values to begin with. But i should be able to backtrack the rows, because there seem to be no problem do it with the columns.
> 
> Hint anyone?

You can use console.log et al. to print debug information to the console
instead of the document, and you may use your browser's debugger.  See
<http://devtoolsecrets.com/>.

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#22557

From"Michael F. Stemper" <michael.stemper@gmail.com>
Date2014-01-10 14:26 -0600
Message-ID<lapl2a$m9k$1@dont-email.me>
In reply to#22528
On 01/06/2014 03:56 AM, jonas.thornvall@gmail.com wrote:
> I find it very hard to spot logical errors when dealing with Writing out to Canvas, normally i write out values from JavaScript with document.write() line by line in the HTML document as i step thru loops but using the canvas you just plot over values without implementing plotout logic?
>
> Have anyone a good idea?

O'Reilly does.

You can create a window for trace messages, using this technique
(straight from the Javascript Rhino book).


First, place something like this early on in your code (possibly in
the head element):

var trace_win = null;
function trace( message )
{
   // if necessary, open trace window
   if( (trace_win==null) || trace_win.closed )
   {
     trace_win = window.open( "trace" );
     trace_win.document.open( "text/plain" );
   }

   trace_win.document.writeln( message );
}


Then, you can scatter calls to "trace" throughout your script, just as
you would calls to "alert". The difference is that you don't need to
acknowledge each individual one, and you have a transcript of the
entire program's execution:

    trace( "Changing color to: " + line_col );
    trace( "Entering fuction foobar" );
    trace( "Finished with foobar" );
    trace( "Drawing from (" + x1 + ", " + y1 + ") to (" + x2 + ", " + y2 
")" );
    trace( "snarf is currently: " + snarf );

and so on.

-- 
Michael F. Stemper
Indians scattered on dawn's highway bleeding;
Ghosts crowd the young child's fragile eggshell mind.

[toc] | [prev] | [next] | [standalone]


#22558

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-01-10 22:12 +0100
Message-ID<10702590.VgB369Vi3A@PointedEars.de>
In reply to#22557
Michael F. Stemper wrote:

> On 01/06/2014 03:56 AM, jonas.thornvall@gmail.com wrote:
>> I find it very hard to spot logical errors when dealing with Writing out
>> to Canvas, normally i write out values from JavaScript with
>> document.write() line by line in the HTML document as i step thru loops
>> but using the canvas you just plot over values without implementing
>> plotout logic?
>>
>> Have anyone a good idea?
> 
> O'Reilly does.
> 
> You can create a window for trace messages, using this technique
> (straight from the Javascript Rhino book).

I do not see the point of this error-prone, incompatible approach when you 
have console.log() & friends.
 
-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#22560

From"Michael F. Stemper" <michael.stemper@gmail.com>
Date2014-01-10 18:15 -0600
Message-ID<laq2f4$928$1@dont-email.me>
In reply to#22558
On 01/10/2014 03:12 PM, Thomas 'PointedEars' Lahn wrote:
> Michael F. Stemper wrote:
>> On 01/06/2014 03:56 AM, jonas.thornvall@gmail.com wrote:

>>> I find it very hard to spot logical errors when dealing with Writing out
>>> to Canvas, normally i write out values from JavaScript with
>>> document.write() line by line in the HTML document as i step thru loops
>>> but using the canvas you just plot over values without implementing
>>> plotout logic?
>>>
>>> Have anyone a good idea?
>>
>> O'Reilly does.
>>
>> You can create a window for trace messages, using this technique
>> (straight from the Javascript Rhino book).
>
> I do not see the point of this error-prone, incompatible approach when you
> have console.log() & friends.

I never heard of it before. However, I just tried it, and it's
definitely a superior alternative. Would I be right in guessing that
this is something that was added after the third edition of the Rhino
book was published in 1996?

-- 
Michael F. Stemper
Always use apostrophe's and "quotation marks" properly.

[toc] | [prev] | [next] | [standalone]


#22565

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-01-11 15:53 +0100
Message-ID<3623831.9nD1xclIA7@PointedEars.de>
In reply to#22560
Michael F. Stemper wrote:

> On 01/10/2014 03:12 PM, Thomas 'PointedEars' Lahn wrote:
>> Michael F. Stemper wrote:
>>> On 01/06/2014 03:56 AM, jonas.thornvall@gmail.com wrote:
>>>> I find it very hard to spot logical errors when dealing with Writing
>>>> out to Canvas, normally i write out values from JavaScript with
>>>> document.write() line by line in the HTML document as i step thru loops
>>>> but using the canvas you just plot over values without implementing
>>>> plotout logic?
>>>>
>>>> Have anyone a good idea?
>>>
>>> O'Reilly does.
>>>
>>> You can create a window for trace messages, using this technique
>>> (straight from the Javascript Rhino book).
>>
>> I do not see the point of this error-prone, incompatible approach when
>> you have console.log() & friends.
> 
> I never heard of it before. However, I just tried it, and it's
> definitely a superior alternative. Would I be right in guessing that
> this is something that was added after the third edition of the Rhino
> book was published in 1996?

It is unlikely that any edition of a “Javascript Rhino book”, much less the 
third one, was published in 1996 CE.  The Rhino project, for a JavaScript™ 
engine written in Java, was started at Netscape in 1997. [1]  Either your 
“Rhino” does not refer to the Rhino project, or you may mean *2006* (that 
would correspond with a release in the Rhino 1.6 series [2a]).  If you mean 
the book “JavaScript: The Definitive Guide”, by David Flanagan, which has a 
rhinoceros on its cover and whose *first* edition was published in 
1996 [2b], you should read the reviews that are referred from the FAQ for 
comp.lang.javascript, <http://PointedEars.de/faq>.

It is possible that console.log() or something like it has been available at 
least since the release of Mozilla 1.0 in 2002 [3], with the -console 
switch, Venkman, the JavaScript Debugger [4], or similar.  However, it was 
not before the release of Firebug – I had beta-tested and reported on 
FireBug 0.4, as it was called when Joe Hewitt was developing it in 
2006 [5] – that in-browser debugging and the “console” object came into 
widespread use.  After there was Firebug, other browser vendors added built-
in developer tools that mirrored its functionality: Chrome Dev Tools, Opera 
Dragonfly, and IE Developer Tools; in that order, I think.

Finally, with the release of Firefox 4.0/Gecko 2.0 on 2011-03-22, the built-
in Error Console was replaced with the built-in Web Console which also 
supported console.log(). [6]

__________
[1]  <https://developer.mozilla.org/en-US/docs/Rhino/History>
[2a] <https://developer.mozilla.org/en-US/docs/Rhino/Downloads_archive>
[2b] <http://shop.oreilly.com/product/9780596805531.do>
[3]  <http://blog.mozilla.org/press/2002/06/mozilla-org-launches-mozilla-1-0/>
[4]  <https://developer.mozilla.org/en/docs/Venkman>
[5]  <http://en.wikipedia.org/wiki/Firebug_(software)>
[6]  <https://developer.mozilla.org/en-US/Firefox/Releases/4>
-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#22559

FromTim Streater <timstreater@greenbee.net>
Date2014-01-10 23:09 +0000
Message-ID<100120142309312235%timstreater@greenbee.net>
In reply to#22557
In article <lapl2a$m9k$1@dont-email.me>, Michael F. Stemper
<michael.stemper@gmail.com> wrote:

> On 01/06/2014 03:56 AM, jonas.thornvall@gmail.com wrote:
> > I find it very hard to spot logical errors when dealing with Writing out to
> > Canvas, normally i write out values from JavaScript with document.write()
> > line by line in the HTML document as i step thru loops but using the canvas
> > you just plot over values without implementing plotout logic?
> >
> > Have anyone a good idea?
> 
> O'Reilly does.
> 
> You can create a window for trace messages, using this technique
> (straight from the Javascript Rhino book).
> 
> 
> First, place something like this early on in your code (possibly in
> the head element):
> 
> var trace_win = null;
> function trace( message )
> {
>    // if necessary, open trace window
>    if( (trace_win==null) || trace_win.closed )
>    {
>      trace_win = window.open( "trace" );
>      trace_win.document.open( "text/plain" );
>    }
> 
>    trace_win.document.writeln( message );
> }
> 
> 
> Then, you can scatter calls to "trace" throughout your script, just as
> you would calls to "alert". The difference is that you don't need to
> acknowledge each individual one, and you have a transcript of the
> entire program's execution:
> 
>     trace( "Changing color to: " + line_col );
>     trace( "Entering fuction foobar" );
>     trace( "Finished with foobar" );
>     trace( "Drawing from (" + x1 + ", " + y1 + ") to (" + x2 + ", " + y2 
> ")" );
>     trace( "snarf is currently: " + snarf );
> 
> and so on.

why not just use console.info() ?? You get all this for free.

-- 
"The idea that Bill Gates has appeared like a knight in shining armour to
 lead all customers out of a mire of technological chaos neatly ignores 
 the fact that it was he who, by peddling second-rate technology, led them
 into it in the first place."                             - Douglas Adams

[toc] | [prev] | [next] | [standalone]


#22561

From"Michael F. Stemper" <michael.stemper@gmail.com>
Date2014-01-10 18:17 -0600
Message-ID<laq2if$928$2@dont-email.me>
In reply to#22559
On 01/10/2014 05:09 PM, Tim Streater wrote:
> In article <lapl2a$m9k$1@dont-email.me>, Michael F. Stemper
> <michael.stemper@gmail.com> wrote:

>> Then, you can scatter calls to "trace" throughout your script, just as
>> you would calls to "alert". The difference is that you don't need to
>> acknowledge each individual one, and you have a transcript of the
>> entire program's execution:
>>
>>     trace( "Changing color to: " + line_col );
>>     trace( "Entering fuction foobar" );
>>     trace( "Finished with foobar" );
>>     trace( "Drawing from (" + x1 + ", " + y1 + ") to (" + x2 + ", " +
>> y2 ")" );
>>     trace( "snarf is currently: " + snarf );
>>
>> and so on.
>
> why not just use console.info() ?? You get all this for free.

I never heard of it before today. Now that I know about it, it's what
I'll use in the future.

-- 
Michael F. Stemper
Indians scattered on dawn's highway bleeding;
Ghosts crowd the young child's fragile eggshell mind.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web