By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,837 Members | 1,813 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,837 IT Pros & Developers. It's quick & easy.

FAQ update and proposed updates

P: n/a
Anyone who has taken a look at the online FAQ today may have noticed
that I have updated it. The majority of the changes are the updating of
broken links and the implementation of that extensive suggestions for
re-wording provided by Michael Winter. Other changes are listed below.

Fore those interested, a zipped snapshot of the entire FAQ and notes, as
it now is, is available at:-

<URL: http://www.jibbering.com/faq/faq_notes/faqNotes.zip > 174Kb

- including the text versions posted to the group.

I don't regard this as a final version 8.1, but getting it online with
the fixed URLs seemed like a good idea.

The following are FAQ requests, some with suggested entries, some with
explanations of what I have done in response, and some requiring future
work, suggestions, etc and inevitably some that I am not willing to act
upon:-

------------------------------------------------------------------------
| From: Dr John Stockton <jr*@merlyn.demon.co.uk>
| Message-ID: <Hz**************@merlyn.demon.co.uk>
|
| Code in a recent article by Evertjan supports calculation in Cents
| with output in Euros, and a (<G>my</G>) version should be included
| in a <FAQ--TRY> explicitly on why it's better to calculate in Cents.
|
--------------------------------------------------------
| From: Dr John Stockton <jr*@merlyn.demon.co.uk>
| Message-ID: <vJ**************@merlyn.demon.co.uk>
|
| <FAQ--TRY> in 4.6, change 0.07 to 0.06+0.01 ???
|
| FAQ has 4.7 Why does 5 * 1.015 != 5.075 or 0.05+0.01 != 0.06?
| Better? 4.7 Why does 5 * 1.015 != 5.075 or 0.06+0.01 != 0.07?

I have change 0.05 to 0.06, etc. This is a proposal for re-wording with
an additional final paragraph mentioning doing money calculations in
cents/pennies;-

<Proposed>
4.7 Why does 5 * 1.015 != 5.075 or 0.05+0.01 != 0.06?
Javascript numbers are represented in binary as IEEE-754 Doubles, with
a resolution of 53 bits, giving an accuracy of 15-16 decimal digits;
integers up to about 9e15 are precise, but few decimal fractions are.
Given this, arithmetic is as exact as possible, but no more.
Operations on integers are exact if the true result and all
intermediates are integers within that range.

In particular, non-integer results should not normally be compared
for equality; and non-integer computed results generally need
rounding; see 4.6.

Traditionally banks and financial institutions have performed
computerised monetary calculations in integer values representing
cents/pennies (or tenths of cents/pennies) in order to avoid
(precision and rounding) issues arising from the use of floating
point number types.
</ Proposed>
------------------------------------------------------------------------
| From: Dr John Stockton <jr*@merlyn.demon.co.uk>
| Message-ID: <CF**************@merlyn.demon.co.uk>
|
| That class of question is on-topic, but there is here less expertise
| in answering what it appears to be than might be found in groups
| news:microsoft.public.scripting.(wsh,jscript). Here we primarily in
| practice deal with script on web pages.
|
| <FAQ--TRY> Those newsgroups should be mentioned somewhere in 2.1 2.7
| or 3.2 </FAQ--TRY>.

I have added mention of microsoft.public.jscript in section 2.2 and
microsoft.public.wsh in section 3.2 (resources for Windows Scripting
Host)

------------------------------------------------------------------------
| From: Dr John Stockton <jr*@merlyn.demon.co.uk>
| Message-ID: <IP**************@merlyn.demon.co.uk>
|
| There should be a <FAQ--TRY> on sorting.

A very vague request as it is. Anyone want to suggest an entry on the
subject for the quick answers?

------------------------------------------------------------------------
| From: Randy Webb <Hi************@aol.com>
| Message-ID: <GP********************@comcast.com>
|
| <FAQ--TRY>
| If you want to post a followup via groups.google.com, don't use
| the "Reply" link at the bottom of the article. Click on
| "show options" at the top of the article, then click on
| the "Reply" at the bottom of the article headers.
| </FAQ--TRY>

This is representative of many requests for an entry on this subject. I
would have preferred not to put this in the FAQ as it is aimed at people
using a single specific Usenet interface. But given the number of
requests I added it to section 2.3 as a new paragraph 7. I have also
re-worded paragraph 6 to make it more obvious that quoting is required.

