Selasa, 02 Agustus 2016

Bristol Digest, Vol 655, Issue 3

Send Bristol mailing list submissions to
bristol@mailman.lug.org.uk

To subscribe or unsubscribe via the World Wide Web, visit
https://mailman.lug.org.uk/mailman/listinfo/bristol
or, via email, send a message with subject or body 'help' to
bristol-request@mailman.lug.org.uk

You can reach the person managing the list at
bristol-owner@mailman.lug.org.uk

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Bristol digest..."


Today's Topics:

1. Re: Bristol Digest, Vol 655, Issue 1 (P K)
2. Regex and Postgres from Perl (Martin Moore)
3. Re: Regex and Postgres from Perl (Amias Channer)


----------------------------------------------------------------------

Message: 1
Date: Tue, 2 Aug 2016 13:19:30 +0100
From: P K <peterking1990@gmail.com>
To: <bristol@mailman.lug.org.uk>
Subject: Re: [bristol] Bristol Digest, Vol 655, Issue 1
Message-ID: <57a08fd3.469d1c0a.c5985.ec2a@mx.google.com>
Content-Type: text/plain; charset="utf-8"

Guess I dodged a bullet before fiddling with that then!

Thanks,
Peter

-----Original Message-----
From: "bristol-request@mailman.lug.org.uk" <bristol-request@mailman.lug.org.uk>
Sent: ‎01/‎08/‎2016 13:00
To: "bristol@mailman.lug.org.uk" <bristol@mailman.lug.org.uk>
Subject: Bristol Digest, Vol 655, Issue 1

Send Bristol mailing list submissions to
bristol@mailman.lug.org.uk

To subscribe or unsubscribe via the World Wide Web, visit
https://mailman.lug.org.uk/mailman/listinfo/bristol
or, via email, send a message with subject or body 'help' to
bristol-request@mailman.lug.org.uk

You can reach the person managing the list at
bristol-owner@mailman.lug.org.uk

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Bristol digest..."


Today's Topics:

1. WD 2009 NAS (Mike Yates)


----------------------------------------------------------------------

Message: 1
Date: Mon, 1 Aug 2016 09:21:11 +0100
From: Mike Yates <bblug@fonehelp.co.uk>
To: Bristol and Bath LUG <bristol@mailman.lug.org.uk>
Subject: [bristol] WD 2009 NAS
Message-ID:
<CAKU1sbzsQGc83wzFuGH_xgT6wya7+VJQR3oJCnwo6nNYKemx2w@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

No, I don't want the HDDs (have plenty 0.5TB) but just FYI they weren't
called MyCloud in 2009 but "MyBook World Edition". Mine had one 1TB drive
and I binned it in 2013 (but still use the HDD) because the Samba was not
Win8.1 compatible. It is the NAS which crashes, not the Windoze, whenever a
Win8.1+ device boots into its LAN, let alone tries to map a drive! I did a
lot of hacking of it and used a newer Samba for NLSU2 but it had several
other issues so I replaced it with a 2TB MyCloud which is a lot better, but
I wish I'd gone Buffalo. I doubt the SMBv5 issue was deliberate, but WD
certainly profited from it, refusing to fix it themselves.

So, it's just as well you didn't revive it!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.lug.org.uk/mailman/private/bristol/attachments/20160801/f822f791/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Bristol mailing list
Bristol@mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/bristol

------------------------------

End of Bristol Digest, Vol 655, Issue 1
***************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.lug.org.uk/mailman/private/bristol/attachments/20160802/8cd1633d/attachment-0001.html>

------------------------------

Message: 2
Date: Tue, 02 Aug 2016 18:04:04 +0100
From: Martin Moore <martinm@it-helps.co.uk>
To: Bristol and Bath Linux User Group <bristol@mailman.lug.org.uk>
Subject: [bristol] Regex and Postgres from Perl
Message-ID: <B50178C2-F682-4F2E-A465-D9E36D0F659B@it-helps.co.uk>
Content-Type: text/plain; charset="UTF-8"


