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


Groups > comp.lang.javascript > #22557

Re: Eye for bugs

From "Michael F. Stemper" <michael.stemper@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Eye for bugs
Date 2014-01-10 14:26 -0600
Organization A noiseless patient Spider
Message-ID <lapl2a$m9k$1@dont-email.me> (permalink)
References <06555351-b90c-4a99-8e22-169eebbc1522@googlegroups.com>

Show all headers | View raw


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.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web