[25234] in Perl-Users-Digest
Perl-Users Digest, Issue: 7479 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 3 14:05:45 2004
Date: Fri, 3 Dec 2004 11:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 3 Dec 2004 Volume: 10 Number: 7479
Today's topics:
Re: $ in text string (Anno Siegel)
Re: (beginner question) downsample data points using ch (Anno Siegel)
(Newbie Question) Digest::MD5 CPAN module compilation e (FreeDiver)
An efficient way to make a large directory tree? <nwang@panix.com>
Re: An efficient way to make a large directory tree? <gifford@umich.edu>
Re: An efficient way to make a large directory tree? <richard@zync.co.uk>
Re: An efficient way to make a large directory tree? <richard@zync.co.uk>
Re: An efficient way to make a large directory tree? <gifford@umich.edu>
Re: An efficient way to make a large directory tree? <richard@zync.co.uk>
Re: An efficient way to make a large directory tree? <richard@zync.co.uk>
Re: An efficient way to make a large directory tree? <gifford@umich.edu>
ANNOUNCEMENT: NYLXS Open House Dec. 6; Perl Classes Dec <cycmn@nyct.net>
Complex Search and Replace (Glo Worm)
Re: Complex Search and Replace <jurgenex@hotmail.com>
FAQ 8.29: Why can't my script read from STDIN after I g <comdog@panix.com>
How to handle a HTTP::Request with gzip, deflate header <leifwessman@hotmail.com>
Re: How to handle a HTTP::Request with gzip, deflate he <gisle@activestate.com>
Re: How to handle a HTTP::Request with gzip, deflate he <gisle@activestate.com>
how to load a picture to an oracle database with the L <texier@ebi.ac.uk>
Re: how to load a picture to an oracle database with th <mritty@gmail.com>
Re: How to Recruit Perl Developers? <matternc@comcast.net>
Mail queue and file locking <nospam@all.thx>
Re: parent of an orphaned process-info about perl and O <usenet@morrow.me.uk>
Re: Perl / MySql / Shopping cart <grapeape88@hotmail.com>
Re: Perl / MySql / Shopping cart <tadmc@augustmail.com>
Pipe input from a Text-File (Gerhard)
Re: Pipe input from a Text-File <toreau@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Dec 2004 13:21:54 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: $ in text string
Message-Id: <copp9i$6o5$3@mamenchi.zrz.TU-Berlin.DE>
Tad McClellan <tadmc@augustmail.com> wrote in comp.lang.perl.misc:
> Terri <terri@cybernets.com> wrote:
[...]
> > Eval() often appears in the code.
>
>
> That can be very dangerous, I hope the vendor is a True Expert, else
> there is a very high probability that the code opens security holes...
>
> My guess is that the vendor is a script kiddie, and that the
> many eval()s are not strictly necessary.
>
> Who is the vendor?
>
> What is the name of their software?
>
> Surely they won't object to you giving that info out, it is
> free advertising for them!
Not really. After even the bit we've heard about the code it isn't.
Anno
------------------------------
Date: 3 Dec 2004 12:50:21 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: (beginner question) downsample data points using chained maps
Message-Id: <copned$6o5$1@mamenchi.zrz.TU-Berlin.DE>
Oscar Stiffelman <imagine@gmail.com> wrote in comp.lang.perl.misc:
> I have a vector of numeric points specified as 2 cols in a text file.
> I want to break the points into windows and compute averages for each
> window.
>
> And (this is important), I am looking for a compact perlish way to do
Why is this *important*? A prototype that does what you want, even
in a less than elegant way, would be worth more at this point.
> it, ideally using the more "functional programming" parts of the
> language, as opposed to the direct, nested for loops.
>
> I am new to Perl, so I would appreciate feedback on the approach I
> have taken below.
You're going about this the wrong way. Start out with something
pedestrian and simple. When it *works*, you can transform it into
tight code, if you want.
> #!/usr/bin/perl
No warnings, no strict. Add them, and the variable declarations that
are then necessary.
> $w = shift; # this is the block size
> die "must specify window size" if !$w;
> @x = sort {@$a[0] <=> @$b[0]} map {[split]} <>;
What is this sort for? It sorts by the number of items in each line,
which is 2 every time by your own specification.
> print "@$_\n" for map {
> ($s0,$s1)=(0,0);
> for(@$_) {
> $s0 += @$_[0];
> $s1 += @$_[1]
> };
> [$s0/$w, $s1/$w]
If $w doesn't divide the number of lines, you may end up with a
final window of fewer than $w points. It would be better to
divide by the actual number of points instead of $w.
> } map {
> [@x[$_*$w .. ($_+1)*$w-1]]
This is fragile if $w doesn't divide the number of records. splice()
would be a better tool.
> } (0..$#x/$w);
When I run this it prints out a series of pairs of zeroes for me
(the right number of pairs, but zero). I'm not going to debug it.
> # In pseudocode, this is what it does:
> for(i = 0; i < n; i+= width) {
> (x,y) = (0,0);
> for(int j = 0; j < width; j++) {
> x += vec[i+j][0];
> y += vec[i+j][1];
> }
> push results, [x/width, y/width];
> }
It would have been better to make this a working Perl solution first.
> Can anyone suggest an even more compact or idiomatically-correct way
> to do this?
Here is how I would do it:
my @data = <DATA>;
my @res;
while ( @data ) {
my @chunk = splice @data, 0, $w;
my ( $x_mean, $y_mean);
for ( @chunk ) {
my ( $x, $y) = split;
$x_mean += $x;
$y_mean += $y;
}
push @res, [ $x_mean/@chunk, $y_mean/@chunk];
}
print "@$_\n" for @res;
Now, if you want, you can rework some of the loops as map()s:
my @data = <DATA>;
print "@$_\n" for map {
my ( $x, $y);
for ( @$_ ) {
$x += $_->[ 0];
$y += $_->[ 1];
}
[ $x/@$_, $y/@$_];
} map [ map [ split], splice( @data, 0, $w)], 0 .. $#data/$w;
Anno
------------------------------
Date: 3 Dec 2004 10:07:48 -0800
From: freedive999@hotmail.com (FreeDiver)
Subject: (Newbie Question) Digest::MD5 CPAN module compilation errors
Message-Id: <e0a67110.0412031007.1b771b6a@posting.google.com>
Hi,
I am a newbie in Perl. I am having trouble installing my
Digest::MD5 CPAN
module. We are running Solaris 8 with gcc 3.0.3 (from SMCgcc3 pkg).
I've got
the following error messages when trying to do a "make". Looks like
it's complaining about that '-KPIC' option is not recognized.
Any idea how I can resolve this problem ?? Do I need another
compiler
for this CPAN module installation ?? Is there any other free compiler
out there ??
Thanks in advance for your help.
Bill
atlantis# perl Makefile.PL CC=/usr/local/bin/gcc
Testing alignment requirements for U32... Test program exit status was
0
Warning: prerequisite Digest::base 1.00 not found at (eval 1) line
220.
Writing Makefile for Digest::MD5
atlantis# make
/usr/local/bin/gcc -c -xO3 -xdepend -DVERSION=\"2.33\"
-DXS_VERSION=\"2.33\" -KPIC -I/usr/perl5/5.00503/sun4-solaris/CORE
-DU32_ALIGNMENT_REQUIRED MD5.c
gcc: unrecognized option `-KPIC'
gcc: language depend not recognized
gcc: MD5.c: linker input file unused because linking not done
Running Mkbootstrap for Digest::MD5 ()
chmod 644 MD5.bs
LD_RUN_PATH="" cc -o blib/arch/auto/Digest/MD5/MD5.so -G MD5.o
cc: MD5.o: No such file or directory
cc: No input files
*** Error code 1
make: Fatal error: Command failed for target
`blib/arch/auto/Digest/MD5/MD5.so'
------------------------------
Date: Fri, 3 Dec 2004 16:11:27 +0000 (UTC)
From: Nan Wang <nwang@panix.com>
Subject: An efficient way to make a large directory tree?
Message-Id: <coq37f$ado$1@reader1.panix.com>
Let's say I have a list of directories:
a/b/c
a/b/c/d
a/b/c/e
a/b/o
a/c
a/c/q
a/x
a/x/y
I'm trying to find the most efficient way to parse this list and come up
with the fewest mkpath call. In other words, only mkpath the leaf nodes:
a/b/c/d
a/b/c/e
a/b/o
a/c/q
a/x/y
So far I'm parsing the list, then for each path, find the parent directory,
use that as the key of a hash, and increment it by 1 for each path under that
key, and only call mkpath on the hash elements with a value of 0. Is there a
better way of doing this?
Thanks in advance.
------------------------------
Date: Fri, 03 Dec 2004 12:00:16 -0500
From: Scott W Gifford <gifford@umich.edu>
Subject: Re: An efficient way to make a large directory tree?
Message-Id: <qsz7jnzco67.fsf@zektor.gpcc.itd.umich.edu>
Nan Wang <nwang@panix.com> writes:
[...]
> I'm trying to find the most efficient way to parse this list and come up
> with the fewest mkpath call. In other words, only mkpath the leaf nodes:
[...]
> So far I'm parsing the list, then for each path, find the parent directory,
> use that as the key of a hash, and increment it by 1 for each path under that
> key, and only call mkpath on the hash elements with a value of 0. Is there a
> better way of doing this?
That sounds like a pretty good technique. From an algorithmic
perspective, it's O(n lg n), which probably the best you can expect
unless there's a limit to the depth of the directories or something
similar. From a practical perspective it sounds fairly sound, too.
Perl's implementation of hashes is very efficient, and it sounds like
that's where the biggest bottleneck will be. It also sounds
straightforward to code and to follow, which is a plus.
It would be interesting to know if it's more efficient to do this
calculation or just mkpath() everything. Algorithmically a bunch of
mkpath()s would be O(n), but practically it would probably be slower,
because of the cost of system calls.
Just MHO, but hope it's helpful!
----ScottG.
------------------------------
Date: Fri, 03 Dec 2004 17:06:15 +0000
From: Richard Gration <richard@zync.co.uk>
Subject: Re: An efficient way to make a large directory tree?
Message-Id: <pan.2004.12.03.17.06.15.320460@zync.co.uk>
On Fri, 03 Dec 2004 16:11:27 +0000, Nan Wang wrote:
>
> Let's say I have a list of directories:
>
> a/b/c
> a/b/c/d
> a/b/c/e
> a/b/o
> a/c
> a/c/q
> a/x
> a/x/y
>
> I'm trying to find the most efficient way to parse this list and come up
> with the fewest mkpath call. In other words, only mkpath the leaf nodes:
>
> a/b/c/d
> a/b/c/e
> a/b/o
> a/c/q
> a/x/y
>
> So far I'm parsing the list, then for each path, find the parent directory,
> use that as the key of a hash, and increment it by 1 for each path under that
> key, and only call mkpath on the hash elements with a value of 0. Is there a
> better way of doing this?
>
> Thanks in advance.
I'm trying to find a way to do the loop with map (and maybe grep) but I
can't find it atm, but how about this:
rich@richg ~/perl $ cat test.pl
#!/usr/bin/perl
use strict;
use warnings;
chomp (my @paths = reverse sort { $a=~s#/#/#g <=> $b=~s#/#/#g } <DATA>);
my $seen = '';
foreach (@paths) {
next if $seen =~ /:$_/;
print "$_\n";
$seen .= ":$_";
}
__END__
a/b/c
a/b/c/d
a/b/c/e
a/b/o
a/c
a/c/q
a/x
a/x/y
rich@richg ~/perl $ ./test.pl
a/b/c/e
a/b/c/d
a/x/y
a/c/q
a/b/o
------------------------------
Date: Fri, 03 Dec 2004 17:11:05 +0000
From: Richard Gration <richard@zync.co.uk>
Subject: Re: An efficient way to make a large directory tree?
Message-Id: <pan.2004.12.03.17.11.01.923269@zync.co.uk>
On Fri, 03 Dec 2004 17:06:15 +0000, Richard Gration wrote:
> I'm trying to find a way to do the loop with map (and maybe grep) but I
> can't find it atm
Got it.
rich@richg ~/perl $ cat test.pl
#!/usr/bin/perl
use Data::Dump qw(dump);
use strict;
use warnings;
chomp (my @paths = reverse sort { $a=~s#/#/#g <=> $b=~s#/#/#g } <DATA>);
my $seen = '';
print join "\n", grep {defined} map { $seen =~ /:$_/ ? undef : ($_,$seen .= ":$_")[0] } @paths;
------------------------------
Date: Fri, 03 Dec 2004 12:26:31 -0500
From: Scott W Gifford <gifford@umich.edu>
Subject: Re: An efficient way to make a large directory tree?
Message-Id: <qszy8gfb8e0.fsf@zektor.gpcc.itd.umich.edu>
Richard Gration <richard@zync.co.uk> writes:
[...]
> my $seen = '';
> print join "\n", grep {defined} map { $seen =~ /:$_/ ? undef : ($_,$seen .= ":$_")[0] } @paths;
This would be more efficient, simpler, and more correct in the face of
directory names containing colons, if $seen were a hash. Also,
returning an empty list to map gets the item ignored, which can
eliminate the grep {defined}. Something like this (untested):
my %seen;
print join "\n", map { $seen{$_} ? () : ($_,$seen{$_}++)[0] } @paths;
Regardless, I'm not sure this is any better than the original.
---ScottG.
------------------------------
Date: Fri, 03 Dec 2004 17:29:03 +0000
From: Richard Gration <richard@zync.co.uk>
Subject: Re: An efficient way to make a large directory tree?
Message-Id: <pan.2004.12.03.17.29.03.350630@zync.co.uk>
#!/usr/bin/perl
print "$_\n" for grep {defined} map { chomp; $seen =~ /:$_/ ? undef :
($_,$seen .= ":$_")[0] } reverse sort { $a=~s#/#/#g <=> $b=~s#/#/#g }
<DATA>
__END__
a/b/c
a/b/c/d
a/b/c/e
a/b/o
a/c
a/c/q
a/x
a/x/y
------------------------------
Date: Fri, 03 Dec 2004 17:35:22 +0000
From: Richard Gration <richard@zync.co.uk>
Subject: Re: An efficient way to make a large directory tree?
Message-Id: <pan.2004.12.03.17.35.22.579809@zync.co.uk>
On Fri, 03 Dec 2004 12:26:31 -0500, Scott W Gifford wrote:
> Richard Gration <richard@zync.co.uk> writes:
>
> [...]
>
>> my $seen = '';
>> print join "\n", grep {defined} map { $seen =~ /:$_/ ? undef :
>> ($_,$seen .= ":$_")[0] } @paths;
>
> This would be more efficient, simpler, and more correct in the face of
> directory names containing colons, if $seen were a hash. Also,
> returning an empty list to map gets the item ignored, which can
> eliminate the grep {defined}. Something like this (untested):
>
> my %seen;
> print join "\n", map { $seen{$_} ? () : ($_,$seen{$_}++)[0] }
> @paths;
This doesn't work the same. Mine will not create /a/b if it's seen /a/b/c,
yours will. However the empty list I did not know about, thank you.
> Regardless, I'm not sure this is any better than the original.
No, nor me, but it's Friday afternoon and I've already succeeded ... I've
learned something :-)
How about:
map { chomp; $seen =~ /:$_/ ? () : ($_,$seen .= ":$_")[0] } reverse sort {
$a=~s#/#/#g <=> $b=~s#/#/#g } <DATA>
------------------------------
Date: Fri, 03 Dec 2004 12:41:21 -0500
From: Scott W Gifford <gifford@umich.edu>
Subject: Re: An efficient way to make a large directory tree?
Message-Id: <qszu0r3b7pa.fsf@zektor.gpcc.itd.umich.edu>
Richard Gration <richard@zync.co.uk> writes:
[...]
>> my %seen;
>> print join "\n", map { $seen{$_} ? () : ($_,$seen{$_}++)[0] }
>> @paths;
>
> This doesn't work the same. Mine will not create /a/b if it's seen /a/b/c,
> yours will. However the empty list I did not know about, thank you.
You're right, sorry!
---ScottG.
------------------------------
Date: Fri, 03 Dec 2004 16:44:46 GMT
From: "J.E./C.Y.Cripps" <cycmn@nyct.net>
Subject: ANNOUNCEMENT: NYLXS Open House Dec. 6; Perl Classes Dec. 8th
Message-Id: <2K0sd.11675$Ae.835@newsread1.dllstx09.us.to.verio.net>
ANNOUNCEMENTS
GNU/LINUX OPEN HOUSE
NYLXS's Membership committee will hold
GNU/Linux and Free Software Open House
in the Midwood Section of Brooklyn USA.
The Open House will be held on MONDAY December 6th
from 6:30 to 11PM a 1724 East 12th Street, in the
Basement of Kings Games is the NYLXS Education Center.
This event is open to the Public. Get a chance to talk to
NYLXS members, experts in GNU/Linux and Free Software. Get a
hands on taste of GNU/Linux and learn what Free Software can
do for you. Sign up for Classes at the Free Software Institute
and learn how to join any of the NYLXS events, from
publication in the NYLXS journal, helping with the radio show,
learning how GNU/Linux can be used in education, or talking to
our Free Software Chamber of Commerce consultants.
Perl I is scheduled to start Dec. 8th.
http://www.nylxs.com
------------------------------
Date: 3 Dec 2004 09:06:36 -0800
From: gloworm@backwoodzmusic.com (Glo Worm)
Subject: Complex Search and Replace
Message-Id: <43eeb0f5.0412030906.faba48e@posting.google.com>
Hello,
How can I take a file such as
abc'abc
abc\'abc
abc\\\'abc
and use a Perl script to make it look like
abc\'abc
abc\'abc
abc\'abc
?
In any case I'd like for the first and second field to be delimited with
\'
Thank you.
------------------------------
Date: Fri, 03 Dec 2004 17:22:40 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Complex Search and Replace
Message-Id: <Ah1sd.64$3T2.21@trnddc04>
Glo Worm wrote:
> Hello,
>
> How can I take a file such as
>
> abc'abc
> abc\'abc
> abc\\\'abc
>
> and use a Perl script to make it look like
>
> abc\'abc
> abc\'abc
> abc\'abc
>
> In any case I'd like for the first and second field to be delimited
> with \'
You don't give much details about what 'abc' can be nor about what the
erronious possible delimeters can be in the original file (just listing
three examples is a bit meager).
What about a plain
s/\\*/\\/
This does the job at least for your examples.
jue
------------------------------
Date: Fri, 3 Dec 2004 17:03:01 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 8.29: Why can't my script read from STDIN after I gave it EOF (^D on Unix, ^Z on MS-DOS)?
Message-Id: <coq685$bfp$1@reader1.panix.com>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.
--------------------------------------------------------------------
8.29: Why can't my script read from STDIN after I gave it EOF (^D on Unix, ^Z on MS-DOS)?
Some stdio's set error and eof flags that need clearing. The POSIX
module defines clearerr() that you can use. That is the technically
correct way to do it. Here are some less reliable workarounds:
1 Try keeping around the seekpointer and go there, like this:
$where = tell(LOG);
seek(LOG, $where, 0);
2 If that doesn't work, try seeking to a different part of the file
and then back.
3 If that doesn't work, try seeking to a different part of the file,
reading something, and then seeking back.
4 If that doesn't work, give up on your stdio package and use sysread.
--------------------------------------------------------------------
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-2002 Tom Christiansen and Nathan
Torkington, and other contributors as noted. All rights
reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
------------------------------
Date: 3 Dec 2004 03:49:19 -0800
From: "Leif Wessman" <leifwessman@hotmail.com>
Subject: How to handle a HTTP::Request with gzip, deflate headers
Message-Id: <1102074559.571451.224460@z14g2000cwz.googlegroups.com>
Hi!
If I send the following to in my request
$req->header('Accept-encoding', 'gzip, deflate');
And then the Content-Encoding header in the response is 'gzip' or
'deflate'. How can I uncompress the content? I've tried the following,
but $data becomes empty:
my $data = $response->content;
my $encoding = $response->header('Content-Encoding');
if ($encoding) {
if ($encoding =~ /gzip/i) {
$data = Compress::Zlib::memGunzip($data);
}
if ($encoding =~ /deflate/i) {
my $x = deflateInit() or die "Cannot create a deflation stream\n" ;
my ($output, $status) = $x->deflate($data) ;
$status == Z_OK or die "deflation failed\n" ;
$data = $output;
($output, $status) = $x->flush() ;
$status == Z_OK or die "deflation failed\n" ;
$data .= $output;
}
}
------------------------------
Date: 03 Dec 2004 12:53:08 +0100
From: Gisle Aas <gisle@activestate.com>
Subject: Re: How to handle a HTTP::Request with gzip, deflate headers
Message-Id: <87acsvha3f.fsf@ask.g.aas.no>
"Leif Wessman" <leifwessman@hotmail.com> writes:
> If I send the following to in my request
>
> $req->header('Accept-encoding', 'gzip, deflate');
>
> And then the Content-Encoding header in the response is 'gzip' or
> 'deflate'. How can I uncompress the content?
In libwww-perl-5.802 the response object have a decoded_content()
method that will undo any Content-Encoding for you.
--
Gisle Aas
------------------------------
Date: 03 Dec 2004 12:56:50 +0100
From: Gisle Aas <gisle@activestate.com>
Subject: Re: How to handle a HTTP::Request with gzip, deflate headers
Message-Id: <87653jh9x9.fsf@ask.g.aas.no>
Gisle Aas <gisle@activestate.com> writes:
> "Leif Wessman" <leifwessman@hotmail.com> writes:
>
> > If I send the following to in my request
> >
> > $req->header('Accept-encoding', 'gzip, deflate');
> >
> > And then the Content-Encoding header in the response is 'gzip' or
> > 'deflate'. How can I uncompress the content?
>
> In libwww-perl-5.802 the response object have a decoded_content()
> method that will undo any Content-Encoding for you.
Also note that you can set up:
$ua->default_header("Accept-Encoding" => "gzip, deflate");
and then all requests you send out will automatically get this header.
No need to do it yourself for each request.
--
Gisle Aas
------------------------------
Date: Fri, 03 Dec 2004 14:37:04 +0000
From: Vincent Le-Texier <texier@ebi.ac.uk>
Subject: how to load a picture to an oracle database with the Load a picture to Oracle with DBI perl module
Message-Id: <41B07A10.7030400@ebi.ac.uk>
hi,
Does anyone know how to load a picture (any format) to an oracle
database with the DBI perl module ?
A small example will be very usefull.
Cheers,
--
Le Texier Vincent
Software Engineer/Database Applications
European Bioinformatics Institute
Wellcome Trust Genome Campus
Hinxton, Cambridge CB10 1SD, UK
Email : texier@ebi.ac.uk
Phone : (01223) 492 592
www.ebi.ac.uk/~texier
------------------------------
Date: Fri, 03 Dec 2004 15:29:09 GMT
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: how to load a picture to an oracle database with the Load a picture to Oracle with DBI perl module
Message-Id: <9D%rd.115$gF5.80@trndny01>
"Vincent Le-Texier" <texier@ebi.ac.uk> wrote in message
news:41B07A10.7030400@ebi.ac.uk...
>
> Does anyone know how to load a picture (any format) to an oracle
> database with the DBI perl module ?
>
> A small example will be very usefull.
Did you try reading the docs for the module you're using? (I presume
you're using DBD::Oracle, right?)
http://search.cpan.org/~timb/DBD-Oracle-1.16/Oracle.pm#Handling_LOBs
contains an example of reading a file and writing its contents into an
Oracle database.
Paul Lalli
------------------------------
Date: Fri, 03 Dec 2004 12:34:32 -0500
From: Chris Mattern <matternc@comcast.net>
Subject: Re: How to Recruit Perl Developers?
Message-Id: <P_adnTdTAtQ0Pi3cRVn-tg@comcast.com>
Make sure you offer them enough salary. Newly trained perl coders
should be paid a minimum of $70,000 to $80,000. Experienced coders
should be offered a six-figure salary.
--
Christopher Mattern
"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
------------------------------
Date: Sat, 4 Dec 2004 03:30:08 +1300
From: "MadDogMcGee" <nospam@all.thx>
Subject: Mail queue and file locking
Message-Id: <copt9l$ppv$1@lust.ihug.co.nz>
Hi there, here's what I'm trying to do:
I'm on a Windows NT system, and want to monitor the Exchange mail queue for
new files. When there's a new file (an email) with certain keywords (i.e.
characteristic spam strings) I want to move the file to another folder so it
doesn't get sent.
Here's my approach, which is working but could probably be improved:
1. Poll the folder (waiting 1 second between polls)
2. If a file is "there", i.e. it has finished being copied across, and it is
less than 1 megabyte, scan it for keywords.
3. If the file has any keywords, move it to a different folder.
4. Goto 1.
To check if the file is copied across, I try to rename the file to itself.
If it's locked, Perl's rename function returns a 0 and if it's unlocked,
rename returns a 1.
I'm worried that using this approach of renaming files will lock them, and
prevent email from being moved out of the queue folder to be sent.
1. Is there a better way to detect new files than to poll the directory
every second?
2. What's the best way to check if a file is unlocked (i.e. fully copied
across)?
3. (Off topic) Any potential problems in scanning the NT Exchange 5.5 mail
queue folder and moving files out?
Thanks!
------------------------------
Date: Thu, 2 Dec 2004 23:54:14 +0000
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: parent of an orphaned process-info about perl and OS version.
Message-Id: <6im482-8i6.ln1@osiris.mauzo.dyndns.org>
Quoth tadmc@augustmail.com:
> madhav_a_kelkar@hotmail.com <madhav_a_kelkar@hotmail.com> wrote:
>
> > Subject: parent of an orphaned process
>
>
> That is nonsensical.
>
> If it is an orphan, then it *has no* parent, by definition.
>
> If it does have a parent, then you can't call it an "orphan".
Strictly true, perhaps; but it is usual in Unix terms to call a process
whose (immediate) parent has died an 'orphan'. The process is then
inherited by init(8), process 1, so it acquires a new parent. At this
point the parent-child analogy breaks down :).
Ben
--
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk
------------------------------
Date: Fri, 03 Dec 2004 12:33:55 GMT
From: "Tony M M" <grapeape88@hotmail.com>
Subject: Re: Perl / MySql / Shopping cart
Message-Id: <T2Zrd.128929$V41.124803@attbi_s52>
"Gregory Toomey" <nospam@bigpond.com> wrote in message
news:31a25qF39i01hU1@individual.net...
> Tony M M wrote:
> > Has anyone on this message group ever thought of modifying, or building
a
> > shopping cart that is real world and usable then putting it out to the
> > populous?
> > What I see is bloated, non working perl scripts that are missing the
mark
> > in the area.
> There are a few ones like http://www.ratite.com/Perl/WebStore.shtml
> However most LAMP shopping cards tend to be php eg oscommerce
oscommerce is bloated beyond belief (imo). It does so many quiries that it
puts quite a workload on the server. But beyond being slow on our server it
is too cookie cutter. Go to one oscommerce site and you have seen most. That
is one of the reasons I started this thread. The digitalpressworks cart (the
one I refered to as a good starting point) is database driven
(autogenerated) or static page (or both). This allows one shop to look
different from another. It is simple in its design (even I can modify it
easliy). But they seem to have stopped development on it. (Again in my
opinion - it needs a database backend, and real-time cc processing and it
would be pretty complete).
> > I asked this question after looking at perl shopping carts for the last
6
> > months and seeing what I indicated above.... If this has been tackled
in
> > the past could anyone point me to the thread? If not, is this the type
of
> > newsgroup that participates like this?
> >
> > Thank you,
> >
> > Tony <Mike> M.
>
> I didnt like anything I saw so I rolled my own.
> It took me about a month to write Phase 1 of www.pchq.com.au in
Perl/mysql,
> complete with an interface to a wholesaler to automatically update prices.
> I added a Perl html whitespace remover and installed a Squid reverse proxy
> so hopefully the site loads fast. Graphics are done with ImageMagick.
> Phase 2 will add checkout/credit card payments.
> gtoomey
I went to the site you listed. Did I miss the cart? I didn't see a place to
put anything in as an order.
That is what I am talking about though... One month to build phase one (if I
knew perl better I would attempt it but I can just test/hack/trail and error
modify). The hard part is (imo) is phase 2 - the return information from the
payment processor in the background, update the database, send confirmation
e-mails, and save the order.
If this newsgroup does projects it would be great. Maybe an old concept -
but used to do it (on old BBS's) back in the old basic/pascal days and we
made some pretty good useful freeware and with perl being an open type of
language it seem to be in the spirit.
Tony <Mike> M
------------------------------
Date: Fri, 3 Dec 2004 07:41:53 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Perl / MySql / Shopping cart
Message-Id: <slrncr0r91.dtl.tadmc@magna.augustmail.com>
Tony M M <grapeape88@hotmail.com> wrote:
> If this newsgroup does projects it would be great.
It doesn't.
We discuss Perl in the Perl newsgroup.
We _help_ people who are developing applications in the Perl
newsgroup, so post your questions here when you run into trouble
writing your application.
We don't generally write code to specification, volunteers tend to
volunteer for things that are "fun" or "interesting".
The drudge of scratching somebody else's itch is probably going
to require payment in some form...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 3 Dec 2004 05:30:04 -0800
From: glange@libero.it (Gerhard)
Subject: Pipe input from a Text-File
Message-Id: <bfd7a7ec.0412030530.3f387002@posting.google.com>
I've made this little script for adding two numbers from command-line:
my ($a,$b) = @ARGV;
my $prg_name = $0; $prg_name =~ s|^.*[\\/]||;
# Usage:
my $usage="Usage: \n$prg_name <A> <B>\n[]: optional Parameter\n";
if (! defined ($ARGV[0])) { print "$usage"; exit; }
print $a+$b;
C:\>add.pl 12 2
14
Content of the Text-File "input.txt":
12 2
2 4
5 7
My question is how can I "pipe" some numbers, which I've stored in a seperate
Text-File "input.txt" to the PERL Script from the DOS Command-line ?
I've tried this, but it don't work this way:
C:\>type input.txt | add.pl
------------------------------
Date: Fri, 03 Dec 2004 14:45:22 +0100
From: Tore Aursand <toreau@gmail.com>
Subject: Re: Pipe input from a Text-File
Message-Id: <pan.2004.12.03.13.45.21.837021@gmail.com>
On Fri, 03 Dec 2004 05:30:04 -0800, Gerhard wrote:
> I've made this little script for adding two numbers from command-line:
>
> my ($a,$b) = @ARGV;
> my $prg_name = $0; $prg_name =~ s|^.*[\\/]||;
> # Usage:
> my $usage="Usage: \n$prg_name <A> <B>\n[]: optional Parameter\n";
> if (! defined ($ARGV[0])) { print "$usage"; exit; }
> print $a+$b;
>
> C:\>add.pl 12 2
> 14
>
> Content of the Text-File "input.txt":
> 12 2
> 2 4
> 5 7
>
> My question is how can I "pipe" some numbers, which I've stored in a seperate
> Text-File "input.txt" to the PERL Script from the DOS Command-line ?
> I've tried this, but it don't work this way:
> C:\>type input.txt | add.pl
Read <STDIN>. Take a look at this code (untested);
#!/usr/bin/perl
#
use strict;
use warnings;
my $sum = 0;
while ( <STDIN> ) {
chomp;
last unless ( defined && /\d/ );
$sum += $_;
}
print "$sum\n";
Should work, although it could have been better at checking if there is a
real number (decimal or not).
--
Tore Aursand <toreau@gmail.com>
"What we see depends mainly on what we look for." (Sir John Lubbock)
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 7479
***************************************