473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Announcing a new online book: Eloquent JavaScipt

A freely-available online book about JavaScript has just been
launched:
http://eloquentjavascript.net

It attempts to provide a comprehensive introduction to the language,
and a practical environment for practicing your programming skills and
trying out code. Take a look, and let me know if you find anything
that could use improvement (there's a 'react' button in the top-left
corner of most of its pages).

Cheers,
Marijn Haverbeke

Aug 2 '07 #1
30 1691
On 2 aug, 17:35, David Mark <dmark.cins...@gmail.comwrote:
Use the style rule position:fixed for all but IE6.
This has a bunch of issues as well (there will be content under the
fixed element). I seem to have fixed the IE problem by setting the
width of the content area to 100% -- what was happening was that the
DIV was too wide for the window, and thus the scroll bar was outside
of the screen. (Don't ask me why.)

The problem with code (in a PRE tag) being too wide for the page turns
out to be very tricky. The overflow-x style seemed a solution for a
moment (at least in FF and IE), but that is still so buggy that it is
unworkable as well. -- If anyone happens to know some way to limit the
width of an element (adding a scrollbar if necessary) without fixing
its height, let me know!
It doesn't work very well. I finally got it to work, but it took a
few tries. Try doing it several times in a row without a miss.
On second thought, I agree. I'll revise it to be less confusing.

Cheers,
Marijn

Aug 2 '07 #2
ma*****@gmail.com wrote:
A freely-available online book about JavaScript has just been
launched:
http://eloquentjavascript.net

It attempts to provide a comprehensive introduction to the language,
and a practical environment for practicing your programming skills and
trying out code. Take a look, and let me know if you find anything
that could use improvement (there's a 'react' button in the top-left
corner of most of its pages).

Cheers,
Marijn Haverbeke
Thank you. I will get back with suggestions once I run through some
examples and/or difficulties.
Aug 2 '07 #3
On Aug 2, 12:12 am, mari...@gmail.com wrote:
A freely-available online book about JavaScript has just been
launched:
http://eloquentjavascript.net
I mocked up an idea for an online JavaScript book with your example/
console concept a while back. So right there I think you have a great
idea! :)

I think a big improvement would be if each page had user comments like
the PHP & MySQL docs have.

Peter

Aug 2 '07 #4
On Aug 2, 6:42 pm, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
[snip]
>
Since you have overridden my choice of Browser font, I will not be
Are you suggesting that pages should not suggest a font family for
their main content? Or to stick with generics only? I can't see
leaving it to the user as most would see a default of Times New
Roman. To me, that would make pages look unpolished, as if the author
didn't bother (or didn't know how) to set the font.
reading it much. I prefer a Serif font; you set a sans-serif font - not
I have always thought that serif fonts read easier on paper and sans-
serif is more legible on monitor screens. Obviously you can't please
everybody in this regard.

[snip]
Your excessive margins waste my screen space.
And causes horizontal scrolling with smaller window sizes (or larger
font sizes.)

Aug 3 '07 #5
On Aug 2, 3:42 pm, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
In comp.lang.javascript message <1186038776.409299.128...@57g2000hsv.goo
glegroups.com>, Thu, 2 Aug 2007 07:12:56, mari...@gmail.com posted:
A freely-available online book about JavaScript has just been
launched:
http://eloquentjavascript.net

Since you have overridden my choice of Browser font, I will not be
reading it much. I prefer a Serif font; you set a sans-serif font - not
even my default Arial, but more squashed-together. NASA and some
Russians are just as bad.
You may wish to learn about using CSS, the cascade, !important rules
and reader stylesheets. You may also find that some browser plugins
make using this technology more accessible to you.

https://addons.mozilla.org/en-US/firefox/addon/2108

Peter

Aug 3 '07 #6
On 2 aug, 23:59, Peter Michaux <petermich...@gmail.comwrote:
I think a big improvement would be if each page had user comments like
the PHP & MySQL docs have.
I have considered this, but the abyssmal quality of most user comments
has made mew decide against it. They mostly just add distraction and
misinformation.

