[18409] in Perl-Users-Digest
Perl-Users Digest, Issue: 577 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 27 21:05:41 2001
Date: Tue, 27 Mar 2001 18:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <985745113-v10-i577@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 27 Mar 2001 Volume: 10 Number: 577
Today's topics:
Check if process is running under cron <dersgniw@fuse.net>
Re: Checking for two end line symbols with regex (Tad McClellan)
Re: Checking for two end line symbols with regex <ren@tivoli.com>
Re: editing function output before assignment to a vari (Tad McClellan)
Re: editing function output before assignment to a vari <ren@tivoli.com>
Re: Help with External Programs <mischief@velma.motion.net>
How can I determine if a file descriptor is still avail <80801@gmx.net>
Re: HTTP Headers <bigusAT@btinternetDOT.com>
Re: HTTP Headers <bcoon@sequenom.com>
Re: More Help please :-) (Damian James)
Re: More Help please :-) <bart.lateur@skynet.be>
Re: More Help please :-) (Tad McClellan)
Re: More Help please :-) (Damian James)
passing strings containing variables to subs <kimmfc@mydeja.com>
Re: passing strings containing variables to subs <wyzelli@yahoo.com>
Re: passing strings containing variables to subs (Tad McClellan)
Perl CGI and GD?? <bcoon@sequenom.com>
Perl vs. Python <bcoon@sequenom.com>
Re: Perl vs. Python <bart.lateur@skynet.be>
Re: Perl::mySQL (Damian James)
Re: Read a scalar as a file? <uri@sysarch.com>
Re: score-based search engines? (Tad McClellan)
Re: score-based search engines? (Damian James)
Re: stat() or 'real' filesize of a file in an iso-files <pilsl_@goldfisch.at>
Re: stat() or 'real' filesize of a file in an iso-files <pilsl_@goldfisch.at>
Re: stat() or 'real' filesize of a file in an iso-files (John Joseph Trammell)
Re: stat() or 'real' filesize of a file in an iso-files <mischief@velma.motion.net>
Re: staying at the bottom on an html page (Tad McClellan)
Thank you to everyone who replied :-) nospam@thank.you
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 27 Mar 2001 19:28:49 -0500
From: "Brian" <dersgniw@fuse.net>
Subject: Check if process is running under cron
Message-Id: <tc2c54c1lj6qc2@corp.supernews.com>
I'm going to write a perl daemon process that will sleep for 60 seconds
(maybe a little more), check to see if some servers (programs) are up and
running, and then write some stats to a file.
I want to make sure that this is running so I was thinking about having a
CRON job that runs every hour or so to check if the perl process is running.
I'm doing this as a daemon instead of running the CRON job every 60 seconds
because in CRON, the job would have to login a separate box, then run the
script... I don't know which would be more process intensive.. probably
doesn't really matter.
Anyways, I was thinking that I would have the main perl script write the
perl job's process ID to a file, then have the cron job (also perl) read
that file to get the PID and then check to see if the job is running. If
it's not running, then it would kick off the process again.
I know there's probably a better way.. I did some searching and didn't
really find anything.
Any ideas?
------------------------------
Date: Tue, 27 Mar 2001 17:48:13 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Checking for two end line symbols with regex
Message-Id: <slrn9c265d.dh8.tadmc@tadmc26.august.net>
Andrej Kartashov <djusha@infotel.kg> wrote:
>
>Please help me, how I check that $category should not contain more
>than three end line
>symbols
>
>Like
>$category !~ /[\\n]{3,};
warn "too many lines\n" unless $category =~ tr/\n// <= 3;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 27 Mar 2001 17:13:41 -0600
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Checking for two end line symbols with regex
Message-Id: <m3d7b23ivu.fsf@dhcp9-175.support.tivoli.com>
On Wed, 28 Mar 2001, djusha@infotel.kg wrote:
> Please help me, how I check that $category should not contain more
> than three end line symbols
print "Good\n" if $category =~ tr/\n// < 3;
> Like
> $category !~ /[\\n]{3,};
Three problems with this:
1. Missing "/" at the end causes syntax error.
2. Extra backslash causes character class to be "\" and "n" -- not
"\n". Don't need the extra slash (or even the character class, for
that matter).
3. This will only catch consecutive newlines. If this is the desired
behavior, use:
print "Good\n" if $category !~ /\n{3}/;
You can exclude the "," since if it matches more than 3, it also
matches 3.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Tue, 27 Mar 2001 16:53:33 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: editing function output before assignment to a variable
Message-Id: <slrn9c22ut.daq.tadmc@tadmc26.august.net>
Mathew Kirsch <kirsch@kodak.com> wrote:
>I've been racking documentation for a solution to this, but apparently I don't
>know how to describe it well enough for a search to find what I want.
It is in perlop.pod ( I found it by trying "grep copy *.pod | grep modif"):
-----------------
Unlike in C, the scalar assignment operator produces a valid lvalue.
Modifying an assignment is equivalent to doing the assignment and
then modifying the variable that was assigned to. This is useful
for modifying a copy of something, like this:
($tmp = $global) =~ tr [A-Z] [a-z];
-----------------
>I want to combine these two lines:
>
>$dom = strftime("%d", localtime(parsedate("yesterday")));
>$dom =~ s/^0//;
>into one operation.
($dom = strftime("%d", localtime(parsedate("yesterday")))) =~ s/^0//;
But I like your original way better...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 27 Mar 2001 17:21:20 -0600
From: Ren Maddox <ren@tivoli.com>
Subject: Re: editing function output before assignment to a variable
Message-Id: <m38zlq3ij3.fsf@dhcp9-175.support.tivoli.com>
On Tue, 27 Mar 2001, kirsch@kodak.com wrote:
> $dom = strftime("%d", localtime(parsedate("yesterday")));
> $dom =~ s/^0//;
I see that Greg has already answered your question, but I thought I'd
just point out that strftime has %e which uses leading spaces instead
of leading zeroes. It doesn't give you exactly what you appear to
want, since a space will be on the front, but depending on your exact
need, I thought it might be useful.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 28 Mar 2001 01:52:00 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Help with External Programs
Message-Id: <tc2gu0760fst25@corp.supernews.com>
Aaron Cline <acline@okstateremovecaps.edu> wrote:
> Hello:
> I am trying to run wvdial from within a perl script. I am able to run it
> fine from with the script, but I can't get it to detach and run in the
> background so that the script will continue. I have tried using backticks
> and the sytem command. Can anyone tell me the command that will make it
> detach?
There are basically two ways to do this.
One is to use system or backticks (which you shouldn't use in a
void context) and use your shell's or the OS's way of starting
something in the background.
The other is to fork() a new process and have the child exec()
the program you want to run. This is how many shells on Unixoid
OSes launch programs start from the command line. You may want
to check the Perl docs for fork() and exec().
perldoc -f fork
perldoc -f exec
Chris
--
Christopher E. Stith
Where there's a will, there's a lawyer.
------------------------------
Date: Tue, 27 Mar 2001 14:24:26 -0700
From: "C. Lechner" <80801@gmx.net>
Subject: How can I determine if a file descriptor is still available ???
Message-Id: <3AC1050A.14494CA0@gmx.net>
Hallo,
I've written the following code and it works fine
till the other end of the connection closes the
socket:
socket (C_SOCK, PF_INET, SOCK_STREAM, $proto);
while (1)
{
my $l = sysread SOCK, $data, 32;
if ($l)
{
syswrite C_SOCK, $data;
}
print "#";
}
I'd like the code to leave the while-loop when
the other end closes the connection instead of
bombing STDOUT w/ hashes. How can I do this ?
CU
- CL
------------------------------
Date: Wed, 28 Mar 2001 00:56:20 +0100
From: "S Warhurst" <bigusAT@btinternetDOT.com>
Subject: Re: HTTP Headers
Message-Id: <99r905$jo6$1@uranium.btinternet.com>
"brian d foy" <comdog@panix.com> wrote in message
news:comdog-D84B53.12543727032001@news.panix.com...
> In article <99pt18$itk@newton.cc.rl.ac.uk>, "S Warhurst"
> <s.warhurst@rl.ac.uk> wrote:
>
> > Can anyone tell me how to retrieve all the http header information
passed
> > from the client to server, and break it down into pairs? I have been
> > searching for a while but can't find any routines to do it.
>
> how are you trying to do this and what are you trying to accomplish?
Well basically, when a user on our intranet goes to the particular webpage I
want it to just display what they are entitled to see. Now, we are using an
NT network & I believe the users NT logon user id can be passed in the HTTP
header information by the "auth" parameter?. That could then be extracted by
Perl & Perl build the web page according to what I want the particular user
to see.
Thanks
Spencer
------------------------------
Date: Tue, 27 Mar 2001 15:59:37 -0800
From: Bryan Coon <bcoon@sequenom.com>
Subject: Re: HTTP Headers
Message-Id: <3AC12969.8DB9908D@sequenom.com>
S Warhurst wrote:
> "brian d foy" <comdog@panix.com> wrote in message
> news:comdog-D84B53.12543727032001@news.panix.com...
> > In article <99pt18$itk@newton.cc.rl.ac.uk>, "S Warhurst"
> > <s.warhurst@rl.ac.uk> wrote:
> >
> > > Can anyone tell me how to retrieve all the http header information
> passed
> > > from the client to server, and break it down into pairs? I have been
> > > searching for a while but can't find any routines to do it.
> >
> > how are you trying to do this and what are you trying to accomplish?
>
> Well basically, when a user on our intranet goes to the particular webpage I
> want it to just display what they are entitled to see. Now, we are using an
> NT network & I believe the users NT logon user id can be passed in the HTTP
> header information by the "auth" parameter?. That could then be extracted by
> Perl & Perl build the web page according to what I want the particular user
> to see.
>
> Thanks
> Spencer
Do you mean a web based login or the NT login? NT Login will pass information
to in a header? News to me. But If its web, use CGI. If its NT, I have no
clue how 'auth' works, but if it is in the header information, CGI will pick it
up. You can even just dump out everything CGI collected and see what you
caught.
Good luck!
Bryan
------------------------------
Date: 27 Mar 2001 23:50:01 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: More Help please :-)
Message-Id: <slrn9c29o3.19b.damian@puma.qimr.edu.au>
brian d foy chose Tue, 27 Mar 2001 13:05:48 -0600 to say this:
>...
> my %hash = map { $_, 1 } @array;
> my @unique = keys %hash;
>
Or, to preserve the original order of @array:
my %seen = ();
my @unique = grep { not $seen{$_}++ } @array;
Why isn't this is in the FAQ?
perldoc -q unique only gives me:
How can I get the unique keys from two hashes?
How can I call my system's unique C functions from Perl?
Do I need to {update mine}||{submit a doc patch}?
Cheers,
Damian
--
@;=0..23;@;{@;}=split//,<DATA>;while(@;){for($;=@;;--$;;){next if($:=rand($;
+1))==0+$;;@;[$;,$:]=@;[$:,$;]}print map{$;{$_}}(@| ,@;);push@|,shift@;if$;[
0]==@|;$|=1;select$&,$&,$&,1/80;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker
------------------------------
Date: Wed, 28 Mar 2001 00:46:56 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: More Help please :-)
Message-Id: <n1d2ctc273v3mhslvue2dtm2fe0o8k5ael@4ax.com>
Damian James wrote:
>brian d foy chose Tue, 27 Mar 2001 13:05:48 -0600 to say this:
>
>> my %hash = map { $_, 1 } @array;
>> my @unique = keys %hash;
>
>Or, to preserve the original order of @array:
The OP said:
:Is there a quick way of removing the
:duplicate lines? While the script is sorting the list?
So he's not too desperate keeping the list in order.
my %hash = map { $_, 1 } @array;
my @unique = sort keys %hash;
That's more like it.
p.s. You chose keep the first occurence of an item. What if one wants to
keep the last occurence instead?
--
Bart.
------------------------------
Date: Tue, 27 Mar 2001 19:40:59 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: More Help please :-)
Message-Id: <slrn9c2cor.et9.tadmc@tadmc26.august.net>
Damian James <damian@qimr.edu.au> wrote:
>brian d foy chose Tue, 27 Mar 2001 13:05:48 -0600 to say this:
>>...
>> my %hash = map { $_, 1 } @array;
>> my @unique = keys %hash;
>>
>
>Or, to preserve the original order of @array:
>
> my %seen = ();
> my @unique = grep { not $seen{$_}++ } @array;
>
>Why isn't this is in the FAQ?
"How can I remove duplicate elements from a list or array?"
--------------
undef %saw;
@out = grep(!$saw{$_}++, @in);
--------------
Looks familiar :-)
>perldoc -q unique only gives me:
>
> How can I get the unique keys from two hashes?
> How can I call my system's unique C functions from Perl?
>
>Do I need to {update mine}||{submit a doc patch}?
No, you need to switch to searching for the inverse of terms that
don't find hits :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 28 Mar 2001 02:03:04 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: More Help please :-)
Message-Id: <slrn9c2hhi.6q3.damian@puma.qimr.edu.au>
Tad McClellan chose Tue, 27 Mar 2001 19:40:59 -0500 to say this:
>
> "How can I remove duplicate elements from a list or array?"
>
>--------------
> undef %saw;
> @out = grep(!$saw{$_}++, @in);
>--------------
>
>Looks familiar :-)
Ack! -- oh well, knew it had to be there somewhere.
>
>...you need to switch to searching for the inverse of terms that
>don't find hits :-)
>
Indeed.
Cheers,
Damian
[ *very* embarrased ]
--
@;=0..23;@;{@;}=split//,<DATA>;while(@;){for($;=@;;--$;;){next if($:=rand($;
+1))==0+$;;@;[$;,$:]=@;[$:,$;]}print map{$;{$_}}(@| ,@;);push@|,shift@;if$;[
0]==@|;$|=1;select$&,$&,$&,1/80;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker
------------------------------
Date: Tue, 27 Mar 2001 23:28:46 GMT
From: Kim C <kimmfc@mydeja.com>
Subject: passing strings containing variables to subs
Message-Id: <h372cts3iuqv4g7alb3p7m6t2duv7lverl@4ax.com>
Hi,
How does one pass a string containing a variable to a subroutine, and
have that variable evaluated in the subroutine?
Example:
chdir "$some_dir" || log_errors("Could not chdir to $some_dir: $!\n");
sub log_errors {
print ERRORS localtime(time);
print ERRORS join "\n" , @_; ## Must handle more than one string
}
This prints the literal string without evaluating the variables:
Sun Mar 25 15:00:00 2001 Could not chdir to $some_dir: $!
How do I force interpretation? And, although I do want to implement
this correctly, writing errors to a log is not too uncommon a task.
Is there a standard way of doing this I'm not aware of?
Thanks,
Kim.
------------------------------
Date: Wed, 28 Mar 2001 10:39:53 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: passing strings containing variables to subs
Message-Id: <NEaw6.7$NL1.2721@vic.nntp.telstra.net>
"Kim C" <kimmfc@mydeja.com> wrote in message
news:h372cts3iuqv4g7alb3p7m6t2duv7lverl@4ax.com...
> Hi,
>
> How does one pass a string containing a variable to a subroutine, and
> have that variable evaluated in the subroutine?
> Example:
>
> chdir "$some_dir" || log_errors("Could not chdir to $some_dir: $!\n");
>
> sub log_errors {
> print ERRORS localtime(time);
> print ERRORS join "\n" , @_; ## Must handle more than one string
> }
>
>
> This prints the literal string without evaluating the variables:
>
> Sun Mar 25 15:00:00 2001 Could not chdir to $some_dir: $!
You must be insertinf 'scalar' and a space in the first print then.
Otherwise, it works fine for me.
Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass
it around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";
------------------------------
Date: Tue, 27 Mar 2001 19:34:50 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: passing strings containing variables to subs
Message-Id: <slrn9c2cd9.et9.tadmc@tadmc26.august.net>
Kim C <kimmfc@mydeja.com> wrote:
>
>How does one pass a string containing a variable to a subroutine, and
>have that variable evaluated in the subroutine?
>Example:
Your example does not require that it be "evaluated" (you mean
"interpolated" there) "in the subroutine".
It can be interpolated "in the subroutine call" just fine.
>This prints the literal string without evaluating the variables:
That makes warnings about unopened filehandles for me. Let's change
it into a complete program that folks can run:
-----------------------
#!/usr/bin/perl -w
use strict;
my $some_dir = 'no_such_dir';
chdir $some_dir || log_errors("Could not chdir to $some_dir: $!\n");
sub log_errors {
print localtime(time);
print join "\n" , @_; ## Must handle more than one string
}
-----------------------
output:
16192721012850Could not chdir to no_such_dir: No such file or directory
I also removed the useless quotes around the $some_dir variable.
It works for me.
> Sun Mar 25 15:00:00 2001 Could not chdir to $some_dir: $!
^^^^^^^^^^^^^^^^^^^^^^^^
localtime() does not do that in list context, as you have it above.
There is something else that you're not telling us...
I cannot duplicate your problem. There is something else that
you're not telling us...
>How do I force interpretation?
Perl FAQ, part 4:
"How can I expand variables in text strings?"
But I don't see any variables in text strings in your code.
Please post a complete program that we can run that illustrates
your problem, and we will help you fix it.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 27 Mar 2001 15:53:09 -0800
From: Bryan Coon <bcoon@sequenom.com>
Subject: Perl CGI and GD??
Message-Id: <3AC127E5.BA75D283@sequenom.com>
Is there any way to generate images directly with GD to stdout when
using cgi in a form? I have tried several tricks, none work.
What I need is to have an image generated on the fly, and embedded in a
form. This is not working, as the only documentation I found does
describe how to do this, ( binmode STDOUT; print STDOUT $im->png(); )
but this only works if you have an appropriate header (Content-type:
image/png or whatever). I am pretty sure that I HAVE to use
multipart:form-data here. Is this possible? Maybe I have to call a
separate script with my image tag?
Mainly I want to avoid littering my drive with a ton of little images,
each of which will be unique (yuck!). I think it is much cleaner to do
it inline.
Thanks!
Bryan
------------------------------
Date: Tue, 27 Mar 2001 16:44:55 -0800
From: Bryan Coon <bcoon@sequenom.com>
Subject: Perl vs. Python
Message-Id: <3AC13407.F0D2721E@sequenom.com>
Hi, I am looking for information on which language is better for web
development. I am currently using perl 5, and am quite happy with it,
yet I wonder if Pythons OO nature may be better suited for what I do.
I have looked all over usenet, perl.com and python.org and am not
satisfied with the info I got.
Some of the things I do in Perl and the modules I use to do them:
Lots of MySQL queries (inserts/updates).
->DBI
Generation of html tables from query
set. ->Data::Table
GD dynamic image generation corresponding to DB queries. ->GD,
GD::Graph
Loads of forms, javascript
stuff. ->CGI
Forked system calls to a linux cluster running PBS.
->POSIX
Along with some specialized modules I wrote for my app (a bio package).
I poked around the Vaults of Parnassus and there are some things, but
not nearly as much as Perl (of course).
Can anyone offer insight on how Python deals with the things I work
with, and what are the pros and cons for perl/python on this kind of
programming?
Sorry for the kind of vague nature of the question, Im just looking for
some input from anyone who has experience doing these things in both
languages.
Thanks!
Bryan
P.S. (Sorry for using the PY word in the perl newsgroup)
------------------------------
Date: Wed, 28 Mar 2001 01:46:47 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl vs. Python
Message-Id: <6hg2ctgqklms9ptg8otk83019sd6f1hlvl@4ax.com>
Bryan Coon wrote:
>Hi, I am looking for information on which language is better for web
>development. I am currently using perl 5, and am quite happy with it,
>yet I wonder if Pythons OO nature may be better suited for what I do.
>I have looked all over usenet, perl.com and python.org and am not
>satisfied with the info I got.
Eek!
Nobody can answer that question but yourself. It's not like trying out
Python costs a lot of money, so try it out for yourself. You might like
it, or maybe not. I'm not fond of it myself, but if it had been here ten
odd years ago, I think I might have been addicted. Now I've got
something I like better. Perl feels more natural to me. And: less
restrictive.
--
Bart.
------------------------------
Date: 28 Mar 2001 00:18:46 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Perl::mySQL
Message-Id: <slrn9c2be1.19b.damian@puma.qimr.edu.au>
Richard Dobson chose Tue, 27 Mar 2001 12:12:15 GMT to say this:
>...
>I am planning it with Perl DBI and mySQL. I would like the files to be within
>the database and to open them from a browser. Is there a function within perl
>for storing documents as opposed to text records within mySQL.
>
>Any guidance would be a great help. Is perl the best tool for this?
>
You don't want a Perl function -- you probably want to check out MySQL's
BLOB data type. Of course, if the document is really a text file, you would
just use the TEXT data type.
HTH
Cheers,
Damian
--
@;=0..23;@;{@;}=split//,<DATA>;while(@;){for($;=@;;--$;;){next if($:=rand($;
+1))==0+$;;@;[$;,$:]=@;[$:,$;]}print map{$;{$_}}(@| ,@;);push@|,shift@;if$;[
0]==@|;$|=1;select$&,$&,$&,1/80;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker
------------------------------
Date: Wed, 28 Mar 2001 00:45:32 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Read a scalar as a file?
Message-Id: <x7d7b2zpoz.fsf@home.sysarch.com>
>>>>> "x" == xris <user@host.com> writes:
x> I'm messing with images, and currently have to write them to disk
x> before performing any tests on them, but I'm wondering if there's a
x> way to read a variable as if it was a file (so I can call something
x> similar to read or sysread on it)...
IO::Scalar found on CPAN
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Tue, 27 Mar 2001 17:16:27 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: score-based search engines?
Message-Id: <slrn9c249r.daq.tadmc@tadmc26.august.net>
xris <user@host.com> wrote:
>p.s. Please reply to the group, this email address is obviously fake
Not obviously enough. Please consider using "user@host.com.invalid"
instead. *That* would be obvious.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 28 Mar 2001 00:06:30 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: score-based search engines?
Message-Id: <slrn9c2an0.19b.damian@puma.qimr.edu.au>
xris chose Tue, 27 Mar 2001 00:04:59 -0600 to say this:
> ...
>
>p.s. Please reply to the group, this email address is obviously fake (I
>get too much spam as it is to entice more from newsgroup spiders)
[OT]
Since I embarked upon the turgid waters of Usenet about four months ago (had
previously avoided it in favour of mailing lists), all the time using one
of my real email addresses that I check every day, I have found that I
receive maybe 2 or 3 more spam emails each week than I did previously.
Sure, I mostly only lurk, but I have been posting enough to clpm lately
to make the stats.
That many messages is no bother to me, and taken care of by filters anyway.
I understand why people would want to mung their email addresses here, but
tend to feel that it has more to do with FUD than anything else.
Oh well, that's my 5c (Australia doesn't have 1c or 2c coins anymore).
Cheers,
Damian
--
@;=0..23;@;{@;}=split//,<DATA>;while(@;){for($;=@;;--$;;){next if($:=rand($;
+1))==0+$;;@;[$;,$:]=@;[$:,$;]}print map{$;{$_}}(@| ,@;);push@|,shift@;if$;[
0]==@|;$|=1;select$&,$&,$&,1/80;print"\b"x(@;+@|)}print"\n"__END__
Just another Perl Hacker
------------------------------
Date: Wed, 28 Mar 2001 02:04:58 +0200
From: peter pilsl <pilsl_@goldfisch.at>
Subject: Re: stat() or 'real' filesize of a file in an iso-filesystem
Message-Id: <MPG.152b4916e61b7c9a9897c5@news.inode.at>
In article <slrn9c1lb1.kd9.trammell@bayazid.hypersloth.net>,
trammell@bayazid.hypersloth.invalid says...
>
> True in general, but if the files are all much smaller than
> the "knapsack", a 'pretty good' solution is calculable.
>
> Peter: what does a histogram of your file sizes look like?
>
It looks quite fine. A few real big one and then decreasing down and a
huge amount of small files. (its like 1/x, where y is the size and x the
numbers ;)
The algorithm works fine: sort by size, start with biggest and drop the
file in the first container where it fits. If you have enough small files
you come pretty close to "full" for all containers (but the last, which
wont get full of course) in no time.
peter
--
pilsl@
goldfisch.at
------------------------------
Date: Wed, 28 Mar 2001 02:08:18 +0200
From: peter pilsl <pilsl_@goldfisch.at>
Subject: Re: stat() or 'real' filesize of a file in an iso-filesystem
Message-Id: <MPG.152b49da1daf56019897c6@news.inode.at>
In article <slrn9c1jik.alk.abigail@tsathoggua.rlyeh.net>, abigail@foad.org
says...
> peter pilsl (pilsl_@goldfisch.at) wrote on MMDCCLXV September MCMXCIII in
> <URL:news:MPG.152ade4bcdf1ed719897c1@news.inode.at>:
> //
> // I am scanning 100.000 files and create subsets for burning on cdrom. To
> // fill each cdrom as most as possible, I need to know for each file and
>
> That's the 0-1 knapsack problem. Which is NP-complete. You really do
> not want to calculate the optimal way to write your CDs, unless you can
> afford to wait far past the heat-death of the universe.
>
I am interested what NP means. My files arent size-distributed linear, so
I got quite an easy and fast algorithm (look at the other posting)
>
> That sounds like a very filesystem specific question, and should be
> asked elsewhere.
>
seems you are right, can please anyone tell me where ? There is no
filesystemgroup, so it will be OT almost everywhere and the usual HOWTOS
dont go that far into the detail.
Maybe this means I have to read the iso9660-standard-definitions ... :-(
;) thnx,
peter
--
pilsl@
goldfisch.at
------------------------------
Date: Wed, 28 Mar 2001 00:11:53 GMT
From: trammell@bayazid.hypersloth.invalid (John Joseph Trammell)
Subject: Re: stat() or 'real' filesize of a file in an iso-filesystem
Message-Id: <slrn9c292g.l1a.trammell@bayazid.hypersloth.net>
On Wed, 28 Mar 2001 02:08:18 +0200, peter pilsl wrote:
> Maybe this means I have to read the iso9660-standard-definitions ... :-(
I would suspect that the documentation for your image-creating
or CD-recording software would have this.
Luck,
J
------------------------------
Date: Wed, 28 Mar 2001 01:48:01 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: stat() or 'real' filesize of a file in an iso-filesystem
Message-Id: <tc2gmhgps1vp89@corp.supernews.com>
peter pilsl <pilsl_@goldfisch.at> wrote:
> In article <slrn9c1jik.alk.abigail@tsathoggua.rlyeh.net>, abigail@foad.org
> says...
>> peter pilsl (pilsl_@goldfisch.at) wrote on MMDCCLXV September MCMXCIII in
>> <URL:news:MPG.152ade4bcdf1ed719897c1@news.inode.at>:
>> //
>> // I am scanning 100.000 files and create subsets for burning on cdrom. To
>> // fill each cdrom as most as possible, I need to know for each file and
>>
>> That's the 0-1 knapsack problem. Which is NP-complete. You really do
>> not want to calculate the optimal way to write your CDs, unless you can
>> afford to wait far past the heat-death of the universe.
>>
> I am interested what NP means. My files arent size-distributed linear, so
> I got quite an easy and fast algorithm (look at the other posting)
`NP' means nodeterministic polynomial. It means that it has not been
determined whether or not a polynomial solution for the problem can
ever be found. Most NP problems are placed in that class because it
is thought unlikely they will ever be solved in polynomial time. These
are classified NP because it's not proven they are non-polynomial nor
that the are polynomial. A given solution can often be found to be
either correct or incorrect in polynomial time.
A special subclass of NP is NP-Complete, which is a fairly large
class of problems which are thought to be nonpolynomial by many
experts, but which all can be transposed from one NP-Complete
problem to another in polynomial time. All of these can have a
protential solution found to be correct or incorrect in polynomial
time, once the solution has actually been found (which cannot, as
yet, be done in polynomial time). If someone ever finds a way to
solve an NP-Complete problem in polynomial time, then all of NP
complete moves to class P.
All this being said, there are many suboptimal approximation
routines for many NP problems which can be run in polynomial
time. The Traveling Salesman Problem, the Towers of Hanoi,
and other NP-Complete problems are the subjects of much research.
One interesting NP-Complete problem which was found in the past
year or two to be NP-Complete is how to test whether a given
Minesweeper game state is logically consistent internally. Maybe
this will be the path which leads someone to cracking the
NP-Complete enigma. ;-)
If all of this is not understood, you may want to read a good
book on the complexity of algorithms, such as
_Computers and Intractability:_
_A Guide to the Theory of NP-Completeness_
Michael R. Garey, David S. Johnson
Format: Textbook Paperback, 338pp.
ISBN: 0716710455
Publisher: W. H. Freeman Company
Pub. Date: November 1990
or some of the other ones that bn.com gave me after a search on
`NP-Complete', `complexity', or `algorithm'. Some of them even
offer approximation algorithms for NP-Complete and NP-Hard
problems.
Chris
--
Christopher E. Stith
You must not lose faith in humanity. Humanity is an ocean;
if a few drops of the ocean are dirty, the ocean does not
become dirty. -- Mohandas K. Gandhi
------------------------------
Date: Tue, 27 Mar 2001 16:14:23 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: staying at the bottom on an html page
Message-Id: <slrn9c20lf.daq.tadmc@tadmc26.august.net>
GWN <chart@bestweb.net> wrote:
>Is there a way to have a web page that is output by a perl cgi script
>display the bottom of the page after printing and not the top?
^^^^^^^^
^^^^^^^^ huh?
Yes.
How a browser displays a web page is not about Perl.
We discuss Perl in this newsgroup.
They discuss how browsers work in other newsgroups. Please ask
over there.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 27 Mar 2001 21:46:40 GMT
From: nospam@thank.you
Subject: Thank you to everyone who replied :-)
Message-Id: <3ac10a1d.6028578@news.freeserve.co.uk>
On Tue, 27 Mar 2001 04:46:08 GMT, nospam@thank.you wrote:
>Hi,
>
>I've written a simple Perl script which creates an emailing list ie, a
>user enters their email address into a html form, the script adds
>their email address to the list. This works fine at the moment but is
>it possible to locate the list file somewhere other than in the
>cgi-bin or a cgi-bin sub-directory - In other words I'd like to
>store/host the list file in another domain. eg.
>www.somewhere.else.com/list/list.txt
>
>I'm currently using;
>
>$file = "maillist/maillist.txt";
>
>to store the file name .
>
>
>Thanks in advance :-)
Thank you to everyone who replied :-)
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 577
**************************************