[18840] in Perl-Users-Digest
Perl-Users Digest, Issue: 1008 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 29 00:14:20 2001
Date: Mon, 28 May 2001 21: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)
Message-Id: <991109106-v10-i1008@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 28 May 2001 Volume: 10 Number: 1008
Today's topics:
Re: <> operator problem <schmelter_tim@hotmail.com>
Re: [Q] count number of emails (Clinton A. Pierce)
Re: END{} and tempfiles <ilya@math.ohio-state.edu>
Re: END{} and tempfiles <buggs@geekmail.de>
Re: FAQ 5.22: How do I set a file's timestamp in perl <wyzelli@yahoo.com>
Re: Function Call <johnlin@chttl.com.tw>
Re: Function Call (Martien Verbruggen)
Re: Function Call <ilya@math.ohio-state.edu>
Re: Help a script to prompt to input and have those inp (Greg Bacon)
Re: How to match and print like this ??? <c_clarkson@hotmail.com>
Re: Limiting Characters - CGI Form (Jacob)
Re: Perl script error during testing <sloon@mindless.com>
Re: Perl script error during testing (Abigail)
Re: question about the UNIX commands in perl script <krahnj@acm.org>
Re: question about the UNIX commands in perl script (Clinton A. Pierce)
Re: question about the UNIX commands in perl script <schmelter_tim@hotmail.com>
Re: question about the UNIX commands in perl script <godzilla@stomp.stomp.tokyo>
Re: question about the UNIX commands in perl script <krahnj@acm.org>
Re: re-sizing GIF images on the fly (Martien Verbruggen)
Re: Stripping a string down to aplhaNumeric characters/ <krahnj@acm.org>
Re: Stripping a string down to aplhaNumeric characters/ <krahnj@acm.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 29 May 2001 02:35:18 GMT
From: "Tim Schmelter" <schmelter_tim@hotmail.com>
Subject: Re: <> operator problem
Message-Id: <GVDQ6.173815$sP6.9365244@news3.aus1.giganews.com>
"Risto Vaarandi" <risto.vaarandi@eyp.ee> wrote in message
news:3B1290C0.BEF57E9B@eyp.ee...
> hello,
>
> I am trying to tail a file with a perl program.
<SNIP>
The File::Tail module (I think that's right) on CPAN addresses the issue
pretty well, from what I've seen. I haven't tried running it under Solaris,
though, only Linux, so it may exhibit the same behavior if the root issue of
the symptoms you're experiencing is tied to a filesystem attribute.
--
Tim Schmelter
schmelter_tim@hotmail.com
------------------------------
Date: Tue, 29 May 2001 01:56:39 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: [Q] count number of emails
Message-Id: <rlDQ6.94927$V5.16880264@news1.rdc1.mi.home.com>
[Posted and mailed]
> A proper Unix mbox file will put '>' in front of any line of the body
> starting with 'From', so the point is moot.
Not moot at all. I'm using sendmail and procmail as an LDA and only
lines matching /^From\s/ are prefixed with >. The original poster had
a different regexp (/^From:.*/) which my LDA's and MUA's leave alone in
the body of a message.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours *and*
clintp@geeksalad.org Perl Developer's Dictionary -- May 2001
"If you rush a Miracle Man, for details, see http://geeksalad.org
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Tue, 29 May 2001 02:46:09 +0000 (UTC)
From: Ilya Zakharevich <ilya@math.ohio-state.edu>
Subject: Re: END{} and tempfiles
Message-Id: <9ev2hh$6ns$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Abigail
<abigail@foad.org>], who wrote in article <slrn9h5nr1.fv8.abigail@tsathoggua.rlyeh.net>:
> opened. But then you still have a problem if END {} isn't run,
> for instance when doing an exec, or a kill -9. Better might be to
> unlink the file right after opening. It'll get deleted as soon as
> the program finishes, for whatever reason.
Will not work on most of the systems. Moreover, if it works, file is
unlinked immediately. I think that having open FHs to an unlinked
file is legal exactly on the same systems where unlinking an opened
file does not fail. [No surprise in this, of course. Unless it is
wrong. ;-]
Ilya
------------------------------
Date: Tue, 29 May 2001 05:20:21 +0200
From: buggs <buggs@geekmail.de>
Subject: Re: END{} and tempfiles
Message-Id: <9ev4fa$94b$05$1@news.t-online.com>
Ilya Zakharevich wrote:
> [A complimentary Cc of this posting was sent to
> Abigail
> <abigail@foad.org>], who wrote in article
> <slrn9h5nr1.fv8.abigail@tsathoggua.rlyeh.net>:
>> opened. But then you still have a problem if END {} isn't run,
>> for instance when doing an exec, or a kill -9. Better might be to
>> unlink the file right after opening. It'll get deleted as soon as
>> the program finishes, for whatever reason.
>
> Will not work on most of the systems. Moreover, if it works, file is
> unlinked immediately. I think that having open FHs to an unlinked
> file is legal exactly on the same systems where unlinking an opened
> file does not fail. [No surprise in this, of course. Unless it is
> wrong. ;-]
>
> Ilya
>
Will just work fine on most UNIX systems.
Buggs
------------------------------
Date: Tue, 29 May 2001 13:34:35 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: FAQ 5.22: How do I set a file's timestamp in perl?
Message-Id: <ZaFQ6.24$NJ3.5300@vic.nntp.telstra.net>
> Note that utime() currently doesn't work correctly with Win95/NT
ports.
> A bug has been reported. Check it carefully before using utime() on
> those platforms.
Is this still true?
Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
------------------------------
Date: Tue, 29 May 2001 10:20:05 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: Function Call
Message-Id: <9ev0tk$5rh@netnews.hinet.net>
"Abigail" wrote
> Abigail
> --
> srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
> //=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
OOPs, the result is:
o JutPrerclrHtek naahe s
------------------------------
Date: Tue, 29 May 2001 02:46:20 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Function Call
Message-Id: <slrn9h63bs.div.mgjv@verbruggen.comdyn.com.au>
On Tue, 29 May 2001 10:20:05 +0800,
John Lin <johnlin@chttl.com.tw> wrote:
> "Abigail" wrote
>> Abigail
>> --
>> srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
>> //=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
>
> OOPs, the result is:
> o JutPrerclrHtek naahe s
And on some of my machines it's something else again. That's because
it relies on a particular implementation of srand()/rand(), which
probably is different on your machine.
Martien
--
Martien Verbruggen |
Interactive Media Division | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd. | from a rich salesperson.
NSW, Australia |
------------------------------
Date: Tue, 29 May 2001 02:49:49 +0000 (UTC)
From: Ilya Zakharevich <ilya@math.ohio-state.edu>
Subject: Re: Function Call
Message-Id: <9ev2od$6p7$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
John W. Krahn
<krahnj@acm.org>], who wrote in article <3B12EB25.91C2AA58@acm.org>:
> Hmmm..., So why is Perl parsing sort(f()) as sort(f ())?
Because of the <expletive> I/O syntax.
Ilya
------------------------------
Date: Tue, 29 May 2001 02:28:28 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Help a script to prompt to input and have those input add or append certain lines in a text file
Message-Id: <th62act3ralca8@corp.supernews.com>
In article <slrn9h5g8j.fv8.abigail@tsathoggua.rlyeh.net>,
Abigail <abigail@foad.org> wrote:
: // Since you are frank about it, let me be too: If we did this, we
: // would be giving away work that other people, or even the very same
: // people, get paid for. This rarely happens in real life.
:
: Paid? You got to be kidding? Someone claiming to be a sysadmin, but not
: being able to do some trivial programming isn't get paid for being one,
: now is (s)he? No employer is that foolish...
Forgotten the recent dot-com bubble already? :-)
Greg
--
Beware of the above code; I have only proved it correct, not tried it.
-- Knuth
------------------------------
Date: Mon, 28 May 2001 20:15:50 -0500
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: How to match and print like this ???
Message-Id: <FA904C187AFED3E8.735DD76493454C29.BD64C0D20EB3FFCA@lp.airnews.net>
cad fei <cadmcse@hotmail.com> wrote:
:
: Thanks for instruction! actually I still have difficulty
: to understand your code, becuase I am new to perl ... I
: had study one day try to modify the code, but every
: time cause the error....because I don't know hash well..
: the real data format actually is like this :
:
[snip]
:
: from running the code, some mark by "M", some by"x"..
: I even don't know why..
: would u have some free time, can you teach me how to
: do it? I am struggling with your code and read the
: Programing Perl Book for whole day,
:
<shameless plug>
If you need a little hand holding while learning
perl please feel free to stop over at the
perl-beginner mailing list. The only drawback is that
it is a Yahoo! groups list.
<http://groups.yahoo.com/group/perl-beginner>
</shameless plug>
HTH,
Charles K. Clarkson
Nobody owes anyone else a living.
[snip]
------------------------------
Date: 28 May 2001 20:40:30 -0700
From: jpetrie@kitsapcu.org (Jacob)
Subject: Re: Limiting Characters - CGI Form
Message-Id: <cedf7c1b.0105281940.31392e6a@posting.google.com>
"Ben Kennedy" <bkennedy99@Home.com> wrote in message news:<2LkP6.3181$lP5.1555792@news1.rdc2.pa.home.com>...
> "Jacob" <jpetrie@kitsapcu.org> wrote in message
> news:cedf7c1b.0105231426.172142a2@posting.google.com...
>
> > This is not working. How should I go about escaping these characters?
>
> You should investigate using the $dbh->quote() method provided by DBI, which
> will perform the necessary escapes for interpolated quotes. Another option
> is to use prepared statement handles with placeholders - this will also
> eliminate issues with quoting. See "perldoc DBI"
>
> --Ben Kennedy
If I need to perform an INSERT statement, is there a way of going
about this with something such as quote()?
Thanks,
Jacob
------------------------------
Date: Tue, 29 May 2001 02:27:10 GMT
From: sloon <sloon@mindless.com>
Subject: Re: Perl script error during testing
Message-Id: <d026htkfpat00unduogeud22pueprm3pfi@4ax.com>
On Mon, 28 May 2001 23:59:53 +0000 (UTC), abigail@foad.org (Abigail)
wrote:
>
>
>What makes you think this has anything to do with Perl?
>
>
>
>Abigail
Perhaps I'm mistaken but I believe that I'm writing a script in Perl
and as this newsgroup seems to deal with Perl in a genneral way, and
is in fact named comp.lang.perl.misc, I pissed in your corn flakes
somehow.
Gee, I'm really sorry..perhaps you should return to whatever
microscopic world you marginally exist in.
Thank's for the help.
------------------------------
Date: Tue, 29 May 2001 02:54:25 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Perl script error during testing
Message-Id: <slrn9h63r1.la0.abigail@tsathoggua.rlyeh.net>
sloon (sloon@mindless.com) wrote on MMDCCCXXVIII September MCMXCIII in
<URL:news:d026htkfpat00unduogeud22pueprm3pfi@4ax.com>:
() On Mon, 28 May 2001 23:59:53 +0000 (UTC), abigail@foad.org (Abigail)
() wrote:
()
() >
() >
() >What makes you think this has anything to do with Perl?
() >
() >
() >
() >Abigail
()
() Perhaps I'm mistaken but I believe that I'm writing a script in Perl
() and as this newsgroup seems to deal with Perl in a genneral way, and
() is in fact named comp.lang.perl.misc, I pissed in your corn flakes
() somehow.
Do you think your problem is relevant in rec.woodworking, because you
were sitting on a wooden chair while developing your program?
You didn't have any *Perl* problems with your setup, now did you?
At least, you weren't discribing any.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
------------------------------
Date: Tue, 29 May 2001 01:53:47 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: question about the UNIX commands in perl script
Message-Id: <3B13012B.2BAB2C2B@acm.org>
Roanld wrote:
>
> simple but confusing:
> I have a perl program with unix shell
> command intergrated. Seems the response is not what I expected.
>
> see here is the sample, the program names awktest,
> -------------------------
> #!/usr/bin/perl
>
> qx`ls -l ping* > listfile`;
> $list=qx{awk '{print $4}' listfile};
> print "the result = $list";
> -------------------------
> suppose we have a file called ping.txt in the current directory.
> I get the system response as,
>
> /lhong/codes>./awktest
> the result = -rwxr-xr-x 1 lhong root 80 May 22 16:21
> ping.txt
>
> But what I need is only 'root', as the right response in UNIX,
>
> /lhong/codes>awk '{print $4}' listfile
> root
print "the result = ", (split)[3] for `ls -l ping*`
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 29 May 2001 02:02:50 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: question about the UNIX commands in perl script
Message-Id: <erDQ6.95003$V5.16884635@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <aafb219c.0105281657.73707085@posting.google.com>,
ronaldh@sina.com (Roanld) writes:
> $list=qx{awk '{print $4}' listfile};
Have you considered that $4 is a perfectly valid variable name in Perl
and that in qx{} scalar variables will interpolate? Use warnings in
your script and you'll get one about "undefined values" at that line.
So shell actually wound up seeing:
awk '{print }' listfile
"perldoc perlop" for more details.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours *and*
clintp@geeksalad.org Perl Developer's Dictionary -- May 2001
"If you rush a Miracle Man, for details, see http://geeksalad.org
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Tue, 29 May 2001 02:07:11 GMT
From: "Tim Schmelter" <schmelter_tim@hotmail.com>
Subject: Re: question about the UNIX commands in perl script
Message-Id: <jvDQ6.173337$sP6.9356434@news3.aus1.giganews.com>
"Roanld" <ronaldh@sina.com> wrote in message
news:aafb219c.0105281657.73707085@posting.google.com...
> simple but confusing:
> I have a perl program with unix shell
> command intergrated. Seems the response is not what I expected.
>
> see here is the sample, the program names awktest,
> -------------------------
> #!/usr/bin/perl
>
> qx`ls -l ping* > listfile`;
> $list=qx{awk '{print $4}' listfile};
> print "the result = $list";
> -------------------------
> suppose we have a file called ping.txt in the current directory.
> I get the system response as,
>
> /lhong/codes>./awktest
> the result = -rwxr-xr-x 1 lhong root 80 May 22 16:21
> ping.txt
>
> But what I need is only 'root', as the right response in UNIX,
>
> /lhong/codes>awk '{print $4}' listfile
> root
>
> I am using perl 5.6.0 in Solaris 2.8, the shell in UNIX is ksh.
>
> Thanks in advance!
>
> Ronald
This strikes me as being needlessly complicated. Why have so many shell
processes running? Korn shell globs filenames for you, for one thing, so you
wouldn't need the "ls" at all. And for goodness sake, awk may be better at
some things, but this is a Perl newsgroup, after all...
GIVEN
ping.txt = "-rwxr-xr-x 1 lhong root 80 May 22 16:21 ping.txt\n"
RUN
perl -wpe "BEGIN{print'the result = '}$_=(split' ')[3]" ping*
OUTPUT
the result = root
That's my lowest golf score, anyway.
Check the perldocs for "glob", "split", and check out "perldoc perlrun" for
the ever-useful command-line switches.
--
Tim Schmelte
schmelter_tim@hotmail.com
------------------------------
Date: Mon, 28 May 2001 19:18:25 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: question about the UNIX commands in perl script
Message-Id: <3B1306F1.205E9938@stomp.stomp.tokyo>
"Clinton A. Pierce" wrote:
> ronaldh wrote:
(snipped)
> > $list=qx{awk '{print $4}' listfile};
> Have you considered that $4 is a perfectly valid variable name in Perl....
Godzilla!
--
#!perl
$4 = "Godzilla Rocks!";
print $4;
PRINTED RESULTS:
________________
Modification of a read-only value attempted at test1.pl line 3.
------------------------------
Date: Tue, 29 May 2001 02:53:32 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: question about the UNIX commands in perl script
Message-Id: <3B130F43.9C9F948A@acm.org>
Tim Schmelter wrote:
>
> "Roanld" <ronaldh@sina.com> wrote in message
> news:aafb219c.0105281657.73707085@posting.google.com...
> > simple but confusing:
> > I have a perl program with unix shell
> > command intergrated. Seems the response is not what I expected.
> >
> > see here is the sample, the program names awktest,
> > -------------------------
> > #!/usr/bin/perl
> >
> > qx`ls -l ping* > listfile`;
> > $list=qx{awk '{print $4}' listfile};
> > print "the result = $list";
> > -------------------------
> > suppose we have a file called ping.txt in the current directory.
> > I get the system response as,
> >
> > /lhong/codes>./awktest
> > the result = -rwxr-xr-x 1 lhong root 80 May 22 16:21
> > ping.txt
> >
> > But what I need is only 'root', as the right response in UNIX,
> >
> > /lhong/codes>awk '{print $4}' listfile
> > root
> >
> > I am using perl 5.6.0 in Solaris 2.8, the shell in UNIX is ksh.
> >
> > Thanks in advance!
> >
> > Ronald
>
> This strikes me as being needlessly complicated. Why have so many shell
> processes running? Korn shell globs filenames for you, for one thing, so you
> wouldn't need the "ls" at all. And for goodness sake, awk may be better at
> some things, but this is a Perl newsgroup, after all...
>
> GIVEN
> ping.txt = "-rwxr-xr-x 1 lhong root 80 May 22 16:21 ping.txt\n"
>
> RUN
> perl -wpe "BEGIN{print'the result = '}$_=(split' ')[3]" ping*
>
> OUTPUT
> the result = root
$ perl -wpe "BEGIN{print'the result = '}$_=(split' ')[3]" ping*
Unquoted string "ping" may clash with future reserved word at -e line 1.
Can't modify constant item in multiplication at -e line 1, at EOF
Execution of -e aborted due to compilation errors.
the result =
$ perl -MO=Deparse -wp -e "BEGIN{print'the result = '}$_=(split' ')[3]"
ping*
"my" variable $len masks earlier declaration in same scope at
/usr/lib/perl5/5.00503/i586-linux/B/Deparse.pm line 1453.
Unquoted string "ping" may clash with future reserved word at -e line 1.
Can't modify constant item in multiplication at -e line 1, at EOF
-e had compilation errors.
Use of uninitialized value at
/usr/lib/perl5/5.00503/i586-linux/B/Deparse.pm line 1142.
the result = LINE: while (defined($_ = <ARGV>)) {
'ping' *= (split(/\s+/, $_, 0))[3]
}
continue {
print $_;
}
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 29 May 2001 02:44:10 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: re-sizing GIF images on the fly
Message-Id: <slrn9h637q.div.mgjv@verbruggen.comdyn.com.au>
On Mon, 28 May 2001 20:24:05 +0100,
Graham Stow <graham@letsgouk.com> wrote:
>>
>>It's likely that some of ImageMagick, Photoshop or gimp support
>>scaling using the nearest neighbor method which is generally MUCH
>>MUCH faster than using the resampling methods.
>
> I guess your saying that using ImageMagick etc is much faster than
> letting the browser do the work, right?
That will depend on the speed of the server where the program runs,
and the speed of the workstation where the browser runs. The main
difference is that one form of resizing is done on the server, while
the other is done on the client. Not resizing on the server generally
will also mean larger download sizes. And the result will be of much
lower quality when you rely on browsers to do that work. They use very
unsophisticated techniques.
>>
>>Another aspect is that you want to save the scaled version again as
>>gif. The gif format is limited to 256 color palettes. But if you
That's actually not entirely true, but in practical terms it's close
enough.
>>scale using interpolation the resulting image is likely to contain
>>much greater number of colors than the original. This causes your
>>image to re-color quantized. Meaning that the palette is regenerated.
>
> OK, I think I understand this.
You are doing better than I do, then :)
ImageMagick can be told to stay within the current palette. However,
there hardly ever is a reason to do so. Let it do its work, then
resample.
What happens on a browser is totally up to the browser. Since it
doesn't save the image again, it doesn't matter. It can use as many
colours it needs to resample the image data while it's being rendered.
The original palette doesn't need to be obeyed, and on a display with
sufficient colours, neither does the 6 side color cube.
>>Gif also employes LZW compression which is patented by UNISYS for at
>>least the next 3 years. This means that you should get a license from
>>UNISYS before using unlicensed programs for generating LZW compressed
>>gifs with unlicensed (free) versions of ImageMagick and Gimp.
>
> Sounds like I should avoid generating GIF thumbnails then, and generate
> png thumbnails instead (see below)?
Indeed.
GIF isn't a very good format anymore. JPEG (or PNG) for photos. PNG
for anything else. Recent web browsers will do the right thing.
>>I would try to use png images instead of gifs for the thumbnails. PNG
>>is a superior format in every way as long as you don't need
>>animations, which I think you don't need according to your description.
Indeed :)
> No, I don't need animations. But I'm not familiar with the png image
> format at all.
You don't need to be. ImageMagick knows what to do with it, and so do
most other pieces of software.
>>Lastly scaling images is a very cpu and memory intensive process,
>>especially as the images become bigger. Doing it on the fly may put a
>>very high load on your server. It may be a better idea to generate
>>the thumbnails when you put the larger version on the server.
I agree with this.
> Most of my images would be under 100K. In the fullness of time I
File size is not important. It's the number of pixels in the image
that matters.
> anticipate having between 10,000 and 20,000 such images on my ISP's
> server, all of them input by clients at their browser using the HTML
> input field <INPUT TYPE=FILE> (i.e. I would not be putting the images on
> the server myself). I have written and tested the Perl scripts do this
> and everything works fine.
>
> The main reason for generating the thumbnails on the fly is that I
> wanted to avoid storing between 10,000 and 20,000 thumbnails. However, I
> could amend the scripts to generate and file the thumbnails at the same
> time as the main image is beamed up to the server. But I'd still rather
> do it all on the fly, assuming for the moment that Image Magick can
> generate the PNG thumbnails from 80-100K GIF images pretty muck
> instantaneously. Any advice on this?
Again: 80-100K for a GIF image means nothing with respect to the
actual size of the image. ImageMagick is pretty fast, but it is
_still_ a very CPU intensive operation. CPU is expensive, disk is
cheap. 10.000 thumbnails is hardly any disk space. resizing 10.000
images a few more times than necessary can break performance on a
machine. Plus, image manipulation requires quite a bit of memory.
thumbnails on disk virtually nothing. memory is also relatively
expensive.
How often do you think you will need to resize an image? 10 per
second? How many are likely to be resized at the same time? How many
CPUs do you have? What sort of CPUs? How much memory? What platform
and OS? All of these parameters will influence what you should do, and
what the costs are.
If you only have to resize about 5 % of your images, say one every 5
minutes, I'd probably not pre-resize them, but I'd do it on the fly.
If you are going to be resizing each image at least 100 times, and you
have to serve about 10 per second, I'd pre-resize them.
You decide.
> Having said all the above, I'm still faced with persuading my ISP to
> install Image Magick on their server (I think they're hoping I'll stop
> pestering them and forget all about this).
To Arnar:
>><shameless plug>
>>Since I wrote the Imager module I'll include example code of generating a
>>thumbnail using that.
I haven't been able to get Imager to work very well for me. I was
writing something about it, and then stopped, because it wouldn't do a
few things correctly (including a core dump or two), and was very
limited in other ways, mainly drawing.
Are you still developing it? (An answer to this would probably be
offtopic. Feel free to email, or ignore, me instead)
Martien
--
Martien Verbruggen |
Interactive Media Division | 42.6% of statistics is made up on the
Commercial Dynamics Pty. Ltd. | spot.
NSW, Australia |
------------------------------
Date: Tue, 29 May 2001 01:16:59 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Stripping a string down to aplhaNumeric characters/Using variables in Reg Expressions
Message-Id: <3B12F8A8.797C6A5@acm.org>
James wrote:
>
> Hey all,
>
> I am currently writing a website where I need a function that will take a
> text string and strip it down to lower case AplhaNumeric charcaters only.
$text_string =~ tr/a-z//cd;
> Is there any function that does that specially?
>
> My thought was to write one that simply used regular expresions to search
> and replace all chr(1 to 255, minus characters and numbers) with nothing,
> simply by using a for loop over the relevant ranges. eg
>
> for a = 1 to 56
> replace chr(a) with null string
> next a
> (in Puesdo code)
>
> But then I hit another problem, how do you use a variable in a regular
> expression?
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 29 May 2001 01:43:51 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Stripping a string down to aplhaNumeric characters/Using variables in Reg Expressions
Message-Id: <3B12FEF7.37631E0F@acm.org>
"John W. Krahn" wrote:
>
> James wrote:
> >
> > Hey all,
> >
> > I am currently writing a website where I need a function that will take a
> > text string and strip it down to lower case AplhaNumeric charcaters only.
>
> $text_string =~ tr/a-z//cd;
>
> > Is there any function that does that specially?
Sorry, you said AlphaNumeric.
$text_string =~ tr/a-z0-9//cd;
John
--
use Perl;
program
fulfillment
------------------------------
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 1008
***************************************