I'm converting an archaic system from a bit of SQL and a lot of
Perl/Javascript to mostly SQL (Postgres) and a bit of js.

Nearly done, but I've got to the bit where Regexes are involved.

Basically I need to do the following from Perl into PostgreSQL. I can't see
a way to do it. I guess I could possibly use the Perl module in Postgres but
it's not something I've done before. Could also get away with putting the
Regex stuff into js if all else fails.

I've looked at regexp_split_to_array but can't see it'll do what I need.

Any ideas?

Ta,

Martin.




my $tafre = '(?:TAF(?:\s*AMD|COR|CC\w?)?\b)'; # TAF start, Canadian
my $timestampre = '\d{4,6}Z?\b'; # Opt, with opt date
my $icaore = '[A-Z]\w{3}\b'; # Mand
my $latere = 'AMD|RTD|COR|TAF|AMD\sCOR';
my $issuere = '\d{4,6}Z\b';
my $periodre = '(?:\d{4}\/\d{4}\b|\d{4,6}\b)';
my $atre = '\d{2,4}'; #
my $winddirre = '[\d\/]{3}|VRB';
my $windspdre = '[\d\/]{2}';
my $gustre = 'G(\d{2})';
my $windunitre = 'KT|MPS|KMH';
my $windre = "($winddirre)($windspdre)(?:$gustre)?($windunitre)";
my $varre = '\d{3}V\d{3}\s*';
my $tempre = 'M?\d\d|\/\/';
my $dewpre = 'M?\d\d|\/\/';
my $altimeterre = '[QA]\s?\d{4}|QFE\d{3,4}.\d';
my $visandcloud = 'CAVOK';
my $onevisre = '(?:P?\d{4}[NSEW]{0,2}|[P0-9\s\/]{0,5}\s*SM|CAVOK)';
my $onervrre = '(?:R\d{2}\w?\/\w+)';
my $onecloudre = '(?:[A-Z]{3}[0-9\/]{3}[A-Z]{0,3}\s*|VV[0-9\/]{3}\s*)';
my $cloudre = $onecloudre.'+|CLR|SKC|NSC';
my $onewxre = '(?:NSW|
.
.
.
.
.

$self->{timestamp},
$self->{icao},
$self->{late},
$self->{issued},
$self->{period},
$self->{winddir},
$self->{meanwindsp},
$self->{gust},
$self->{windunit},
$self->{vis},
$self->{wx},
$self->{cloud},
$self->{supp},
$self->{change},
$self->{temps}
)

= ($metline =~ /
(?:$tafre)?\s*
($timestampre)?\s* # optional
timestamp
($icaore)\s* # mand icao
identifier
($latere)?\s*
($issuere)?\s* # optional issue
time
($periodre)\s* # Mandatory period
(?:$windre)?\s* # wind, gust
# ($onevisre\s*)?\s* # a vis gps
((?:$onevisre\s*)*)\s* # zero or more vis
gps
((?:$onewxre\s*)*)\s* # zero or more wx
groups
($cloudre)?\s* # optional cloud
group
((?:$onesuppre\s*)*\s*)
(.*?)\s*
((?:$onetaftempre\s*)*\s*)=/sx))
# supplementary info



------------------------------

Message: 3
Date: Tue, 2 Aug 2016 20:50:31 +0100
From: Amias Channer <me@amias.net>
To: Bristol and Bath Group <bristol@mailman.lug.org.uk>, Martin Moore
<martinm@it-helps.co.uk>
Subject: Re: [bristol] Regex and Postgres from Perl
Message-ID:
<CAMgU7XXS5JM5JUNEgR73RpVDb0X-DX+zW1o5=k5osWoQVU0bHQ@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hello martin,

This will help
https://github.com/TooTallNate/pcre-to-regexp

Cheers
Amias

On 2 Aug 2016 18:04, "Martin Moore via Bristol" <bristol@mailman.lug.org.uk>
wrote:

