Silly Newbie Mistake

G

Gene Wirchenko

[snip]
I am not getting error messages. I simply get no page display.
This makes tracking down errors considerably more difficult and
time-consuming.
[snip]

They can be if the error is not reported.

No decent browser is going to detect an syntax error, and then not
report it.

I am using IE 9. I do not care if you consider it then to be not
a decent browser. It is the one that I have to use. I think it
highly likely that it can report errors, but I am not getting that.

[snip]
If in your case the page isn't being loaded you might have no syntax
error, instead a logic error that means what you think is a pointer to
some DOM item is in fact null, and execution stops right there (I'm
assuming your JS loads the page, otherwise you'd see it - in my error
case the page load completes but because JS execution doesn't, various
buttons are not disabled as normal).

There are those sorts of errors at times, too, but I have
execution stopping dead due to syntax errors.
Have you looked in the FF error console? (Tools -> Web Developer -.
Error Console)

As stated previously, I am using IE 9. I have seen the F12
tools, but they do not work reliably for me (or I am missing
something).

Sincerely,

Gene Wirchenko
 
G

Gene Wirchenko

In comp.lang.javascript message <nojtd7pb39ofku9j7a1bi6pog635kga2ua@4ax.


But we here are smarter, and so use other browsers.

I prefer Firefox myself, but company standard is IE.
Note that the reported market share for other browsers is now
considerably greater than that for IE.

IE still has a considerable plurality, not that that makes a
difference to me. The company standard is IE.
Of course, once the author's sillies have been dealt with by using other
browsers, one should use IE and try to deal with its sillies.

I will be developing a complex system in IE. I need to learn it
inside out.
For code not reliant on a GUI and I/O, it may well be worth testing in
JScript under WSH. That at least gives a clear indication, in your
choice of font size, of where it thinks the error is or becomes
detectable.

??? How would a Webpage not be reliant on I/O?

Sincerely,

Gene Wirchenko
 
G

Gene Wirchenko

At the best of time, I have found debugging JavaScript code to be
such a bother. I have been using IE's F12, but it does not handle (or
I have not figured out how) debugging an included file (<script
src=...). (If you know how, would you please let me know?) As a
consequence, I did not get immediate feedback on my silly error and
wasted a couple of hours.

I highly recommend you learn JavaScript in either Firefox with the
Firebug extension[1] or Google Chrome. The debugging tools are much
better. I guess you can also throw in Opera, as Dragonfly is pretty good
too (but slower on starting). Just load the page once, navigate to the
included scripts in the debugger, set your breakpoints, then reload.

I do not have the option. The company standard is IE.

[snip]

Sincerely,

Gene Wirchenko
 
R

Ross McKay

I do not have the option. The company standard is IE.

Which is fine when you know what you are doing, but while you are
learning the language you should use good learning tools -- the IE
developer tools are passable for debugging real like IE problems, but
you should not be writing solely for IE9 (lock in anyone?) and you will
get better diagnostic information from Firefox+Firebug and Google
Chrome.

Also, a JS lint tool does not care about what browser you are using, it
looks at your source files:
You might find greater happiness (less Risk!) in returning to an edit /
"compile" / test cycle, where "compile" is actually a lint pass to check
for such basic mistakes.[4][5] You'll probably need to tinker with the
config files to suppress some screaming though, as linters can be
excessively fussy at times :)
[...]
[4] http://www.jslint.com/
[5] http://www.javascriptlint.com/
 
E

Evertjan.

Gene Wirchenko wrote on 09 dec 2011 in comp.lang.javascript:
[snip]
Sometimes,
this causes problems though less than right after typing the code
in.