------------------------------------------------------------------------
| From: Dr John Stockton <jr*@merlyn.demon.co.uk>
| Message-ID: <Bi**************@merlyn.demon.co.uk>
|
| <FAQ--TRY> 4.15 start : add something like "After a page is loaded,
| the first use of document.write[ln] will clear it before writing.".

-------------------------------------------------------
| From: Randy Webb <Hi************@aol.com>
| Message-ID: <hP********************@comcast.com>
|
| > <FAQ--TRY> 4.15 start : add something like "After a page is
| > loaded, the first use of document.write[ln] will clear it
| >before writing.".
|
| document.write has nothing to do with dynamically changing the
| current page. There should be something in the FAQ (or notes)
| about the improper use of document.write but 4.15 isn't the
| right place.

Using document.write after the page loads probably is a FAQ and so
should have an entry. I don't think it should be with 4.15 as it is not
dynamic manipulation, even if attempts are made to use it that way (and
it was used in dynamic page updating in Netscape 4).

<Proposed>
4.n Why does using document.write replace the existing document?

When a document finishes loading the its input stream is closed (the
equivalent of calling document.close is performed by the browser). And
calls to the document.write method following the closing of the stream
will open a new input stream and replace the current document with
anything that is written. As the script that is calling document.write
is very likely to be part of the current document it is likely to be
replaced in the process, and so may not be able to perform more than a
single write call (depending on the browser being used).
</Proposed>

------------------------------------------------------------------------
| From: Dr John Stockton <jr*@merlyn.demon.co.uk>
| Message-ID: <P1**************@merlyn.demon.co.uk>
|
| <FAQ--TRY> It would be useful to have a list of the names of the
| browser families, and their salient members in each case.

A list that isn't a complete list suggests that browsers not on the list
can be disregarded. An up to date, complete, list is not known to me.
And given that the embedded browser market is where the money is at the
moment (where new browsers are being written) and it is often difficult
to identify which browser is embedded in which device, I suspect that a
complete list would be difficult to create.

------------------------------------------------------------------------
| From: Thomas 'PointedEars' Lahn <Po*********@web.de>
| Message-ID: <17****************@PointedEars.de>
|
| <FAQ--TRY>
|
| - In section 3.2, the FAQ still refers to
|
| http://devedge.netscape.com/library/...1.3/reference/
|
| which is dead since almost a year:
| <http://www.mozillazine.org/talkback.html?article=5381>
|
| It should point to a mirror like
|
| <http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.3/reference/>
|
| - Not mentioned in the FAQ, there was also a documentation on
| JavaScript 1.5 available on DevEdge, which is now hosted at
| the Mozilla Foundation website:
|
| <http://developer.mozilla.org/en/docs/JavaScript>
|
| - General information on JavaScript, the ECMAScript 3 Final
| Specification and previous editions can be found at
|
| <http://www.mozilla.org/js/>
|
| and
|
| <http://www.mozilla.org/js/language/>
|
| - W3C DOM Level 1 HTML has been obsoleted by W3C DOM Level 2 HTML
| (see: "Status of this document" section), yet the FAQ refers to
| the former's ECMAScript Language Binding section. It should
| refer to
|
| <http://www.w3.org/TR/DOM-Level-2-HTML/ecma-script-binding.html>
|
| instead.
|
| - The FAQ does not contain any reference to any W3C DOM Level 3
| specification:
|
| <http://www.w3.org/DOM/>
|
| </FAQ--TRY>

I have changed all of the JavaScript 1.3 references to correspo0nding
entries in Sun's documentation.

I have added JavaScript 1.5 references and the mozilla.org that lists
the other ECMA specs in section 3.2

Jim had already added DOM level 2, and I added mention of DOM level 3 in
section 2.9.

------------------------------------------------------------------------
| From: "VK" <sc**********@yahoo.com>
| Message-ID: <11**********************@z14g2000cwz.googlegroups .com>
|
| <FAQ--TRY> title like "Does the world really exist or it's given
| to me in my sensations and experience only?"
|
| <sniped incoherent twaddle>

