[16639] in Perl-Users-Digest
Perl-Users Digest, Issue: 4051 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 17 21:06:07 2000
Date: Thu, 17 Aug 2000 18:05:19 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <966560718-v9-i4051@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 17 Aug 2000 Volume: 9 Number: 4051
Today's topics:
Anwering my own question.. Re: More Parse::RecDescent q <ocschwar@mit.edu>
Re: Checking if variables exist <elephant@squirrelgroup.com>
Re: Checking if variables exist <vrillusions@mail.com>
Re: Checking if variables exist <abe@ztreet.demon.nl>
Re: close window <-EViL-DOC-@BLUR.COM>
Re: Deleting messages from web board <timewarp@shentel.net>
Re: Deleting messages from web board <timewarp@shentel.net>
Re: DOS Batch to PERL Conversion <bkennedy@hmsonline.com>
Re: FileHandle in array <ceeeya@my-deja.com>
Re: Finding a duplicate character <lr@hpl.hp.com>
Re: grepping for multiple fields <abe@ztreet.demon.nl>
Re: grepping for multiple fields <care227@attglobal.net>
Re: grepping for multiple fields <ren.maddox@tivoli.com>
Re: help i'm stuck!!! (Richard J. Rauenzahn)
Re: Help please! <elephant@squirrelgroup.com>
How do I get statistics from Win NT processes? (ie tot <garyb1@home.com>
Re: I have another question pape_98@my-deja.com
Re: Image Manipulation Question <elijah@workspot.net>
Looking for a SCRIPT= (=?ISO-8859-1?Q?BigB=90=90=99?=)
Re: Mailform <mercan.1@osu.edu>
Re: mkdir problem!! (Brandon Metcalf)
Re: need help with msql and perl <mje@shakha.com>
OT: Anyone interested in selling their Perl 4 books tha newdebugger@my-deja.com
Re: Out of memory! error. Working with arrays... (Mark-Jason Dominus)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 17 Aug 2000 23:11:17 +0000
From: Omri Schwarz <ocschwar@mit.edu>
Subject: Anwering my own question.. Re: More Parse::RecDescent questions.
Message-Id: <399C7115.380CB3BA@mit.edu>
'foo'(s) is bad.
('foo')(s) is good.
Next question:
/^\\]\n/ in a rule becomes
m/[^\]\n/ as far as the parser is concerned.
How do I fix that?
------------------------------
Date: Thu, 17 Aug 2000 22:40:42 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Checking if variables exist
Message-Id: <MPG.1407075ba39c070c9896c3@localhost>
[ posted to comp.lang.perl.misc and CCed to vrillusions@mail.com ]
Larry Rosler wrote ..
>In article <MPG.1406133677d681599896c1@localhost> on Thu, 17 Aug 2000
>05:19:08 GMT, jason <elephant@squirrelgroup.com> says...
>
>...
>
>> a) a scalar is false if it is undefined or if it equals the null string
>> or if the numeric value of the scalar is zero
>
>It's slightly more complicated than that.
>
>A scalar is false if it is undefined or if it equals the null string
>or if it equals the string '0' or if it is a number whose value is 0.
>
>Thus a scalar with value '00' is true, but if assigned '00' + 0 it is
>false, as is -0.0e100, etc.
ahh yes .. thanks for the correction .. it is an important difference
and covers other strings like 'abc' which when evaluated numerically
have the value of zero but in a boolean context are true
sorry for the misinformation
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Thu, 17 Aug 2000 22:58:04 GMT
From: Todd Eddy <vrillusions@mail.com>
Subject: Re: Checking if variables exist
Message-Id: <399C6E07.F079322F@mail.com>
This is the reason why I don't post the whole script, I end up getting flamed
("...Some CGI you're doing
there."). This is only my second script I have ever made, give me a f#$%ing break
here. All I wanted to know was how to make sure that certain fields were filled out,
thats all. Not a disection of my script pointing out all the errors. In my opinion,
if it works, keep it. Like that -wT part, I have NEVER seen that on any of the
online resources I have looked at for tutorials and stuff (about 6 or 7 sites) nor
have I seen that in any of the 10 or so scripts I have installed. Thus it must not
be that standard of practice. Same goes for the rest of it, if all of that is
working, then why mess with it? And whats really got me mad and why I took the time
to reply is WHERE THE HELL DO YOU GIVE ANY HELP ON THE SUBJECT??????? Your giving me
all of these suggestions to make it 'better' and yet you don't even help me with the
problem I am having, that being I can't get the error checking to work. Its people
like you, who are not only insulting, but don't even touch on the subject that the
person is asking, that makes me hate everytime I run into a problem and I post here
for help. The only reason I am making this script is because a friend wants to
something to happen automatically without him having to do anything. I would have
just entered everything in manually then deal with some of the rude people in these
newsgroups.
Abe Timmerman wrote:
> On Thu, 17 Aug 2000 04:59:48 GMT, Todd Eddy <vrillusions@mail.com>
> wrote:
>
> > I didn't think you would need the rest of it, since it really won't effect this
> > in any way, so I thought I would just post that to save a little on the loading
> > time. So heres the whole thing:
> >
> > #!/usr/bin/perl
> No warnings, no Taint checking, no strictness; Some CGI you're doing
> there.
>
> #!/usr/bin/perl -wT
> use strict;
>
> > ###############
> > # Form Processing Section
> > #########################
> > # Determining whether or not the <FORM> method is GET or POST
> > # if it is GET, that means all the data was appended to the URL
> > # if it is POST, all the data was put into STDIN, a data buffer
>
> Please stop doing that. There is a module that does this for you (and
> better).
>
> While you are studying the documentation that comes with CGI.pm, 'fix'
> your script like:
>
> use CGI qw(:standard);
> use CGI::Carp 'fatalsToBrowser';
>
> my %FORM = map { $_ => param($_) } param();
>
> And start using the tools suitable for the job, it's all in the CGI.pm
> package.
>
> > # Send data as html
> > ###################
> > print "Content-type: text/html\n\n";
>
> print header;
>
> > # Parsing the variables
> > #######################
> > $date = $FORM{'LAN_Date'};
> > $newdate = $date;
> > $newdate =~ tr[/][-]; # replace /es with -es
> > @filedate = split(/-/, $newdate);
> > if ($filedate[0] < 9) { $filedate[0] = "0".$filedate[0]; }
> > if ($filedate[1] < 9) { $filedate[1] = "0".$filedate[1]; }
> > $filedate = "20".$filedate[2]."-".$filedate[0]."-".$filedate[1];
> > $datalocation = $datadir.$filedate.".df";
>
> my $datalocation = sprintf "${datadir}20%d-%02d-%02d.df",
> (split m!/!, param('LAN_Date'))[2, 0, 1];
>
> [rest left as an exercise]
>
> --
> Good luck,
> Abe
--
Todd Eddy
vrillusions@mail.com
http://www.vrillusions.com/
------------------------------
Date: Fri, 18 Aug 2000 02:07:49 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Checking if variables exist
Message-Id: <18uopsocdbkikgftb1b1e6ncm8p41dmu0e@4ax.com>
[ Please put your comments following the (suitably trimmed) text you are
responding to ]
[ Some sort of order restored ]
On Thu, 17 Aug 2000 22:58:04 GMT, Todd Eddy <vrillusions@mail.com>
wrote:
> Abe Timmerman wrote:
>
> > On Thu, 17 Aug 2000 04:59:48 GMT, Todd Eddy <vrillusions@mail.com>
> > wrote:
...
> > >
> > > #!/usr/bin/perl
> > No warnings, no Taint checking, no strictness; Some CGI you're doing
> > there.
> >
> This is the reason why I don't post the whole script, I end up getting flamed
> ("...Some CGI you're doing
> there."). This is only my second script I have ever made, give me a f#$%ing break
> here.
I only criticized your code, that's no where near flaming.
> > #!/usr/bin/perl -wT
> > use strict;
> >
> Like that -wT part, I have NEVER seen that on any of the
> online resources I have looked at for tutorials and stuff (about 6 or 7 sites) nor
> have I seen that in any of the 10 or so scripts I have installed. Thus it must not
> be that standard of practice. Same goes for the rest of it, if all of that is
> working, then why mess with it?
>
'-w' turns on warnings, which is very helpful when you are developing a
program. '-T' turns on taint checking (see perlsec manpage) which should
be in cgi programs. If you consult sources that do not use these
features and prefer that, ok, but don't come asking here if it bit you.
...
> > While you are studying the documentation that comes with CGI.pm, 'fix'
> > your script like:
> >
> > use CGI qw(:standard);
> > use CGI::Carp 'fatalsToBrowser';
...
> And whats really got me mad and why I took the time
> to reply is WHERE THE HELL DO YOU GIVE ANY HELP ON THE SUBJECT??????? Your giving me
> all of these suggestions to make it 'better' and yet you don't even help me with the
> problem I am having, that being I can't get the error checking to work.
You probably got so mad, that you didn't even look at my answer. By
putting the line:
use CGI::Carp 'fatalsToBrowser';
in your script, it will show the message of your die() in the browser.
Please start reading the documentation for CGI.pm (and family).
perldoc CGI::Carp
perldoc CGI
--
Good luck,
Abe
------------------------------
Date: Fri, 18 Aug 2000 09:52:31 +1000
From: "-EViL-DOC-" <-EViL-DOC-@BLUR.COM>
Subject: Re: close window
Message-Id: <8nhtjn$f2f$1@nina.pacific.net.au>
hehehehehehehe
"Gwyn Judd" <tjla@guvfybir.qlaqaf.bet> wrote in message
news:slrn8pnouo.306.tjla@thislove.dyndns.org...
> I was shocked! How could Flip <radjis@hotmail.com>
> say such a terrible thing:
> >Could anybody tell me what the perl command is to close the current
> >browserwindow
>
> kill 9, $netscape_pid;
>
> usually does it for me
>
> --
> Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
> He played the king as if afraid someone else would play the ace.
> -- John Mason Brown, drama critic
------------------------------
Date: Thu, 17 Aug 2000 18:35:58 -0400
From: Albert Dewey <timewarp@shentel.net>
Subject: Re: Deleting messages from web board
Message-Id: <399C68CE.65B4BA31@shentel.net>
Its called crontab - check your how-to's and tell your server admin to set up one for you.
xlr555usa@netscape.net wrote:
> Hi,
>
> I am using Matt's wwwboard (scriptarchive.com) and I am trying to modify the wwwadmin.pl file so that entries older than a week will be deleted automatically.
>
> Is there a way to create a conditional statement with the date function that will allow me to do this?
>
> Any suggestions are greatly appreciated.
>
> I posted my code for wwwadmin.pl here:
>
> http://home.mindspring.com/~lexmesa/stest/wwwadmin.pl.txt
>
> regards,
>
> Tim
>
> ==================================
> Posted via http://nodevice.com
> Linux Programmer's Site
------------------------------
Date: Thu, 17 Aug 2000 18:57:20 -0400
From: Albert Dewey <timewarp@shentel.net>
Subject: Re: Deleting messages from web board
Message-Id: <399C6DCF.E47E0783@shentel.net>
Tim -
I must apologize for any rudeness here but my experience with anything at Matt's site it that those codes are so poorly written and out of date that managing them
through internal modification is a test of a zen master's patience. Anyway, you will have to find the 'timestamp' (if any) that should be recorded as part of each
message posting. Then you will have to create a simple perl routine that, when run, will compare each of these time stamps with the current time of the server and
delete any messages that are older than one week. Then you will have to get your server admin to setup a crontab file to run this perl routine every 24 hours and
the rest will be handled automatically. You probably do not want to have this routine tied to any of the routines found in the normal messageboard operations,
(such as everytime a user posts a message) because it will be run way too frequently and consume excess processor time. Once a day is sufficient. Hate to say it
but using 'prefab scripts' like those found at Matt's only leads to nightmares such as yours. When time comes to get it to do something special, just the effort
it takes to read and interperet another's poorly documented and badly written code is usually more time consuming than if you just made the damn thing from
scratch yourself.
Just another comment from the peanut gallery . . . . .
Albert Dewey
xlr555usa@netscape.net wrote:
> Hi,
>
> I am using Matt's wwwboard (scriptarchive.com) and I am trying to modify the wwwadmin.pl file so that entries older than a week will be deleted automatically.
>
> Is there a way to create a conditional statement with the date function that will allow me to do this?
>
------------------------------
Date: Thu, 17 Aug 2000 22:06:08 GMT
From: "Ben Kennedy" <bkennedy@hmsonline.com>
Subject: Re: DOS Batch to PERL Conversion
Message-Id: <klZm5.108535$A%3.1426584@news1.rdc2.pa.home.com>
<smilesdotcom@my-deja.com> wrote in message
news:8nh6ua$9ad$1@nnrp1.deja.com...
> I am looking for a simple utility that will convert a DOS batch file to
> a PERL file. The batch is very simple. I am not looking for
> perfection, just a starting point.
I haven't heard of anything that does that - are you trying to convert
simple batch files that run other programs, or convert looping constructs?
--Ben Kennedy
------------------------------
Date: Fri, 18 Aug 2000 00:25:42 GMT
From: ceeeya <ceeeya@my-deja.com>
Subject: Re: FileHandle in array
Message-Id: <8nhvpl$733$1@nnrp1.deja.com>
In article <80hmps4gcj473g38nqdiv7ok991pln0peh@4ax.com>,
Abe Timmerman <abe@ztreet.demon.nl> wrote:
>
> for my $file (@files) {
> open $file->[1], $file->[0] or
> die "Can't open[r] '$file->[0]': $!";
> while ( readline $file->[1] ) {
> print;
> }
> close $file->[1];
> }
>
Thanks for tips. I'm still having trouble with the readline. The
construct above does not read any lines. It does appear to be
syntactically correct. I have been successful with this:
for my $file (@files) {
open $file->[1], $file->[0] or
die "Can't open[r] '$file->[0]': $!";
$fh = $file->[1];
while ( <$fh> ) {
print;
}
close $file->[1];
}
I've been pouring over perlref, but haven't been able to make the proper
connect yet.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 17 Aug 2000 14:54:59 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Finding a duplicate character
Message-Id: <MPG.1405ff11ba52835498ac8c@nntp.hpl.hp.com>
In article <8nheck$ii4$1@nnrp1.deja.com> on Thu, 17 Aug 2000 19:28:47
GMT, vanis@my-deja.com <vanis@my-deja.com> says...
> Hi,
>
> Let's say
>
> $sentence = "Thee easyy questionss cann bee foundd inn thee faqq";
>
> I'd like to search for every occurrence of a sequentially-duplicate
> character, and potentially replace that character with something else
> (i.e. parentheses.. The(e) easy(y)..etc)
s/(.)\1/$1($1)/g; # add /s to include newlines
> P.s. A link to the faqs please...
perlfaq4: "How do I remove consecutive pairs of characters?"
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 18 Aug 2000 00:34:58 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: grepping for multiple fields
Message-Id: <t8oopski2pnpe6fjt28sbunq34u4gmeb64@4ax.com>
On Thu, 17 Aug 2000 13:53:39 -0500, Russ Jones <russ_jones@rac.ray.com>
wrote:
> This problem came up in a quick and dirty script that I was writing
> today, and I know that there has to be some better way than the one I
> used, which was ugly brute force. I just didn't have time to do it
> right.
>
> I have a file that contains lines like this:
>
> text text text blah blah (12345/54321) rejected blah blah etc.
>
> Some lines have one number in the parens, some have two, separated by
> a slash. Not all lines have rejected in them, but if they do, I want
> them. I also want any other lines that have one or more of the same
> numbers that were in the rejected lines. So, given these lines:
...
> I'd want line 2 because it says "rejected" somewhere in it
> I'd want lines 1 and 4 because their numbers show up in line two
> I wouldn't want line 3 because the number doesn't match a "rejected"
> line
#!/usr/bin/perl -w
use strict;
chomp( my @lines = <DATA> );
my(%seen);
my @final = grep {
my @n = m(?=[/)])!g;
/rejected/ || (@n && @seen{ @n }) } map {
my @n = m(?=[/)])!g;
/rejected/ and @seen{ @n } = (1) x @n; $_
} @lines;
print "Final:\n", map "\t$_\n" => @final;
__DATA__
line 1 stuff here more stuff etc (12345) etc etc....
line 2 some other text here (12345/44332) rejected
line 3 yadda yadda yadda (67890) more text here
line 4 t'was brillig (44332) outgrabe
--
Good luck,
Abe
------------------------------
Date: Thu, 17 Aug 2000 19:22:23 -0400
From: Drew Simonis <care227@attglobal.net>
Subject: Re: grepping for multiple fields
Message-Id: <399C73AF.C925681F@attglobal.net>
Abe Timmerman wrote:
>
>
> #!/usr/bin/perl -w
> use strict;
>
> chomp( my @lines = <DATA> );
>
> my(%seen);
> my @final = grep {
> my @n = m(?=[/)])!g;
> /rejected/ || (@n && @seen{ @n }) } map {
> my @n = m(?=[/)])!g;
> /rejected/ and @seen{ @n } = (1) x @n; $_
> } @lines;
>
> print "Final:\n", map "\t$_\n" => @final;
>
> __DATA__
> line 1 stuff here more stuff etc (12345) etc etc....
> line 2 some other text here (12345/44332) rejected
> line 3 yadda yadda yadda (67890) more text here
> line 4 t'was brillig (44332) outgrabe
wow... this is nice.
------------------------------
Date: 17 Aug 2000 16:48:16 -0500
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: grepping for multiple fields
Message-Id: <m3itsza7a7.fsf@dhcp11-177.support.tivoli.com>
gbacon@HiWAAY.net (Greg Bacon) writes:
> You have to make two passes:
It seems like you should be able to get by with one pass if you
additionally save any lines that do not (yet) have match, and then as
soon as you find a reject that matches any of the saved lines, you
output the appropriate saved lines. You will still process future
lines that match in the same way as before.
OK, half an hour later I managed to crank out the code. I also added
some code to avoid printing the same line twice if it matches twice.
#! /usr/bin/perl -w
use strict;
my %rejected;
my %caught;
my @printed;
my $line_num = 0; # to track if the line has been printed
my @lines = split /\n/, <<EOLines;
stuff here more stuff etc (12345) etc etc....
some other text here (12345/44332) rejected
yadda yadda yadda (67890) more text here
t'was brillig (44332) outgrabe
needed to add this to test (12345/56789) multiple numbers
and this one (12345/44332) as well
EOLines
for (@lines) {
if (/rejected/) {
for my $number (m< \( (\d+) (?:/(\d+))? \) >x) {
next unless defined $number;
++$rejected{$number};
next unless exists $caught{$number};
for my $line (@{$caught{$number}}) {
print "$lines[$line]\n" unless $printed[$line_num];
$printed[$line_num] = 1;
}
}
print "$_\n";
} else {
for my $number (m< \( (\d+) (?:/(\d+))? \) >x) {
next unless defined $number;
if ($rejected{$number}) {
print "$_\n";
++$printed[$line_num];
last; # only print it once
} else {
push @{$caught{$number}}, $line_num;
}
}
}
} continue {
++$line_num;
}
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 17 Aug 2000 23:15:13 GMT
From: nospam@hairball.cup.hp.com (Richard J. Rauenzahn)
Subject: Re: help i'm stuck!!!
Message-Id: <966554112.593026@hpvablab.cup.hp.com>
Kjetil Skotheim <kjetilskotheim@iname.com> writes:
>
>@sorted = sort @data; #will sort "alphabethically"
>1,10,15,2,20...
>@sorted = sort {$a cmp $b} @data; #same as above, {$a cmp $b} is the
>default
>@sorted = sort {$a <=> $b} @data; #will sort by number: 1,2,10,15,20...
And for those inclined to use Perl for spamming, DOS, and other such
activities:
@sorted = sort { ${[-1,0,1]}[rand 3] } @data; # will sort alphab-unethically
Rich (Sorry, couldn't resist and no, I don't think this is a good way to
shuffle.)
--
Rich Rauenzahn ----------+xrrauenza@cup.hp.comx+ Hewlett-Packard Company
Technical Consultant | I speak for me, | 19055 Pruneridge Ave.
Development Alliances Lab| *not* HP | MS 46TU2
ESPD / E-Serv. Partner Division +--------------+---- Cupertino, CA 95014
------------------------------
Date: Thu, 17 Aug 2000 23:30:43 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Help please!
Message-Id: <MPG.1407130b6ec9f3a59896c8@localhost>
Miriam wrote ..
>I've created a small perl script that I whould like to share with others but
>I don't want them to change it.
>Since my perl cgi is text code, is there a way to encrypt or compile my
>script into .exe ou some other way to avoid them to read and change my code?
>
>I've tried perl2exe, seems ok but the final file size is huge. Is there some
>other program around there that let me do the same but makes smaller files?
you'll get the same reply here as you got in c.i.w.a.cgi
perlfaq3: "How can I hide the source for my Perl program?"
perldoc -q source
--
jason -- elephant@squirrelgroup.com --
------------------------------
Date: Fri, 18 Aug 2000 01:03:17 GMT
From: "Gary Brown" <garyb1@home.com>
Subject: How do I get statistics from Win NT processes? (ie total memory used by process)
Message-Id: <pX%m5.7815$i5.254441@news1.rdc2.on.home.com>
I am trying to do a "ps aux" in Winnt. I would like to track the memory
used by a process. I will have the process name, but I can't find any
module that will give me stats, just ones that start and stop processes.
Basically, I would like to get the information that taskmanager (processes
tab) and Performance Monitor(prefmon.exe) use.
Any help would be appreciated.
------------------------------
Date: Thu, 17 Aug 2000 22:45:57 GMT
From: pape_98@my-deja.com
Subject: Re: I have another question
Message-Id: <8nhpv0$i6$1@nnrp1.deja.com>
Thanks for you help :-)
But now I have another problem,
This is what my database looks like:
NIH,B1D-403,01 36,13 5 26 ,15 43,1 5 2 5 2 4
NIH,B1D-415,01 36,13 5 26 ,15 43,1 5 2 5 2 4
NIH,B1D-43,01 36,13 5 26 ,15 43,1 5 2 5 2 4
Suburban,B1D-10,52 51 36,135 256 ,15413,1512
the numbers I'm trying to sort are the ones after the B1D-,
how do i get the sort to not considery those characters ???
In article <399C45DF.93383AA3@attglobal.net>,
care227@attglobal.net wrote:
> pape_98@my-deja.com wrote:
> >
> > Now that I know how to sort correctly how do u implement a function
> > calls a file and then sorts its contents.
> > would it be something like this:
> >
> > use strict;
> > use vars qw(@unsorted @sorted $a $b);
> >
> > open ('/applications/apache/cgi-bin/pape/number') or die "Can't open
> > file: $!\n";
>
> Hmmm... you forgot the filehandle.
>
> open SORTER, '</applications/apache/cgi-bin/pape/number' or die $!;
>
> and while I'm at it, why are you storing stuff under the cgi-bin
> directory?
>
> > my @unsorted;
> >
> > @sorted = sort { $a <=> $b } @unsorted;
>
> Sorting two empty arrays? And is this a numerical or string
> comparison? <=> is for number like strings, while cmp is for
> word like strings.
>
> chomp(my @unsorted = <SORTER>); will read your file into an
> array for you to sort.
>
> > u can tell i'm new at this can't you???
>
> neh, doing fine.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 17 Aug 2000 22:39:39 GMT
From: Eli the Bearded <elijah@workspot.net>
Subject: Re: Image Manipulation Question
Message-Id: <eli$0008171703@qz.little-neck.ny.us>
In comp.lang.perl.misc, Logan Shaw <logan@cs.utexas.edu> wrote:
> James <jthomson110@home.com> wrote:
> >Does anyone know of any routines, scripts or recommendations on creating a
> >script that would take a directory of images and create a new directory of
> >those same images - only shrunken in size?
> I would just install pbmplus and use that. It can read and write jpegs
> and gif files and maybe png if you install the right stuff. Then, you
> just do something like this:
>
> djpeg < foo.jpg | pnmscale -xysize 120 90 | cjpeg > thumbnails/foo.jpg
...
Let me second the pbm tools. I scaled the entire Muze CD cover
art database (144-thousand 170x170 high quality jpeg images to
'-quality 55' jpeg images at two different sizes) in just a few
hours using a very similar pipeline in a loop. Didn't take
that much longer than copying the source images off of the four
CDs they came on.
Any pure perl implementation won't be pure perl, but XS or
external pipes; or will be quite slow.
Elijah
------
the input files averaged 15k, the ouput files averaged 3k and 6k
------------------------------
Date: Thu, 17 Aug 2000 19:12:04 -0400 (EDT)
From: blatnoi@webtv.net (=?ISO-8859-1?Q?BigB=90=90=99?=)
Subject: Looking for a SCRIPT=
Message-Id: <11707-399C7144-11@storefull-612.iap.bryant.webtv.net>
looking for a perl script to use to display Images against backgrounds
and view images resized(where a person can change the size of image to
view only in browser not resize image as in manipulating it just to play
around with sizes) if anyone has a script please reply & state where it
can be run, thanks
------------------------------
Date: Thu, 17 Aug 2000 20:14:42 -0500
From: "Fatih C. Mercan" <mercan.1@osu.edu>
To: Ronald Kas <unartic@cistron.nl>
Subject: Re: Mailform
Message-Id: <399C8E02.D762CD24@osu.edu>
> Hi there!
>
> I'm completely new at perl, and though I'm formiliar with html, asp,
> javascript , I want to learn more about perl. I'm trying to write a script
> that sends a form by email, but I receive the following error from my
> logfile:
>
> 'Premature end of script headers'
>
> That is this causing and how do I fix it?
>
> Question 2:
> Does anybody now some good sites on which I can learn perl?
>
> Thanx!
>
> Ronald
The error 'Premature end of script headers' is due to the bad header sent to
the browser.
You have to include
print "Content-type: text/html\n\n";
line to the first point that the script sends something to print to the
browser.
One other possiblity is that there might be an error with the script, so you
have to check this from the command line..
For example;
ReadInput();
PrintPage();
SendMail();
in PrintPage sub you have to write the header response at the very beginning.
2. Buy a book
------------------------------
Date: 17 Aug 2000 21:50:19 GMT
From: bmetcalf@nortelnetworks.com (Brandon Metcalf)
Subject: Re: mkdir problem!!
Message-Id: <8nhmmr$mvv$1@bcrkh13.ca.nortel.com>
hallian@hotmail.com writes:
> I'm trying to check and make directory for year, month and day don't
> exist. But I just can't create the directories. I have tried it with
> (1)system() command and mkir(filename,mode)
>
> here it is:
> ==========
> $archive="/tmp/archive";
> $todayis=`date +%m:%d:%Y`;
> ($month,$day,$year)=split(/:/,$todayis);
>
> if (! -d "$archive/$year")
> {
> system("mkdir $archive/$year");
> }
>
> if (! -d "$archive/$year/$month")
> {
> system("mkdir $archive/$year/$month");
> }
Does /tmp/archive exist? If not, that's your problem. Use either
mkdir -p
or
File::Path::mkpath()
Brandon
------------------------------
Date: Thu, 17 Aug 2000 17:01:22 -0600
From: "Matthew J. Evans" <mje@shakha.com>
Subject: Re: need help with msql and perl
Message-Id: <399c6fc9$1@webmaster.la-tierra.com>
"karamazov" <hello@hello.com> wrote in message
news:8nar9b$8gd$1@slb7.atl.mindspring.net...
> i am writing a script using the dbd::msql driver to access a small msql
db.
> the prob i have is with a query i am trying to process. here is the code
> for it:
>
> my $dbh=DBI->connect($db, $dbName);
> my $statement= "select mov_index, mov_title, mov_year,mov_rating from
movie
> where mov_avail= 'Y' \g";
\g isn't SQL. Delete it.
> my $sth=$dbh->prepare($statement);
>
> for some reason the query won't execute when i call $sth->execute. i get
> parse errors. what is wrong with this?
>
------------------------------
Date: Fri, 18 Aug 2000 00:35:46 GMT
From: newdebugger@my-deja.com
Subject: OT: Anyone interested in selling their Perl 4 books that they haven't thrown out yet?
Message-Id: <8ni0d1$7ni$1@nnrp1.deja.com>
If you do, please email me at mjaNOSPAM@ieNOSPAMee.org with:
In order of importance:
1) Year book was published and ISBN
2) author and title
along with price
Thanks, MJ
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 18 Aug 2000 00:10:36 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Out of memory! error. Working with arrays...
Message-Id: <399c7efc.2007$19e@news.op.net>
In article <399C378C.4554AA88@hotmail.com>,
Alex T. <samara_biz@hotmail.com> wrote:
>Thanks for your reply.
>
>Sure I will try what you suggested, but only after I get rid of "Out
>of memory!" error.
Then you're doomed, because that suggestion is the only thing that
will fix the out-of-memory error.
In the time it took you to post your reply saying that you would not
try it you could have tried it. You are not making good use of your
time.
>Or... do you think that "Out of memory!" error is caused by the way I call the
>sort() function?
Yes. The records in @database are references to hashes.
When you run 'sort' on @database, the code block
{ %{$database[$a]}->{Address} cmp
%{$database[$b]}->{Address} }
is run many times, with $a and $b set to different elements of @database.
Since elements of @database are references to hashes, $a and $b are
references to hashes. But you are not using them like references to
hashes. You are using them as numeric indices into @database. When
you use a reference as a number, it usually turns into a very large
number. (The number is the hardware address of the place where the
referred-to data is stored.) When you use this very large number as
an index into @database, Perl automatically extends @database to have
that many elements. Then you run out of memory.
I think that when someone points out a serious problem in your code,
it is a mistake to say that you will fix it *after* you fix some other
problem. Often the two problems are related.
Many times when I teach people to program, I see them make this
mistake: Their program has two errors in it, and it doesn't work.
They say "Oh, I see the error," and then they fix error A, but then
their program still doesn't work. So they decide that they were
wrong, and they undo the change. Then maybe they find error B and fix
that. But the program still does not work because they still have
error A. Then they think they don't know what is wrong, even though
they found both errors! They give up, or they start trying all sorts
of other things that are not connected with the real problem.
When someone points out a serious error in your program, it is foolish
not to fix it right away. It often happens that one error masks the
behavior of another. Debugging is difficult, and when two or three
errors combine the result can be impossible to figure out.
------------------------------
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 V9 Issue 4051
**************************************