Why would that cause problems [stipulating that you understand the
code?

Oh, come on! Typos, and of course,

Modular programming even on the minute scale of common browser
javascript prograsmes, will prevent that.

function tempModule(arguments) {
alert(arguments);
return tempReturnValues; // replace with absolute test-value;
};

If this works, then replace the fmodule with it's dynamic equivlent.

if I am experimenting with features, your stipulation is silly:

This is not a stipulation, it is an advice from years of experience.
it is not a safe bet that I understand the code totally.

It should not be a "safe bet", it should be your effort.
your code cann't be sound, if you don' understand it,
and an added bonus is that you learn from this added understanding.

Trying to debug code that you do not understand is futile,
because it is error-prone. Just testing a ununderstood code can never
reach the level of stability that you usually would expect of your
programming and that can be reached by understood and debugged code.

Total understanding is easuier if you understand your modular modules
and the compilation of those modules in your total design.

Experimenting with say! new DOM-features in a large code without first
having tested and understood that feature on a small scale on a simple
test-page seems inadvisable.
 
N

Norman Peelman

Gene Wirchenko wrote on 08 dec 2011 in comp.lang.javascript:
On 08 Dec 2011 21:28:51 GMT, "Evertjan."

Gene Wirchenko wrote on 07 dec 2011 in comp.lang.javascript:

[SNIP]

Why a bother? Debugging is just the way to unbother.

I have pages crash with no error message. It is then a bother to
hunt down errors. Perhaps, you have your browser set up with all of
the nifty settings for detecting AND REPORTING errors. Despite
looking for them repeatedly, I have been unable to find them.

I mostly do not use [your nifty] browser debuggers.

I just told you I set the necessary alert() breakpoints.

And I have said a number of times that some errors do not get
picked up by that. The page simply does not render.

Are you saying that you don't even get the "page has completed but
with errors" message at the bottom of the browser window, which when
clicked on brings up a small pop-up window with an error message?
If the code does not run for syntactical reasons,
I remark out all the lines of code that could be the culprit,
and reinsert them in groups, using

//.... or /*...*/,

I have done similarly. I think that you can understand that
having to do so is much much more effort than getting a message such
as:
Syntax error in line 47 of somepage.html
and proceeding from there.

[snip]
Sometimes,
this causes problems though less than right after typing the code in.

Why would that cause problems [stipulating that you understand the code?

Oh, come on! Typos, and of course, if I am experimenting with
features, your stipulation is silly: it is not a safe bet that I
understand the code totally.

Sincerely,

Gene Wirchenko

Googling 'ie javascript debugger' brought up links that include these
links.

http://www.debugbar.com/

http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=18359

http://projects.nikhilk.net/WebDevHelper/
 
M

Mike Duffy

Trying to debug code that you do not understand is futile,

It does force you to learn. But you do have a point. Sometimes, what you
learn is wrong. If those wrong ideas are close to the root of the knowledge
tree you build on a particular subject, pruning the bad branches can
sometimes cause the whole tree to collapse.
 
R

Richard Cornford

I am not getting error messages. I simply get no page display.

"No page display", if taken literally, sounds more like a problem with
HTML or the browser's ability to access the page. Obviously if either
of those where the case then there is no chance of any javascript
executing at all, so there won't even be syntax errors.
This makes tracking down errors considerably more difficult and
time-consuming.

The difficult and time consuming part is learning how things should
work and how to verify when/that they are. "No page display" is such
an extreme symptom that it won't have more than a dozen or so possible
causes, which would come into play in a certain order and so can be
tested for and either eliminated or identified as pertinent with a
shortish sequence of tests.
The probability is 1.

The probability of what exactly?
Note that I stipulated "(or I have not figured out how)".

I noticed, and it struck me as likely to be the case here.
A feature that I can not figure out how to use
might as well not exist.

True, but it is unlikely that the limits of your comprehension will be
restrictive in this context.
How does it work?



Yes. I have looked. Where is that setting?
<snip>

Tools->Internet Options...->Advanced(tab)->Settings(list)-
Browsing(sublist)->Display a notification about every script
error(checkbox); should be checked, and also any "Disable script
debugging" checkboxes above it (these checkboxes don't refer to F12
debugging, apparently).

Richard.
 
T

Thomas 'PointedEars' Lahn

Mike said:
It does force you to learn. But you do have a point. Sometimes, what you
learn is wrong. If those wrong ideas are close to the root of the
knowledge tree you build on a particular subject, pruning the bad branches
can sometimes cause the whole tree to collapse.

[x] Sigged.


PointedEars
 
E

Evertjan.

Mike Duffy wrote on 09 dec 2011 in comp.lang.javascript:
It does force you to learn. But you do have a point. Sometimes, what
you learn is wrong. If those wrong ideas are close to the root of the
knowledge tree you build on a particular subject, pruning the bad
branches can sometimes cause the whole tree to collapse.

That depends on what you mean by "what you learn".

I suggest that what you learn cannot be wrong,
as aquiring wrong ideas cannot be called "learning".

"Learning" is the dynamic and interactive process of aquiring knowledge and
skills by hearing, discussing and finding out new ideas, and adapting those
ideas to the results of those discussions, logical thinking and testing.

For such learning one needs to have a firm believe in the final doubt of
the scientific process.

Clientside javascript is just like the real world:
- there is no trustable manual.
- the inner workings are not always the same but depend on partly unknown
factors like place [which engine/browser?] and time [what version, what
DOM/OS].
 
G

Gene Wirchenko

Gene Wirchenko wrote on 09 dec 2011 in comp.lang.javascript:
[snip]
Sometimes,
this causes problems though less than right after typing the code
in.

Why would that cause problems [stipulating that you understand the ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
code?
^^^^
Oh, come on! Typos, and of course,

Modular programming even on the minute scale of common browser
javascript prograsmes, will prevent that.

function tempModule(arguments) {
alert(arguments);
return tempReturnValues; // replace with absolute test-value;
};

If this works, then replace the fmodule with it's dynamic equivlent.

if I am experimenting with features, your stipulation is silly:

This is not a stipulation, it is an advice from years of experience.

*You* used the word "stipulating" above.
It should not be a "safe bet", it should be your effort.
your code cann't be sound, if you don' understand it,
and an added bonus is that you learn from this added understanding.

Perhaps, you have missed the point. I am learning JavaScript.
Note the word "learning". That means that I do not know as much about
it as I would like. I have been entering code from a text and working
with it. If I already understand the code, there is little or no
point to entering it. If I do not, then there is from the opportunity
to learn.

Having entered some code, it might not work due to:

1) bugs: I have found more than one bug in the code. I am an
experienced P/A, just not in JavaScript yet.

2) language/browser/other changes since the text was published: The
copyright is 1999, but it is the best text that I have found so far as
to level of detail, and despite its minor errors, it has not flipped
the bozo bit.