Aug 3 '07 #7
On 3 aug, 01:32, David Mark <dmark.cins...@gmail.comwrote:
Well, that is one issue that is easy to fix: put it at the top and use
a suitable top margin on the body.
It seems to me that scrolling the page will cause text to end up on
the top anyway. Plus, I don't want that console at the top.
I wouldn't use overflow-x as there are compatibility issues. Use
overflow.
I would, except that that requires the height of the content to be
fixed. Fixed-height code-boxes are a clumsy waste of space. Maybe I'll
make my scripts adjust the height of the boxes, though that requires
adding extra space for the scrollbar on IE.
To minimize horizontal scrolling, tighten up the margins of the page
(for a start.) From the looks of it, that will allow the page to
display without horizontal scrollbars at 800x600. Optimally, a page
shouldn't need a horizontal scrollbar until the width drops below
500. To achieve that goal, you would need to break long lines in your
source code. An example of a site that does this is alistapart.com.
Granted, their pages also require horizontal scrolling (their design
wastes too much screen space), but they do keep their code snippets
from overflowing into the next column.
I could reduce the margins a little, but that will make the lines
awfully long in big windows. I tried making the code lines shorter,
but that makes them very awkward to read.
It wouldn't be confusing if it were reliable. The first time I tried
it, I thought it was broken. Only after you mentioned that it should
work did I go back and try again. I didn't look at your script, so I
am not sure what the problem is.
The 'unreliability' that you observed had something to do with the
fact that it would 'snap' closed when you dragged it too small. I
changed this (you can't drag it below a certain size now), and it
seems to behave in a more friendly way.

Regards,
Marijn

Aug 3 '07 #8
On Aug 3, 3:25 am, David Mark <dmark.cins...@gmail.comwrote:
On Aug 3, 2:17 am, mari...@gmail.com wrote:
On 3 aug, 01:32, David Mark <dmark.cins...@gmail.comwrote:
[snip]
code snippets.) You'll still need to implement a CSS expression to
simulate max-width in IE6 and earlier (wrap it in an IE conditional
comment.) You can put the text-align:center rule for the body in
there too (it is an old IE fix too.)
Oops. You are using quirks mode, so you will need to simulate max-
width for IE period. Same for the auto margin workaround. Consider
switching to standards mode.

Also, I left out a color rule for the code DIV.

