Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Linux is obsolete (Andrew Tanenbaum)


devel / comp.lang.tcl / Re: Clock scan issue

SubjectAuthor
* Clock scan issuesnosniv
+- Clock scan issueRalf Fassel
`* Clock scan issueRich
 `- Clock scan issuesnosniv

1
Clock scan issue

<43ce6bc5-97ae-4ac2-a9b7-ecf1bb2b9b9en@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9966&group=comp.lang.tcl#9966

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:1b8c:b0:6ee:cffb:2222 with SMTP id dv12-20020a05620a1b8c00b006eecffb2222mr13730965qkb.674.1667315821590;
Tue, 01 Nov 2022 08:17:01 -0700 (PDT)
X-Received: by 2002:a05:6214:27c3:b0:4bb:6d7d:982a with SMTP id
ge3-20020a05621427c300b004bb6d7d982amr16106274qvb.98.1667315821421; Tue, 01
Nov 2022 08:17:01 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Tue, 1 Nov 2022 08:17:01 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=82.1.128.13; posting-account=gstOigoAAADV9pmzZL58qQ436SKV3SBu
NNTP-Posting-Host: 82.1.128.13
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <43ce6bc5-97ae-4ac2-a9b7-ecf1bb2b9b9en@googlegroups.com>
Subject: Clock scan issue
From: nivpars...@gmail.com (snosniv)
Injection-Date: Tue, 01 Nov 2022 15:17:01 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1410
 by: snosniv - Tue, 1 Nov 2022 15:17 UTC

My CSV file has the row data like this:

"1 November 2022 11:00:27",156.0,24.2,15.7,131.6,13.6,7.0,
So when I chop up the row into elements I get the timestamp as just:
"1 November 2022 11:00:27"

So I have to further remove the quotes to get clock scan with format to work, by using:
set l1 [string length $my_DateTime]
set my_DateTime [string range $my_DateTime 1 [expr $l1 - 2]]

Is there a simpler way please?

TIA Niv.

Re: Clock scan issue

<ygazgdawt1r.fsf@akutech.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9969&group=comp.lang.tcl#9969

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!news.mb-net.net!open-news-network.org!news.mind.de!bolzen.all.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: ralf...@gmx.de (Ralf Fassel)
Newsgroups: comp.lang.tcl
Subject: Re: Clock scan issue
Date: Tue, 01 Nov 2022 17:14:40 +0100
Lines: 20
Message-ID: <ygazgdawt1r.fsf@akutech.de>
References: <43ce6bc5-97ae-4ac2-a9b7-ecf1bb2b9b9en@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: individual.net 2RpDiFd4LtYzxxOLv/7tjQ7oqS0Ja4NPHt1+YZ/JkbPJ7GzrQ=
Cancel-Lock: sha1:yZgF730YtATDr501UOTtPm0gdHs= sha1:vfiaos10h++LP4GXngoZfORaSIE=
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
 by: Ralf Fassel - Tue, 1 Nov 2022 16:14 UTC

* snosniv <nivparsons@gmail.com>
| My CSV file has the row data like this:
>
| "1 November 2022 11:00:27",156.0,24.2,15.7,131.6,13.6,7.0,
|
| So when I chop up the row into elements I get the timestamp as just:
| "1 November 2022 11:00:27"

Others have already pointed to tcllib::csv

https://core.tcl-lang.org/tcllib/doc/trunk/embedded/md/tcllib/files/modules/csv/csv.md

Use it to process your CSV input, and the quoting issue will go away.

Other than that, check the "string trim" method

https://www.tcl-lang.org/man/tcl8.6/TclCmd/string.htm#M47

HTH
R'

Re: Clock scan issue

<tjriu9$qibk$3@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9973&group=comp.lang.tcl#9973

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: ric...@example.invalid (Rich)
Newsgroups: comp.lang.tcl
Subject: Re: Clock scan issue
Date: Tue, 1 Nov 2022 16:53:29 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <tjriu9$qibk$3@dont-email.me>
References: <43ce6bc5-97ae-4ac2-a9b7-ecf1bb2b9b9en@googlegroups.com>
Injection-Date: Tue, 1 Nov 2022 16:53:29 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="976f85e8b9aa8267b18aa2f750b2de52";
logging-data="870772"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Bw68vjJzmm7FxhSIJlipB"
User-Agent: tin/2.0.1-20111224 ("Achenvoir") (UNIX) (Linux/3.10.17 (x86_64))
Cancel-Lock: sha1:pY+67h6O/k5REwjZfeU0G6jZPN0=
 by: Rich - Tue, 1 Nov 2022 16:53 UTC