3) my typos: These can be nasty.
Trying to debug code that you do not understand is futile,
because it is error-prone. Just testing a ununderstood code can never
reach the level of stability that you usually would expect of your
programming and that can be reached by understood and debugged code.

It is hardly futile. I do get it debugged, and at this point, I
also learn more about the language. Among other things, knowing
language failure patterns is useful in debugging.
Total understanding is easuier if you understand your modular modules
and the compilation of those modules in your total design.
Sure.

Experimenting with say! new DOM-features in a large code without first
having tested and understood that feature on a small scale on a simple
test-page seems inadvisable.

How fatuous! That is exactly what I am doing. However, I am at
the point where some of these exercises are not short bits of code.
Some of them depend on the interaction of many bits. Besides, it is
not enough to be able to handle small bits of code; I need to be able
to handle larger aggregations of code.

Sincerely,

Gene Wirchenko

..
 
G

Gene Wirchenko

On Fri, 09 Dec 2011 06:44:55 -0500, Norman Peelman

[snip]
Are you saying that you don't even get the "page has completed but
with errors" message at the bottom of the browser window, which when
clicked on brings up a small pop-up window with an error message?

That is right. I have since solved my problem though.

[snip]

Sincerely,

Gene Wirchenko

..
 
D

Dr J R Stockton

In comp.lang.javascript message <3u42e7d2uq84hj3hnqjs2o774lk0dh1mt2@4ax.
I am not getting error messages. I simply get no page display.
This makes tracking down errors considerably more difficult and
time-consuming.

The biggest mistake made by beginners, and you are manifestly a beginner
here, whatever else you may have done before, is to change too much
between tests.

If, between two tests, you only change one line of code (keeping the old
line as comment), then, when it no longer does what you expect, the
fault must have something to do with the difference between the two
lines.

Another general trick, in a language where undeclared variables are
permissible, is to write "banana" just after the new part (assuming that
you are not programming vegetably). You know then that you should be
getting an error message (unless you have written an infinite loop);
and, if it is banana, at least your code above had a measure of
acceptability. That also serves to prevent subsequent code interfering
with any visible evidence that there may be.

--
(c) John Stockton, nr London UK. replyYYWW merlyn demon co uk Turnpike 6.05.
Web <http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes precede replies. Snip well. Write clearly. Mail no News.

..
 
T

Thomas 'PointedEars' Lahn

Mike said:
[x] Sigged.

Danke, Herr Lahn.

It is customary in Usenet to use the informal "you", the equivalent of which
is "Du" in German, not "Sie" or "Herr" (mister), unless impoliteness has
been detected. This differs from common German usage, of course.

Unfortunately, your From header value does not comply with RFC 5536, so I
have to write this publicly, and the sig is going to be the only text I will
see from you from now on.


F'up2 poster

PointedEars
 
E

Evertjan.

Gene Wirchenko wrote on 09 dec 2011 in comp.lang.javascript:
[snip]

Sometimes,
this causes problems though less than right after typing the code
in.