Aug 3 '07 #9
On 3 aug, 09:25, David Mark <dmark.cins...@gmail.comwrote:
I definitely don't think you want to play around with the window's scrollbars.
It *seems* to work fine now. Sure, I have to use some kind of hack to
make links to anchors work, and I wouldn't be surprised if there are
still some problematic corner cases on some browsers, but this really
seems preferable to the alternatives.
[html snippet]
That works very well for Firefox, but my obscure-css knowledge turned
out to be insufficient to make it behave properly on IE. Besides,
fixing the width of these things will give long lines a scroll-bar
even when the client has a window that is wide enough to show them. I
tweaked things a bit more (slightly smaller font, narrower margins,
cut down a few more long lines), and now everything displays propertly
on 800x600. People using smaller windows than that are probably used
to horizontal scrolling ;)
You don't want to go down that road. Using script to fix layout
issues is a bad idea.
I know. The console is entirely layed out by scripts and absolute
positions (texareas and iframes don't resize very well on their own),
and it was a major headache.

Thanks again for the remarks and hints, they forced me to take care of
a few sloppy aspects that I had been trying to forget about. Heh.

Marijn

Aug 3 '07 #10
On 3 aug, 00:42, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
Clicking the face gives me three runtime
errors, then provides one of those stupid boxes which are far too small;
The stupid box is still way too small (...), but I found and fixed the
errors.

Cheers,
Marijn

Aug 3 '07 #11
David Mark wrote:
On Aug 3, 3:25 am, David Mark <dmark.cins...@gmail.comwrote:
>On Aug 3, 2:17 am, mari...@gmail.com wrote:
>>On 3 aug, 01:32, David Mark <dmark.cins...@gmail.comwrote:
[...] You'll still need to implement a CSS expression to
simulate max-width in IE6 and earlier (wrap it in an IE conditional
comment.) You can put the text-align:center rule for the body in
there too (it is an old IE fix too.)

Oops. You are using quirks mode,
That is called Compatibility Mode in MSHTML.
so you will need to simulate max-width for IE period.
Nonsense. IE < 7 does not support max-width, or min-width, max-height
or min-height for that matter. In no rendering mode. Period.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not the
best source of advice on designing systems that use javascript.
-- Richard Cornford, <f8*******************@news.demon.co.uk>
Aug 3 '07 #12
On Aug 3, 5:45 am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
David Mark wrote:
On Aug 3, 3:25 am, David Mark <dmark.cins...@gmail.comwrote:
On Aug 3, 2:17 am, mari...@gmail.com wrote:
On 3 aug, 01:32, David Mark <dmark.cins...@gmail.comwrote:
[...] You'll still need to implement a CSS expression to
simulate max-width in IE6 and earlier (wrap it in an IE conditional
comment.) You can put the text-align:center rule for the body in
there too (it is an old IE fix too.)
Oops. You are using quirks mode,

That is called Compatibility Mode in MSHTML.
so you will need to simulate max-width for IE period.

Nonsense. IE < 7 does not support max-width, or min-width, max-height
or min-height for that matter. In no rendering mode. Period.
And for that matter, you didn't even need to read the thread. Just
read what you quoted.
Aug 3 '07 #13
David Mark wrote:
On Aug 3, 5:45 am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
>David Mark wrote:
>>On Aug 3, 3:25 am, David Mark <dmark.cins...@gmail.comwrote:
On Aug 3, 2:17 am, mari...@gmail.com wrote:
On 3 aug, 01:32, David Mark <dmark.cins...@gmail.comwrote:
[...] You'll still need to implement a CSS expression to
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>simulate max-width in IE6 and earlier (wrap it in an IE conditional
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
>>>comment.) You can put the text-align:center rule for the body in
^^^^^^^^
>>>there too (it is an old IE fix too.)
Oops. You are using quirks mode,
^^^^^^^^^^^^^^^^^^^^^^^^^
>That is called Compatibility Mode in MSHTML.

Thanks for that. It is also known as and often referred to as quirks
mode.
>>so you will need to simulate max-width for IE period.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>Nonsense. IE < 7 does not support max-width, or min-width, max-height

I never said it did. If you would have read the thread before
posting, you would have seen that I explained how to simulate this in
IE6.
It is you who is not reading what he is replying to, or thinking of
replying to a posting of (sub)thread A in (sub)thread B and subsequently
doing so. How typical that you are blaming your readers for not
automatically unravelling the misunderstandings you caused.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not the
best source of advice on designing systems that use javascript.
-- Richard Cornford, <f8*******************@news.demon.co.uk>
Aug 3 '07 #14
On 3 aug, 12:07, David Mark <dmark.cins...@gmail.comwrote:
Actually, it has shown light on existing problems. You have tuned
your layout for IE's quirks mode. Other than Firefox, what other
browsers have you tested with?
Current Opera, Safari, IE6 and IE7. The scrollbar in standards-mode is
so screwed up that the only explanation is a bug. So no, I didn't
adjust my layout to quirks mode.

Marijn

Aug 3 '07 #15
Thomas 'PointedEars' Lahn said the following on 8/3/2007 5:45 AM:
David Mark wrote:
>On Aug 3, 3:25 am, David Mark <dmark.cins...@gmail.comwrote:
>>On Aug 3, 2:17 am, mari...@gmail.com wrote:
On 3 aug, 01:32, David Mark <dmark.cins...@gmail.comwrote:
[...] You'll still need to implement a CSS expression to
simulate max-width in IE6 and earlier (wrap it in an IE conditional
comment.) You can put the text-align:center rule for the body in
there too (it is an old IE fix too.)
Oops. You are using quirks mode,

That is called Compatibility Mode in MSHTML.
>so you will need to simulate max-width for IE period.
^^^^^^^^
Nonsense. IE < 7 does not support max-width, or min-width, max-height
or min-height for that matter. In no rendering mode. Period.
Did you not see the word "simulate"?

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 3 '07 #16
Thomas 'PointedEars' Lahn said the following on 8/3/2007 7:20 AM:
David Mark wrote:
>On Aug 3, 5:45 am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
>>David Mark wrote:
<snip>
>>>so you will need to simulate max-width for IE period.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>Nonsense. IE < 7 does not support max-width, or min-width, max-height
I never said it did. If you would have read the thread before
posting, you would have seen that I explained how to simulate this in
IE6.

It is you who is not reading what he is replying to

Considering that you can't even read what you quote.... Pay close
attention to the word "simulate" and the phrase "need to simulate" that
even *you* marked.
How typical that you are blaming your readers for not
automatically unravelling the misunderstandings you caused.
I think it is - plainly - obvious who is causing the misunderstanding.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 3 '07 #17
On 3 aug, 12:07, David Mark <dmark.cins...@gmail.comwrote:
Actually, it has shown light on existing problems. You have tuned
your layout for IE's quirks mode. Other than Firefox, what other
browsers have you tested with?
No, I haven't tuned my layout to IE's quirks mode. I have tested with
Safari 3, Opera 9, Firefox 1.5 and 2, and IE 6 and 7. The phenomenon I
was describing is sufficiently bizarre to make me feel justified to
assume it is a bug.

Cheers,
Marijn

Aug 3 '07 #18
In comp.lang.javascript message <11**********************@57g2000hsv.goo
glegroups.com>, Thu, 2 Aug 2007 07:12:56, ma*****@gmail.com posted:
>A freely-available online book about JavaScript has just been
launched:
http://eloquentjavascript.net

It attempts to provide a comprehensive introduction to the language,
and a practical environment for practicing your programming skills and
trying out code. Take a look, and let me know if you find anything
that could use improvement (there's a 'react' button in the top-left
corner of most of its pages).

Cheers,
Marijn Haverbeke
It seems to have improved overnight.

Your "last edited on 3/8/2007" will mislead Americans, and also anyone
who thinks you are more or less American (your name indicates only
ancestry). Use the ISO form, 2007-08-03; no reasonable person can
misunderstand that (some USG agencies might - Google YYYYDDMM).

Re another article : Code should never be machine-wrapped post-
authoring.

Re 52/53 : Due to the hidden leading "1" bit in an IEEE Double, of
course.

In Chap. 3, "at this looks" - "as this looks" .

You should obfuscate your E-mail address in the source of the pages.
Change m@g.c to m@g.c - it will do no harm, and may do some good. I
also encoded part of the 'mailto:', but now I put my address only as an
image.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "" (SonOfRFC1036)
Aug 3 '07 #19
[sorry for the double post further back, I was being stupid]

On 3 aug, 18:56, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
Your "last edited on 3/8/2007" will mislead Americans, and also anyone
who thinks you are more or less American (your name indicates only
ancestry). Use the ISO form, 2007-08-03; no reasonable person can
misunderstand that (some USG agencies might - Google YYYYDDMM).
Hah, I should probably just make it "August 3rd 2007" or something,
and be done with it.
Re 52/53 : Due to the hidden leading "1" bit in an IEEE Double, of
course.
Thanks for clarifying this, I didn't get it from the cryptic remark
earlier. (I guess that particular aspect of IEEE floats had sunk
deeply into the swamp that is my brain.) -- Now how do I explain this
to new programmers going into long complicated tangents? Heh, I'll
think about it.
In Chap. 3, "at this looks" - "as this looks" .
Thanks, fixed.
You should obfuscate your E-mail address in the source of the pages.
Change m...@g.c to m@g.c - it will do no harm, and may do some good. I
also encoded part of the 'mailto:', but now I put my address only as an
image.
I've been painstackingly doing that for a while (or tricks with images
or javascript), but my address is all over the net already as it is,
and I guess spammers will have figured out this particular trick by
now.

