[22511] in Perl-Users-Digest
Perl-Users Digest, Issue: 4732 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 19 21:06:09 2003
Date: Wed, 19 Mar 2003 18:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 19 Mar 2003 Volume: 10 Number: 4732
Today's topics:
Re: Array reference argument to subroutine problem (Jim Cochrane)
Re: Array reference argument to subroutine problem (Jim Cochrane)
Re: Catching RST when using sysread and sockets <bkennedy@hmsonline.com>
Re: Data 'thinning' with Perl MySQL ctcgag@hotmail.com
Re: Data 'thinning' with Perl MySQL <rereidy@indra.com>
Re: Data 'thinning' with Perl MySQL <goldbb2@earthlink.net>
Re: Find&Replace only in a certain scope <mstep@t-online.de>
How to include data stamps in a script?? (John Smith)
Re: Lightweight CGI module? <ntnewsNOSPAM@hrz3.hrz.tu-darmstadt.de>
Re: Mangled Regular Expressions with '|' Operator <me@verizon.invalid>
Re: Mangled Regular Expressions with '|' Operator <abigail@abigail.nl>
Moving a hash to a separate file <sbour@niaid.nih.gov>
Re: Moving a hash to a separate file (Jay Tilton)
Re: new Perl feature request: call into shared libs (Walter Roberson)
Re: OT: Borland's equivalent to -o or -Fo <jussij@zeusedit.com>
RFD: comp.databases.berkeley-db <philip@tildesoftware.com>
Socket Problem In Perl (Ryan Ritten)
Re: text filter <mgjv@tradingpost.com.au>
Re: text filter <goldbb2@earthlink.net>
Re: Why can not use this regexp to determine the prime <abigail@abigail.nl>
Re: Why can not use this regexp to determine the prime (Jay Tilton)
Re: why can't I last? ctcgag@hotmail.com
Re: Why is alarm() waiting for inconsistent periods of <No_4@dsl.pipex.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 19 Mar 2003 12:07:01 -0700
From: jtc@flatland.dimensional.com (Jim Cochrane)
Subject: Re: Array reference argument to subroutine problem
Message-Id: <slrnb7hful.4ni.jtc@flatland.dimensional.com>
In article <slrnb7f82m.pe7.jtc@flatland.dimensional.com>, Jim Cochrane wrote:
>In article <x78yvcwdne.fsf@mail.sysarch.com>, Uri Guttman wrote:
>>>>>>> "JC" == Jim Cochrane <jtc@flatland.dimensional.com> writes:
>>
>> JC> The web page "Passing Parameters to Functions" (
>> ...
>>
>>a (rare) very good perl tuturial is at:
>>
>> http://www.ebb.org/PickingUpPerl/
>>
>
>[I responded earlier, but either I send mail instead of posting, or the
>post has not shown up yet. Apologies for any double posting.]
>
>Thanks for the URL. However, I'm getting an alert:
>"The connection was refused when attempting to contact www.ebb.org"
>Perhaps their server is temporarily down.
It's now working - Looks like the server was down.
Thanks again.
--
Jim Cochrane
jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]
------------------------------
Date: 19 Mar 2003 12:21:12 -0700
From: jtc@flatland.dimensional.com (Jim Cochrane)
Subject: Re: Array reference argument to subroutine problem
Message-Id: <slrnb7hgp8.4ni.jtc@flatland.dimensional.com>
Thanks very much to all the replied. I've learned that the arrays need to
be passed by reference by enclosing them in '[]' or, when specified as
ranges, preceded by a '\'. (Probably the '[]' form should be preferred.)
It also appears to work when passing actual variables, e.g.:
ref_manipulator([@a1], [@a2]);
# or
ref_manipulator(\@a1, \@a2);
In article <slrnb7f4h1.pe7.jtc@flatland.dimensional.com>, Jim Cochrane wrote:
>The web page "Passing Parameters to Functions" (
>http://www.cs.cf.ac.uk/Dave/PERL/node61.html#SECTION00920000000000000000
>) describes how to use references to pass more than one array to a
>subroutine and distinguish between the two arrays in the subroutine.
>Unfortunately, on my system (perl -v5.6.1 on Redhat 7.3), this does not
>work. When I run the script below (the 2nd example on the above page),
>I get the following results:
>
>$ /tmp/ref.pl
>The first array is .
>The second array is .
>
>The web page says the output should be:
>
>The first array is 1 2 3 4 5.
>The second array is A B C D E.
>
>What's up here? Is my version of Perl too old? (I doubt it - it's not
>that old.) Is the page wrong? Something else - environment setting, ...?
>
>Thanks!
>
>
>#!/usr/bin/perl -w
>
>firstSub( (1..5), ("A".."E"));
>
>sub firstSub {
> my($ref_firstArray, $ref_secondArray) = @_;
>
> print("The first array is @{$ref_firstArray}.\n");
> print("The second array is @{$ref_secondArray}.\n");
>}
>
>--
>Jim Cochrane
>jtc@dimensional.com
>
>[When responding by email, include the term non-spam in the subject line to
>get through my spam filter.]
--
Jim Cochrane
jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]
------------------------------
Date: Wed, 19 Mar 2003 16:31:03 -0500
From: "Ben Kennedy" <bkennedy@hmsonline.com>
Subject: Re: Catching RST when using sysread and sockets
Message-Id: <L9WdnT7bY5aof-WjXTWcoQ@giganews.com>
"Scott McPheeters" <scottmc94@hotmail.com> wrote in message
news:13b27267.0303180821.7eb2b4bf@posting.google.com...
> My problem is every once in a while the tandem will send a RST (I see
> the RST using a packet sniffer) and I can't seem to catch it. My
> sysread will just sit there looking for data that doesn't come.
Perl has no knowledge whatsoever of the details of the interchange - it just
sees a file descriptor it gets from the OS
> $chk = sysread($remote,$ans_length,2);
> $tot = unpack("n", $ans_length);
> $chk = sysread($remote, $ans, $tot);
> close $remote;
One conceivable problem is that your first sysread call fails, making your
$tot value undefined, and then passing an undefined value into your second
sysread(). What I would suggest is to insert debugging information at each
line, and verify there are no variable types with 'use strict'. Make sure
you verify that each sysread() call is returning the correct number of
bytes. Make sure you are not sending more than 2 & 16 bytes per message
either. Verify that your second sysread() is slurping all the data from the
file descriptor, depending on the OS it can take multiple calls. Hope this
helps -
--Ben Kennedy
------------------------------
Date: 19 Mar 2003 19:21:16 GMT
From: ctcgag@hotmail.com
Subject: Re: Data 'thinning' with Perl MySQL
Message-Id: <20030319142116.181$pa@newsreader.com>
ineverlookatthis@yahoo.com (Steve) wrote:
> Dear All
>
> I have a problem which might be of interest:
>
> I have an application based on perl and MySQL that logs data from a
> series of instruments, logging interval ranges from minutes to hours
> on different instruments. I don't need to keep it all forever but I
> need to 'thin' it in a defined way. For example, on data over 1 week
> old reduce observations to a max of one record per hour per
> instrument, over two weeks old reduce to 1 per 2 hours etc etc. This
> would allow me to see recent performance in great detail, provide a
> historical record and provide an indefinite archive of sample values.
>
> I cannot come-up with an algorithm that does this in a remotely
> elegant way.
Who cares about elegant? This is a messy problem, just find something
that is practical.
> Either I read everything into an array, thin that and
> then rewrite it - I don't like that because I worry about the size of
> the array in future developments,
Read the primary key of everything that needs to be thinned (up to a
certain number of items) into an array, then delete those things based on
primary key.
> or I repeatedly read the table,
> delete records, reread the table in a very ugly way - which I presume
> to have huge overheads.
It probably wouldn't be that bad. And if you can use an index, so much the
better.
> In particularly I don't want a solution that
> depends on being run only once a day or once a week!
You have to keep in mind that normal mysql tables will lock the entire
table when any changes are being made. Thus, rather than writing some
clever SQL that deletes 10,000's of records in one go, locking the table
forever, you probably want to delete them one by one. So if you want to
limit the number of expensive full-table-scanning queries, write a clever
SQL that selects the PK of 10,000's of records in one go, and then deletes
them one at a time.
Probably the best way would be to compute a expiration date when the
records are added, store that in an indexed column, and do
while (1) {
sleep 600;
1 while $dbh->do("delete low_priority from blah where
expiration_date<now() limit 1") > 0;
};
from a background process.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
------------------------------
Date: Wed, 19 Mar 2003 13:37:12 -0700
From: Ron Reidy <rereidy@indra.com>
Subject: Re: Data 'thinning' with Perl MySQL
Message-Id: <3E78D4F8.2000409@indra.com>
See below ...
ctcgag@hotmail.com wrote:
> ineverlookatthis@yahoo.com (Steve) wrote:
>
>>Dear All
>>
>>I have a problem which might be of interest:
>>
[ snip ]
> You have to keep in mind that normal mysql tables will lock the entire
> table when any changes are being made. Thus, rather than writing some
> clever SQL that deletes 10,000's of records in one go, locking the table
> forever, you probably want to delete them one by one. So if you want to
> limit the number of expensive full-table-scanning queries, write a clever
> SQL that selects the PK of 10,000's of records in one go, and then deletes
> them one at a time.
A better method would be:
1. Get the rows (by PK) that you want to save into a temp table.
2. Delete from the permanent table where PK rows not in the temp table
>
> Probably the best way would be to compute a expiration date when the
> records are added, store that in an indexed column, and do
>
--
Ron Reidy
Oracle DBA
------------------------------
Date: Wed, 19 Mar 2003 18:31:56 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Data 'thinning' with Perl MySQL
Message-Id: <3E78FDEB.114F0C95@earthlink.net>
Steve wrote:
>
> Dear All
>
> I have a problem which might be of interest:
>
> I have an application based on perl and MySQL that logs data from a
> series of instruments, logging interval ranges from minutes to hours
> on different instruments. I don't need to keep it all forever but I
> need to 'thin' it in a defined way. For example, on data over 1 week
> old reduce observations to a max of one record per hour per
> instrument, over two weeks old reduce to 1 per 2 hours etc etc. This
> would allow me to see recent performance in great detail, provide a
> historical record and provide an indefinite archive of sample values.
>
> I cannot come-up with an algorithm that does this in a remotely
> elegant way. Either I read everything into an array, thin that and
> then rewrite it - I don't like that because I worry about the size of
> the array in future developments, or I repeatedly read the table,
> delete records, reread the table in a very ugly way - which I presume
> to have huge overheads. In particularly I don't want a solution that
> depends on being run only once a day or once a week!
The following code assumes that the data contains a 'date' column, which
is the time that the record was created, and which when fetched produces
an integer in seconds since the epoch.
$dbh->{FetchHashKeyName} = 'NAME_lc';
# Sort data cronologically.
my $get = $dbh->prepare( q[SELECT * FROM table ORDER BY date] );
$get->execute;
my @cols = @{ $get->{COLS} };
my $del = $dbh->prepare( q[DELETE FROM table WHERE ]
. join(" AND ", "$_ = ?", @cols ) );
# Last row examined for a particular instrument type.
my %coalesce;
my $today = time() % (60 * 60);
while( my $rec = $dbh->fetchrow_hashref ) {
use integer; # avoid need for int() all over the place.
# how many weeks ago was this record?
my $recweek = ($today - $rec->{date}) / (60 * 60 * 24 * 7);
# no thinning for records less than a week old.
next if $recweek < 1;
my $other = $coalesce{$rec->{instrument}} ||= {};
if( !%$other ) {
%$other = %$rec;
next;
}
my $interval = 60 * 60 * 2 ** $recweek;
my $o_inter = $other->{date} / $interval;
my $r_inter = $rec->{date} / $interval;
if( $o_inter == $r_inter ) {
# delete the more recent of the two.
$del->execute( @{$rec}{@cols} );
# or, instead, do:
# $del->execute( @{$other}{@cols} );
# %$other = %$rec;
# , to delete the older of the two.
} else {
%$other = %$rec;
}
}
[untested]
> This must be a common problem with data gathering programmes but I
> have not been able to find a solution that lets MySQL do the work.
That's not a perl question :)
Also, keep in mind what Xho (ctcgag@hotmail.com) said -- if you create
an SQL statement that deletes huge numbers of rows at once, it will lock
the table for the entire duration of that operation. If anything else
will be using that table, then such behavior would be impolite.
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: Wed, 19 Mar 2003 21:14:49 +0100
From: Marek Stepanek <mstep@t-online.de>
Subject: Re: Find&Replace only in a certain scope
Message-Id: <BA9E8E49.5A09%mstep@t-online.de>
On 19.03.2003 10:27 Uhr, in article b59d5u$ahu$1@mamenchi.zrz.TU-Berlin.DE,
"Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote:
>
> Your problem isn't how to limit the effect of a text substitution to
> part of a string. That is trivial:
>
> substr( $str, $start, $length) =~ s///;
>
> deals only with the substring and leaves other parts alone. Your
> problem is how to find the substring(s) you want to work on. This
> is where HTML parsing enters because regex matching just doesn't cut
> it.
>
> Anno
Thank you Anno, and Tassilo,
finally some answers! But a little bit disappointing. I thought - I am only
a Perl beginner - that the following should be possible:
look for _keyword_
look behind the closest <table
set the offset of it in a $beginning_variable
look forward to the closest </table
set it to the $end_variable
replace all _0\d with _01 from $beginning_variable to $end_variable
... the rest (the loop) would be easy. Even for me as a beginner.
so: is this not possible to set an offset to a variable an search between
two positions ???
(I am already doubting about the power of Perl ... )
greetings from Munich
marek
______________________________________________________________________
___PODIUM_INTERNATIONAL_//_the_embassy_for_talented_young_musicians___
_______Marek_Stepanek__mstep_[at]_PodiumInternational_[dot]_de________
__________________http://www.PodiumInternational.de___________________
______________________________________________________________________
------------------------------
Date: 19 Mar 2003 14:18:49 -0800
From: clearguy02@yahoo.com (John Smith)
Subject: How to include data stamps in a script??
Message-Id: <500f84f3.0303191418.73826e32@posting.google.com>
Hi perl experts,
I am writing a perl script that runs several times a day. Every time
it runs, it needs to give an output file like below:
test1_links_03182003[1].html when the script is run first time;
(where 03182003 is today's date and [1] reperesents that the script is
run for the first time today)
test1_links_03182003[2].html when the script is run second time;
test1_links_03182003[3].html when the script is run third time;
test1_links_03182003[4].html when the script is run fourth time;
My code: script name is run.pl and the necessary line is:
------------------------------
#! C:/perl/bin/perl
system "ren C:\\Inetpub\\Test\\results__links.html test1_links.html";
------------------------------------------------------------------------
Now every time I run the above script, it has to replace
test1_links.html with test1_links_03182003[1].html etc.
How can I insert the necessary code in the above script to get the
desired results?
Thanks in advances,
J
------------------------------
Date: Wed, 19 Mar 2003 22:08:59 +0100
From: "alex" <ntnewsNOSPAM@hrz3.hrz.tu-darmstadt.de>
Subject: Re: Lightweight CGI module?
Message-Id: <b5am9b$3ka$07$1@news.t-online.com>
hi
> The DBI connect to ODBC is also minor compared to the Client-side
> Think time. I use the 5-second rule of thumb; Clients will ignore 1 to
> 3 second latency. 5 seconds is acceptable. The ODBC is essential
> because it allows us to use Perl and SQL rather than the Unspeakable.
> If we discard ODBC, we then lose the possibility of cross-platform
> usage.
i talked together with keynote some months ago - and they told me a very
good site takes 0.4-0.8sec, 0.8-1.2 is normal and 1.2-1.5 you should do
something... everyting about this is unaccepable and you may loose
customers! i think so too. Our mayor website is in ColdFusion and it takes
about 1.0-1.4sec loading the front page. i'm on the way moving to apache and
mod_perl - i think 3-5seconds is realy bad - you should think about changing
something!
Alex
------------------------------
Date: Wed, 19 Mar 2003 19:59:03 GMT
From: "dw" <me@verizon.invalid>
Subject: Re: Mangled Regular Expressions with '|' Operator
Message-Id: <b_3ea.58663$68.20083@nwrdny01.gnilink.net>
"Abigail" <abigail@abigail.nl> wrote in message
news:slrnb7g53o.u4a.abigail@alexandra.abigail.nl...
> dw (me@verizon.invalid) wrote on MMMCDLXXXVII September MCMXCIII in
> <URL:news:ihSda.73341$gi1.48384@nwrdny02.gnilink.net>:
> &&
> && "Tom Keenan" <keenan1REMOVE@adelphiaNOSPAM.net> wrote in message
> && news:keenan1REMOVE-533193.22503018032003@news1.news.adelphia.net...
> && > For example, the following little script should 'accept' a
> && > string of 1s and 0s containing an even number of 1s,
> && > and 'reject' anything else.
> && I guess I would use:
> && /^0*(10*10*)*$/
> && or
> && if (tr/1/1/ %2 == 0)
>
>
> tr/1/1/ % 2 == 0 matches 'a1a1', but that should be rejected.
>
You're right. I wasn't thinking about that when I did the tr. However, I
was thinking that it might be faster to use tr instead of doing matching if
working on a large set of data.
$ones = tr/1/1/;
$zeros = tr/0/0/;
if ($ones + $zeros == length && $ones %2 == 0) {
# ok
} ....
------------------------------
Date: 19 Mar 2003 21:37:43 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Mangled Regular Expressions with '|' Operator
Message-Id: <slrnb7hop7.u4a.abigail@alexandra.abigail.nl>
dw (me@verizon.invalid) wrote on MMMCDLXXXVII September MCMXCIII in
<URL:news:b_3ea.58663$68.20083@nwrdny01.gnilink.net>:
][
][ "Abigail" <abigail@abigail.nl> wrote in message
][ news:slrnb7g53o.u4a.abigail@alexandra.abigail.nl...
][ > dw (me@verizon.invalid) wrote on MMMCDLXXXVII September MCMXCIII in
][ > <URL:news:ihSda.73341$gi1.48384@nwrdny02.gnilink.net>:
][ > &&
][ > && "Tom Keenan" <keenan1REMOVE@adelphiaNOSPAM.net> wrote in message
][ > && news:keenan1REMOVE-533193.22503018032003@news1.news.adelphia.net...
][ > && > For example, the following little script should 'accept' a
][ > && > string of 1s and 0s containing an even number of 1s,
][ > && > and 'reject' anything else.
][
][ > && I guess I would use:
][ > && /^0*(10*10*)*$/
][ > && or
][ > && if (tr/1/1/ %2 == 0)
][ >
][ >
][ > tr/1/1/ % 2 == 0 matches 'a1a1', but that should be rejected.
][ >
][
][ You're right. I wasn't thinking about that when I did the tr. However, I
][ was thinking that it might be faster to use tr instead of doing matching if
][ working on a large set of data.
Actually on large datasets, using both y/// and // might be fastest:
!(/[01]/ || y/1/1/ % 2)
Abigail
--
perl -Mstrict -we '$_ = "goto _.print chop;\n=rekcaH lreP rehtona tsuJ";_1:eval'
------------------------------
Date: Wed, 19 Mar 2003 15:38:25 -0500
From: Stephan Bour <sbour@niaid.nih.gov>
Subject: Moving a hash to a separate file
Message-Id: <BA9E3F71.6436%sbour@niaid.nih.gov>
> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--B_3130933106_27084183
Content-type: text/plain; charset="ISO-8859-1"
Content-transfer-encoding: 8bit
I have a hash in my script that Iąd like to move to a separate file for
easier maintenance. What is the format for the file and how do I call this
external hash from within the script?
Thanks,
Stephan.
--B_3130933106_27084183
Content-type: text/html; charset="US-ASCII"
Content-transfer-encoding: quoted-printable
<HTML>
<HEAD>
<TITLE>Moving a hash to a separate file</TITLE>
</HEAD>
<BODY>
<FONT FACE=3D"Verdana">I have a hash in my script that I’d like to move=
to a separate file for easier maintenance. What is the format for the=
file and how do I call this external hash from within the script?<BR>
<BR>
Thanks,<BR>
<BR>
Stephan.</FONT>
</BODY>
</HTML>
--B_3130933106_27084183--
------------------------------
Date: Thu, 20 Mar 2003 00:26:17 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Moving a hash to a separate file
Message-Id: <3e7907f6.34108914@news.erols.com>
Stephan Bour <sbour@niaid.nih.gov> wrote:
: > This message is in MIME format. Since your mail reader does not understand
: this format, some or all of this message may not be legible.
Usenet is a plaintext medium. In the interest of maximum legibility
and exposure, you should prevent your news client from wrecking your
articles like that.
: I have a hash in my script that Iąd like to move to a separate file for
: easier maintenance. What is the format for the file and how do I call this
: external hash from within the script?
The Data::Dumper module would be useful for creating the file. Its
format should be transparent. Pulling the data structure back into
your program can be accomplished with do('filename') .
------------------------------
Date: 20 Mar 2003 00:14:49 GMT
From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)
Subject: Re: new Perl feature request: call into shared libs
Message-Id: <b5b15p$og9$1@canopus.cc.umanitoba.ca>
In article <b59b0u$17iv$1@agate.berkeley.edu>,
Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
:If the sufficient need arises, any compiler allows to code the
:solution in ASM.
Use of inline assembler is not part of the ANSI-C standard
"The keywords entry, fortran, and asm have not been included since they
were either never used, or are not portable. Uses of fortran and asm
as keywords are noted as common extensions."
The SGI compilers for IRIX do not support inline assembler.
There's always linking against a routines coded in other languages,
but that's not exactly "pure C".
--
Positrons can be described as electrons traveling backwards in time.
Certainly many Usenet arguments about the past become clearer when they
are re-interpreted as uncertainty about the future.
-- Walter Roberson
------------------------------
Date: Thu, 20 Mar 2003 08:24:20 +1000
From: Jussi Jumppanen <jussij@zeusedit.com>
Subject: Re: OT: Borland's equivalent to -o or -Fo
Message-Id: <3E78EE14.D76@zeusedit.com>
Ilya Zakharevich wrote:
> I want to compile a C file into an OBJ file. With gcc, it is
>
> $(CC) -c -o file.obj file.c
>
> With M$ VC it is
>
> $(CC) -c -Fofile.obj file.c
>
> How one does it with Borland?
For this and many other options you just need to go to a DOS prompt
and type in bcc32 at the command prompt. This will results in the
follwoing output:
Borland C++ 5.0 for Win32 Copyright (c) 1993, 1996 Borland International
Syntax is: BCC32 [ options ] file[s] * = default; -x- = turn switch x
off
-3 * 80386 Instructions -4 80486 Instructions
-Ax Disable extensions -B Compile via assembly
-C Allow nested comments -Dxxx Define macro
-Exxx Alternate Assembler name -Hxxx Use pre-compiled headers
-Ixxx Include files directory -K Default char is unsigned
-Lxxx Libraries directory -M Generate link map
-N Check stack overflow -Ox Optimizations
-P Force C++ compile -R Produce browser info
-RT * Generate RTTI -S Produce assembly output
-Txxx Set assembler option -Uxxx Undefine macro
-Vx Virtual table control -X Suppress autodep. output
-aN Align on N bytes -b * Treat enums as integers
-c Compile only -d Merge duplicate strings
-exxx Executable file name -fxx Floating point options
-gN Stop after N warnings -iN Max. identifier length
-jN Stop after N errors -k * Standard stack frame
-lx Set linker option -nxxx Output file directory
-oxxx Object file name -p Pascal calls
-tWxxx Create Windows app -u * Underscores on externs
-v Source level debugging -wxxx Warning control
-xxxx Exception handling -y Produce line number info
-zxxx Set segment names
and the in fact the:
-oxxx Object file name
is the switch you are after :)
Jussi Jumppanen
Author of: Zeus for Windows, Win32 (Brief, Emacs, etc) FTP Text Editor
"The C/C++, Java, HTML, FTP, Python, PHP, Perl programmer's editor"
Home Page: http://www.zeusedit.com
------------------------------
Date: Wed, 19 Mar 2003 23:38:08 +0000
From: Philip Greer <philip@tildesoftware.com>
Subject: RFD: comp.databases.berkeley-db
Message-Id: <1048117088.326@isc.org>
REQUEST FOR DISCUSSION (RFD)
unmoderated group comp.databases.berkeley-db
This is a formal Request For Discussion (RFD) for the creation of a
world-wide unmoderated Usenet newsgroup comp.databases.berkeley-db.
This is not a Call for Votes (CFV); you cannot vote at this time.
Procedural details are below.
Newsgroup line:
comp.databases.berkeley-db Berkeley database and related topics.
RATIONALE: comp.databases.berkeley-db
Today there is not a specific usenet location for discussions on
berkeley database management software (from this point forward I'll
refer to as just 'berkeley-db'). I've seen discussion occur on
comp.databases, comp.lang.python, comp.lang.perl.misc and other usenet
forums pertaining to sendmail and other solutions that utilize
berkeley-db for storage purposes. Sure, those discussions can be
specific to the software that is utilizing berkeley-db in the back
end, but a majority of those discussions are specific to the database
software itself and/or issues thereof. A central forum specific to
berkeley-db itself will greatly benefit the programming community that
utilizes the tool. As well, with today's increased usage of embedded
systems, and of the use of berkeley database libraries within embedded
solutions, a need for a common area to discuss this software tool will
continue to increase.
CHARTER: comp.databases.berkeley-db
The newsgroup comp.databases.berkeley-db shall be a forum devoted to
the discussion of the berkeley database management software, it's
usage and it's support in a free atmosphere.
All postings must be in ordinary text format only; no special format
files (BinHex, MIME, UUEncode, etc.) are to be posted. Crossposting
of articles irrelevant to the berkeley database solution is strongly
discouraged. Also discouraged are personals and personal messages,
and any postings of a purely commercial nature.
END CHARTER.
PROCEDURE:
This is a request for discussion, not a call for votes. In this phase
of the process, any potential problems with the proposed newsgroups
should be raised and resolved. The discussion period will continue
for a minimum of 21 days (starting from when the first RFD for this
proposal is posted to news.announce.newgroups), after which a Call For
Votes (CFV) may be posted by a neutral vote taker if the discussion
warrants it. Please do not attempt to vote until this happens.
All discussion of this proposal should be posted to news.groups.
This RFD attempts to comply fully with the Usenet newsgroup creation
guidelines outlined in "How to Create a New Usenet Newsgroup" and "How
to Format and Submit a New Group Proposal". Please refer to these
documents (available in news.announce.newgroups) if you have any
questions about the process.
DISTRIBUTION:
This RFD has been posted to the following newsgroups:
news.groups, news.announce.newgroups, comp.databases,
comp.lang.python, comp.lang.perl.misc
Proponent: Philip Greer <philip@tildesoftware.com>
Proponent: Dave Segleau <dave@sleepycat.com>
------------------------------
Date: 19 Mar 2003 13:45:01 -0800
From: sparticusREMOVE@thesparticusarena.com (Ryan Ritten)
Subject: Socket Problem In Perl
Message-Id: <f4d27a4f.0303191345.1c707568@posting.google.com>
hello,
I wrote a little client/server in perl using sockets. Everything
works fine if the client exits normally ... the server notices that
the socket is done and closes it. But if the client dies abnormally
(ie. computer freezes... etc) the server doesn't notice that the
client is gone and keeps the socket open...
am I doing something wrong? Is this was it supposed to happen or is
there a quick fix for it. I'd paste my code here but it's part of a
game I've made and is huge.
Thanx for any help you can give :)
-Ryan
------------------------------
Date: Wed, 19 Mar 2003 21:52:18 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: text filter
Message-Id: <slrnb7hpki.8eh.mgjv@verbruggen.comdyn.com.au>
On Tue, 18 Mar 2003 22:35:00 GMT,
Uri Guttman <uri@stemsystems.com> wrote:
>>>>>> "MV" == Martien Verbruggen <mgjv@tradingpost.com.au> writes:
>
> MV> Even for the case under discussion, the differences are not too big (a
> MV> factor of two). Note that the regular expressions below are not always
> MV> exactly equivalent (see my other post in this thread).
>
> MV> use Benchmark;
>
> MV> $a = "aji_+,/f-12 " x 100;
>
> MV> Benchmark::cmpthese timethese -1 => {
> MV> s1 => '$::a =~ s#[^[:alnum:],/]##g',
> MV> s2 => '$::a =~ s#[^a-zA-Z\d,/]##g',
> MV> y => '$::a =~ y#a-zA-Z0-9,/##dc',
> MV> }
>
> ummm, don't you need to reset $a to the string each time? otherwise
> after the first call the rest are all failure cases and it seems that
> s/// is faster than tr for those. what i asked for was a case where data
> was changed and s/// is faster.
You're right.
In that case tr/// does win out significantly.
use Benchmark;
Benchmark::cmpthese timethese -1 => {
bl => '$::a = "aji_+,/f-12 " x 100',
s1 => '$::a = "aji_+,/f-12 " x 100; $::a =~ s#[^[:alnum:],/]##g',
s2 => '$::a = "aji_+,/f-12 " x 100; $::a =~ s#[^a-zA-Z\d,/]##g',
y => '$::a = "aji_+,/f-12 " x 100; $::a =~ y#a-zA-Z0-9,/##dc',
}
Rate s1 s2 y bl
s1 4757/s -- -2% -88% -96%
s2 4842/s 2% -- -88% -96%
y 39767/s 736% 721% -- -68%
bl 126169/s 2552% 2506% 217% --
Martien
--
|
Martien Verbruggen |
Trading Post Australia | "Mr Kaplan. Paging Mr Kaplan..."
|
------------------------------
Date: Wed, 19 Mar 2003 21:06:11 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: text filter
Message-Id: <3E792213.F74F953C@earthlink.net>
Martien Verbruggen wrote:
[snip]
> use Benchmark;
>
> Benchmark::cmpthese timethese -1 => {
> bl => '$::a = "aji_+,/f-12 " x 100',
> s1 => '$::a = "aji_+,/f-12 " x 100; $::a =~ s#[^[:alnum:],/]##g',
> s2 => '$::a = "aji_+,/f-12 " x 100; $::a =~ s#[^a-zA-Z\d,/]##g',
Shouldn't both of these have a + modifiyer for more speed?
That is, instead of stuff like s#[...]##g, it should be s#[...]+##g.
> y => '$::a = "aji_+,/f-12 " x 100; $::a =~ y#a-zA-Z0-9,/##dc',
> }
>
> Rate s1 s2 y bl
> s1 4757/s -- -2% -88% -96%
> s2 4842/s 2% -- -88% -96%
> y 39767/s 736% 721% -- -68%
> bl 126169/s 2552% 2506% 217% --
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: 19 Mar 2003 20:08:47 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Why can not use this regexp to determine the prime?
Message-Id: <slrnb7hjif.u4a.abigail@alexandra.abigail.nl>
W.J cnqin (qin@freebsd.lzu.edu.cn) wrote on MMMCDLXXXVII September
MCMXCIII in <URL:news:864r5z1txp.fsf@freebsd.lzu.edu.cn>:
&&
&& I use this regexp to find the prime:
&&
&& @ARGV = (3..15);
&&
&& while($count = shift){
&& $_ = '1' x $count;
&& print $count,"\n" if ! m/^(11+)+\1$/; #if not match so it is a prime
&& }
&&
&& I find this topic with google , But it can not give me a statisfactory answer.
&&
&& why the regexp must be written as /^(11+)\1+$/ ?
Because otherwise, it doesn't work?
The regex you used, /^(11+)+\1$/ just asks whether a number N can
be written as: N == a_1 + a_2 + ... + a_k + a_k, with each k >= 2,
and each a_i >= 2. Any number larger than 4 can.
/^(11+)\1+$/, OTOH, asks whether a number N can be written as:
N == a + a + ... + a == k * a, which a >= 2 and k >= 2.
Any composite number can, and no prime can.
Abigail
--
#!/opt/perl/bin/perl -w
$\ = $"; $SIG {TERM} = sub {print and exit};
kill 15 => fork for qw /Just another Perl Hacker/;
------------------------------
Date: Thu, 20 Mar 2003 00:10:31 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Why can not use this regexp to determine the prime?
Message-Id: <3e7905a0.33511029@news.erols.com>
tadmc@augustmail.com (Tad McClellan) wrote:
: Derek Thomson <dthomson@NOSPAMusers.sf.net> wrote:
: > W.J cnqin wrote:
: >> I use this regexp to find the prime:
:
: [ snip non-working regex ]
:
: >> why the regexp must be written as /^(11+)\1+$/ ?
:
: > Interesting use of regexes! Where is this taken from, or is it your own
: > example of craziness? :)
:
: It is Abigail's craziness.
:
: See the thread from 1998 rooted at:
:
: Message-ID: <r8zpcyvrju.fsf_-_@asc.sps.mot.com>
And the OP may have been seen it in The Jargon File, in the entry for
"one-liner wars."
------------------------------
Date: 19 Mar 2003 19:30:48 GMT
From: ctcgag@hotmail.com
Subject: Re: why can't I last?
Message-Id: <20030319143048.990$QZ@newsreader.com>
Andras Malatinszky <nobody@dev.null> wrote:
> I presume -- and I may be wrong here -- that Steve's thinking that since
> the MAIN: label is before the outer loop, saying last MAIN returns
> control to the point before the outer loop begins, so the program enters
> the outer loop again, the loops are run until the last MAIN is executed
> again, at which point control is returned to the point before the outer
> loop, and things keep getting repeated over and over again.
I thought that Steve was just thinking that last did what redo actually
does.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service New Rate! $9.95/Month 50GB
------------------------------
Date: Wed, 19 Mar 2003 20:43:10 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: Why is alarm() waiting for inconsistent periods of time?
Message-Id: <3e78d65e$0$4849$cc9e4d1f@news.dial.pipex.com>
Carlton Brown wrote:
> I am attempting to use alarm(10800) and I find that it is alarming 1
> to 3 seconds sooner than I expect.
>...
> Can anyone tell me what I am doing that may be causing this behavior?
It is possible that time is being kept in check on your system by NTP
(or similar). This will be adjusting the clock from time to time. Your
alarm() call will still arrive after 3 hours as far as the processors
are concerned, but in the meantime a few seconds have been removed from
the wall clock?
Anyway, you are using it to timestamp/keepalive. It shouldn't
matter to the effect you are trying to achieve.
--
Just because I've written it doesn't mean that
either you or I have to believe it.
------------------------------
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.
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 4732
***************************************