[26049] in Perl-Users-Digest
Perl-Users Digest, Issue: 8257 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jul 18 19:42:10 2005
Date: Mon, 18 Jul 2005 15:05:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 18 Jul 2005 Volume: 10 Number: 8257
Today's topics:
Re: copy contructor <abigail@abigail.nl>
Re: Earthquake Forecasting Program July 11, 2005 <bobofficers@invalid.net>
Re: Earthquake Forecasting Program July 11, 2005 <bobofficers@invalid.net>
Extract until unquote or EOL <spamenot.mog.pettersson@telia.com>
Re: Extract until unquote or EOL <someone@example.com>
Re: Extract until unquote or EOL <noreply@gunnar.cc>
Re: Extract until unquote or EOL <1usa@llenroc.ude.invalid>
Re: Extract until unquote or EOL <spamenot.mog.pettersson@telia.com>
Re: PAR 0.89 + Socket + ASP 5.8.7 = PL_memory_wrap <john@castleamber.com>
Re: parsing email addresses <abigail@abigail.nl>
Regexp for variable length tags <Jon@nospam.com>
Re: Regexp for variable length tags <someone@example.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Jul 2005 19:42:36 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: copy contructor
Message-Id: <slrnddo1hc.7fo.abigail@alexandra.abigail.nl>
Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMMMCCCXXXIX
September MCMXCIII in <URL:news:dbfv8r$88k$1@mamenchi.zrz.TU-Berlin.DE>:
[ Snip ]
&& In my opinion, class design around accessors does solve the attribute
&& problem. Whether the solution is satisfactory (generally, or for a
&& specific problem) is another question.
Just one question: how are you storing your attributes?
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Mon, 18 Jul 2005 11:44:35 -0700
From: Bob Officer <bobofficers@invalid.net>
Subject: Re: Earthquake Forecasting Program July 11, 2005
Message-Id: <83und1pv3du700os4oug71i6ks242ojqfp@4ax.com>
Keywords: X
On Mon, 11 Jul 2005 08:31:31 GMT, in sci.geo.earthquakes, "edgrsprj"
<edgrsprj@ix.netcom.com> wrote:
>PROPOSED EARTHQUAKE FORECASTING
>COMPUTER PROGRAM DEVELOPMENT EFFORT
<sigh> here we go again...
EDG is not a computer programmer, nor is he a geologist...
The best guess seems to be that he is he is crackpot, often going from group
to group espousing some sort of knowledge and asking for people to forward
his articles to government, schools and other professional bodies with a
demand that public monies be giving to him to support his "research".
A few years ago he started begging for programming help to process these
"signals" he has been looking for... (odd he has never explained what the
exactly these signals really are.
>Posted July 11, 2005
>My main earthquake forecasting Web page is:
>http://www.freewebz.com/eq-forecasting/Data.html
>
>Newsgroup Readers: If you circulate copies of this report to groups of
>computer programmers at different universities etc. around the world then
>they might find the subject matter to be interesting.
or that might classify you just as EDG is classified, KOOK or Crackpot
>The information in this report represents expressions of personal opinion.
>
>THE GOAL OF THIS REPORT
>
> This is part of an effort to get some idea regarding how many
>computer programmers and other researchers around the world might be
>interested in participating in a project aimed at developing life saving
>earthquake forecasting computer programs.
>
> That effort is not presently underway. And I don't know when or if
>it will get started. I am simply attempting to determine if other people
>believe that large numbers of volunteers would be interested in working on
>such a project or if there would instead be little interest in it. That
>information would be helpful for developing a plan for establishing a Web
>site where the project would be centered. Personnel running the following
>Web site have volunteered to make their site available for such an effort.
Look at this for all his effort over the past few years...
>But nothing has gotten underway so far.
>
--
Ak'toh'di
------------------------------
Date: Mon, 18 Jul 2005 11:54:37 -0700
From: Bob Officer <bobofficers@invalid.net>
Subject: Re: Earthquake Forecasting Program July 11, 2005
Message-Id: <j9und1dk1cl08bg2tum967h974lrf656oc@4ax.com>
Keywords: X
On Wed, 13 Jul 2005 23:39:46 GMT, in sci.geo.earthquakes, "Hank Oredson"
<horedson@earthlink.net> wrote:
>"edgrsprj" <edgrsprj@ix.netcom.com> wrote in message
>news:2OeBe.2928$oZ.770@newsread2.news.atl.earthlink.net...
>> "Hank Oredson" <horedson@earthlink.net> wrote in message
>> news:1vYAe.2575$dU3.2553@newsread2.news.pas.earthlink.net...
>>> "edgrsprj" <edgrsprj@ix.netcom.com> wrote in message
>>> news:pmXAe.9096$aY6.3897@newsread1.news.atl.earthlink.net...
>>> > "Hank Oredson" <horedson@earthlink.net> wrote in message
>>> > news:7%UAe.4148$BK1.174@newsread3.news.pas.earthlink.net...
>>> >> "edgrsprj" <edgrsprj@ix.netcom.com> wrote in message
>>> >> news:upBAe.1915$oZ.930@newsread2.news.atl.earthlink.net...
>>> >> > "edgrsprj" <edgrsprj@ix.netcom.com> wrote in message
>>> >> > news:D7qAe.21003$eM6.9503@newsread3.news.atl.earthlink.net...
>>> >> >> PROPOSED EARTHQUAKE FORECASTING
>>> >> >> COMPUTER PROGRAM DEVELOPMENT EFFORT
>>
>>> I guess my question was not specific enough.
>>> What I wanted was the exact sources, so I could access the data.
>>> The exact data sets you used.
>>
>> July 13, 2005
>>
>> Thanks again for the comments and interest.
>>
>> The original report in this thread should have contained pointers to
>> all of the information you are requesting. But once again, here are some
>> of
>> the important URLs.
>>
>> http://www.freewebz.com/eq-forecasting/301.html
>>
>> That Web page contains information regarding the details of how the
>> forecasting program works. Also stored there are copies of an early
>> Zipped .txt version of the Perl program I am using along with Zip file
>> versions of earlier versions of the .txt format database files that I am
>> using. I had to Zip them because of their size and the limited bandwidth
>> of
>> that Web site. If you would prefer to receive them as regular text files
>> then you can try contacting me by e-mail and I will try to send them
>> along.
>>
>> Perl users who downloaded and ran that .pl program some time ago
>> said
>> that they had no trouble getting it to run on a Window's XP system. Other
>> operating system users might encounter a few formatting problems etc.
>>
>> http://www.freewebz.com/eq-forecasting/90-05.html
>> http://www.freewebz.com/eq-forecasting/128.html
>>
>> Those Web pages discuss the theories involved with this forecasting
>> method. Some of the most important information is at the end of that
>> 128.html Web page.
>
>I found no equations there, nor any links to the original data sources.
>
>> http://www.freewebz.com/eq-forecasting/Data.html
>>
>> That Web page contains several types of forecast data along with
>> some
>> information regarding how to interpret them.
>
>Did not find any information on the source of the data.
>
>> http://www.freewebz.com/eq-forecasting/151.html
>>
>> That Web page contains some "Help" information with details
>> regarding
>> things such as the U.S. Navy's MICA computer program which I use to
>> generate
>> data for things such as the locations of the Earth, sun, and moon relative
>> to the J2000 reference system.
>>
>> You should not expect to be able to instantly absorb all of that
>> information though it sounds like understanding it should not be a problem
>> for you. I have been working on the project for about 15 years. And
>> unfortunately, every improvement seems to take days, weeks, months, ...
>
>Everything looked fairly obvious, except that there did not seem
>to be any reference to the source of the datasets.
>
>> Additionally, as I said in my first report in this thread, the
>> multiple participants part of the project is not yet operational. For one
>> thing, a suitable Web site has to be found. Right now I am simply
>> trying to determine what the interest level there might be in such a
>> project. And positive feedback that I have been getting by e-mail etc.
>> has been encouraging.
>
>Perhaps I was not clear enough in my previous posts.
>
>I am looking for the SOURCE of the data, that is, where did
>YOU get the data from, so that I may obtain my own datasets.
>
>In particular I am interested in the EM dataset.
There isn't any "data set"
There are no "formula"...
There is only EGD
Crackpot.
http://www.crank.net/geology.html
Look down to the middle of the page E.D.G.
Listed as "Cranky"
--
Ak'toh'di
------------------------------
Date: Mon, 18 Jul 2005 18:15:43 GMT
From: Mats <spamenot.mog.pettersson@telia.com>
Subject: Extract until unquote or EOL
Message-Id: <jlSCe.29331$d5.182409@newsb.telia.net>
Hi!
I've messed with this problem a while now. I want to parse a file for
declarations (ex: NAME = "myname").
I wan't to extract the phrase/text between the two quotes. BUT If the
last quote isn't available (type/user error) then it should extract
until end of line. If no quotes are there at all, it should extract the
whole line (except NAME=). If there are several double quotes, it should
extract between the first two (that i seem to have achived).
My current testscript looks as below:
---
#!/usr/bin/perl -w
use strict;
$_ = 'NAME = "between quotes" not this" nor this';
print $1."\n" if m/\s*NAME\s*=\s*"*(.*?)"|$/s;
---
This prints out as i want:
between quotes
But if i delete the last two doublequotes and just keep the first it
prints nothing. If i delete the first doublequote also, i get an
"uninitialized value" error.
Anybody knows a smooth solution to this?
Mats
------------------------------
Date: Mon, 18 Jul 2005 18:43:38 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Extract until unquote or EOL
Message-Id: <uLSCe.164325$on1.81576@clgrps13>
Mats wrote:
>
> I've messed with this problem a while now. I want to parse a file for
> declarations (ex: NAME = "myname").
>
> I wan't to extract the phrase/text between the two quotes. BUT If the
> last quote isn't available (type/user error) then it should extract
> until end of line. If no quotes are there at all, it should extract the
> whole line (except NAME=). If there are several double quotes, it should
> extract between the first two (that i seem to have achived).
>
> My current testscript looks as below:
>
> ---
> #!/usr/bin/perl -w
>
> use strict;
>
> $_ = 'NAME = "between quotes" not this" nor this';
>
> print $1."\n" if m/\s*NAME\s*=\s*"*(.*?)"|$/s;
> ---
>
> This prints out as i want:
> between quotes
>
> But if i delete the last two doublequotes and just keep the first it
> prints nothing. If i delete the first doublequote also, i get an
> "uninitialized value" error.
>
> Anybody knows a smooth solution to this?
print "$1\n" if /\s*NAME\s*=\s*"?([^"]+)/;
John
------------------------------
Date: Mon, 18 Jul 2005 20:53:09 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Extract until unquote or EOL
Message-Id: <3k2c4oFrtsrrU1@individual.net>
John W. Krahn wrote:
>
> print "$1\n" if /\s*NAME\s*=\s*"?([^"]+)/;
Nice. Only that the leading \s* can be dropped.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Mon, 18 Jul 2005 18:56:42 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Extract until unquote or EOL
Message-Id: <Xns96979807BCB76asu1cornelledu@127.0.0.1>
Mats <spamenot.mog.pettersson@telia.com> wrote in
news:jlSCe.29331$d5.182409@newsb.telia.net:
> I wan't to extract the phrase/text between the two quotes. BUT If the
> last quote isn't available (type/user error) then it should extract
> until end of line. If no quotes are there at all, it should extract
> the whole line (except NAME=). If there are several double quotes, it
> should extract between the first two (that i seem to have achived).
...
> print $1."\n" if m/\s*NAME\s*=\s*"*(.*?)"|$/s;
Usually, I find it easier to deal with a literal translation of the
requirements into the relevant index and substr calls:
#!/usr/bin/perl
use strict;
use warnings;
while(<DATA>) {
if( /^\s*NAME\s*=\s*(.*)/ ) {
my $v;
if( (my $i = 1 + index $1, q{"}) ) {
if( -1 < (my $j = index substr($1, $i), q{"}) ) {
$v = substr $1, $i, $j;
} else {
$v = substr $1, $i;
}
} else {
$v = $1;
}
print "$v\n";
}
}
__DATA__
NAME = "between quotes" not this nor this
NAME = no quotation marks so grab all of this
NAME = "solitary quotation mark at the beginning of line, so grab all
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Mon, 18 Jul 2005 19:09:57 GMT
From: Mats <spamenot.mog.pettersson@telia.com>
Subject: Re: Extract until unquote or EOL
Message-Id: <98TCe.142254$dP1.495414@newsc.telia.net>
John W. Krahn wrote:
> Mats wrote:
>
>>I've messed with this problem a while now. I want to parse a file for
>>declarations (ex: NAME = "myname").
>>
>>I wan't to extract the phrase/text between the two quotes. BUT If the
>>last quote isn't available (type/user error) then it should extract
>>until end of line. If no quotes are there at all, it should extract the
>>whole line (except NAME=). If there are several double quotes, it should
>>extract between the first two (that i seem to have achived).
>>
>>My current testscript looks as below:
>>
>>---
>>#!/usr/bin/perl -w
>>
>>use strict;
>>
>>$_ = 'NAME = "between quotes" not this" nor this';
>>
>>print $1."\n" if m/\s*NAME\s*=\s*"*(.*?)"|$/s;
>>---
>>
>>This prints out as i want:
>>between quotes
>>
>>But if i delete the last two doublequotes and just keep the first it
>>prints nothing. If i delete the first doublequote also, i get an
>>"uninitialized value" error.
>>
>>Anybody knows a smooth solution to this?
>
>
> print "$1\n" if /\s*NAME\s*=\s*"?([^"]+)/;
>
>
>
> John
Well! Thats a lot less complicated and smarter than i ever thought off
and as bonus it works! I really should be thinking in a more KISS like way.
Thanks!
Mats
------------------------------
Date: 18 Jul 2005 19:01:09 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: PAR 0.89 + Socket + ASP 5.8.7 = PL_memory_wrap
Message-Id: <Xns96978E749717Dcastleamber@130.133.1.4>
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:
> John Bokma <john@castleamber.com> wrote in
>> Note (probably harmless): No library found for msvcrt.lib
>
> Once you get msvcrt.lib, those should be resolved.
The odd thing is, I installed the SDK, and:
C:\Archivos de programa\Microsoft Visual Studio .NET 2003\Vc7\lib
*does* have the msvcrt.lib...
Set Lib=
C:\Archivos de programa\Microsoft Visual Studio .NET 2003\Vc7\lib;%Lib%
(one line) solved that problem
So what I did:
cd C:\Archivos de programa\Microsoft Visual C++ Toolkit 2003
run Visual C++ Toolkit 2003 Command Prompt
in this "prompt":
cd C:\Archivos de programa\Microsoft Platform SDK
setenv /XP32 /RETAIL
cd C:\......\PAR-0.89.tar\PAR-0.89
Set Lib=
C:\Archivos de programa\Microsoft Visual Studio .NET 2003\Vc7\lib;%Lib%
nmake clean
perl Makefile.PL
nmake
nmake install
And... works!
Manye thanks Sinan, Ron, and Rob (Sisyphus)
--
John Small Perl scripts: http://johnbokma.com/perl/
Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
------------------------------
Date: 18 Jul 2005 19:45:41 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: parsing email addresses
Message-Id: <slrnddo1n4.7fo.abigail@alexandra.abigail.nl>
James (bob_then@yahoo.com.au) wrote on MMMMCCCXXXIX September MCMXCIII in
<URL:news:42dba13a$1@dnews.tpgi.com.au>:
-- I have a form that saves e-mail addresses to file and then sends them an
-- email but to send the email it need to be in the form a\@b.c.d not a@b.c.d
-- how can I get it to add the \ in front of the @ because I tried using =~ /@/
-- but it doesn't work because it changes it from a@b.c.d to a.c.d without the
-- \ how can I fix this?
$ sed -e 's/@/\\@/' file > file.$$ && mv file.$$ file
Abigail
--
map{${+chr}=chr}map{$_=>$_^ord$"}$=+$]..3*$=/2;
print "$J$u$s$t $a$n$o$t$h$e$r $P$e$r$l $H$a$c$k$e$r\n";
------------------------------
Date: Mon, 18 Jul 2005 16:07:36 -0400
From: Jon Burroughs <Jon@nospam.com>
Subject: Regexp for variable length tags
Message-Id: <dbh2i3$8aa$1@news.nems.noaa.gov>
I am processing some data that has a up to three key-value pairs
concatenated together. The keys can be "ADD, REM, EQD". Values are
variable length.
There will always be an "ADD" section, followed by 0 to 1 "REM"
sections, followed by 0 to 1 "EQD" sections. For example:
ADDxxxxxxxxREMyyyyyEQDzzzzz
I'm trying to find a regular expression that will split this apart into
separarate sections in one step.
So far, I have this:
$rec =~ /(ADD.+)(REM.+)(EQD.+)/;
But, this only works if I know the record has all three tokens.
This gobbles too much:
$rec =~ /(ADD.+)(REM.+)?(EQD.+)?/;
Any ideas?
-Jon
------------------------------
Date: Mon, 18 Jul 2005 20:24:39 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Regexp for variable length tags
Message-Id: <beUCe.95614$wr.21425@clgrps12>
Jon Burroughs wrote:
> I am processing some data that has a up to three key-value pairs
> concatenated together. The keys can be "ADD, REM, EQD". Values are
> variable length.
>
> There will always be an "ADD" section, followed by 0 to 1 "REM"
> sections, followed by 0 to 1 "EQD" sections. For example:
> ADDxxxxxxxxREMyyyyyEQDzzzzz
>
> I'm trying to find a regular expression that will split this apart into
> separarate sections in one step.
>
> So far, I have this:
>
> $rec =~ /(ADD.+)(REM.+)(EQD.+)/;
>
> But, this only works if I know the record has all three tokens.
>
> This gobbles too much:
> $rec =~ /(ADD.+)(REM.+)?(EQD.+)?/;
>
> Any ideas?
Try using non-greedy quantifiers.
perldoc perlre
John
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8257
***************************************