>
> I'm converting an archaic system from a bit of SQL and a lot of
> Perl/Javascript to mostly SQL (Postgres) and a bit of js.
>
> Nearly done, but I've got to the bit where Regexes are involved.
>
> Basically I need to do the following from Perl into PostgreSQL. I
> can't see
> a way to do it. I guess I could possibly use the Perl module in
> Postgres but
> it's not something I've done before. Could also get away with putting
> the
> Regex stuff into js if all else fails.
>
> I've looked at regexp_split_to_array but can't see it'll do what I
> need.
>
> Any ideas?
>
> Ta,
>
> Martin.
>
>
>
>
> my $tafre = '(?:TAF(?:\s*AMD|COR|CC\w?)?\b)'; # TAF start,
> Canadian
> my $timestampre = '\d{4,6}Z?\b'; # Opt, with
> opt date
> my $icaore = '[A-Z]\w{3}\b'; # Mand
> my $latere = 'AMD|RTD|COR|TAF|AMD\sCOR';
> my $issuere = '\d{4,6}Z\b';
> my $periodre = '(?:\d{4}\/\d{4}\b|\d{4,6}\b)';
> my $atre = '\d{2,4}'; #
> my $winddirre = '[\d\/]{3}|VRB';
> my $windspdre = '[\d\/]{2}';
> my $gustre = 'G(\d{2})';
> my $windunitre = 'KT|MPS|KMH';
> my $windre = "($winddirre)($windspdre)(?:$gustre)?($windunitre)";
> my $varre = '\d{3}V\d{3}\s*';
> my $tempre = 'M?\d\d|\/\/';
> my $dewpre = 'M?\d\d|\/\/';
> my $altimeterre = '[QA]\s?\d{4}|QFE\d{3,4}.\d';
> my $visandcloud = 'CAVOK';
> my $onevisre = '(?:P?\d{4}[NSEW]{0,2}|[P0-9\s\/]{0,5}\s*SM|CAVOK)';
> my $onervrre = '(?:R\d{2}\w?\/\w+)';
> my $onecloudre =
> '(?:[A-Z]{3}[0-9\/]{3}[A-Z]{0,3}\s*|VV[0-9\/]{3}\s*)';
> my $cloudre = $onecloudre.'+|CLR|SKC|NSC';
> my $onewxre = '(?:NSW|
> .
> .
> .
> .
> .
>
> $self->{timestamp},
> $self->{icao},
> $self->{late},
> $self->{issued},
> $self->{period},
> $self->{winddir},
> $self->{meanwindsp},
> $self->{gust},
> $self->{windunit},
> $self->{vis},
> $self->{wx},
> $self->{cloud},
> $self->{supp},
> $self->{change},
> $self->{temps}
> )
>
> = ($metline =~ /
> (?:$tafre)?\s*
> ($timestampre)?\s* # optional
> timestamp
> ($icaore)\s* # mand icao
> identifier
> ($latere)?\s*
> ($issuere)?\s* # optional issue
> time
> ($periodre)\s* # Mandatory period
> (?:$windre)?\s* # wind, gust
> # ($onevisre\s*)?\s* # a vis gps
> ((?:$onevisre\s*)*)\s* # zero or more vis
> gps
> ((?:$onewxre\s*)*)\s* # zero or more wx
> groups
> ($cloudre)?\s* # optional cloud
> group
> ((?:$onesuppre\s*)*\s*)
> (.*?)\s*
> ((?:$onetaftempre\s*)*\s*)=/sx))
> # supplementary info
>
>
>
>
>
>
>
> _______________________________________________
> Bristol mailing list
> Bristol@mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/bristol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.lug.org.uk/mailman/private/bristol/attachments/20160802/dcd3999c/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
Bristol mailing list
Bristol@mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/bristol

------------------------------

End of Bristol Digest, Vol 655, Issue 3
***************************************

Tidak ada komentar:

Posting Komentar