Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #35624 > unrolled thread
| Started by | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| First post | 2018-09-22 02:16 -0700 |
| Last post | 2018-09-22 04:00 -0700 |
| Articles | 20 on this page of 25 — 4 participants |
Back to article view | Back to comp.lang.javascript
Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 02:16 -0700
Re: Splice array of arrays with objects. Julio Di Egidio <julio@diegidio.name> - 2018-09-22 02:45 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 03:07 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 03:09 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 03:15 -0700
Re: Splice array of arrays with objects. JJ <jj4public@vfemail.net> - 2018-09-23 05:44 +0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 15:51 -0700
Re: Splice array of arrays with objects. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-09-23 09:28 +0200
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-23 02:01 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-23 02:03 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 03:24 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 03:28 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 03:43 -0700
Re: Splice array of arrays with objects. Julio Di Egidio <julio@diegidio.name> - 2018-09-22 03:40 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 03:47 -0700
Re: Splice array of arrays with objects. Julio Di Egidio <julio@diegidio.name> - 2018-09-22 04:00 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 04:02 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 04:03 -0700
Re: Splice array of arrays with objects. Julio Di Egidio <julio@diegidio.name> - 2018-09-22 04:09 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 04:21 -0700
Re: Splice array of arrays with objects. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2018-09-22 16:17 +0200
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 09:30 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 04:45 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 04:16 -0700
Re: Splice array of arrays with objects. Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-09-22 04:00 -0700
Page 1 of 2 [1] 2 Next page →
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-22 02:16 -0700 |
| Subject | Splice array of arrays with objects. |
| Message-ID | <c3fce846-0dec-495b-992b-6a75a1bb974c@googlegroups.com> |
I have a track array and try to do an elementary eventeditor, and i managed to remove elements using track[recTrack].midiMess.splice(trackEvent,1); But when i try to insert a new element "objects" into array i fail. Is there something i miss, because it tells me undefined? track[recTrack].midiMess.data0.splice(trackEvent,0,"144"); //Well how? track[recTrack].midiMess.data1.splice(trackEvent,0,insnote); track[recTrack].midiMess.data2.splice(trackEvent,0,insvel);
[toc] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2018-09-22 02:45 -0700 |
| Message-ID | <a08d4842-238e-4652-b37e-c88ccdd556c0@googlegroups.com> |
| In reply to | #35624 |
On Saturday, 22 September 2018 11:17:06 UTC+2, Jonas Thörnvall wrote: > track[recTrack].midiMess.splice(trackEvent,1); > track[recTrack].midiMess.data0.splice(trackEvent,0,"144"); //Well how? > Is there something i miss, because it tells me undefined? What tells you undefined?? You should get a JS error saying reference undefined or null or something, and where. Note that your sloppiness is our extra effort... That said, I just note that above you are splicing midiMess, below you are splicing midiMess.dataN. Does that make sense? Julio
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-22 03:07 -0700 |
| Message-ID | <c4a7b9f8-0c35-44cf-b600-b92a78fca3e9@googlegroups.com> |
| In reply to | #35625 |
Den lördag 22 september 2018 kl. 11:45:11 UTC+2 skrev Julio Di Egidio:
> On Saturday, 22 September 2018 11:17:06 UTC+2, Jonas Thörnvall wrote:
>
> > track[recTrack].midiMess.splice(trackEvent,1);
> > track[recTrack].midiMess.data0.splice(trackEvent,0,"144"); //Well how?
>
> > Is there something i miss, because it tells me undefined?
>
> What tells you undefined?? You should get a JS error saying reference undefined or null or something, and where. Note that your sloppiness is
> our extra effort...
>
> That said, I just note that above you are splicing midiMess, below you are
> splicing midiMess.dataN. Does that make sense?
>
> Julio
I think so? This is my track object.
function newTrack(m) {
track[m] ={
outport:[],
portname : [],
midichannel:[],
program:[],
midiMess:[],
//CONFIGURATION OF midiMess:[{time:0,data0:0,data1:0,data2:0}]
};
return track;
}
Here is how i update the track.
track[tracknr].midiMess.push({time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]});
}
I mean it make sense to remove the full object "Event element" midiMess.
But thought i could splice objects of midiMess one at a time, but maybe i must update them all like when doing push new object?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-22 03:09 -0700 |
| Message-ID | <12005e89-e46e-42b7-a15a-ee21279e4ed2@googlegroups.com> |
| In reply to | #35626 |
Den lördag 22 september 2018 kl. 12:07:09 UTC+2 skrev Jonas Thörnvall:
> Den lördag 22 september 2018 kl. 11:45:11 UTC+2 skrev Julio Di Egidio:
> > On Saturday, 22 September 2018 11:17:06 UTC+2, Jonas Thörnvall wrote:
> >
> > > track[recTrack].midiMess.splice(trackEvent,1);
> > > track[recTrack].midiMess.data0.splice(trackEvent,0,"144"); //Well how?
> >
> > > Is there something i miss, because it tells me undefined?
> >
> > What tells you undefined?? You should get a JS error saying reference undefined or null or something, and where. Note that your sloppiness is
> > our extra effort...
> >
> > That said, I just note that above you are splicing midiMess, below you are
> > splicing midiMess.dataN. Does that make sense?
> >
> > Julio
>
> I think so? This is my track object.
>
> function newTrack(m) {
> track[m] ={
> outport:[],
> portname : [],
> midichannel:[],
> program:[],
> midiMess:[],
> //CONFIGURATION OF midiMess:[{time:0,data0:0,data1:0,data2:0}]
> };
> return track;
> }
>
> Here is how i update the track.
> track[tracknr].midiMess.push({time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]});
> }
>
> I mean it make sense to remove the full object "Event element" midiMess.
> But thought i could splice objects of midiMess one at a time, but maybe i must update them all like when doing push new object?
track[tracknr].midiMess.splice({time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]});
?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-22 03:15 -0700 |
| Message-ID | <f4465779-f23d-4505-abaa-d521a367aa82@googlegroups.com> |
| In reply to | #35627 |
Den lördag 22 september 2018 kl. 12:09:57 UTC+2 skrev Jonas Thörnvall:
> Den lördag 22 september 2018 kl. 12:07:09 UTC+2 skrev Jonas Thörnvall:
> > Den lördag 22 september 2018 kl. 11:45:11 UTC+2 skrev Julio Di Egidio:
> > > On Saturday, 22 September 2018 11:17:06 UTC+2, Jonas Thörnvall wrote:
> > >
> > > > track[recTrack].midiMess.splice(trackEvent,1);
> > > > track[recTrack].midiMess.data0.splice(trackEvent,0,"144"); //Well how?
> > >
> > > > Is there something i miss, because it tells me undefined?
> > >
> > > What tells you undefined?? You should get a JS error saying reference undefined or null or something, and where. Note that your sloppiness is
> > > our extra effort...
> > >
> > > That said, I just note that above you are splicing midiMess, below you are
> > > splicing midiMess.dataN. Does that make sense?
> > >
> > > Julio
> >
> > I think so? This is my track object.
> >
> > function newTrack(m) {
> > track[m] ={
> > outport:[],
> > portname : [],
> > midichannel:[],
> > program:[],
> > midiMess:[],
> > //CONFIGURATION OF midiMess:[{time:0,data0:0,data1:0,data2:0}]
> > };
> > return track;
> > }
> >
> > Here is how i update the track.
> > track[tracknr].midiMess.push({time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]});
> > }
> >
> > I mean it make sense to remove the full object "Event element" midiMess.
> > But thought i could splice objects of midiMess one at a time, but maybe i must update them all like when doing push new object?
>
> track[tracknr].midiMess.splice({time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]});
>
> ?
Uncaught TypeError: Cannot read property 'splice' of undefined
at noteInsert (listtrack.js:12)
at HTMLButtonElement.onclick (midi.html:133)
[toc] | [prev] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2018-09-23 05:44 +0700 |
| Message-ID | <1r7wmrgj91rxt.1984rnv8kl648.dlg@40tude.net> |
| In reply to | #35628 |
On Sat, 22 Sep 2018 03:15:18 -0700 (PDT), Jonas Thörnvall wrote:
>>
>> track[tracknr].midiMess.splice({time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]});
>>
>> ?
> Uncaught TypeError: Cannot read property 'splice' of undefined
> at noteInsert (listtrack.js:12)
> at HTMLButtonElement.onclick (midi.html:133)
That's not `splice()` which returns `undefined`. It's the `midiMess` which
is not defined in `track[tracknr]`. Chances are that the `midiMess` property
got reassigned with other value.
Try adding a setter function to that property, and make the setter function
raise an exception or issue the `debugger` statement, so that whichever code
modifies it (the property, not the array contents), will be known.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-22 15:51 -0700 |
| Message-ID | <73e08c60-a358-42d2-bf8c-1c8d47fa27a1@googlegroups.com> |
| In reply to | #35650 |
Den söndag 23 september 2018 kl. 00:44:36 UTC+2 skrev JJ:
> On Sat, 22 Sep 2018 03:15:18 -0700 (PDT), Jonas Thörnvall wrote:
> >>
> >> track[tracknr].midiMess.splice({time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]});
> >>
> >> ?
> > Uncaught TypeError: Cannot read property 'splice' of undefined
> > at noteInsert (listtrack.js:12)
> > at HTMLButtonElement.onclick (midi.html:133)
>
> That's not `splice()` which returns `undefined`. It's the `midiMess` which
> is not defined in `track[tracknr]`. Chances are that the `midiMess` property
> got reassigned with other value.
>
> Try adding a setter function to that property, and make the setter function
> raise an exception or issue the `debugger` statement, so that whichever code
> modifies it (the property, not the array contents), will be known.
Well no problem i solved howto update the full object, it would be interesting to know howto just update a property of object to do insert, but Julio said it has to be done manual "insertion".
Here is how i updated the object.
track[tracknr].midiMess.splice(trackEvent,0,{time:instime,data0:144,data1:insnote,data2:insvel});
I had prefered another syntax.... because trackEvent is the index of midiMess not of the object....
track[tracknr].midiMess[trackEvent].splice(0,{time:instime,data0:144,data1:insnote,data2:insvel});
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2018-09-23 09:28 +0200 |
| Message-ID | <c4b89388-1192-98aa-bff1-aa5e1708b4e2@PointedEars.de> |
| In reply to | #35650 |
JJ wrote:
> On Sat, 22 Sep 2018 03:15:18 -0700 (PDT), Jonas Thörnvall wrote:
>>> track[tracknr].midiMess.splice({time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]});
>>>
>>> ?
>> Uncaught TypeError: Cannot read property 'splice' of undefined
>> at noteInsert (listtrack.js:12)
>> at HTMLButtonElement.onclick (midi.html:133)
>
> That's not `splice()` which returns `undefined`. It's the `midiMess` which
> is not defined in `track[tracknr]`. Chances are that the `midiMess` property
> got reassigned with other value.
>
> Try adding a setter function to that property, and make the setter function
> raise an exception or issue the `debugger` statement, so that whichever code
> modifies it (the property, not the array contents), will be known.
True. But if “splice” refers to the standard (ECMAScript) method,
“Array.prototype.splice”, then it simply does not work this way: the first
argument has to be the zero-based *index* where to start modifying an
*Array-like* object; i.e., a *Number* value that is *an integer* (and NOT an
Object value where the object obviously has no suitable valueOf() method):
<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice>
JavaScript 101.
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, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-23 02:01 -0700 |
| Message-ID | <a7490caa-6cba-4af4-8cf8-f86be77e08c4@googlegroups.com> |
| In reply to | #35654 |
Den söndag 23 september 2018 kl. 09:28:32 UTC+2 skrev Thomas 'PointedEars' Lahn:
> JJ wrote:
> > On Sat, 22 Sep 2018 03:15:18 -0700 (PDT), Jonas Thörnvall wrote:
> >>> track[tracknr].midiMess.splice({time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]});
> >>>
> >>> ?
> >> Uncaught TypeError: Cannot read property 'splice' of undefined
> >> at noteInsert (listtrack.js:12)
> >> at HTMLButtonElement.onclick (midi.html:133)
> >
> > That's not `splice()` which returns `undefined`. It's the `midiMess` which
> > is not defined in `track[tracknr]`. Chances are that the `midiMess` property
> > got reassigned with other value.
> >
> > Try adding a setter function to that property, and make the setter function
> > raise an exception or issue the `debugger` statement, so that whichever code
> > modifies it (the property, not the array contents), will be known.
>
> True. But if “splice” refers to the standard (ECMAScript) method,
> “Array.prototype.splice”, then it simply does not work this way: the first
> argument has to be the zero-based *index* where to start modifying an
> *Array-like* object; i.e., a *Number* value that is *an integer* (and NOT an
> Object value where the object obviously has no suitable valueOf() method):
>
> <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice>
>
> JavaScript 101.
>
>
> 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, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
I've already told you i've solved it you lowIQ idiot.
track[tracknr].midiMess[trackEvent].splice(0,{time:instime,data0:144,data1:insnote,data2:insvel});
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-23 02:03 -0700 |
| Message-ID | <e31ed834-df9b-424f-a2bf-3a115fa7114d@googlegroups.com> |
| In reply to | #35655 |
Den söndag 23 september 2018 kl. 11:01:11 UTC+2 skrev Jonas Thörnvall:
> Den söndag 23 september 2018 kl. 09:28:32 UTC+2 skrev Thomas 'PointedEars' Lahn:
> > JJ wrote:
> > > On Sat, 22 Sep 2018 03:15:18 -0700 (PDT), Jonas Thörnvall wrote:
> > >>> track[tracknr].midiMess.splice({time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]});
> > >>>
> > >>> ?
> > >> Uncaught TypeError: Cannot read property 'splice' of undefined
> > >> at noteInsert (listtrack.js:12)
> > >> at HTMLButtonElement.onclick (midi.html:133)
> > >
> > > That's not `splice()` which returns `undefined`. It's the `midiMess` which
> > > is not defined in `track[tracknr]`. Chances are that the `midiMess` property
> > > got reassigned with other value.
> > >
> > > Try adding a setter function to that property, and make the setter function
> > > raise an exception or issue the `debugger` statement, so that whichever code
> > > modifies it (the property, not the array contents), will be known.
> >
> > True. But if “splice” refers to the standard (ECMAScript) method,
> > “Array.prototype.splice”, then it simply does not work this way: the first
> > argument has to be the zero-based *index* where to start modifying an
> > *Array-like* object; i.e., a *Number* value that is *an integer* (and NOT an
> > Object value where the object obviously has no suitable valueOf() method):
> >
> > <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice>
> >
> > JavaScript 101.
> >
> >
> > 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, cljs, <f806at$ail$1$8300dec7@news.demon.co.uk>
>
> I've already told you i've solved it you lowIQ idiot.
> track[tracknr].midiMess[trackEvent].splice(0,{time:instime,data0:144,data1:insnote,data2:insvel});
But i also told you that the whole syntax is fucked up.
because the index is a property of the array, not of the object you fucking moron.
track[tracknr].midiMess[trackEvent].splice(0,{time:instime,data0:144,data1:insnote,data2:insvel});
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-22 03:24 -0700 |
| Message-ID | <c4821c6a-498c-449f-8067-f91d9cf234f9@googlegroups.com> |
| In reply to | #35626 |
Den lördag 22 september 2018 kl. 12:07:09 UTC+2 skrev Jonas Thörnvall:
> Den lördag 22 september 2018 kl. 11:45:11 UTC+2 skrev Julio Di Egidio:
> > On Saturday, 22 September 2018 11:17:06 UTC+2, Jonas Thörnvall wrote:
> >
> > > track[recTrack].midiMess.splice(trackEvent,1);
> > > track[recTrack].midiMess.data0.splice(trackEvent,0,"144"); //Well how?
> >
> > > Is there something i miss, because it tells me undefined?
> >
> > What tells you undefined?? You should get a JS error saying reference undefined or null or something, and where. Note that your sloppiness is
> > our extra effort...
> >
> > That said, I just note that above you are splicing midiMess, below you are
> > splicing midiMess.dataN. Does that make sense?
> >
> > Julio
>
> I think so? This is my track object.
>
> function newTrack(m) {
> track[m] ={
> outport:[],
> portname : [],
> midichannel:[],
> program:[],
> midiMess:[],
> //CONFIGURATION OF midiMess:[{time:0,data0:0,data1:0,data2:0}]
> };
> return track;
> }
>
> Here is how i update the track.
> track[tracknr].midiMess.push({time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]});
> }
>
> I mean it make sense to remove the full object "Event element" midiMess.
> But thought i could splice objects of midiMess one at a time, but maybe i must update them all like when doing push new object?
Well this is what i mean it is all so fucking confusing?
Why isn't the syntax straightforward?
In a sain uninverse the syntax would be.
track[recTrack].midiMess[trackEvent].data0.splice(0,144);
Shouldn't it??????
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-22 03:28 -0700 |
| Message-ID | <b7ec5e62-284b-4286-99d4-0405b99a156d@googlegroups.com> |
| In reply to | #35629 |
Den lördag 22 september 2018 kl. 12:24:46 UTC+2 skrev Jonas Thörnvall:
> Den lördag 22 september 2018 kl. 12:07:09 UTC+2 skrev Jonas Thörnvall:
> > Den lördag 22 september 2018 kl. 11:45:11 UTC+2 skrev Julio Di Egidio:
> > > On Saturday, 22 September 2018 11:17:06 UTC+2, Jonas Thörnvall wrote:
> > >
> > > > track[recTrack].midiMess.splice(trackEvent,1);
> > > > track[recTrack].midiMess.data0.splice(trackEvent,0,"144"); //Well how?
> > >
> > > > Is there something i miss, because it tells me undefined?
> > >
> > > What tells you undefined?? You should get a JS error saying reference undefined or null or something, and where. Note that your sloppiness is
> > > our extra effort...
> > >
> > > That said, I just note that above you are splicing midiMess, below you are
> > > splicing midiMess.dataN. Does that make sense?
> > >
> > > Julio
> >
> > I think so? This is my track object.
> >
> > function newTrack(m) {
> > track[m] ={
> > outport:[],
> > portname : [],
> > midichannel:[],
> > program:[],
> > midiMess:[],
> > //CONFIGURATION OF midiMess:[{time:0,data0:0,data1:0,data2:0}]
> > };
> > return track;
> > }
> >
> > Here is how i update the track.
> > track[tracknr].midiMess.push({time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]});
> > }
> >
> > I mean it make sense to remove the full object "Event element" midiMess.
> > But thought i could splice objects of midiMess one at a time, but maybe i must update them all like when doing push new object?
>
> Well this is what i mean it is all so fucking confusing?
> Why isn't the syntax straightforward?
> In a sain uninverse the syntax would be.
> track[recTrack].midiMess[trackEvent].data0.splice(0,144);
>
> Shouldn't it??????
So what is the syntax?
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-22 03:43 -0700 |
| Message-ID | <47de5a0b-d715-43e0-a5ee-15a3b9dd3968@googlegroups.com> |
| In reply to | #35630 |
Den lördag 22 september 2018 kl. 12:28:46 UTC+2 skrev Jonas Thörnvall:
> Den lördag 22 september 2018 kl. 12:24:46 UTC+2 skrev Jonas Thörnvall:
> > Den lördag 22 september 2018 kl. 12:07:09 UTC+2 skrev Jonas Thörnvall:
> > > Den lördag 22 september 2018 kl. 11:45:11 UTC+2 skrev Julio Di Egidio:
> > > > On Saturday, 22 September 2018 11:17:06 UTC+2, Jonas Thörnvall wrote:
> > > >
> > > > > track[recTrack].midiMess.splice(trackEvent,1);
> > > > > track[recTrack].midiMess.data0.splice(trackEvent,0,"144"); //Well how?
> > > >
> > > > > Is there something i miss, because it tells me undefined?
> > > >
> > > > What tells you undefined?? You should get a JS error saying reference undefined or null or something, and where. Note that your sloppiness is
> > > > our extra effort...
> > > >
> > > > That said, I just note that above you are splicing midiMess, below you are
> > > > splicing midiMess.dataN. Does that make sense?
> > > >
> > > > Julio
> > >
> > > I think so? This is my track object.
> > >
> > > function newTrack(m) {
> > > track[m] ={
> > > outport:[],
> > > portname : [],
> > > midichannel:[],
> > > program:[],
> > > midiMess:[],
> > > //CONFIGURATION OF midiMess:[{time:0,data0:0,data1:0,data2:0}]
> > > };
> > > return track;
> > > }
> > >
> > > Here is how i update the track.
> > > track[tracknr].midiMess.push({time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]});
> > > }
> > >
> > > I mean it make sense to remove the full object "Event element" midiMess.
> > > But thought i could splice objects of midiMess one at a time, but maybe i must update them all like when doing push new object?
> >
> > Well this is what i mean it is all so fucking confusing?
> > Why isn't the syntax straightforward?
> > In a sain uninverse the syntax would be.
> > track[recTrack].midiMess[trackEvent].data0.splice(0,144);
> >
> > Shouldn't it??????
>
> So what is the syntax?
It all become guess work to me, i can guess?
track[tracknr].midiMess.push(trackEvent,0,{time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]})
;
Well i will try.
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2018-09-22 03:40 -0700 |
| Message-ID | <c51e6a76-abdf-445c-932e-f0a67645731f@googlegroups.com> |
| In reply to | #35629 |
On Saturday, 22 September 2018 12:24:46 UTC+2, Jonas Thörnvall wrote: > Den lördag 22 september 2018 kl. 12:07:09 UTC+2 skrev Jonas Thörnvall: > > I mean it make sense to remove the full object "Event element" midiMess. > > But thought i could splice objects of midiMess one at a time, but maybe I > > must update them all like when doing push new object? Splice is defined for arrays, not for objects. To "update" objects, you just assign values to their properties, e.g.: rack[recTrack].midiMess[trackEvent].data0 = "144"; (or, 144: you keep mixing them by they are not the same...) > Well this is what i mean it is all so fucking confusing? No programmer has ever said programming is easy: in fact, by simple trial and error, it's rather guaranteed you'll be forever a crank... HTH, Julio
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-22 03:47 -0700 |
| Message-ID | <863751c3-7fc5-4d81-80c0-00964712c4d2@googlegroups.com> |
| In reply to | #35631 |
Den lördag 22 september 2018 kl. 12:40:47 UTC+2 skrev Julio Di Egidio:
> On Saturday, 22 September 2018 12:24:46 UTC+2, Jonas Thörnvall wrote:
> > Den lördag 22 september 2018 kl. 12:07:09 UTC+2 skrev Jonas Thörnvall:
>
> > > I mean it make sense to remove the full object "Event element" midiMess.
> > > But thought i could splice objects of midiMess one at a time, but maybe I
> > > must update them all like when doing push new object?
>
> Splice is defined for arrays, not for objects. To "update" objects, you just
> assign values to their properties, e.g.:
>
> rack[recTrack].midiMess[trackEvent].data0 = "144";
>
> (or, 144: you keep mixing them by they are not the same...)
>
> > Well this is what i mean it is all so fucking confusing?
>
> No programmer has ever said programming is easy: in fact, by simple trial
> and error, it's rather guaranteed you'll be forever a crank...
>
> HTH,
>
> Julio
Well that is not an insert Julio....
So you say one can't do it, using splice?
Not even something like
track[tracknr].midiMess.splice(trackEvent,0,{time:clock,data0:message.data[0],data1:message.data[1],data2:message.data[2]})
Or?
;
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2018-09-22 04:00 -0700 |
| Message-ID | <1be45c58-3f6f-45a7-9868-43900fc0e5ce@googlegroups.com> |
| In reply to | #35633 |
On Saturday, 22 September 2018 12:47:10 UTC+2, Jonas Thörnvall wrote:
> Well that is not an insert Julio....
Well, sorry for not guessing what you meant, idiot.
> track[tracknr].midiMess.splice(trackEvent, 0, { time: clock, data0:
> message.data[0], data1 :message.data[1], data2: message.data[2] })
(Use spacing appropriately, all the more so when you are a fucking rookie.)
And now what's wrong with that, you bloody spammer?? A rethorical question,
this is simply the last time I waste my time on you, promised...
*Plonk*
Julio
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-22 04:02 -0700 |
| Message-ID | <afa1172c-1b22-4636-aaae-23262e6a9a4c@googlegroups.com> |
| In reply to | #35635 |
Den lördag 22 september 2018 kl. 13:00:40 UTC+2 skrev Julio Di Egidio:
> On Saturday, 22 September 2018 12:47:10 UTC+2, Jonas Thörnvall wrote:
>
> > Well that is not an insert Julio....
>
> Well, sorry for not guessing what you meant, idiot.
>
> > track[tracknr].midiMess.splice(trackEvent, 0, { time: clock, data0:
> > message.data[0], data1 :message.data[1], data2: message.data[2] })
>
> (Use spacing appropriately, all the more so when you are a fucking rookie.)
>
> And now what's wrong with that, you bloody spammer?? A rethorical question,
> this is simply the last time I waste my time on you, promised...
>
> *Plonk*
>
> Julio
"But when i try to insert a new element "objects" into array i fail.
Is there something i miss, because it tells me undefined? "
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-22 04:03 -0700 |
| Message-ID | <a94de36a-1991-464b-9f9a-d45dd3fc1b87@googlegroups.com> |
| In reply to | #35635 |
Den lördag 22 september 2018 kl. 13:00:40 UTC+2 skrev Julio Di Egidio:
> On Saturday, 22 September 2018 12:47:10 UTC+2, Jonas Thörnvall wrote:
>
> > Well that is not an insert Julio....
>
> Well, sorry for not guessing what you meant, idiot.
>
> > track[tracknr].midiMess.splice(trackEvent, 0, { time: clock, data0:
> > message.data[0], data1 :message.data[1], data2: message.data[2] })
>
> (Use spacing appropriately, all the more so when you are a fucking rookie.)
>
> And now what's wrong with that, you bloody spammer?? A rethorical question,
> this is simply the last time I waste my time on you, promised...
>
> *Plonk*
>
> Julio
I am far to stupid to get offended, by foul words Julio LoL, nah i just keep going...
You know the little train that could LoL
[toc] | [prev] | [next] | [standalone]
| From | Julio Di Egidio <julio@diegidio.name> |
|---|---|
| Date | 2018-09-22 04:09 -0700 |
| Message-ID | <00846e2f-ba5b-4d29-9499-950be6bb7e5a@googlegroups.com> |
| In reply to | #35637 |
On Saturday, 22 September 2018 13:03:46 UTC+2, Jonas Thörnvall wrote: > I am far to stupid to get offended, by foul words Julio Idiot, rookie and spammer are not foul words, Jonas. But I do wish I knew better English: I am going to learn some legalese... *Plonk* Julio
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2018-09-22 04:21 -0700 |
| Message-ID | <4758e6c3-14d2-473b-91e9-c4f2b8573c93@googlegroups.com> |
| In reply to | #35638 |
Den lördag 22 september 2018 kl. 13:10:02 UTC+2 skrev Julio Di Egidio: > On Saturday, 22 September 2018 13:03:46 UTC+2, Jonas Thörnvall wrote: > > > I am far to stupid to get offended, by foul words Julio > > Idiot, rookie and spammer are not foul words, Jonas. > > But I do wish I knew better English: I am going to learn some legalese... > > *Plonk* > > Julio Well natural language open to interpretation Julio but i had 178 in the last IQ test i did, so in the medical psychiatric term, i am far from it. But then again medical terminology about just as useful as Javascript syntax in real life. https://en.wikipedia.org/wiki/Idiot
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.javascript
csiph-web