snosniv <nivparsons@gmail.com> wrote:
> My CSV file has the row data like this:
>
> "1 November 2022 11:00:27",156.0,24.2,15.7,131.6,13.6,7.0,
>
> So when I chop up the row into elements I get the timestamp as just:
> "1 November 2022 11:00:27"
>
>
> So I have to further remove the quotes to get clock scan with format to work, by using:
> set l1 [string length $my_DateTime]
> set my_DateTime [string range $my_DateTime 1 [expr $l1 - 2]]
>
> Is there a simpler way please?

Use the Tcllib CSV library. It handles the quirky quoting standard for
CSV files which you are not handling with what appears to be your own
custom attempt at parsing the CSV file..

I.e.:

package require csv
package require struct::queue

struct::queue q
set fd [open csvfile.csv RDONLY]
csv::readwqueue $fd q
close $fd

foreach row [q get [q size]] {
# do things with each row here -- and any CSV escaping quotes will be
# missing, but any quotes that actually form part of the data will be
# present
}

Do note that the above hoovers the entire CSV into memory all at once.
Depending on the size of the csv, you may or may not want to hoover it
all in up front.

Re: Clock scan issue

<d517b361-20e9-4b86-a625-01d2655267d2n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=9977&group=comp.lang.tcl#9977

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:2002:b0:6fa:19cd:81f6 with SMTP id c2-20020a05620a200200b006fa19cd81f6mr14728384qka.691.1667379202154;
Wed, 02 Nov 2022 01:53:22 -0700 (PDT)
X-Received: by 2002:ac8:5d87:0:b0:39c:eb24:2e1a with SMTP id
d7-20020ac85d87000000b0039ceb242e1amr18569050qtx.577.1667379201995; Wed, 02
Nov 2022 01:53:21 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Wed, 2 Nov 2022 01:53:21 -0700 (PDT)
In-Reply-To: <tjriu9$qibk$3@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=82.1.128.13; posting-account=gstOigoAAADV9pmzZL58qQ436SKV3SBu
NNTP-Posting-Host: 82.1.128.13
References: <43ce6bc5-97ae-4ac2-a9b7-ecf1bb2b9b9en@googlegroups.com> <tjriu9$qibk$3@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <d517b361-20e9-4b86-a625-01d2655267d2n@googlegroups.com>
Subject: Re: Clock scan issue
From: nivpars...@gmail.com (snosniv)
Injection-Date: Wed, 02 Nov 2022 08:53:22 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2502
 by: snosniv - Wed, 2 Nov 2022 08:53 UTC

On Tuesday, 1 November 2022 at 16:53:33 UTC, Rich wrote:
> snosniv <nivpa...@gmail.com> wrote:
> > My CSV file has the row data like this:
> >
> > "1 November 2022 11:00:27",156.0,24.2,15.7,131.6,13.6,7.0,
> >
> > So when I chop up the row into elements I get the timestamp as just:
> > "1 November 2022 11:00:27"
> >
> >
> > So I have to further remove the quotes to get clock scan with format to work, by using:
> > set l1 [string length $my_DateTime]
> > set my_DateTime [string range $my_DateTime 1 [expr $l1 - 2]]
> >
> > Is there a simpler way please?
> Use the Tcllib CSV library. It handles the quirky quoting standard for
> CSV files which you are not handling with what appears to be your own
> custom attempt at parsing the CSV file..
>
> I.e.:
>
> package require csv
> package require struct::queue
>
> struct::queue q
> set fd [open csvfile.csv RDONLY]
> csv::readwqueue $fd q
> close $fd
>
> foreach row [q get [q size]] {
> # do things with each row here -- and any CSV escaping quotes will be
> # missing, but any quotes that actually form part of the data will be
> # present
> }
>
> Do note that the above hoovers the entire CSV into memory all at once.
> Depending on the size of the csv, you may or may not want to hoover it
> all in up front.

Thanks for the pointer to the CSV lib. & tips on usage.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor