FAQ Item?

  • Thread starter Dr J R Stockton
  • Start date
D

Dr J R Stockton

In comp.lang.javascript message <IbGdnQFeb5YX2xHWnZ2dnUVZ8gudnZ2d@gigane
That site is more WTF-worthy than FAQ-worthy. I'm not talking about its
contents, but its implementation.

It was suggested for its contents, and not for its implementation.
It was decided that the five most
frequently used browsers should be presented in a random order; to
accomplish this, they sort an array using the following comparator function:

var aBrowserOrderTop5 = new Array(0,1,2,3,4);

aBrowserOrderTop5.sort(RandomSort);

function RandomSort (a,b)
{
return (0.5 - Math.random());
}

Notice anything? Try loading it a few times in IE and Firefox, and see
if you notice any interesting patterns =)

That's irrelevant. The split into five major browsers (all of which I
have) and seven minor ones (five or six of which I have no recollection
of hearing anything about) is significant, but there is no need for true
randomness, as long as it can be purported.

Nevertheless, it seems clear that the author of the code had not studied
our newsgroup FAQ and used its links.

The sensible way to make the page seems to be to _deal_ (see FAQ) arrays
of 0-4 & 0-6, and to use DOM methods to insert the advert structures, in
the order given by those, into either table TDs or as float:left.

W3C's validator says 53 errors, though 49 of those are the same. The
CSS seems better.


What do readers think of the seven minor browsers given?
 
D

Dr J R Stockton

In comp.lang.javascript message <XIKdnaez58_jHhDWnZ2dnUVZ8lGdnZ2d@gigane
I know that. The fact that the EU has instructed Microsoft to offer a
browser choice screen is old news, but the site itself is relatively
new, and its botched implementation is relevant to a JS newsgroup.

Not really. Microsoft seems to have fairly consistent standards of
coding. Remember that they have had ISO Week Numbering in VBScript
DatePart with errors in IE4 (as delivered with new Win98) to current IE8
at WinXP sp3 and Windows 7 - in spite of having a (badly-coded) fix in
their Web site since mid-2004 or earlier.

I wasn't even talking about true randomness, I was pointing out an
interesting algorithmic fuckup. They can "purport" whatever they want -
IE ending up in the last position 50% of the time isn't even close to
random.

It does not do so in my tests, in IE & FF. I see no obvious visible
bias, but prejudice can be detected when the routine above is tested
thousands of times in IE8. The same bias is not present with that
routine in two other browsers.


But you should remember that those whose judgement matters to the
proprietors of the code will be persons devoid of mathematical
knowledge.



While the professionals may know all about all the browsers that there
are, the sort of people for whom a FAQ should be intended will not. And
they will not know about commonality of rendering engines.



ASIDE : there's an amusing little peak in access to my
critdate.htm, starting on the day after 2010 February 28th.
 
S

Scott Sauyet

Dr said:
It does not do so in my tests, in IE & FF.  I see no obvious visible
bias, but prejudice can be detected when the routine above is tested
thousands of times in IE8.

They've changed the algorithm. It's now correctly using the Fisher-
Yates Shuffle.

-- Scott
 
D

Dr J R Stockton

In comp.lang.javascript message <5ea591dd-6cec-44cb-a0aa-ed62119c3c1b@v2
0g2000yqv.googlegroups.com>, Wed, 3 Mar 2010 14:42:53, Scott Sauyet
They've changed the algorithm. It's now correctly using the Fisher-
Yates Shuffle.

That one is in the source linked to from the FAQ.

But they do not need to shuffle an array preloaded with numbers; they
can with slightly simpler code generate the numbers while positioning
them - I call that Dealing.

But the script starts with making a 12-element array :
var dataBrowsers= new Array(new BrowserData ... // .
If they made arrays of 5 & 7 elements, they could be shuffled in place,
since exchanging object elements should be effectively swapping pointers
without moving the bulky data 'in' those objects. Then concat.


That Web page,
<http://www.browserchoice.eu/BrowserChoice/browserchoice_en.htm>,
is one of the few cases where coding for IE-only might reasonably be
considered reasonable.

I winder why they have var ..., ArrayShuffle, ... at the start of
their page.js ?

Their code seems to have the idea that there are exactly 5 major
browsers, but that the number of minor ones is likely to vary - probably
sound enough in practice.



Query : all 12 browsers appear to be GUI. Given the state of EU and US
disability discrimination legislation, is it right for such a page and
its "further information" to have no apparent mention of Lynx and of
speech browsing?
 

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,777
Messages
2,569,604
Members
45,218
Latest member
JolieDenha

Latest Threads

Top