--------------------------------------------------------
| http://groups.google.co.uk/group/com...6b0f8e07897987
| VK
|
| It should, and you could file an "instability bug" to Mozilla
| (bugzilla.mozilla.org). But I'm affraid that it doesn't help
| too much on your *current* project. The root problem is that
| IFRAME's hierarhy is not well defined, as it appeared as a
| rather new extension of WINDOW. I'm sorry for being too lazy
| to type in all underground issues, but if you really want to
| know them, I can answer it within a week or so (summer, man ;-)
| Actually it's a remote - but direct - issue of <FAQ--TRY> tread
| question you may see now in this group (where I'm almost bit
| down by the best selected people of comp.lang.javascript :-(
|
| I would stay on the loop for now (unless 50-100 ms time gain is
| important in your project).

I added a paragraph to section 5.1 stating that FAQ request markers
should not be used in posts that are not intend as making FAQ requests,
as that is apparently not as self-evident as it should be.

------------------------------------------------------------------------
| From: "VK" <sc**********@yahoo.com>
| Message-ID: <11**********************@g14g2000cwa.googlegroups .com>
|
| To stop this <FAQ--TRY> from flaggering like a hell's gates counter,
| I'm proposing a UN Counsil style text (no politics discussions, only
| fully mutually acceptable points).
|
| <FAQ--TRY>
| <QUE>
| I'm doing:
|
| var myObject = new Array();
| var myObject["StringIdentifier"] = IdentifierValue;
|
| But myObject.length doesn't change. What a hay? I event tried:
|
| var myObject = new Object();
| var myObject["StringIdentifier"] = IdentifierValue;
|
| but it doesn't help!
| </QUE>
| <ANS>
| The myObject.length property is set properly
| only for an array which you have declared
| by using var myObject = new Array() or by
| var myObject = [item1, item2, item3]
| and only if you're using positive integers for identifiers.
| If some of your identifiers are strings, they will not be counted
| to the myObject.length. In the particular, all form values come
| to the function as strings. So even if your textField.value contains
| a number, it will be treated as a string. So to ensure that
| myObject.length
| is set properly, you should do at the least:
| var myObject[+Identifier] = IdentifierValue;
| </FAQ--TRY>

<Proposed>
4.n Why does adding a named property to an Array not alter its length?

All javascript objects may have arbitrarily named properties added to
them at runtime. Arrays are a special category of object where the
addition of properties who's names correspond with normalised
non-negative integers (array indexes) also may modify the Array's length
property such that it is one greater than the largest "array index"
property created.

Properties with names that do not correspond with normalised
non-negative integers have the same effect on an Array object as on any
other javascript object. The property may be added to the object at
runtime but there are no consequential modifications to any other
properties of the object.
</Proposed>

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...2489119d355ddd
| Thomas 'PointedEars' Lahn
|
| <FAQ--TRY>
|
| However, it does have `FunctionExpression's which are supported
| from JavaScript 1.2 (NN 4.0) and JScript 1.0 (IE 3.0) on:
|
|
| if (document.getElementById)
| {
| var getElemById = function getElemById(id)
| {
| return document.getElementById(id);
| }
| }
|
|
| </FAQ--TRY>

In context this is a request to have quick answer 4.15 use function
expressions instead of the Function construction that it uses now. I
don't think that change is necessary as the page in the notes uses
function expressions in this context, so examples of function
expressions are provided.

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...208586f895b8e6
| Dr John Stockton
|
| <FAQ--TRY>ISTM that it would be good to have an entry on RegExps
| for validation. Is the FAQ still being updated?

We couldn't do a FAQ entry on "how do you validate forms" as that is too
big a subject for a single quick answer and it doesn't necessarily (or
exclusively) involve regular expressions. So, any specific suggestions?

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...aefbe2b60a68ef
| Dr John Stockton
|
| Aside: <FAQ--TRY> That is not found by a search for "Shuffle" - I
| suggest changing to "How to Deal and Shuffle" </FAQ--TRY>

Done.

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...a2967f21f6f299
| Dr John Stockton
|
| <FAQ--TRY> An entry referring to dates should mention the importance
| of discriminating between GMT, local Winter Time, & local Summer
| Time.

Suggestions?

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...0e476ae10f0c57
| Dr John Stockton
|
| There's an implied <FAQ--TRY> there, for 2.3 paragraphs 4 & 6.
|
| Possible FAQ Question 4.0 - "How should javascript be written" -
| answer to include indent & paragraph, spaces, line-length for
| News, and probably a link to FAQ notes. Praise plaintext editing,
| validators, etc., and knock inferior composing packages, if those
| can be done briefly.
|
| It's FA, even if not a FQ !
|
| The "can not" in the FAQ (4.33) should, as everywhere else, be
| "cannot".

4.33 has been re-worded so it no longer contains "can not" or "cannot".

The notes already cover how to include/format javascript source for
newsgroup posts. I do not expect that anything too prescriptive on
general script authoring style to meet with much agreement. I also doubt
that it would be brief.

------------------------------------------------------------------------

| http://groups.google.co.uk/group/com...911e4abd38a52e
| Randy Webb
|
| <FAQ--TRY>
| Why does 4.34 no longer mention reading files from a server?
| </FAQ--TRY>

Yes, but not in so many words.

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...7a256423a85c59
| Dr John Stockton
|
| <FAQ--TRY> 4.37 refers to "featuresting" </FAQ--TRY>

Not any more.

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...8df39157481b59
| Dr John Stockton
|
| <FAQ--TRY> Never do something unrequested on a Web page - fancy
| background, showing date and/or time, etc., unless there is reason
| to expect it to be beneficial to the typical reader. </FAQ--TRY>

? I worry that attempting to be too prescriptive without adequate
explanation is likely to detract from the rest of the FAQ. And adequate
explanation is difficult to accommodate in a quick answer.

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...fc06e0718fd700
| Randy Webb
|
| <FAQ--TRY>
| Is there a notes section that deals with image swaps? I know 4.31
| addresses why rollovers are slow but I do not see anything in the FAQ
| itself that addresses how to do an image swap.
| </FAQ--TRY>

Not yet. I see other subjects as having a greater call on my time, but
that doesn't stop anyone else writing something on image swapping.

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...16eee76e95c7f6
| Dr John Stockton
|
| <FAQ--TRY>
|
| >Correctly inserting the "Mark of the Web" does work:
|
| ><!-- saved from url=(0014)about:internet -->
| ><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
| > ...
| >The above places the script in the Internet zone, and therefore
| >IE does not block any script, since script in the Internet zone
| >can not do the damage that one running in the My Computer zone
| >can.
|
| IMHO, the Mark should be in the FAQ.
|
| Since there seems to be some difficulty or delaying element as
| regards FAQ updates, can the newsgroup itself develop an item on
| the Mark, suitable for direct quotation or insertion?
|
| The above is no doubt correct, but IMHO a little more explanation
| would be appropriate for a FAQ response.

I will think about that and get back to you.

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...99fff04c73f214
| Dr John Stockton
|
| which I believe to be the standard.
|
| "expires=Thu, 01-Jan-1970 00:00:00 GMT"
| is insignificantly longer than
| "expires="+new Date(0).toGMTString()
| and definitely shorter than what is commonly used. <FAQ--TRY>?

We have a problem with the cookies entry in that the old URL referenced
has disappeared. I have provisionally replaced it with a link to a
w3schools page, but given that the notes already contains a page on
cookies it might be better just to expand that.

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...a27b098c018d44
| Dr John Stockton
|
| <FAQ--TRY> ?
| It would be useful IMHO to have a list of javascript/OS version
| combinations, with, for each, the chronological and numerical
| resolutions (e.g. IE4/Win98 : 54.9 ms, 10 ms) or a list of
| resolution combinations followed by the systems that have them.

OK. Do you have the list? ;)

------------------------------------------------------------------------

| http://groups.google.co.uk/group/com...893f092e1dd4f6
| Randy Webb
|
| <FAQ--TRY>
| Something about the type attribute being required and language
| attributes causing problems in certain browsers? javascript1.4
| being a problem in IE6.
| </FAQ--TRY>

See:-

<URL: http://www.jibbering.com/faq/faq_notes/script_tags.html >

But that page is not yet linked to bay any entry on the FAQ proper.

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...9bc2ed5e875320
| Dr John Stockton
|
| <FAQ--TRY> Could Sec 3.2 become an <ol type=a> list,
| please </FAQ--TRY>

One of many requests for alterations to the presentation of the FAQ.
Unfortunately they require that the code that creates the various FAQ
versions form an XML source be modified, and that the XML source is
changed to make it more flexible.

I intend doing this eventually but it has to be done properly so I will
need some time to implement it.

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...117c5edefe4706
| Dr John Stockton
|
| <FAQ--TRY> ISTM that accessibility is important, and javascript
| can affect this. Therefore, I suggest a small entry in FAQ
| Section 4, mainly as an indication of importance, which would
| deprecate overriding readers' choices without true need, link to
| Web information, deprecate the unnecessary use of features not
| common to "all" browsers, and refer to provision for those
| without JS. And/or link(s) in Sec 3. </FAQ--TRY>

A couple of months ago I had a look at what sort of state the WAI
scripting technology document was in. It isn't at all good.

The way in which javascript interferes with accessibility is mostly a
design issue. I cannot thing of a good quick answer on the subject. Any
suggestions?

------------------------------------------------------------------------
| http://groups.google.co.uk/group/com...20f19690272a16
| Dr John Stockton
|
| <FAQ--TRY> The link in 2.6 should be annotated (PDF) if it is PDF;
| otherwise, I suspect it is not the standard but an HTML page linking
| to it. </FAQ--TRY>

2.6 doesn't actually say that it is the standard, and it is an HTML page
with links to the standard itself.

------------------------------------------------------------------------

Richard.

Nov 7 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
JRS: In article <dk*******************@news.demon.co.uk>, dated Mon, 7
Nov 2005 01:26:10, seen in news:comp.lang.javascript, Richard Cornford
<Ri*****@litotes.demon.co.uk> posted :
I don't regard this as a final version 8.1, but getting it online with
the fixed URLs seemed like a good idea.

The following are FAQ requests, some with suggested entries, some with
explanations of what I have done in response, and some requiring future
work, suggestions, etc and inevitably some that I am not willing to act
upon:-
<Proposed>
4.7 Why does 5 * 1.015 != 5.075 or 0.05+0.01 != 0.06?
...
Traditionally banks and financial institutions have performed
computerised monetary calculations in integer values representing
cents/pennies (or tenths of cents/pennies) in order to avoid
(precision and rounding) issues arising from the use of floating
point number types.
ISTM better to state merit before tradition :

To avoid precision and rounding issues arising from the use of the
Javascript floating-point number type, most monetary calculations are
better done with integer values representing cents/pence (or
tenths/hundredths of cents/pence). Banks and other financial
institutions do that.
| There should be a <FAQ--TRY> on sorting.

A very vague request as it is. Anyone want to suggest an entry on the
subject for the quick answers?

Not quite, but here's a starter.

The Array type (and?) has a .sort() method. The default is to use String
comparison, unsuitable for Numbers. To sort numerically, use .sort(Fn)
with function Fn(a, b) { return a-b }.

In sorting N items, the comparison function will generally be called O(N
log N) times. For large enough N, it will be faster to pre-process the
entries, in time O(N), so that the default .sort() can be used, then to
rectify the entries.

Using document.write after the page loads probably is a FAQ and so
should have an entry. I don't think it should be with 4.15 as it is not
dynamic manipulation, even if attempts are made to use it that way (and
it was used in dynamic page updating in Netscape 4).
I proposed that it be put there to indicate, to those who read only
4.15, why something else (as then follows) is needed. IMHO,
document.write is an obvious way to change the current page, albeit with
the defect of changing the page rather than a part of it.

But if document write is given another entry 4.n, just start 4.15 with
"(Cf. 4.n.)".

| <FAQ--TRY> It would be useful to have a list of the names of the
| browser families, and their salient members in each case.

A list that isn't a complete list suggests that browsers not on the list
can be disregarded.
Disagree. Just include, for safety, something like "Other browsers, and
other classes of browsers, exist. ISTM necessary for the interpretation
of such as in 4.43 : "Netscape, Mozilla and other Gecko-based browsers"
An up to date, complete, list is not known to me.
And given that the embedded browser market is where the money is at the
moment (where new browsers are being written) and it is often difficult
to identify which browser is embedded in which device, I suspect that a
complete list would be difficult to create.
That's another reason why it would be useful. It's a place to share
your discovery (personally or by persuasion) that ToadPhone embeds a
Lucretia-type browser. The first reason is that reference is often made
in the group to the properties of, for example, Gecko or Mozilla
browsers, and most incomers won't have any idea which those may be.
I added a paragraph to section 5.1 stating that FAQ request markers
should not be used in posts that are not intend as making FAQ requests,
as that is apparently not as self-evident as it should be.
A reply will generally deserve to be collected at the same time, as it
may improve the original request.

| <FAQ--TRY>ISTM that it would be good to have an entry on RegExps
| for validation.

We couldn't do a FAQ entry on "how do you validate forms" as that is too
big a subject for a single quick answer and it doesn't necessarily (or
exclusively) involve regular expressions. So, any specific suggestions?
Let us drop the pretence that the Subjects of FAQ entries must actually
represent actual questions, and consider FAQ as Frequent Answers to
Questions. Then :

4.z How are forms validated?

Validate on completion, submission, or request; not onChange or onBlur.

Most entries are best validated with the help of Regular Expressions.

Example : to check that an entry is a well-formed sum of money below a
million :
OK = /^\d{1-6}(\.\d{2})?$/.test(Entry.value) // #-# or #-#.##
after which Cost = +Entry.value will be safe.

RegExp/Validation links :
<li><a href="http://www.infimum.dk/HTML/validering.html">Validering
af HTML-formularer</a> by Lasse Reichstein Nielsen
<li><a href="http://www.xs4all.nl/~sbpoley/webmatters/formval.html">
Javascript form validation - doing it right</a> by Stephen Poley
<URL:http://www.merlyn.demon.co.uk/js-valid.htm>
<URL:http://www.merlyn.demon.co.uk/js-date4.htm>

<< include a link to a list of RegExp parts like what I saved as
D:\JSCRREFS\MSREGEXP\js56jsgrpregexpsyntax.html >>
| <FAQ--TRY> An entry referring to dates should mention the importance
| of discriminating between GMT, local Winter Time, & local Summer
| Time.

Suggestions?
<< I've noticed that those who read the FAQ may go for Sec 4 and miss
dates in Sec 3. >>

4.q Why does my calendar miss/duplicate a day?

The Date Object stores UTC milliseconds, but the civil clock jumps by an
hour twice a year in many places. Thus adding/subtracting 86400 seconds
is not always the same as adding/subtracting one day; use the latter.
Note that when actual time is not needed, it is more efficient to use
the UTC functions, which are faster. See ...
| There's an implied <FAQ--TRY> there, for 2.3 paragraphs 4 & 6.
|
| Possible FAQ Question 4.0 - "How should javascript be written" -
| answer to include indent & paragraph, spaces, line-length for
| News, and probably a link to FAQ notes. Praise plaintext editing,
| validators, etc., and knock inferior composing packages, if those
| can be done briefly.
|
| It's FA, even if not a FQ !
|
| The "can not" in the FAQ (4.33) should, as everywhere else, be
| "cannot".

4.33 has been re-worded so it no longer contains "can not" or "cannot".

The notes already cover how to include/format javascript source for
newsgroup posts. I do not expect that anything too prescriptive on
general script authoring style to meet with much agreement. I also doubt
that it would be brief.
IMHO, there needs to be something in the FAQ; it can easily, being
supported by Notes, be brief.

"All computer code should be written for legibility; this means with
intelligent use of indentation and other whitespace. For News, lines
should not be machine-wrapped. Most experts prefer to edit the code
directly, rather than with WYSIWYG packages. See Notes <...>."
| <FAQ--TRY> Never do something unrequested on a Web page - fancy
| background, showing date and/or time, etc., unless there is reason
| to expect it to be beneficial to the typical reader. </FAQ--TRY>

? I worry that attempting to be too prescriptive without adequate
explanation is likely to detract from the rest of the FAQ. And adequate
explanation is difficult to accommodate in a quick answer.
Well, you have the Notes, so the bit in the FAQ proper can be as brief
as the above - it explains its essence, but not its detail.

| >Correctly inserting the "Mark of the Web" does work: | IMHO, the Mark should be in the FAQ. I will think about that and get back to you.
No need to get back; I know nothing except that I need to learn. Again,
a sentence and a reference to Notes may be the way to go.

We have a problem with the cookies entry in that the old URL referenced
has disappeared.
My js-date0.htm#CD has a few links, dead or alive.

| It would be useful IMHO to have a list of javascript/OS version
| combinations, with, for each, the chronological and numerical
| resolutions (e.g. IE4/Win98 : 54.9 ms, 10 ms) or a list of
| resolution combinations followed by the systems that have them.

OK. Do you have the list? ;)
If I did, it would be on my site. The code to determine it for the
current browser is at js-dates.htm#Ress - actually, I see that I do have
a list there, albeit short.

D = new Date()
Hardware Operating-System Browser Updating-Interval Numerical-Resolution
Mac OS X Safari 1.5 1
Firefox 4.8 1
IE 1 1
OS 9 IE 2.1 1
PC WinXP 15.625 ?
Win2kPro Firefox 15.625 1
IE 10 1
Win98 IE4 54.9 10
<Test> Loop Count : { 10 } 55 10
Times in milliseconds
| <FAQ--TRY> Could Sec 3.2 become an <ol type=a> list,
| please </FAQ--TRY> I intend doing this eventually but it has to be done properly so I will
need some time to implement it.


The spacing, however, is now better than it used to be.

On the new 2005-11-05 FAQ :
S 4.30 has lost its first sentence which ISTM makes two important
introductory points.

"clj" looks ugly to me - "c.l.j." ?

Section 1 para 2 is correct on Wednesdays in News; but may be deceptive
in the joint Web version.

Section 1 Conventions used in the HTML version - I have CSS but I think
it does not have dotted/dashed lines.
2.10 - to be consistent, Subject needs a "?". The word
"Internationalisation" is American for "Foreign-isation", and should be
"Multinationalisation". Example : Inter... means dates YYYY-MM-DD;
Multi... means DD-MM-YYYY or MM/DD/YY or ... ... ... .

4.6 - I've changed StrU a bit :-

function Prfx(Q, L, c) { var s = Q+"" // ??
// if (!c) var c = ' '
if (c.length>0) while (s.length<L) { s = c+s } ;
return s }

function StrU(X, M, N) { // X>=0.0 ; gives M digits point N digits
var T, S=new String(Math.round(X*Number("1e"+N))) // *10^N
if (/\D/.test(S)) { return ''+X } // cannot cope
with (new String(Prfx(S, M+N, '0')))
return substring(0, T=(length-N)) + '.' + substring(T) }

The section needs to include something like "StrU(X, M, N) : convert
non-negative number X to a string of M digits point N digits" - maybe in
comment in the code section.
4.12 ... "By convention it assumes any number beginning with 0 is Octal,
and any number beginning with 0x Hexadecimal." But 0x begins with 0.

By convention it assumes that any number beginning with 0x is
Hexadecimal, and otherwise any number beginning with 0 is Octal.

Aside : Thus the common constant 0 is Octal.

4.13 : ...

The (string) value property of such controls can be read directly from
the element:-
var value = contrl.value;

or, to kill 2 birds with 1.25 stones :-

The value property of such controls can be read from the element :-
var StringValue = contrl.value ;
var NumberValue = +contrl.value ;

4.20 : ... CPU use up to 100% -> CPU use up to near 100% ?
I find that other things can still happen, though not on that page.
Some Typos :

S1 p4 : wednesdays. -> Wednesdays.
S2.6 : suppor -> support
S4.8 : parent -> Parent or <tt>parent</tt> or ?
S4.29 : Here's -> Here's

Style :

I'd adjust Sec 2.1, 2.2 and others so that sentences begin with a
capital letter.
2.1 : The official Usenet newsgroup dealing with javascript is
comp.lang.javascript. There ...
2.2 : Newsgroup clj ...
I've done a "diffs" on old and new, but you've (quite rightly) done so
many minor adjustments to text that it's hard to see the changes of
technical importance. There appears to be no instance of ## in the body
at present; might technical changes be marked ## (say at the start of
the paragraph) until the next release?

HTH,

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Nov 8 '05 #2

P: n/a
JRS: In article <81**************@merlyn.demon.co.uk>, dated Mon, 7 Nov
2005 23:55:43, seen in news:comp.lang.javascript, Dr John Stockton
<jr*@merlyn.demon.co.uk> posted :
| There should be a <FAQ--TRY> on sorting.

A very vague request as it is. Anyone want to suggest an entry on the
subject for the quick answers?

Not quite, but here's a starter.

The Array type (and?) has a .sort() method. The default is to use String
comparison, unsuitable for Numbers. To sort numerically, use .sort(Fn)
with function Fn(a, b) { return a-b }.

In sorting N items, the comparison function will generally be called O(N
log N) times. For large enough N, it will be faster to pre-process the
entries, in time O(N), so that the default .sort() can be used, then to
rectify the entries.


A demonstration of that sort of thing, showing improvement for N over
about 25, is at <URL:http://www.merlyn.demon.co.uk/js-order.htm#Effy>
(new page).
If Numbers in the range 10^n <= X < 10^n+1 are to be sorted numerically,
the default sort method suffices. But, according to ECMA, two Numbers
must be converted to String for each comparison. Therefore, for many
Numbers to be sorted, it should be better to convert them first to
String.
I note that, with A an Array Object,
for (J in A) { ... }
seems slower than
J = L ; while (J--) { ... }
where L=A.length.

--
John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Nov 9 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.