Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #39859 > unrolled thread
| Started by | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| First post | 2021-04-08 03:32 -0700 |
| Last post | 2021-04-10 00:01 -0700 |
| Articles | 5 on this page of 65 — 11 participants |
Back to article view | Back to comp.lang.javascript
I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-08 03:32 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-08 03:37 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-08 04:26 -0700
Re: I don't get it JJ <jj4public@gmail.com> - 2021-04-08 19:39 +0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-08 05:53 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-08 13:55 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-09 00:46 -0700
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-09 10:03 +0100
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-09 04:09 -0700
Re: I don't get it "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-04-09 11:07 -0700
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-10 03:23 +0100
Re: I don't get it "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2021-04-10 22:02 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-11 01:05 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-11 01:07 -0700
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-11 11:42 +0100
Re: I don't get it John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-09 20:01 +0100
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-09 13:31 -0700
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-10 03:37 +0100
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-09 23:53 -0700
Re: I don't get it John G Harris <niam@jghnorth.org.uk.invalid> - 2021-04-10 12:05 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-10 15:59 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-10 15:47 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-10 18:25 +0100
Re: I don't get it Jon Ribbens <jon+usenet@unequivocal.eu> - 2021-04-10 17:29 +0000
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-10 19:08 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-11 11:41 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-11 14:33 +0100
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-12 02:39 -0700
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-12 11:21 +0100
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-12 10:19 -0700
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-12 21:20 +0100
Re: I don't get it "sc...@sauyet.com" <scott@sauyet.com> - 2021-04-12 14:32 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-13 04:11 -0700
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-13 14:58 +0100
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-13 09:20 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-13 09:29 -0700
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-13 20:06 +0100
Re: I don't get it "sc...@sauyet.com" <scott@sauyet.com> - 2021-04-13 15:09 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-14 01:15 -0700
Re: I don't get it "sc...@sauyet.com" <scott@sauyet.com> - 2021-04-14 05:22 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-15 11:52 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-15 11:57 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-15 12:04 -0700
Re: I don't get it Scott Sauyet <scott.sauyet@gmail.com> - 2021-04-15 19:29 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-20 14:12 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-20 14:47 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-20 23:35 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-21 01:08 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-21 01:24 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-21 01:29 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-13 09:32 -0700
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-13 21:59 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-14 01:32 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-14 09:08 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-14 10:06 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-14 10:59 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-14 14:05 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-14 16:32 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-14 23:53 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-15 13:56 +0100
Re: I don't get it The Natural Philosopher <tnp@invalid.invalid> - 2021-04-12 11:20 +0100
Re: I don't get it Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-04-08 15:21 +0100
Re: I don't get it Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2021-04-09 16:50 +0200
Re: I don't get it Man From a city with name Viljandi <he12457@hotmail.com> - 2021-04-08 10:44 -0700
Re: I don't get it Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-04-10 00:01 -0700
Page 4 of 4 — ← Prev page 1 2 3 [4]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2021-04-12 11:20 +0100 |
| Message-ID | <s516tu$ptl$1@dont-email.me> |
| In reply to | #39900 |
On 11/04/2021 14:33, Ben Bacarisse wrote:
> The Natural Philosopher <tnp@invalid.invalid> writes:
>
>> On 10/04/2021 19:08, Ben Bacarisse wrote:
>>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>>
>>>> On 10/04/2021 15:47, Ben Bacarisse wrote:
>>>>> The Natural Philosopher <tnp@invalid.invalid> writes:
>>>>>
>>>>>> On 09/04/2021 20:01, John G Harris wrote:
>>>>>>> On Fri, 9 Apr 2021 10:03:13 +0100, The Natural Philosopher
>>>>>>> <tnp@invalid.invalid> wrote:
>>>>>>>
>>>>>>> <snip>
>>>>>>>> After spending two days some years ago I discovered that IE and Firefox
>>>>>>>> differed in their handling of comparisons of numerical and string data,
>>>>>>>> and that something like
>>>>>>>>
>>>>>>>> if('1'== 1)
>>>>>>>>
>>>>>>>> was handled differently in each browser.
>>>>>>>>
>>>>>>>> As with all loosely typed languages, bugs in your code are trumped by
>>>>>>>> bugs in the language itself.
>>>>>>>
>>>>>>> Was that before or after they claimed to conform to ECMA 262? If
>>>>>>> after, one or both browsers had a bug, not the language. If before,
>>>>>>> that's what you get with USPs.
>>>>>>
>>>>>> It was around 2007 give or take. IE6 and XP was current. I coded for
>>>>>> firefox, it broke in IE6.
>>>>>>
>>>>>> I actually checked the language spec. As far as I cam remember the
>>>>>> spec was explicit, that you converted to whatever the target of an
>>>>>> assignement was in a mixed type operation, but in a conditional there
>>>>>> was no assignment type...
>>>>>
>>>>> So you looked in the wrong place. I don't think that adds much useful
>>>>> information. ECMA 262, 3rd edition (2000) is very clear about the
>>>>> conversions required by the == operator (section 11.9.1 and 11.9.3).
>>>>> For the record, the string should be converted to a number (and the
>>>>> algorithm for doing that is given in great detail too).
>>>>>
>>>>> So it's not an issue with the specification. Testing in IE6 running on
>>>>> XP I find that the conversion is done correctly. Did Mozilla really
>>>>> have such a crude bug, and if so, did you really code for that despite
>>>>> the specification being clear?
>>>>>
>>>> All I know is that IE6 and firefox gave different results and it was
>>>> down to an implicit cast in a conditional statement. The code I have
>>>> now - dated 2008, after fixing - simply turns everything explicitly
>>>> into a Number()....so I assume that firefox was doing that implicitly
>>>> and IE6 was not.
>>>
>>> I've tested it on IE6. Unless IE6 is a Heisenberg browser, it does the
>>> conversion correctly.
>>>
>>>> You can defend the language all you like - I was past caring.
>>>
>>> I'm not defending the language.
>>>
>>>> I had a job to do and IE6 and firefox produced completely different
>>>> results on the same web page, because of casting. Forcing everything
>>>> to a number whether it needed it or not fixed the issue.
>>>
>>> Maybe is was Mozilla that got it wrong, or maybe you are
>>> mis-remembering?
>>>
>> There was no right or wrong as I recall. Two browsers interpreted the
>> spec differently because the correct interpretation was not clear.
>
> I don't think you have read the specification. I can't see any room for
> misinterpretation in this case. You made it clear that you had
> originally read the wrong part of the specification so you can hardly
> claim to be a reliable source for what the specification says.
>
>> I coded for Mozilla. It worked, Others tried IE6, it didn't work. I
>> scattered explicit Number() casts throughout my code, it worked for
>> everyone.
>
> Then you mislead people with your example, because IE6 does not get that
> conversion wrong. I can't be sure that Mozilla did not (but I would be
> very surprised) but IE6 is readily available for testing.
>
>> At some level mozilla was casting to a number,
>
> In the case you cited, that is correct (and very clearly required by the
> specification).
>
>> but IE6 wasn't.
>
> I tested it on IE6 and it correctly converted the string to a number in
> the comparison. I think you are spreading confusion.
>
>> I spent a little time trying to work out what SHOULD happen, but the
>> spec didn't cover the exact case.
>
> That is not true. I gave you the section numbers that explain the
> required conversions in an equality comparison (the case you cited).
I believe this the modified code snippet that worked - without the
Number casts it differed on the two browsers
// turn off all menus at this level or higher, but turn on one at
// this level that matches id
function showmenu(level,id)
{
var allmenus;
var exp=/PARENT/;
var i;
allmenus=document.getElementsByTagName('DIV');
for (i=0; i<allmenus.length;i++)
{
var sample=allmenus[i];
if (exp.test(sample.id)) // Its a menu div, which we want..
{
if (sample.style.zIndex >= level) // all levels at our level or above
{
// this is the bad comparison
if (Number(sample.id.slice(6))==Number(id)) // matches required expander
{
sample.style.display='block';
document.getElementById('mousetray').style.display='block'; // turn
on the mousetray
}
else sample.style.display='none';
}
}
}
}
--
"I guess a rattlesnake ain't risponsible fer bein' a rattlesnake, but ah
puts mah heel on um jess the same if'n I catches him around mah chillun".
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2021-04-08 15:21 +0100 |
| Message-ID | <878s5svouw.fsf@bsb.me.uk> |
| In reply to | #39862 |
JJ <jj4public@gmail.com> writes: > On Thu, 8 Apr 2021 04:26:12 -0700 (PDT), Jonas Thörnvall wrote: >> Do anyone understand my code? > > Frankly, I don't bother checking an incomplete and untestable code. ... full of non-local variables and poor layout. I had enough of that in the 70s with other people's FORTRAN code. -- Ben.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2021-04-09 16:50 +0200 |
| Message-ID | <12749872.uLZWGnKmhe@PointedEars.de> |
| In reply to | #39864 |
Ben Bacarisse wrote: > JJ <jj4public@gmail.com> writes: >> On Thu, 8 Apr 2021 04:26:12 -0700 (PDT), Jonas Thörnvall wrote: >>> Do anyone understand my code? >> >> Frankly, I don't bother checking an incomplete and untestable code. > > ... full of non-local variables and poor layout. I had enough of that > in the 70s with other people's FORTRAN code. s/poor layout/lack of an easily readable code style/ <https://eslint.org/> -- PointedEars FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix> <https://github.com/PointedEars> | <http://PointedEars.de/wsvn/> Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
[toc] | [prev] | [next] | [standalone]
| From | Man From a city with name Viljandi <he12457@hotmail.com> |
|---|---|
| Date | 2021-04-08 10:44 -0700 |
| Message-ID | <2fc96ed7-8f20-4b7f-a5a8-cf7b28d30bdcn@googlegroups.com> |
| In reply to | #39859 |
Do more work, then You will get it.
Kristjan Robam
jonas.t...@gmail.com kirjutas neljapäev, 8. aprill 2021 kl 13:32:12 UTC+3:
> https://jonasth.github.io/
> Please have a look, i do subtract the latency from the next upcoming event don't i???????????
>
>
> function STARTPLAY(){
> if (keepGoing) {
> stopRec=setTimeout(STARTPLAY,copyEv[playPos]);
> //While still notes
> if (playPos<copyEv.length) {
> //******THIS CODE WILL CORRECT, THE FUTURE TIMING OF NEXT EVENT
> //The realtime that passed is performance.now()-browserLoadTIME
> //The scheduled time is the note timings schedTime=copyEv[playPos]+schedTime;
> //Realtime-scheduledtime is our latency.
> //calculate latency=performance.now()-browserLoadTIME-schedTime;
> //calculate new position copyEv[playPos]=copyEv[playPos]-latency;
> ctm.font = "26px Arial";
> ctm.fillStyle="blue";
> ctm.fillRect(50,40,500,500);
> ctm.fillStyle="white";
> ctm.fillText("Sum scheduled "+schedTime, 50, 70);
> REALTIME=performance.now()-browserLoadTIME;
> ctm.fillText("Real time "+REALTIME, 50, 90);
> LATENCY=REALTIME-schedTime;
> ctm.fillText("Latency "+LATENCY, 50, 110);
> schedTime=copyEv[playPos]+schedTime;
> ctm.fillText("Orig TIME Ev "+copyEv[playPos], 50, 130);
> copyEv[playPos]=Math.max(0,copyEv[playPos]-LATENCY);
> ctm.fillText("New TIME Ev "+copyEv[playPos], 50, 150);
> reshed=copyEv[playPos]+reshed;
> ctm.fillText("Reshed time "+reshed, 50, 170);
> outportarr[outportindex].send(noteMessage[playPos]);
> oldPassedTime=schedTime;
> playPos++;
> if (echo && mode=="Play"){
> pianoKeypressOut();
> }
> } else { stop();}
> }
> }
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2021-04-10 00:01 -0700 |
| Message-ID | <7ed5caee-abbb-49d7-a5ac-f4990611c107n@googlegroups.com> |
| In reply to | #39859 |
torsdag 8 april 2021 kl. 12:32:12 UTC+2 skrev Jonas Thörnvall:
> https://jonasth.github.io/
> Please have a look, i do subtract the latency from the next upcoming event don't i???????????
>
>
> function STARTPLAY(){
> if (keepGoing) {
> stopRec=setTimeout(STARTPLAY,copyEv[playPos]);
> //While still notes
> if (playPos<copyEv.length) {
> //******THIS CODE WILL CORRECT, THE FUTURE TIMING OF NEXT EVENT
> //The realtime that passed is performance.now()-browserLoadTIME
> //The scheduled time is the note timings schedTime=copyEv[playPos]+schedTime;
> //Realtime-scheduledtime is our latency.
> //calculate latency=performance.now()-browserLoadTIME-schedTime;
> //calculate new position copyEv[playPos]=copyEv[playPos]-latency;
> ctm.font = "26px Arial";
> ctm.fillStyle="blue";
> ctm.fillRect(50,40,500,500);
> ctm.fillStyle="white";
> ctm.fillText("Sum scheduled "+schedTime, 50, 70);
> REALTIME=performance.now()-browserLoadTIME;
> ctm.fillText("Real time "+REALTIME, 50, 90);
> LATENCY=REALTIME-schedTime;
> ctm.fillText("Latency "+LATENCY, 50, 110);
> schedTime=copyEv[playPos]+schedTime;
> ctm.fillText("Orig TIME Ev "+copyEv[playPos], 50, 130);
> copyEv[playPos]=Math.max(0,copyEv[playPos]-LATENCY);
> ctm.fillText("New TIME Ev "+copyEv[playPos], 50, 150);
> reshed=copyEv[playPos]+reshed;
> ctm.fillText("Reshed time "+reshed, 50, 170);
> outportarr[outportindex].send(noteMessage[playPos]);
> oldPassedTime=schedTime;
> playPos++;
> if (echo && mode=="Play"){
> pianoKeypressOut();
> }
> } else { stop();}
> }
> }
Are the values all computed before the setTimeouts?
Is that what happens?
[toc] | [prev] | [standalone]
Page 4 of 4 — ← Prev page 1 2 3 [4]
Back to top | Article view | comp.lang.javascript
csiph-web