Cheers,
Marijn

Aug 3 '07 #20
On Aug 3, 7:20 am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
David Mark wrote:
On Aug 3, 5:45 am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
David Mark wrote:
On Aug 3, 3:25 am, David Mark <dmark.cins...@gmail.comwrote:
On Aug 3, 2:17 am, mari...@gmail.com wrote:
On 3 aug, 01:32, David Mark <dmark.cins...@gmail.comwrote:
[...] You'll still need to implement a CSS expression to

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>>simulate max-width in IE6 and earlier (wrap it in an IE conditional

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^>>>comment.) You can put the text-align:center rule for the body in
^^^^^^^^
>>there too (it is an old IE fix too.)
Oops. You are using quirks mode,

^^^^^^^^^^^^^^^^^^^^^^^^^>That is called Compatibility Mode in MSHTML.
Thanks for that. It is also known as and often referred to as quirks
mode.
>so you will need to simulate max-width for IE period.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nonsense. IE < 7 does not support max-width, or min-width, max-height
I never said it did. If you would have read the thread before
posting, you would have seen that I explained how to simulate this in
IE6.

It is you who is not reading what he is replying to, or thinking of
replying to a posting of (sub)thread A in (sub)thread B and subsequently
doing so. How typical that you are blaming your readers for not
You are out of your mind. And what the hell is a (sub)thread A? This
very simple thread and the very simple issue you confused went
something like:

