Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #37826 > unrolled thread
| Started by | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| First post | 2019-11-22 02:10 -0800 |
| Last post | 2019-11-23 18:56 -0800 |
| Articles | 20 on this page of 30 — 6 participants |
Back to article view | Back to comp.lang.javascript
Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-22 02:10 -0800
Re: Parse out after newline and paragraph? JJ <jj4public@vfemail.net> - 2019-11-22 18:36 +0700
Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-22 03:58 -0800
Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-22 04:09 -0800
Re: Parse out after newline and paragraph? JJ <jj4public@vfemail.net> - 2019-11-23 08:38 +0700
Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-22 23:31 -0800
Re: Parse out after newline and paragraph? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-22 18:25 +0000
Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-22 11:09 -0800
Re: Parse out after newline and paragraph? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-23 10:51 +0000
Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-23 05:04 -0800
Re: Parse out after newline and paragraph? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-23 18:37 +0000
Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-24 09:58 -0800
Re: Parse out after newline and paragraph? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-24 18:51 +0000
Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-24 10:01 -0800
Re: Parse out after newline and paragraph? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-24 19:28 +0000
Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-25 01:19 -0800
Re: Parse out after newline and paragraph? John G Harris <niam@jghnorth.org.uk.invalid> - 2019-11-25 18:28 +0000
Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-26 04:24 -0800
Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-27 05:41 -0800
Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-30 08:47 -0800
Re: Parse out after newline and paragraph? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-11-30 10:38 -0800
Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-30 11:21 -0800
Re: Parse out after newline and paragraph? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2019-11-22 10:43 -0800
Re: Parse out after newline and paragraph? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2019-11-22 11:11 -0800
Re: Parse out after newline and paragraph? luserdroog <luser.droog@gmail.com> - 2019-11-23 12:09 -0800
Re: Parse out after newline and paragraph? Julio Di Egidio <julio@diegidio.name> - 2019-11-23 18:21 -0800
Re: Parse out after newline and paragraph? Julio Di Egidio <julio@diegidio.name> - 2019-11-23 19:08 -0800
Re: Parse out after newline and paragraph? luserdroog <luser.droog@gmail.com> - 2019-11-23 19:52 -0800
Re: Parse out after newline and paragraph? Julio Di Egidio <julio@diegidio.name> - 2019-11-23 21:54 -0800
Re: Parse out after newline and paragraph? luserdroog <luser.droog@gmail.com> - 2019-11-23 18:56 -0800
Page 1 of 2 [1] 2 Next page →
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-11-22 02:10 -0800 |
| Subject | Parse out after newline and paragraph? |
| Message-ID | <d088ea44-e208-40fd-9a85-f2178820eb01@googlegroups.com> |
": [
{
"duration": 0.0881409374999933,
"durationTicks": 22,
"midi": 72,
"name": "C5",
"ticks": 13056,
"time": 52.30764,
"velocity": 0.952755905511811
I try to parseout the time from string above, but i do not manage get rid of the comma after time event.
It is probably because i do not know how to adjust relative the paragraph?
impTimeStart=impNote[IN].indexOf('"time": ');
impTimeEnd=impNote[IN].indexOf(',\n"velocity":');
impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd);
I do not do much parsing so a full example, would be nice. Maybe i just do it a silly way to start with.
Jonas T
[toc] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2019-11-22 18:36 +0700 |
| Message-ID | <1kby42xl1ihl.1e9zoms9j2hcv$.dlg@40tude.net> |
| In reply to | #37826 |
On Fri, 22 Nov 2019 02:10:12 -0800 (PST), Jonas Thörnvall wrote:
> ": [
> {
> "duration": 0.0881409374999933,
> "durationTicks": 22,
> "midi": 72,
> "name": "C5",
> "ticks": 13056,
> "time": 52.30764,
> "velocity": 0.952755905511811
>
> I try to parseout the time from string above, but i do not manage get rid
> of the comma after time event.
>
> It is probably because i do not know how to adjust relative the paragraph?
>
> impTimeStart=impNote[IN].indexOf('"time": ');
> impTimeEnd=impNote[IN].indexOf(',\n"velocity":');
> impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd);
>
> I do not do much parsing so a full example, would be nice. Maybe i just do
> it a silly way to start with.
>
> Jonas T
It's more simpler to just use regular regex. e.g.
impTime = impNote[IN].match(/"time": (\d+(?:\.\d+))/)[1];
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-11-22 03:58 -0800 |
| Message-ID | <92ee491e-e27f-4d55-a363-cea94b811f76@googlegroups.com> |
| In reply to | #37830 |
Den fredag 22 november 2019 kl. 12:36:38 UTC+1 skrev JJ:
> On Fri, 22 Nov 2019 02:10:12 -0800 (PST), Jonas Thörnvall wrote:
> > ": [
> > {
> > "duration": 0.0881409374999933,
> > "durationTicks": 22,
> > "midi": 72,
> > "name": "C5",
> > "ticks": 13056,
> > "time": 52.30764,
> > "velocity": 0.952755905511811
> >
> > I try to parseout the time from string above, but i do not manage get rid
> > of the comma after time event.
> >
> > It is probably because i do not know how to adjust relative the paragraph?
> >
> > impTimeStart=impNote[IN].indexOf('"time": ');
> > impTimeEnd=impNote[IN].indexOf(',\n"velocity":');
> > impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd);
> >
> > I do not do much parsing so a full example, would be nice. Maybe i just do
> > it a silly way to start with.
> >
> > Jonas T
>
> It's more simpler to just use regular regex. e.g.
>
> impTime = impNote[IN].match(/"time": (\d+(?:\.\d+))/)[1];
Yeah i see it works JJ, but i kind of promised myself to never use none selfexplanationary code. To decode that you must learn regexp, by heart.
I think i stick with replace to remove it.
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-11-22 04:09 -0800 |
| Message-ID | <c2565c5d-45ee-4de1-8c40-c14897bcfc9b@googlegroups.com> |
| In reply to | #37832 |
Den fredag 22 november 2019 kl. 12:58:35 UTC+1 skrev Jonas Thörnvall:
> Den fredag 22 november 2019 kl. 12:36:38 UTC+1 skrev JJ:
> > On Fri, 22 Nov 2019 02:10:12 -0800 (PST), Jonas Thörnvall wrote:
> > > ": [
> > > {
> > > "duration": 0.0881409374999933,
> > > "durationTicks": 22,
> > > "midi": 72,
> > > "name": "C5",
> > > "ticks": 13056,
> > > "time": 52.30764,
> > > "velocity": 0.952755905511811
> > >
> > > I try to parseout the time from string above, but i do not manage get rid
> > > of the comma after time event.
> > >
> > > It is probably because i do not know how to adjust relative the paragraph?
> > >
> > > impTimeStart=impNote[IN].indexOf('"time": ');
> > > impTimeEnd=impNote[IN].indexOf(',\n"velocity":');
> > > impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd);
> > >
> > > I do not do much parsing so a full example, would be nice. Maybe i just do
> > > it a silly way to start with.
> > >
> > > Jonas T
> >
> > It's more simpler to just use regular regex. e.g.
> >
> > impTime = impNote[IN].match(/"time": (\d+(?:\.\d+))/)[1];
>
> Yeah i see it works JJ, but i kind of promised myself to never use none selfexplanationary code. To decode that you must learn regexp, by heart.
>
> I think i stick with replace to remove it.
Ended up like this, at least there is no doubt about what is happening, turned out i need it in milliseconds also.
impTimeStart=impNote[IN].indexOf('"time": ');
impTimeEnd=impNote[IN].indexOf('"velocity":');
impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd);
impTime=impTime.replace(",","");
impTime=impTime.replace(".","");
console.log(impTime);
[toc] | [prev] | [next] | [standalone]
| From | JJ <jj4public@vfemail.net> |
|---|---|
| Date | 2019-11-23 08:38 +0700 |
| Message-ID | <lot98uss1a13$.he4xht2l16wy.dlg@40tude.net> |
| In reply to | #37833 |
On Fri, 22 Nov 2019 04:09:51 -0800 (PST), Jonas Thörnvall wrote:
>>
>> Yeah i see it works JJ, but i kind of promised myself to never use none
>> selfexplanationary code. To decode that you must learn regexp, by heart.
>>
>> I think i stick with replace to remove it.
>
> Ended up like this, at least there is no doubt about what is happening,
> turned out i need it in milliseconds also.
>
> impTimeStart=impNote[IN].indexOf('"time": ');
> impTimeEnd=impNote[IN].indexOf('"velocity":');
> impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd);
> impTime=impTime.replace(",","");
> impTime=impTime.replace(".","");
> console.log(impTime);
In that case, you can shorten the number extraction like this.
impTimeStart=impNote[IN].indexOf('"time": ');
impTimeEnd=impNote[IN].indexOf(',', impTimeStart);
impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd);
> turned out i need it in milliseconds also.
> ...
> impTime=impTime.replace(".","");
That won't work as expected. In your example source (JSON) text, the value
of the time property is 52.30764. If that value is in seconds, and you
removed the period character and treats it as milliseconds, you'll get
5230764 milliseconds (or 5230.764 seconds) instead of 52307.64 milliseconds.
Use this instead.
impTime=impTime * 1000;
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-11-22 23:31 -0800 |
| Message-ID | <c955c380-b772-49ba-b166-375532348bb4@googlegroups.com> |
| In reply to | #37840 |
Den lördag 23 november 2019 kl. 02:38:30 UTC+1 skrev JJ:
> On Fri, 22 Nov 2019 04:09:51 -0800 (PST), Jonas Thörnvall wrote:
> >>
> >> Yeah i see it works JJ, but i kind of promised myself to never use none
> >> selfexplanationary code. To decode that you must learn regexp, by heart.
> >>
> >> I think i stick with replace to remove it.
> >
> > Ended up like this, at least there is no doubt about what is happening,
> > turned out i need it in milliseconds also.
> >
> > impTimeStart=impNote[IN].indexOf('"time": ');
> > impTimeEnd=impNote[IN].indexOf('"velocity":');
> > impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd);
> > impTime=impTime.replace(",","");
> > impTime=impTime.replace(".","");
> > console.log(impTime);
>
> In that case, you can shorten the number extraction like this.
>
> impTimeStart=impNote[IN].indexOf('"time": ');
> impTimeEnd=impNote[IN].indexOf(',', impTimeStart);
> impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd);
>
> > turned out i need it in milliseconds also.
> > ...
> > impTime=impTime.replace(".","");
>
> That won't work as expected. In your example source (JSON) text, the value
> of the time property is 52.30764. If that value is in seconds, and you
> removed the period character and treats it as milliseconds, you'll get
> 5230764 milliseconds (or 5230.764 seconds) instead of 52307.64 milliseconds.
> Use this instead.
>
> impTime=impTime * 1000;
Yeah you are correct JJ, nah it is probably not in seconds, well it could be that channel starting at 52 seconds "it is the first note on channel". I have to get it imported and i will see. ***Or list the other channels***
Thank's for help JJ, i think i pretty much did a parse of notes, i must also parse the CC that are listed separately. Then push both notes and CC to track and sort by time.
Then i will implement a save and load my own simple textformat "midi", i am not one hundred decided upon the actual structure of midi object, it seem beneficial to be able to have different midiports on a single track but we will see how it ends up. But i guess both program changes and cc will be saved as sorted time events in a plain textstring row using a delimiter. Midiformat is hell of a format to deal with, it would be easier to implement a zip compression to get down textsize then implement midiformat. But back in the day i guess the hardware resources just was not there.
[toc] | [prev] | [next] | [standalone]
| From | John G Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2019-11-22 18:25 +0000 |
| Message-ID | <7t9gtela34l9730moeadkk9ihq739eq4rf@4ax.com> |
| In reply to | #37826 |
On Fri, 22 Nov 2019 02:10:12 -0800 (PST), Jonas Thörnvall
<jonas.thornvall@gmail.com> wrote:
>": [
> {
> "duration": 0.0881409374999933,
> "durationTicks": 22,
> "midi": 72,
> "name": "C5",
> "ticks": 13056,
> "time": 52.30764,
> "velocity": 0.952755905511811
>
>I try to parseout the time from string above, but i do not manage get rid of the comma after time event.
>
>It is probably because i do not know how to adjust relative the paragraph?
>
>impTimeStart=impNote[IN].indexOf('"time": ');
>impTimeEnd=impNote[IN].indexOf(',\n"velocity":');
>impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd);
<snip>
Someone with an IQ of 190 would write
impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd-1);
or, better still, search for the position of the first comma after
impTimeStart+8 and use that value instead.
John
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-11-22 11:09 -0800 |
| Message-ID | <5cd83575-4789-4eb9-97e6-1e7f7c3ada02@googlegroups.com> |
| In reply to | #37836 |
Den fredag 22 november 2019 kl. 19:25:43 UTC+1 skrev John G Harris:
> On Fri, 22 Nov 2019 02:10:12 -0800 (PST), Jonas Thörnvall
> <jonas.thornvall@gmail.com> wrote:
>
> >": [
> > {
> > "duration": 0.0881409374999933,
> > "durationTicks": 22,
> > "midi": 72,
> > "name": "C5",
> > "ticks": 13056,
> > "time": 52.30764,
> > "velocity": 0.952755905511811
> >
> >I try to parseout the time from string above, but i do not manage get rid of the comma after time event.
> >
> >It is probably because i do not know how to adjust relative the paragraph?
> >
> >impTimeStart=impNote[IN].indexOf('"time": ');
> >impTimeEnd=impNote[IN].indexOf(',\n"velocity":');
> >impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd);
> <snip>
>
> Someone with an IQ of 190 would write
>
> impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd-1);
>
> or, better still, search for the position of the first comma after
> impTimeStart+8 and use that value instead.
>
> John
Yeah John but there is alot of commas to pass by so you would have to find 6 th index, yeah maybe i did that parsing instrumentfiles. Nah it works fine like it is a few lines extra to keep logic simple it is worth it.
But i liked the -1 if it just had worked apparently the /n and possibly even paragraph is part of string index?
[toc] | [prev] | [next] | [standalone]
| From | John G Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2019-11-23 10:51 +0000 |
| Message-ID | <qn3ite5664ccehr5sspa7v41a1k8mimmt2@4ax.com> |
| In reply to | #37839 |
On Fri, 22 Nov 2019 11:09:36 -0800 (PST), Jonas Thörnvall <jonas.thornvall@gmail.com> wrote: >Den fredag 22 november 2019 kl. 19:25:43 UTC+1 skrev John G Harris: >> On Fri, 22 Nov 2019 02:10:12 -0800 (PST), Jonas Thörnvall >> <jonas.thornvall@gmail.com> wrote: <snip> >> Someone with an IQ of 190 would write >> >> impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd-1); >> >> or, better still, search for the position of the first comma after >> impTimeStart+8 and use that value instead. >> >> John > >Yeah John but there is alot of commas to pass by so you would have to find 6 th index, yeah maybe i did that parsing instrumentfiles. Nah it works fine like it is a few lines extra to keep logic simple it is worth it. <snip> Here's a case where the right answer is RTFM! Go to ECMA 262, section 21.1.3.8, and read the note at the beginning of the section. Hint : You don't have to find a lot of commas. John
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-11-23 05:04 -0800 |
| Message-ID | <ac68cc42-2bea-46a4-a6be-66fc048dd971@googlegroups.com> |
| In reply to | #37845 |
Den lördag 23 november 2019 kl. 11:51:17 UTC+1 skrev John G Harris:
> On Fri, 22 Nov 2019 11:09:36 -0800 (PST), Jonas Thörnvall
> <jonas.thornvall@gmail.com> wrote:
>
> >Den fredag 22 november 2019 kl. 19:25:43 UTC+1 skrev John G Harris:
> >> On Fri, 22 Nov 2019 02:10:12 -0800 (PST), Jonas Thörnvall
> >> <jonas.thornvall@gmail.com> wrote:
> <snip>
> >> Someone with an IQ of 190 would write
> >>
> >> impTime=impNote[IN].substring(impTimeStart+8,impTimeEnd-1);
> >>
> >> or, better still, search for the position of the first comma after
> >> impTimeStart+8 and use that value instead.
> >>
> >> John
> >
> >Yeah John but there is alot of commas to pass by so you would have to find 6 th index, yeah maybe i did that parsing instrumentfiles. Nah it works fine like it is a few lines extra to keep logic simple it is worth it.
> <snip>
>
> Here's a case where the right answer is RTFM!
>
> Go to ECMA 262, section 21.1.3.8, and read the note at the beginning
> of the section.
>
> Hint : You don't have to find a lot of commas.
>
> John
I don't think i have to i already use it John in other files, it is just my memory for syntax in not excellent. At least when it is not semantical.
function getBankName(i){
console.log("getBankName()");
var ENDBANKNAME = Abank[i].indexOf("]",0);
bankName[i]=Abank[i].substring(0,ENDBANKNAME);
// console.log(bankName[i]);
}
Maybe something like indexFind(",",occurence 5);
I find it very hard to remember if there is no semantical context to hang it up on.
[toc] | [prev] | [next] | [standalone]
| From | John G Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2019-11-23 18:37 +0000 |
| Message-ID | <avuite9mrtvgk10gnao4oa4pto2p874eh5@4ax.com> |
| In reply to | #37847 |
On Sat, 23 Nov 2019 05:04:54 -0800 (PST), Jonas Thörnvall
<jonas.thornvall@gmail.com> wrote:
<snip>
>Maybe something like indexFind(",",occurence 5);
>I find it very hard to remember if there is no semantical context to hang it up on.
No, no, no.
It would be
indexFind(",", starting_at_char n);
where n is the position of the previous substring.
John
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-11-24 09:58 -0800 |
| Message-ID | <f897657c-d4fa-44e8-bb29-eb6d821708ff@googlegroups.com> |
| In reply to | #37849 |
Den lördag 23 november 2019 kl. 19:37:32 UTC+1 skrev John G Harris:
> On Sat, 23 Nov 2019 05:04:54 -0800 (PST), Jonas Thörnvall
> <jonas.thornvall@gmail.com> wrote:
>
> <snip>
> >Maybe something like indexFind(",",occurence 5);
> >I find it very hard to remember if there is no semantical context to hang it up on.
>
> No, no, no.
>
> It would be
> indexFind(",", starting_at_char n);
> where n is the position of the previous substring.
>
> John
But hello John you can't know starting at without, which occurence that is wanted?
Yeah occurence definitly better. "Occurence n" if you so want.
[toc] | [prev] | [next] | [standalone]
| From | John G Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2019-11-24 18:51 +0000 |
| Message-ID | <i4klteht0571mc5f5davm8qmh73sbpip9b@4ax.com> |
| In reply to | #37858 |
On Sun, 24 Nov 2019 09:58:13 -0800 (PST), Jonas Thörnvall
<jonas.thornvall@gmail.com> wrote:
>Den lördag 23 november 2019 kl. 19:37:32 UTC+1 skrev John G Harris:
>> On Sat, 23 Nov 2019 05:04:54 -0800 (PST), Jonas Thörnvall
>> <jonas.thornvall@gmail.com> wrote:
>>
>> <snip>
>> >Maybe something like indexFind(",",occurence 5);
>> >I find it very hard to remember if there is no semantical context to hang it up on.
>>
>> No, no, no.
>>
>> It would be
>> indexFind(",", starting_at_char n);
>> where n is the position of the previous substring.
>>
>> John
>
>But hello John you can't know starting at without, which occurence that is wanted?
>Yeah occurence definitly better. "Occurence n" if you so want.
First you search for "time", starting at the default character
position 0, and get the position of "t". Call it position b.
Then you search for "," , starting at character position b, and get
the position of the next comma after "time". Call it position e.
Then you extract the substring starting at t+8 and ending just before
e.
If you want to find the n'th occurrence of something then write a
function to do that, but you won't need it.
John
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-11-24 10:01 -0800 |
| Message-ID | <d489a345-58b5-4dd8-9195-69bfd392f28c@googlegroups.com> |
| In reply to | #37849 |
Den lördag 23 november 2019 kl. 19:37:32 UTC+1 skrev John G Harris:
> On Sat, 23 Nov 2019 05:04:54 -0800 (PST), Jonas Thörnvall
> <jonas.thornvall@gmail.com> wrote:
>
> <snip>
> >Maybe something like indexFind(",",occurence 5);
> >I find it very hard to remember if there is no semantical context to hang it up on.
>
> No, no, no.
>
> It would be
> indexFind(",", starting_at_char n);
> where n is the position of the previous substring.
>
> John
Commaseparated parameters that not named who really can remember them if not used frequently. An editor that show the implicit semantic of parametrised syntax would be indispenseble.
[toc] | [prev] | [next] | [standalone]
| From | John G Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2019-11-24 19:28 +0000 |
| Message-ID | <5fmltehcq9s0f7db7tf3inng1sqj196rmu@4ax.com> |
| In reply to | #37859 |
On Sun, 24 Nov 2019 10:01:58 -0800 (PST), Jonas Thörnvall <jonas.thornvall@gmail.com> wrote: <snip> >Commaseparated parameters that not named who really can remember them if not used frequently. An editor that show the implicit semantic of parametrised syntax would be indispenseble. About 4,000 years ago some genius solved that problem. He invented an external memory for things you don't want to remember yourself. It's called writing. If you can't remember something, just look it up in the manual. John
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-11-25 01:19 -0800 |
| Message-ID | <118850f1-b878-412f-b8f2-4ca535980577@googlegroups.com> |
| In reply to | #37861 |
Den söndag 24 november 2019 kl. 20:29:00 UTC+1 skrev John G Harris: > On Sun, 24 Nov 2019 10:01:58 -0800 (PST), Jonas Thörnvall > <jonas.thornvall@gmail.com> wrote: > > <snip> > >Commaseparated parameters that not named who really can remember them if not used frequently. An editor that show the implicit semantic of parametrised syntax would be indispenseble. > > About 4,000 years ago some genius solved that problem. He invented an > external memory for things you don't want to remember yourself. It's > called writing. If you can't remember something, just look it up in > the manual. > > John Parametrised values without semantic context i call blipblopping John, the whole point of creating highlevel languages to start with was to avoid blipblopping. It is nice that regexp is there for people **who think*** they gain something LoL But make them part of the highlevel language naaaah... don't think so.
[toc] | [prev] | [next] | [standalone]
| From | John G Harris <niam@jghnorth.org.uk.invalid> |
|---|---|
| Date | 2019-11-25 18:28 +0000 |
| Message-ID | <q77ote9vo7j48d0t5cgjr8qla0rggjt2li@4ax.com> |
| In reply to | #37865 |
On Mon, 25 Nov 2019 01:19:08 -0800 (PST), Jonas Thörnvall <jonas.thornvall@gmail.com> wrote: <snip> >Parametrised values without semantic context i call blipblopping John, the whole point of creating highlevel languages to start with was to avoid blipblopping. <snip> So when you do a subtraction you remember that subtrahend=5 is the parameter to the left of the - sign, or is it the one to the right? John
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-11-26 04:24 -0800 |
| Message-ID | <fd7b6c99-3f76-4201-9720-16f7631690be@googlegroups.com> |
| In reply to | #37868 |
Den måndag 25 november 2019 kl. 19:28:20 UTC+1 skrev John G Harris: > On Mon, 25 Nov 2019 01:19:08 -0800 (PST), Jonas Thörnvall > <jonas.thornvall@gmail.com> wrote: > > <snip> > >Parametrised values without semantic context i call blipblopping John, the whole point of creating highlevel languages to start with was to avoid blipblopping. > <snip> > > So when you do a subtraction you remember that subtrahend=5 is the > parameter to the left of the - sign, or is it the one to the right? > > John No man that is operators and operands, there is no meaning to remember operands or name them. You use the operator, but there is such a thing like overload with parameters and if they just commaseparated values. Well that is rather idiotic, because then you have to look for the manual everytime you use them. It is much easier to remember if there is a syntactical context to hangup the parameter with. Like occurence. In this case occurence is the operator and 5 the operand. I think you get what i mean. To be abit obtreus something like a.findIndex(a,b,c,d,e,f,g,h) basicly a very detailed search "like regexp", will get very hard to handle expesically "if the operand is missing" and just the order matter for howto interpretate the arguments/operands. Using semantical operators like occurence the order no longer matter"in most cases".
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-11-27 05:41 -0800 |
| Message-ID | <772dce9f-bcdb-4f3a-bb4b-f99657cf5d50@googlegroups.com> |
| In reply to | #37876 |
Den tisdag 26 november 2019 kl. 13:25:01 UTC+1 skrev Jonas Thörnvall: > Den måndag 25 november 2019 kl. 19:28:20 UTC+1 skrev John G Harris: > > On Mon, 25 Nov 2019 01:19:08 -0800 (PST), Jonas Thörnvall > > <jonas.thornvall@gmail.com> wrote: > > > > <snip> > > >Parametrised values without semantic context i call blipblopping John, the whole point of creating highlevel languages to start with was to avoid blipblopping. > > <snip> > > > > So when you do a subtraction you remember that subtrahend=5 is the > > parameter to the left of the - sign, or is it the one to the right? > > > > John > > No man that is operators and operands, there is no meaning to remember operands or name them. You use the operator, but there is such a thing like overload with parameters and if they just commaseparated values. Well that is rather idiotic, because then you have to look for the manual everytime you use them. It is much easier to remember if there is a syntactical context to hangup the parameter with. Like occurence. > > In this case occurence is the operator and 5 the operand. > I think you get what i mean. > > To be abit obtreus something like a.findIndex(a,b,c,d,e,f,g,h) basicly a very detailed search "like regexp", will get very hard to handle expesically "if the operand is missing" and just the order matter for howto interpretate the arguments/operands. > > Using semantical operators like occurence the order no longer matter"in most cases". Well i come so far it parse the notes on respective midichannel, now just prg and CC to parse. And maybe fix so parts per quarter and bpm change work. https://midisequenser.000webhostapp.com/
[toc] | [prev] | [next] | [standalone]
| From | Jonas Thörnvall <jonas.thornvall@gmail.com> |
|---|---|
| Date | 2019-11-30 08:47 -0800 |
| Message-ID | <383d537f-64d9-4baa-9025-c87c620c99df@googlegroups.com> |
| In reply to | #37878 |
Den onsdag 27 november 2019 kl. 14:41:21 UTC+1 skrev Jonas Thörnvall: > Den tisdag 26 november 2019 kl. 13:25:01 UTC+1 skrev Jonas Thörnvall: > > Den måndag 25 november 2019 kl. 19:28:20 UTC+1 skrev John G Harris: > > > On Mon, 25 Nov 2019 01:19:08 -0800 (PST), Jonas Thörnvall > > > <jonas.thornvall@gmail.com> wrote: > > > > > > <snip> > > > >Parametrised values without semantic context i call blipblopping John, the whole point of creating highlevel languages to start with was to avoid blipblopping. > > > <snip> > > > > > > So when you do a subtraction you remember that subtrahend=5 is the > > > parameter to the left of the - sign, or is it the one to the right? > > > > > > John > > > > No man that is operators and operands, there is no meaning to remember operands or name them. You use the operator, but there is such a thing like overload with parameters and if they just commaseparated values. Well that is rather idiotic, because then you have to look for the manual everytime you use them. It is much easier to remember if there is a syntactical context to hangup the parameter with. Like occurence. > > > > In this case occurence is the operator and 5 the operand. > > I think you get what i mean. > > > > To be abit obtreus something like a.findIndex(a,b,c,d,e,f,g,h) basicly a very detailed search "like regexp", will get very hard to handle expesically "if the operand is missing" and just the order matter for howto interpretate the arguments/operands. > > > > Using semantical operators like occurence the order no longer matter"in most cases". > > Well i come so far it parse the notes on respective midichannel, now just prg and CC to parse. And maybe fix so parts per quarter and bpm change work. > https://midisequenser.000webhostapp.com/ Managed to parse out the CC values on each channel now i just must push them with notes and sort the track. I must say that Javascript string handling is excellent for parsing makes it very easy, well done to whoever thought that one out. Split, substring, indexoff and replace and you parse out with ease at least from "strings". I like it, i was thinking this was going to take weeks, more like 10 hours. That is a sign someone done something right.
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.javascript
csiph-web