Why would that cause problems [stipulating that you understand the ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
code?
^^^^
Oh, come on! Typos, and of course,

Modular programming even on the minute scale of common browser
javascript prograsmes, will prevent that.

function tempModule(arguments) {
alert(arguments);
return tempReturnValues; // replace with absolute test-value;
};

If this works, then replace the fmodule with it's dynamic equivlent.

if I am experimenting with features, your stipulation is silly:

This is not a stipulation, it is an advice from years of experience.

*You* used the word "stipulating" above.[/QUOTE]

Quite, but not in the sense in can be called silly, as my stipulation is
just an hypothetical inference to state my hypothesis, not a statement of
fact.
Perhaps, you have missed the point. I am learning JavaScript.
Note the word "learning". That means that I do not know as much about
it as I would like.

This goes for most of us. We all learn. As said I reserve the word learn
for aquiring the right knowledge and/or skill.

By "understanding your code" I mean that you understand what it *should*
do, terribly absent when copying a [voluminous] script code from the web
or book.
I have been entering code from a text

Script code just being text,
and javascript being a scripting language??

Oh, you must mean a printed page?
and working
with it. If I already understand the code, there is little or no
point to entering it. If I do not, then there is from the opportunity
to learn.

So you are trying out script code where both [1] you you do know what it
should do and [2] needs to be debugged, because it is not a correctly
working code?
Having entered some code, it might not work due to:

1) bugs: I have found more than one bug in the code. I am an
experienced P/A, just not in JavaScript yet.

As I surmized.
2) language/browser/other changes since the text was published: The
copyright is 1999, but it is the best text that I have found so far as
to level of detail, and despite its minor errors, it has not flipped
the bozo bit.

Are you sure you want to learn from code from last century?
3) my typos: These can be nasty.

So you don't copy from the web but from a last century book, it seems.

Sinse most present day javascript books are not of high quality, and last
century's ones are even worse, the best you can learn from them is sound
debugging.

And that is what I started to explain in this thread, how to do simple
debugging by inserting breakpoints and remarking out code lines.
It is hardly futile. I do get it debugged, and at this point, I
also learn more about the language. Among other things, knowing
language failure patterns is useful in debugging.


How fatuous! That is exactly what I am doing. However, I am at
the point where some of these exercises are not short bits of code.
Some of them depend on the interaction of many bits. Besides, it is
not enough to be able to handle small bits of code; I need to be able
to handle larger aggregations of code.

At this point you should try modular programming, very feasable in
javascript, and making the testing and understanding of your programme
possible.

Declare the input to output and the interface effects of each module and
make and test that module for all values within the required range. When
satisfied treat that module as a black box and use your modules to
compile a module of the next higher level of modularity.

Is this 1999 code up to this level of loguic or is it just a Gordian knot
of interloping parts of all too linear programing?
 
J

J.R.

Dear JavaScripters:

At the best of time, I have found debugging JavaScript code to be
such a bother. I have been using IE's F12, but it does not handle (or
I have not figured out how) debugging an included file (<script
src=...). (If you know how, would you please let me know?) As a
consequence, I did not get immediate feedback on my silly error and
wasted a couple of hours.

Of course, you haven't figured it out. Check this out:
<http://msdn.microsoft.com/en-us/library/gg699336(v=vs.85).aspx>

MSDN has loads of information concerning the F12 Developer Tools:
<http://msdn.microsoft.com/en-us/library/gg589500(v=vs.85).aspx>

Cheers,
Joao Rodrigues (J.R.)
 
D

Dr J R Stockton

In comp.lang.javascript message <lmo2e757mar0dn9vgb1osnhmh98fl5lj14@4ax.
I prefer Firefox myself, but company standard is IE.

That suggests that you have access to Firefox. If the company allows
you to install Firefox at work, do so, and use it as a debugger.
Otherwise, install Firefox at home, and practice there until you can
write code that has a chance of running in IE.


IE still has a considerable plurality, not that that makes a
difference to me. The company standard is IE.

Perhaps you should have chosen a wiser company.

I will be developing a complex system in IE. I need to learn it
inside out.

If your coding is for an intranet, or otherwise not exposed to the Great
World Outside, then it would be well to say so, in each new thread at
least. Otherwise, that is a ludicrous, if common, policy, worthy of the
more obstinate governments of lower latitudes.


Then you will need to distinguish between its peculiar ideas, which you
will have to live with until IE 10 (when they will change) and your own
inaccurate ideas, which can be corrected when discovered.

??? How would a Webpage not be reliant on I/O?

I wrote "code", not "webpage". It is quite possible to have chunks of
code which manipulate data, without storing them. A simple but
unrealistic illustration would be if you had to sort, into chronological
order, a set of strings each starting with a date/time formatted as in
Sat Dec 10 2034 09:46:05 a.m.
(which is the sort of thing that Middle North Americans like), and it
had to be done without using the Date Object.

That task requires no I/O, and temporary debugging I/O can use
WScript.echo.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top