From: VK on
On Apr 24, 10:26 pm, VK <schools_r...(a)yahoo.com> wrote:
> All good boys and girls (the one who reading c.l.j. :) always do like
> this:
>
>  if ((myRequest.status == 200) || (myRequest.status == 0)) {
>   // success
>  }

Just got a bit down from my colleague for this advice. Just didn't
look into libraries for a long time, sorry.

Either for sync or async requests it has to accounted that for failed
attempt to read a local file (say file doesn't exists):

IE throws error on xhr.open(...) stage
Fx throws error on xhr.send('') stage
Sf returns .status -1100

Ch and Op return status 0 either for success or for error. That last
one implies that for local data reading .status is useless. One needs
to check responseText to see if anything in there. Actually it the
best way anyway. One needs responseText/responseXML data in the first
place, not .status data.
..status is useful if nothing found in responseText and you are trying
to figure out why.

And yes, open/send should be always placed into try-catch block.


From: Eric Bednarz on
VK <schools_ring(a)yahoo.com> writes:

> Test (unzip and run AJAX/test/index.html):
> http://sites.google.com/site/schoolsring/javascript
> LocalDataReadingTest.zip

I see two problems here. The good news is that one of them can be
solved. Use a newsreader.

> […] The guys didn't read MSDN for years.

I'm reminded of a dialog in A fish called Wanda, featuring apes, reading
and Nietzsche. :-)

> var isIE = /*@cc_on/*@if(@_jscript)true(a)else@*/false/*@end@*/;

This is a ridiculously verbose way of writing

var isIE = /*@cc_on true || @*/ false;

instead of

var isIE /*@cc_on = true @*/;

From: VK on
On Apr 25, 3:19 am, Eric Bednarz <bedn...(a)fahr-zur-hoelle.org> wrote:
> >  var isIE = /*@cc_on/*@if(@_jscript)true(a)else@*/false/*@end@*/;
>
> This is a ridiculously verbose way of writing
>
>   var isIE = /*@cc_on true || @*/ false;
>
> instead of
>
>   var isIE /*@cc_on = true @*/;

Do we have have a world keystroke shortage? :-) Also it is a
conditional compilation, so I prefer to see conditionally compiled
blocks of *statements*, not pieces of them - despite IE will take it.
More important though that once @cc_on, it is on until @end or to the
end of source. Not important for a few liner, but making the engine
additionally check for pragma statements across 10-100Kb of text is
not efficient, so I @end cc right after it not needed anymore.
Question of taste and habits anyway. I just don't agree that full
syntax of anything can be "ridiculous". "Not necessary" is the max
IMHO. :-)

From: Eric Bednarz on
VK <schools_ring(a)yahoo.com> writes:

> On Apr 25, 3:19 am, Eric Bednarz <bedn...(a)fahr-zur-hoelle.org> wrote:

>> > var isIE = /*@cc_on/*@if(@_jscript)true(a)else@*/false/*@end@*/;

>> var isIE /*@cc_on = true @*/;
>
> Do we have have a world keystroke shortage? :-)

The problem is that confused syntax supports confused minds.

> Also it is a
> conditional compilation, so I prefer to see conditionally compiled
> blocks of *statements*, not pieces of them - despite IE will take it.

Your gut feeling might be that an if statement assigned to a variable
makes more sense. That might explain it. :-)

> More important though that once @cc_on, it is on until @end or to the
> end of source.

'@end' in CC pretty much does what programmers would intuitively expect
it to do in the context of a syntax that has blocks without braces.

I could say now that your problem is that you make things up while you
type, but that has been explained to you in this group… how often?


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title></title>
</head>
<body>
<script type='text/javascript'>
var isIE = /*@cc_on/*@if(@_jscript)true(a)else@*/false/*@end@*/;
isIE && alert(@_jscript_version);
</script>
</body>
</html>
From: VK on
On Apr 25, 5:07 am, Eric Bednarz <bedn...(a)fahr-zur-hoelle.org> wrote:
> I could say now that your problem is that you make things up while you
> type

No, I am just following what is written on the producer page. The
current CC docs
http://msdn.microsoft.com/en-us/library/7kx09ct1(v=VS.80).aspx
http://msdn.microsoft.com/en-us/library/ct27x3xa(v=VS.80).aspx
is a complete rewrite with JScript 8.0 as a target at the top of the
page. At the time I was reading it a few years ago the target was
JScript 5.6 and
1) @cc_on - @end was given as "pragma parser on/off" paired statements
2) @elif was not documented nor mentioned anywhere at all. I saw it a
code snippet in MSDN this is how I "discovered" it.

In relation to @end I tested it on IE6 / Win XP and your statement
about it being just closing part of @if-(a)elif-@else-(a)end block is
right. And @cc_on once used keeps pragma parser on till the end of
source. So either it was a change from IE5 to IE6 or - most probably -
bad documentation from the very beginning.