1. I told the OP they would have to simulate max-width in IE6.
2. I realized they were using quirks mode and amended that to IE
period as IE7 still won't do max-width in quirks mode.
3. You jumped in with an incorrect interpretation of (2) as apparently
you didn't understand what I meant.
4. I corrected you and told you (once again) to read (and comprehend)
before posting and you replied with this rubbish.

Aug 3 '07 #21
In comp.lang.javascript message <11*********************@e16g2000pri.goo
glegroups.com>, Fri, 3 Aug 2007 02:05:58, Peter Michaux
<pe**********@gmail.composted:
>On Aug 2, 3:42 pm, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
>In comp.lang.javascript message <1186038776.409299.128...@57g2000hsv.goo
glegroups.com>, Thu, 2 Aug 2007 07:12:56, mari...@gmail.com posted:
>A freely-available online book about JavaScript has just been
launched:
http://eloquentjavascript.net

Since you have overridden my choice of Browser font, I will not be
reading it much. I prefer a Serif font; you set a sans-serif font - not
even my default Arial, but more squashed-together. NASA and some
Russians are just as bad.

You may wish to learn about using CSS, the cascade, !important rules
and reader stylesheets. You may also find that some browser plugins
make using this technology more accessible to you.

https://addons.mozilla.org/en-US/firefox/addon/2108
No. I want to have my browser as-delivered, just like the ones in the
Library are; not to need to change my general preferences; and not to
make special provision for reading particular sites. My vision is near
enough normal.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/&c., FAQqy topics & links;
<URL:http://www.merlyn.demon.co.uk/clpb-faq.txt RAH Prins : c.l.p.b mFAQ;
<URL:ftp://garbo.uwasa.fi/pc/link/tsfaqp.zipTimo Salmi's Turbo Pascal FAQ.
Aug 3 '07 #22
In comp.lang.javascript message <11*********************@19g2000hsx.goog
legroups.com>, Fri, 3 Aug 2007 06:09:14, ma*****@gmail.com posted:
>On 3 aug, 00:42, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
>Good point about the date and author, I guess I'll add these to every
page. Could you tell me which browser you use and which errors the
feedback system gives you?
IE6 in XP sp2; but the errors have gone. The main box is still too
small; the address box is too short for the address I would put there;
the name box is too short for at least one of my friends, and the
Subject box is too short.
>In Chapter 4, the description of the getTime values has the standard two
errors.

Which are?
Should you be writing a Javascript text if you know so little? The ISO
standard gets it right.

>Chapter 2 - the limit is 2^53, not 2^52. That's over 9e15.
"Calculations with whole numbers (also called integers) that fit in 52
bits are guaranteed to always be precise." Apart from 52->53, that's
not entirely so. Shift and other operations are 32-bit. I think you
don't mention the useful Unary + operator.

I didn't know >and << are 32 bit. (That is a shame.) Does unary + do
anything that the Number function doesn't? -- Apart from being
shorter.
As above.

It's quicker, too. Maybe Number has to create an Object, while + does
not have to. They can, for example, both take Boolean arguments.

I have a response to DM in hand, but the window has crashed. The draft
may reappear on reboot, tomorrow.

It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Aug 3 '07 #23
ma*****@gmail.com wrote:
[sorry for the double post further back, I was being stupid]

On 3 aug, 18:56, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
>Your "last edited on 3/8/2007" will mislead Americans, and also anyone
who thinks you are more or less American (your name indicates only
ancestry). Use the ISO form, 2007-08-03; no reasonable person can
misunderstand that (some USG agencies might - Google YYYYDDMM).

