[25881] in Perl-Users-Digest
Perl-Users Digest, Issue: 8110 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 24 18:05:18 2005
Date: Tue, 24 May 2005 15:05:07 -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 Tue, 24 May 2005 Volume: 10 Number: 8110
Today's topics:
Calculating time of employee session from the log date/ <jkamdar@mitre.org>
Re: Calculating time of employee session from the log d <spamtrap@dot-app.org>
Fibonacci string <darkon.tdo@gmail.com>
Re: Fibonacci string <someone@example.com>
Re: Fibonacci string <ddunham@redwood.taos.com>
Re: Fibonacci string unixSPAM@zeouane.org
Re: FormMail Problem <noreply@gunnar.cc>
Re: sendmail windows trouble <alexj@freesurf.ch>
Re: The Perl Review, Summer 2005 (David Combs)
Re: The Perl Review, Summer 2005 (David Combs)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 24 May 2005 16:55:25 -0400
From: Jayesh Kamdar <jkamdar@mitre.org>
Subject: Calculating time of employee session from the log date/time stamp using perl
Message-Id: <d704m6$54v$1@newslocal.mitre.org>
Hi,
I would appreciate if someone can point me to any perl command/module
that will let me calculate the session of the person was logged on to
corporate server. I have included a sample of log.
employee XXXXX logged in via VPN3000 at 01:37:34 on 04/18/2005 from
111.111.1.111
employee XXXX logged out of VPN3000 at 08:12:46 on 04/18/2005
Thanks,
Jayesh
------------------------------
Date: Tue, 24 May 2005 18:03:20 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Calculating time of employee session from the log date/time stamp using perl
Message-Id: <VamdnYr90uo0OQ7fRVn-jA@adelphia.com>
Jayesh Kamdar wrote:
> I would appreciate if someone can point me to any perl command/module
> that will let me calculate the session of the person was logged on to
> corporate server. I have included a sample of log.
>
> employee XXXXX logged in via VPN3000 at 01:37:34 on 04/18/2005 from
> 111.111.1.111
> employee XXXX logged out of VPN3000 at 08:12:46 on 04/18/2005
Regexes would be useful for splitting up the lines of the log:
perldoc perlretut
perldoc perlre
And Date::Manip would help parse and compare the time/date stamps.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Tue, 24 May 2005 19:05:52 -0000
From: "David K. Wall" <darkon.tdo@gmail.com>
Subject: Fibonacci string
Message-Id: <Xns9660999507FD9dkwwashere@216.168.3.30>
Here's a fun fact I ran across in the book _The Golden Ratio_, by
Mario Livio. Take the string '1' and replace it with '10'.
Thereafter, replace any occurrence of '1' with '10' and '0' with '1'.
Then count the number of 0s and 1s in the string. You get a
Fibonacci sequence for each count (offset by one iteration).
Here's Perl code to do it. You get about the same results if you
start with '0', just offset a little.
use strict;
use warnings;
my $v = '1';
for (1 .. 20) {
my ($n0, $n1) = (0, 0);
$v = join '',
map {
if ($_) {
$n1++;
'10';
}
else {
$n0++;
'1';
}
} split //, $v;
printf "%10d %10d\n", $n0, $n1;
}
--
David Wall
------------------------------
Date: Tue, 24 May 2005 20:42:41 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: Fibonacci string
Message-Id: <5lMke.9430$9A2.4623@edtnps89>
David K. Wall wrote:
> Here's a fun fact I ran across in the book _The Golden Ratio_, by
> Mario Livio. Take the string '1' and replace it with '10'.
> Thereafter, replace any occurrence of '1' with '10' and '0' with '1'.
> Then count the number of 0s and 1s in the string. You get a
> Fibonacci sequence for each count (offset by one iteration).
>
> Here's Perl code to do it. You get about the same results if you
> start with '0', just offset a little.
>
> use strict;
> use warnings;
>
> my $v = '1';
> for (1 .. 20) {
> my ($n0, $n1) = (0, 0);
> $v = join '',
> map {
> if ($_) {
> $n1++;
> '10';
> }
> else {
> $n0++;
> '1';
> }
> } split //, $v;
> printf "%10d %10d\n", $n0, $n1;
> }
You can make that shorter and faster:
my $v = '1';
for ( 1 .. 20 ) {
printf "%10d %10d\n", $v =~ y/0//, $v =~ y/1//;
$v =~ s/([01])/ $1 ? '10' : '1' /eg;
}
:-)
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 24 May 2005 20:48:12 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: Fibonacci string
Message-Id: <gqMke.1200$rY6.668@newssvr13.news.prodigy.com>
David K. Wall <darkon.tdo@gmail.com> wrote:
> use strict;
> use warnings;
> my $v = '1';
> for (1 .. 20) {
> my ($n0, $n1) = (0, 0);
> $v = join '',
> map {
> if ($_) {
> $n1++;
> '10';
> }
> else {
> $n0++;
> '1';
> }
> } split //, $v;
> printf "%10d %10d\n", $n0, $n1;
> }
Very nice...
I might do it this way and let the regex engine do some of the heavy
lifting.. :-)
use strict;
use warnings;
$_=0;
foreach my $loop ( 1 .. 20 )
{
s/(.)/$1?10:1/eg;
my $ones = tr/1//;
printf "%10d %10d\n", length() - $ones, $ones;
}
--
Darren Dunham ddunham@taos.com
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >
------------------------------
Date: Tue, 24 May 2005 23:05:16 +0200
From: unixSPAM@zeouane.org
Subject: Re: Fibonacci string
Message-Id: <1gx39gb.h38rgcf2k2kuN%unixSPAM@zeouane.org>
John W. Krahn <someone@example.com> wrote:
> > use strict;
> > use warnings;
> >
> > my $v = '1';
> > for (1 .. 20) {
> > my ($n0, $n1) = (0, 0);
> > $v = join '',
> > map {
> > if ($_) {
> > $n1++;
> > '10';
> > }
> > else {
> > $n0++;
> > '1';
> > }
> > } split //, $v;
> > printf "%10d %10d\n", $n0, $n1;
> > }
>
> You can make that shorter and faster:
>
>
> my $v = '1';
> for ( 1 .. 20 ) {
> printf "%10d %10d\n", $v =~ y/0//, $v =~ y/1//;
> $v =~ s/([01])/ $1 ? '10' : '1' /eg;
> }
We're not worthy !!
--
unix@zeouane.org
------------------------------
Date: Tue, 24 May 2005 17:38:35 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: FormMail Problem
Message-Id: <3fh00qF7degjU1@individual.net>
Anno Siegel wrote:
> Gunnar Hjalmarsson wrote:
>> Christopher Nehren wrote:
>>>> Olen R. Pearson wrote:
>>>>> I am using FormMail.CGI v. 1.92 (04/21/02) to process s form on a
>>>>> Website.
>>>
>>> *stop* using FormMail now. It's
>>> horribly, horrendously insecure and thoroughly broken.
>>
>> Even if I'm not sure, I have a feeling that you are referring to
>> previous versions. If also v. 1.92 deserves that verdict, it would be
>> nice if you (or somebody else) could explain *how* it's broken.
>
> I don't know about security but it's still substandard Perl code.
I do of course not suggest that it's good code in the light of today's
standards. Not even the author does, btw.
> I see no strict, no warnings, use of global package variables all over
> the place and a general lack of familiarity with Perl's possiblilities.
> Some use of qr() would help the code as would POSIX::strftime instead
> of the homebrew date conversion.
>
> One concrete example (there are more):
>
> $Config{'required'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
> $Config{'required'} =~ s/(\s+)?\n+(\s+)?//g;
> $Config{'env_report'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
> $Config{'env_report'} =~ s/(\s+)?\n+(\s+)?//g;
> $Config{'print_config'} =~ s/(\s+|\n)?,(\s+|\n)?/,/g;
> $Config{'print_config'} =~ s/(\s+)?\n+(\s+)?//g;
>
> That should be something like (untested):
>
> for ( @config{ qw( required env_report print_config} ) {
> s/(\s+|\n)?,(\s+|\n)?/,/g;
> s/(\s+)?\n+(\s+)?//g;
> }
Okay. But broken? Not just broken, but *thoroughly broken*?
> As mentioned I didn't look for holes (other people are presumably
> doing that),
I'm waiting. :)
> Clearly this code hasn't seen a ground-up rewrite
> since its beginnings under Perl 4.
There were two points I tried to raise by replying to Christopher's post:
1. Perl 4 style programs are not automatically *broken*.
2. When somebody claims that one of the most spread Perl scripts out
there is "horribly, horrendously insecure and thoroughly broken", it's
reasonble to demand that he provides evidence supporting the statement.
If he doesn't, maybe even can't, the claim tells me more about the
judgement of the one who makes the claim than about the code in question.
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 24 May 2005 17:12:59 +0200
From: Alexandre Jaquet <alexj@freesurf.ch>
Subject: Re: sendmail windows trouble
Message-Id: <4293447b$0$1152$5402220f@news.sunrise.ch>
Tad McClellan a écrit :
> Alexandre Jaquet <alexj@freesurf.ch> wrote:
>
>
>
>> my $tempfile = "temp.msg";
>
>
>
> CGI programs run in a multitasking environment, the file could get
> corrupted if two users hit this program at the same time...
>
>
>
>> open(MAIL,">$tempfile");
>
>
>
> You should always, yes *always*, check the return value from open():
>
> open(MAIL,">$tempfile") or die "could not open '$tempfile' $!";
>
>
>
>>I got
>
>
>
> You did?
>
>
>
>>[Tue May 24 14:03:36 2005] [error] [client 127.0.0.1] 'sendmail'
>>is not reconize as a internal program, referer:
>
> ^^^^^^^^
>
>>http://127.0.0.1/cgi-bin/recordz.cgi?lang=fr&page=register
>
>
>
> Please do not re-type error messages, use copy/paste instead.
>
>
>
>>I've added my sendmail path in the PATH var but still doesn't work.
>>
>>Any idea ?
>
>
>
> Use an absolute path to sendmail rather than relying on the PATH mechanism.
>
>
Thanks, but since I'm not in unix environmenet I will use MIME::Lite
package. it's working fine right now.
Anyway thanks for all.
Alexandre Jaquet
------------------------------
Date: Tue, 24 May 2005 18:01:59 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: The Perl Review, Summer 2005
Message-Id: <d6vq6n$lq5$1@reader1.panix.com>
In article <Xns964DDE8EF293castleamber@130.133.1.4>,
John Bokma <john@castleamber.com> wrote:
>Gregory Toomey wrote:
>
>> John Bokma wrote:
>>
>>>
>>> I just wonder how many people will perceive this as a commercial
>>> message...
Just how the heck are to find out that such a resource
even EXISTS, if not through here?
Plus, at least in this case, the "vendor" is a person
who has contributed GREATLY to THIS VERY NEWSGROUP!
Not only that, but his (foy's) post is about a means
to LEARN MORE about perl -- if that isn't of interest
to most (all?) readers of this group, then I don't
know what is!
I myself would like to see MORE such posts, of eg
especially conferences (non-free, thus "commercial") and books.
David
------------------------------
Date: Tue, 24 May 2005 18:09:33 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: The Perl Review, Summer 2005
Message-Id: <d6vqkt$jq1$1@reader1.panix.com>
In article <090520051650391392%comdog@panix.com>,
brian d foy <comdog@panix.com> wrote:
>In article <Xns964C24BF3C8castleamber@130.133.1.4>, John Bokma
><john@castleamber.com> wrote:
>
>> brian d foy wrote:
>>
>> > Prices: $16 in the US, $30 outside the US. Web only subscriptions
>> > are $16. If we can get enough subscribers in the European Union, we'll
>> > start printing there too and lower the cost.
>
>> I just wonder how many people will perceive this as a commercial message...
>
>
Over at comp.lang.lisp, one guy has talked at length
about his book, "Practical Common Lisp", and no one, as far
as I can tell, has complained.
(Well, he did post various versions of it on-line.)
Over at comp.unix.solaris, one guy has written, and talked
about at length, his book on programming to Solaris. Again,
no complaints that I've seen. (And, as far as I know, in
this case it is available only via getting from a publisher,
for money.)
In my opinion, the ends justifies the means -- *if* the
ends are of benefit to at least a substantial part
of a group's readership.
David
------------------------------
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 8110
***************************************