Re: <FAQENTRY> 3.2 update needed
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: <FAQENTRY> 3.2 update needed

From: Dr John Stockton <jrs@merlyn.demon.co.uk>
Date: Thu Nov 03 2005 - 14:35:13 CET

JRS: In article <HLT9f.1255$uQ6.61731@news.optus.net.au>, dated Wed, 2
Nov 2005 00:29:27, seen in news:comp.lang.javascript, RobG
<rgqld@iinet.net.au> posted :
>
>Has anyone looked at wikipedia lately? It's free, supports mulitple
>languages and already has a lot of JavaScript stuff - maybe a bit of
>effort from those here will keep it up-to-date?
>
>It may be a useful adjunct to the jibbering.com site, though not really
>a replacement.

Here's an example of why, to be reliable, a FAQ needs a well-chosen
Editor combined with review by others : the site containing http://www
.criosoftware.it/default42.aspx seems frequently cited in
news:it.comp.lang.javascript (though AFAICS only by one person), and
that page contains
    function __pt_str_codXcifre(nchar,car) {
     var str="";
     for(var x=0;x<eval(parseInt(nchar)-this.length);x++) str+=car;
     return str+this;
    }
In use, 'this' is String. Note eval and parseInt(x), in a for loop
which should be a while loop. While not involving the content of str in
every concatenation is good, ISTM that the benefit may be outweighed by
the cost of the extra concatenation to add str.

That's the sort of code that might well be put in a wiki-faq, perhaps
even as a replacement for something better. One cannot safely cite a
wiki if one wishes to cite a particular solution.

The page also contains "Inserita il 02/11/2005" which should mean
yesterday but may mean February.

                        <FAQENTRY> 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?

Note that we normally adjust length by incrementing, which in javascript
requires a new string every time.

For generating long strings, the following recursive routine takes many
fewer operations; there must be a way to code it iteratively for
efficiency. Lightly-tested; but derived from something reliable for
generating positive integer powers in a language without a Math.pow
equivalent. Using L<0 is not recommended.

function BigCat(L) { var T
  if (L==0) return ""
  if (L&&1) return BigCat(L-1) + " "
  T = BigCat(L/2) ; return T + T }
 

-- 
 © 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.
Received on Mon Nov 21 03:17:47 2005