Hah, I should probably just make it "August 3rd 2007" or something,
and be done with it.
03 Aug 2007 (don't need comma etc. This one is advocated by Strunk and
White in Elements of Style.
Aug 4 '07 #24
On 4 aug, 00:35, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
IE6 in XP sp2; but the errors have gone. The main box is still too
small; the address box is too short for the address I would put there;
the name box is too short for at least one of my friends, and the
Subject box is too short.
Yes, but fortunately these text fields (marvellous things that they
are) allow one to input text that is wider than the fields themselves.
Also, there's an e-mail link at the bottom of each page now, for those
who'd rather use their own mail client.
In Chapter 4, the description of the getTime values has the standard two
errors.
Which are?

Should you be writing a Javascript text if you know so little? The ISO
standard gets it right.
Ugh. Either you tell me what you are talking about, or I shall
regrettably be forced to classify you as a useless buffoon.
It's quicker, too. Maybe Number has to create an Object, while + does
not have to. They can, for example, both take Boolean arguments.
Number does not create an object, unless 'new' is applied to it. Thus,
it seems to be equivalent to unary-+, more verbose, but also clearer.

Regards,
Marijn

Aug 4 '07 #25
ma*****@gmail.com wrote:
On 4 aug, 00:35, Dr J R Stockton wrote:
<snip>
>It's quicker, too. Maybe Number has to create an Object,
while + does not have to. They can, for example, both
take Boolean arguments.

Number does not create an object, unless 'new' is applied
to it. Thus, it seems to be equivalent to unary-+, more
verbose, but also clearer.
There is object creation implied in all calls to native function objects
(the - arguments - object at minimum, probably the Activation/Variable
object (as the Variable object needs to be unique if closures are used),
probably an object for the execution context's scope and possibly an
object for the execution context itself). None of that is necessarily
true for the built-in functions, but still testing suggests that -
Number(x) - is 4 to 7 times slower than - (+x) - and as the outcome is
specified to be identical the difference is most likely accounted for in
the overheads of the function call.

Richard.

Aug 4 '07 #26
In comp.lang.javascript message <11**********************@e16g2000pri.go
oglegroups.com>, Fri, 3 Aug 2007 13:07:07, David Mark
<dm***********@gmail.composted:
>On Aug 3, 7:20 am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
>...
>You are out of your mind.
You are fairly new here. What you observe was thoroughly established
here last year, as can be established no doubt through Google.

TL reminds me of the joke about the BAOR carollers that got put on a
fizzer one Xmas.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQish topics, acronyms, & links.
For news:borland.*, use their server newsgroups.borland.com ; but first read
Guidelines <URL:http://www.borland.com/newsgroups/guide.htmlff. with care.
Aug 4 '07 #27
In comp.lang.javascript message <11**********************@k79g2000hse.go
oglegroups.com>, Fri, 3 Aug 2007 18:59:05, ma*****@gmail.com posted:
>
>Re 52/53 : Due to the hidden leading "1" bit in an IEEE Double, of
course.

Thanks for clarifying this, I didn't get it from the cryptic remark
earlier. (I guess that particular aspect of IEEE floats had sunk
deeply into the swamp that is my brain.) -- Now how do I explain this
to new programmers going into long complicated tangents? Heh, I'll
think about it.
You don't.

You just say that a JS Number can hold every integer within
+-9007199254740992 (inclusive) exactly; and can hold with an accuracy of
better than 1 in 10^15 any value of magnitude between 10^-308 and
10^+308, also +-Infinity. And that logical operations on Numbers are
32-bit. Check the ISO/IEC or ECMA standard for details.

Then you cite a reference for the structure of an IEEE Double.
I think that you should add, maybe as an Appendix, a few major
references - the ISO standard, this group, its FAQ, and something like
<http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide>.
It's a good idea to read the newsgroup c.l.j and its FAQ. See below.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
<URL:http://www.merlyn.demon.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Aug 4 '07 #28
In comp.lang.javascript message <11*********************@22g2000hsm.goog
legroups.com>, Sat, 4 Aug 2007 05:56:54, ma*****@gmail.com posted:
>On 4 aug, 00:35, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
>IE6 in XP sp2; but the errors have gone. The main box is still too
small; the address box is too short for the address I would put there;
the name box is too short for at least one of my friends, and the
Subject box is too short.

Yes, but fortunately these text fields (marvellous things that they
are) allow one to input text that is wider than the fields themselves.
Of course. But it is nice to be able to see the whole entry at once.
BTW, I'd particularly suggest serif or monospace there - if one happens
to enter a name with the letter "ij" in it, it's difficult to see in
sans-serif whether one has got it right.
>Also, there's an e-mail link at the bottom of each page now, for those
who'd rather use their own mail client.
Appreciated.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6.
Web <URL:http://www.merlyn.demon.co.uk/- w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/- see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.
Aug 4 '07 #29
On Aug 4, 9:49 am, Dr J R Stockton <j...@merlyn.demon.co.ukwrote:
In comp.lang.javascript message <1186171627.319181.318...@e16g2000pri.go
oglegroups.com>, Fri, 3 Aug 2007 13:07:07, David Mark
<dmark.cins...@gmail.composted:
On Aug 3, 7:20 am, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
...
You are out of your mind.

You are fairly new here. What you observe was thoroughly established
here last year, as can be established no doubt through Google.
Yes. From searching through some older posts, I have identified a
couple of nutcases in this group. I won't even mention the other one,
though I am sure you know who I mean. He seems to have faded away.

And come to think of it, there was a third one who made the other two
look relatively sane, but he was apparently just a short-lived troll.
>
TL reminds me of the joke about the BAOR carollers that got put on a
fizzer one Xmas.
LOL. That IS a good one. But seriously, I don't follow that at all.

Aug 5 '07 #30
In comp.lang.javascript message <11**********************@57g2000hsv.goo
glegroups.com>, Thu, 2 Aug 2007 07:12:56, ma*****@gmail.com posted:
>A freely-available online book about JavaScript has just been
launched:
http://eloquentjavascript.net

Chap. 4.

The wording "milliseconds it is away from January 1st 1970" really means
a count starting with 0 at the very beginning of January 2nd. Commonly
one sees problems with "between" and "from". Actually, as the standards
say, the zero of the count is at the beginning of 1970-01-01 00:00:00
UTC. The UTC is important, though GMT might be more accurate as
javascript has no Leap Seconds.
You say "In addition to a date and time, Date objects also contain
information about a timezone." That is wrong. The only data in a Date
Object is an IEEE Double representing the milliseconds. A Date Object
also has a method getTimezoneOffset, but that makes an O.S. call giving
the aforesaid Double and returning the difference between local time and
UTC for that particular UTC. If it were stored in the Object, there
should be a setTimezoneOffset.

When it is one o'clock in Amsterdam it is ALWAYS either noon or midnight
in London - exactly in practice, but NL legal time is probably UTC-based
whereas UK legal time is probably still GMT-based. The time in NY will
generally be 7:00 but sometimes 8:00.

"Some functions can take any number of arguments" - I rather think any
function can take any number of arguments. There, "can use any" would
be better.

"inside Math. All the trigonometric functions are there" - not all, only
those JS knows. Omit the word "All".

In unpolluted proper British English, "cannot" implies impossible but
"can not" implies not compulsory. You cannot feed your cat tinned cat-
food (cats cannot open tins); you can not feed your cat anything but it
will get annoyed and go elsewhere.

Chap 10 : a list of the standard methods that accept RegExp arguments
could be useful. I know of six. There's a missing full stop.

In Appendix 2, "Next Chapter" is not a link. Because you have
overridden default text and link styles, I cannot tell that by looking
at it. I prefer default decoration; your colours are too close.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/- FAQqish topics, acronyms & links;
Astro stuff via astron-1.htm, gravity0.htm ; quotings.htm, pascal.htm, etc.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Aug 5 '07 #31

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Steve | last post by:
If someone says RTFM, go here... http://www.hudzilla.org/php/index.php <quote> Please read the copyright notice and abide by it. Some day I hope to publish this thing, and that would be...
1
by: Tomas Wilhelmsson | last post by:
Im a bit short of money atm, no job and the school dont want to give me any so im looking for an online book (not ripped) about oop design? .. or some paper on it, never been a good code designer...
6
by: LayneMitch via WebmasterKB.com | last post by:
Hello. I'm new to the javascript world, but almost complete with reading the two books I've purchased so I do have some knowledge. However, none of the books I have provide me with enough...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.