[13681] in Perl-Users-Digest
Perl-Users Digest, Issue: 1091 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 16 02:05:25 1999
Date: Fri, 15 Oct 1999 23:05:10 -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: <940053909-v9-i1091@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 15 Oct 1999 Volume: 9 Number: 1091
Today's topics:
Re: "Proper" way to load a file (Larry Rosler)
Re: 200+ messages a day and still repetitive? (Brett W. McCoy)
Re: Assistance required, please help... (Abigail)
Re: detailed problem (Craig Berry)
Re: detailed problem <rootbeer@redcat.com>
Re: encryption and crypt() ? <rootbeer@redcat.com>
GD-1.22 Windows build? (Steve Siegel)
Re: Help with extracting a portion of a string <pooka@cygnus.ucdavis.edu>
Re: Help with extracting a portion of a string (Sam Holden)
Re: Help with extracting a portion of a string (Sam Holden)
Learn Perl Language <12345@unbounded.com>
Mathematically oriented routine <jfure@lsil.com>
Re: Mathematically oriented routine <randy@theory.uwinnipeg.ca>
Newbie in search of.... <Admin@themcc.org>
Re: Newbie in search of.... <rootbeer@redcat.com>
Re: Newbie Question (Kragen Sitaker)
Re: offtopic web transactions was [Re: What is best..?] (Abigail)
Oraperl for AIX 4.x (David Cui)
perl and encrypted cookies tlars@my-deja.com
Re: perl and encrypted cookies <rootbeer@redcat.com>
Re: Perl and Excel (Kragen Sitaker)
rand() problem. Please help. <zzhang@bayou.uh.edu>
Re: rand() problem. Please help. <zzhang@bayou.uh.edu>
recursive delete <ab@cd.com>
Re: recursive delete <mwatkins@promotion4free.com>
Re: Running Perl script locally on a win98 machine <gert-jan@souverein.tmfweb.nl>
Re: Running Perl script locally on a win98 machine <wyzelli@yahoo.com>
Substitute for Net::SSL? <mwatkins@promotion4free.com>
Re: tr// question (Sam Holden)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 15 Oct 1999 21:48:20 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: "Proper" way to load a file
Message-Id: <MPG.1271a36b29190f8798a0a2@nntp.hpl.hp.com>
In article <x3yzoxk5nbc.fsf@tigre.matrox.com> on Fri, 15 Oct 1999
17:25:11 -0400, Ala Qumsieh <aqumsieh@matrox.com> says...
...
> Or maybe you can save only the lines that you want and discard some
> lines that aren't necessary:
>
> while (<FILE>) {
> if ($_ == $I_Want_This_Line) {
> $contents .= $_;
> }
> }
Just to pick a tiny nit, I doubt very much that you want '==' in that
comparison, instead of 'eq'.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 16 Oct 1999 03:35:21 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: 200+ messages a day and still repetitive?
Message-Id: <slrn80fsrs.7so.bmccoy@moebius.foiservices.com>
Also Sprach Nolen Johnson <nolenj@worldnet.att.net>:
>A closing note:
> Don't be afraid of crashing your computer a few times...In today's
>technology most operating
>systems wil probably recover.
> It is so cool when you finally figure something out on your own...if you
>ever experience the
>thrill, I guarantee you will think you are king of the world.
I have found that I learn more by answering questions than asking them...
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: 15 Oct 1999 22:28:50 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Assistance required, please help...
Message-Id: <slrn80fs6s.q8s.abigail@alexandra.delanet.com>
Hobbes (hobbes@MailAndNews.com) wrote on MMCCXXXVII September MCMXCIII in
<URL:news:3808F338@MailAndNews.com>:
..
.. I am having trouble with checkboxes. Can someone please help me? Email me
.. and
.. I will give you the details of my problem.
Tk problems are best discussed in comp.lang.perl.tk.
But be sure to describe your problem there.
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 16 Oct 1999 04:09:03 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: detailed problem
Message-Id: <s0fuivdir0133@corp.supernews.com>
Max (nihilist@kenobiz.com) wrote:
> ok, i made some changes, the source code exists here:
> http://www.kenobiz.com/problem.txt
Okay, I guess you *are* a masochist. Your source reproduced below, with
comments interleaved.
> #!/usr/local/bin/perl
Still no -w or 'use strict'. Why avoid having perl tell you what you're
doing wrong? Also no 'use CGI'; instead, you're using a kludgy,
unreliable roll-your-own parm splitter. Why reinvent the wheel, when
there's a nice shiny well-tested sturdy round one in the perl
distribution?
> $theyesfile = "yes.txt";
> $thenofile = "no.txt";
> $thetotal = "total.txt";
>
> ##### parse form #####
>
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> @pairs = split(/&/, $buffer);
> foreach $pair (@pairs) {
> ($name, $value) = split(/=/, $pair);
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $FORM{$name} = $value;
> }
>
> ######################
>
> if ($FORM{$hoke} == 'yes') {
Two errorks in one line. $hoke has not been defined, so what you're
really getting here is $FORM{undef()}. That's always null, which can
become a numeric 0 through coersion if needed. Similarly, the 'yes' on
the right becomes a numeric 0 if coerced. And your use of the == rather
than eq comparison operator forces numeric coersion. Thus the test is 0
== 0, which evaluates true, so we always take this branch. Ouch.
> open (YESFILE, "+>$theyesfile") || die $!;
You're not locking the file. That creates a race condition if two users
hit this CGI app at the same-ish time.
> $tempyes = <YESFILE>;
> $yeses = $tempyes + 1;
> print YESFILE "$yeses";
Could make that
print YESFILE <YESFILE> + 1;
if you were so inclined.
> close(YESFILE);
>
> open (TOTALFILE, "+>$thetotal") || die $!;
> $tot = <TOTALFILE>;
> $tott = $tot + 1;
> print TOTALFILE "$tott";
> close(TOTALFILE);
>
> $maxlength = 110;
> $yesperc = $yeses / $tott;
> $noperc = 1 - $yesperc;
Impying these are percentages is a trap for you or anyone else trying to
maintain this code later. $yesfrac would be better, and similarly for the
others.
> $secyesperc = int(1000 * $yesperc) / 10;
> $secnoperc = int(1000 * $noperc) / 10;
> $yeslength = $yesperc * $maxlength;
> $nolength = $noperc * $maxlength;
I'm going to give up there. Were I designing this from scratch, I'd take
the CGI.pm recommendation above, use a single state file containing the
count of yes and of no votes, and a few dozen other things. But hopefully
this will get you started.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Fri, 15 Oct 1999 22:39:03 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: detailed problem
Message-Id: <Pine.GSO.4.10.9910152236540.25558-100000@user2.teleport.com>
On Sat, 16 Oct 1999, Craig Berry wrote:
> > $tempyes = <YESFILE>;
> > $yeses = $tempyes + 1;
> > print YESFILE "$yeses";
>
> Could make that
>
> print YESFILE <YESFILE> + 1;
>
> if you were so inclined.
Ah, but then it would be even harder to add the seek() that's almost
certainly needed. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 15 Oct 1999 22:46:48 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: encryption and crypt() ?
Message-Id: <Pine.GSO.4.10.9910152243560.25558-100000@user2.teleport.com>
On Fri, 15 Oct 1999, Dan Baker wrote:
> Is the perl source for crypt() available as an "extra"
> somewhere on CPAN that I missed it?
If you get your Win32 Perl from ActiveState, I'm told that you get crypt
with it automatically. But you could also visit this URL. I don't know why
this hasn't already been made into a proper module and put onto CPAN.
Maybe the author just hasn't had the chance yet, but (IMHO) it would be a
welcome addition. Perhaps with a name change to Crypt::UnixCrypt, or some
such, though.....
http://www.pdv-systeme.de/users/martinv/Crypt.pm
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 16 Oct 1999 05:57:11 GMT
From: stevesny@ibm.net (Steve Siegel)
Subject: GD-1.22 Windows build?
Message-Id: <38081318.32698500@news1.ibm.net>
Hi,
Does anyone know of a GD-1.22 (with True Type fonts) complete windows build?
Much thanks,
Steve
PS - An email response would be greatly appreciated
------------------------------
Date: Sat, 16 Oct 1999 03:16:45 GMT
From: Brandon <pooka@cygnus.ucdavis.edu>
Subject: Re: Help with extracting a portion of a string
Message-Id: <38077D5F.74B58FED@cygnus.ucdavis.edu>
Tad McClellan wrote:
>
> Surely UC Davis has courses on Formal Methods and Set Theory?
>
> Go ask a prof if you can parse a context free grammar with
> a regular expression.
>
> Then come back and apologize.
>
That's an interesting thought. Tell me how can I convert a DFA into a
CFG if no regular languages exist in the set of context free languages?
Apology accepted.
------------------------------
Date: 16 Oct 1999 05:40:17 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Help with extracting a portion of a string
Message-Id: <slrn80g3u1.j63.sholden@pgrad.cs.usyd.edu.au>
On Sat, 16 Oct 1999 03:16:45 GMT, Brandon <pooka@cygnus.ucdavis.edu> wrote:
>Tad McClellan wrote:
>>
>> Surely UC Davis has courses on Formal Methods and Set Theory?
>>
>> Go ask a prof if you can parse a context free grammar with
>> a regular expression.
>>
>> Then come back and apologize.
>>
>
>That's an interesting thought. Tell me how can I convert a DFA into a
>CFG if no regular languages exist in the set of context free languages?
Possibly you should also take a logic course and a set theory course while
your at it.
Of course all regular languages are context free, of course you can convert
a DFA into a CFG. You can not however convert a CFG into a DFA.
Maybe a specific CFG can be turned into a DFA, however there is no
algorithm for turning an arbitrary CFG into a DFA.
If you read the sentence you quoted in any way other than asking a
professor to explain how to parse and arbitrary CFG with a regex then you
should read some CS texts. The intent of the statement was obvious to everyone
else.
Of course a troll will always pick on some ambiguity in the english.
--
Sam
In case you hadn't noticed, Perl is not big on originality.
--Larry Wall
------------------------------
Date: 16 Oct 1999 05:41:46 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Help with extracting a portion of a string
Message-Id: <slrn80g40q.j63.sholden@pgrad.cs.usyd.edu.au>
On Fri, 15 Oct 1999 13:55:04 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
>[Posted and a courtesy copy mailed.]
>
>In article <slrn80dlkm.ir2.sholden@pgrad.cs.usyd.edu.au> on 15 Oct 1999
>07:24:06 GMT, Sam Holden <sholden@pgrad.cs.usyd.edu.au> says...
>> On Fri, 15 Oct 1999 07:15:07 GMT, sumengen@my-deja.com wrote:
>> >Hi,
>> >Yours doesn't work if there are more than one comments in the html file.
>> >Will this work?
>> >$html =~ m/(<!--[^(-->)]*-->)/g;
>>
>> That does not do what you think it does. [^(-->)] matches any character except
>> for (,-,> and ). Comments are allowed to contain those characters...
>
>Wrong! It matches any character except these: ( ) * + , - >
Damn ranges hiding in the arrow ;)
--
Sam
We prefer English to remain a rich language, quirky, sloppy, and full
of redundancy. Same for Perl.
--Larry Wall
------------------------------
Date: 16 Oct 1999 05:00:21 GMT
From: Internet Explorer <12345@unbounded.com>
Subject: Learn Perl Language
Message-Id: <38080665$0$203@nntp1.ba.best.com>
any web site good for me to learn perl language?
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Fri, 15 Oct 1999 17:34:10 -0700
From: Jan Fure <jfure@lsil.com>
Subject: Mathematically oriented routine
Message-Id: <3807C802.3FFF2B60@lsil.com>
Hi;
I'm a perl newbie (just finished the chapter 4 examples from the Llama
book).
I would like pointers to mathematical code examples. The program I want
to make does something like this:
a. Open a file containing 2 variables (1 in first column, one in
second, space or comma delimited).
b. Convert the variables into arrays @arr1, @arr2.
c. Generate an array @arr3 (with the derivative of variable 2 with
respect to variable 1.
d. Find the value of variable one ($arr1[x]) corresponding to (with
same index as)
the maximum value of @arr3.
e. Do a linear curve fit of @arr2 about the value in (d.).
f. Find the intersection of the linear curve fit with x-axis.
And more steps of the same style.
If anybody can point me to some perl code that opens files, reads in
variables and performs arithmetical operations on the variables, I will
be thankful.
Jan
PS, I have lurked for a while, and looked at the FAQ's at www.perl.com,
but I don't seem to find anything close to my application. The array
sizes would be a few hundred elements, so I believe memory will be no
issue.
--
__________________________________________________
Jan Fure
LSI Logic Corporation Phone: (503) 618-4351
23400 N.E. Glisan Fax: (503) 618-0308
Gresham, Oregon 97030 E-mail: jfure@lsil.com
__________________________________________________
------------------------------
Date: Fri, 15 Oct 1999 23:43:53 -0500
From: "Randy Kobes" <randy@theory.uwinnipeg.ca>
Subject: Re: Mathematically oriented routine
Message-Id: <7u8vni$iet$1@canopus.cc.umanitoba.ca>
Jan Fure <jfure@lsil.com> wrote in
message news:3807C802.3FFF2B60@lsil.com...
> I'm a perl newbie (just finished the chapter 4 examples from the Llama
> book).
>
> I would like pointers to mathematical code examples. The program I want
> to make does something like this:
>
> a. Open a file containing 2 variables (1 in first column, one in
> second, space or comma delimited).
> b. Convert the variables into arrays @arr1, @arr2.
Hi,
This would be pretty straightforward - look in the
documentation for how to open a file, and also the
split and push functions.
> c. Generate an array @arr3 (with the derivative of variable 2 with
> respect to variable 1.
> d. Find the value of variable one ($arr1[x]) corresponding to (with
> same index as)
> the maximum value of @arr3.
> e. Do a linear curve fit of @arr2 about the value in (d.).
> f. Find the intersection of the linear curve fit with x-axis.
>
> And more steps of the same style.
>
> If anybody can point me to some perl code that opens files, reads in
> variables and performs arithmetical operations on the variables, I will
> be thankful.
>
> Jan
I take it these variables are analytic expressions, as
opposed to numerical values? If so, you should look
at the Math::ematica and/or Math::Pari modules, which would
provide an interface to libraries which can do these sort
of things readily. If the variables happen to be polynomials,
it is probably possible to put together some code to do
some or all of this, but Mathematica or Pari would be easier.
best regards,
Randy Kobes
------------------------------
Date: Fri, 15 Oct 1999 23:31:27 -0500
From: Chris Morasch - Webservant <Admin@themcc.org>
Subject: Newbie in search of....
Message-Id: <3807FF9F.C58FF343@themcc.org>
Greeting group!
I am learning perl but, not as fast as time will allow. I am the church
administrator for The Master's Community Church - http://themcc.org as
well as the webservant. With all the building remodeling going on right
now, I don't have time to study out and write a script for a on-line
tape request form that I have been working on. The tapes are not sold
for a profit but, rather given out for donations given to the church.
I am looking for a generic script that works like a on-line store, but
with out the cart and the big price tag.
or
Some one willing to write a script that works for what I need.
Chris
------------------------------
Date: Fri, 15 Oct 1999 22:53:47 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Newbie in search of....
Message-Id: <Pine.GSO.4.10.9910152253290.25558-100000@user2.teleport.com>
On Fri, 15 Oct 1999, Chris Morasch - Webservant wrote:
> I am looking for a generic script that works like a on-line store, but
> with out the cart and the big price tag.
If you're wishing merely to _find_ (as opposed to write) programs,
this newsgroup may not be the best resource for you. There are many
freeware and shareware archives which you can find by searching Yahoo
or a similar service. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 16 Oct 1999 03:31:28 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Newbie Question
Message-Id: <kkSN3.7592$E_1.419094@typ11.nn.bcandid.com>
In article <7u85va$3he$1@gxsn.com>,
Martin Elliott <martin@mert.globalnet.co.uk> wrote:
>I am trying to incorporate Perl into a website. All I want to do is use it
>to read input from a .txt file, and display it, and also to write to another
>.txt file regularly.
Here's a Perl program that reads three lines from a text file, outputs
them, and then writes a number to another text file once a second. I
don't know if it will help you much.
It's not a CGI script, but it's easy to make into one.
#!/usr/bin/perl -w
use strict;
use IO::Handle;
open THE_TEXT_FILE, "<walnuts.txt" or die "can't open walnuts.txt: $!\n";
my $line;
for (1..3) {
$line = <THE_TEXT_FILE>;
print "Got this line: $line";
}
open THE_OTHER_TEXT_FILE, ">>anotherone.txt" or die "can't open anotherone.txt: $!\n";
my $n = 1;
autoflush THE_OTHER_TEXT_FILE 1;
for (;;) {
print THE_OTHER_TEXT_FILE $n, "\n";
sleep 1;
}
>I have never used Perl before, so does anyone have any good URLs for
>tutorials/FAQ or know any good books etc.
Recommend you try the following commands somewhere you have Perl
installed. They will lead you on to greater things.
perldoc perldoc
perldoc perlfaq
perldoc perl
perldoc -f print
perldoc IO::Handle
perldoc CGI
Good books include the camel book and the llama book. perldoc
perlbook.
>Also, how can you test Perl scripts without uploading the files?
Install perl on your machine. If you want to test CGI scripts, it's
easier if you install a web server on your machine too.
Oh, by the way, messages with nonspecific Subject: lines tend to get
ignored.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Oct 12 1999
28 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: 15 Oct 1999 22:20:28 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: offtopic web transactions was [Re: What is best..?]
Message-Id: <slrn80frn9.q8s.abigail@alexandra.delanet.com>
lt lindley (ltl@rgsun40.viasystems.com) wrote on MMCCXXXVII September
MCMXCIII in <URL:news:7u8kr5$1il$1@rguxd.viasystems.com>:
\\ Abigail <abigail@delanet.com> wrote:
\\ :>The best advice is not to use a stateless protocol for something
\\ :>that requires state. Every "solution" to this problem has its
\\ :>drawback, and will not work in all cases.
\\
\\ This is not my bailiwick. I know about the stateless nature
\\ of HTTP and understand the various failure scenarios, but
\\ I've never needed to play in this arena.
\\
\\ What do the big sites do? Maintain transaction state in their
\\ database for a fixed period of time and do garbage collection?
Hidden fields (probably the most reliable), cookies, URL codifying
(used to be more popular a few years ago), Javascript, Java, and
the attitude "screw them if it ain't works".
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 16 Oct 1999 05:34:01 GMT
From: cui@solaria.sol.net (David Cui)
Subject: Oraperl for AIX 4.x
Message-Id: <38080e49$0$28088@news.sol.net>
Hi! netter,
I made DBD for Oracle on an AIX4.2.1 and
Oracle 8.0.5 using gcc and my perl program
coredumped at ora_login.
In fact, make test doesn't work too.
Can anyone help me with this?
Thanks.
David
------------------------------
Date: Sat, 16 Oct 1999 04:02:17 GMT
From: tlars@my-deja.com
Subject: perl and encrypted cookies
Message-Id: <7u8tc5$lmh$1@nnrp1.deja.com>
I'd like to use perl to encrypt some data that I will store in a cookie
on a users machine. Unfortunately, I have to run perl on Windows NT
(not my choice). Does anyone know a perl package I could use for
encryption that will run on NT. I'd like the encryption algorithm to be
fairly powerful.
Thanks,
Tait
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 15 Oct 1999 22:52:56 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: perl and encrypted cookies
Message-Id: <Pine.GSO.4.10.9910152252360.25558-100000@user2.teleport.com>
On Sat, 16 Oct 1999 tlars@my-deja.com wrote:
> Does anyone know a perl package I could use for encryption that will
> run on NT.
If there's a module which does what you want, it should be listed in
the module list on CPAN. If you don't find one to your liking, you're
welcome and encouraged to submit one! :-) Hope this helps!
http://www.cpan.org/
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Sat, 16 Oct 1999 03:10:17 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Perl and Excel
Message-Id: <t0SN3.7521$E_1.419623@typ11.nn.bcandid.com>
In article <7u7nuk$39n$1@ultra.sonic.net>, Gala Grant <gala@sonic.net> wrote:
>I need to use Perl to open an Excel Spreadsheet and pull out info, and then
>dynamically create a web page based on the pulled info. Does anyone have
>any info on using Perl to manipulate Excel? Is there a module or any text
>about it somewhere?
You can control Excel via OLE aka ActiveX. But if you have Excel
running on your web server, IMHO, you have a problem. Maybe you should
see if you can store the Excel data in a CSV file.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Tue Oct 12 1999
28 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Sat, 16 Oct 1999 00:16:09 -0500
From: Zhengdong Zhang <zzhang@bayou.uh.edu>
Subject: rand() problem. Please help.
Message-Id: <38080A19.BAD7C18D@bayou.uh.edu>
In my perl program I have the following two functions:
sub individual_constructor
{
my $i;
my ($k, $v);
my @individual;
my $point;
$i = 0;
for $point (@all_points)
{
($k) = keys %$point;
($v) = values %$point;
if (!defined($v->[-2])) ### this is an other_point
{
$individual[$i] = {$k, [rand(1), rand(1)]};
}
else ### this a ref_point
{
$individual[$i] = {$k, [$v->[-2], $v->[-1]]};
}
$i++;
}
return @individual;
}
sub initialize_first_generation
{
my $i;
foreach $i (0..($pop_size-1))
{
$individuals[$i] = [individual_constructor()]
}
}
--------------
Within each $individuals[$i] I can get random numbers, but every single
random number is the same to different individual and different program
run. How I can solve this problem since the random number generation is
very important to this EP program. Is there any tricks about rand()?
Thanks
Zhnegdong zhang
------------------------------
Date: Sat, 16 Oct 1999 00:35:19 -0500
From: Zhengdong Zhang <zzhang@bayou.uh.edu>
Subject: Re: rand() problem. Please help.
Message-Id: <38080E97.A0C6CD02@bayou.uh.edu>
Zhengdong Zhang wrote:
> In my perl program I have the following two functions:
>
> sub individual_constructor
> {
> my $i;
> my ($k, $v);
> my @individual;
> my $point;
>
> $i = 0;
> for $point (@all_points)
> {
> ($k) = keys %$point;
> ($v) = values %$point;
>
> if (!defined($v->[-2])) ### this is an other_point
> {
> $individual[$i] = {$k, [rand(1), rand(1)]};
> }
> else ### this a ref_point
> {
> $individual[$i] = {$k, [$v->[-2], $v->[-1]]};
> }
> $i++;
> }
>
> return @individual;
> }
>
> sub initialize_first_generation
> {
> my $i;
>
> foreach $i (0..($pop_size-1))
> {
> $individuals[$i] = [individual_constructor()]
> }
> }
>
> --------------
>
> Within each $individuals[$i] I can get random numbers, but every single
> random number is the same to different individual and different program
> run. How I can solve this problem since the random number generation is
> very important to this EP program. Is there any tricks about rand()?
>
> Thanks
> Zhnegdong zhang
I missed the obvious mistake: $v->[-2] is always defined. After I change
it to $v->[$dimension]
everything works fine.
zz
------------------------------
Date: Fri, 15 Oct 1999 23:37:07 -0500
From: "Blair Heuer" <ab@cd.com>
Subject: recursive delete
Message-Id: <7u8vs7$cck$1@fir.prod.itd.earthlink.net>
I am trying to find out how to do a recursive delete. I need to be able to
delete folders regardless of what is within them. I looked around on
DejaNews trying to find the answer, to hopefully not have to bother the
board with repeated questions (sorry i was unable to do that), and found
many people point to File::Find but never a good explanation. Could someone
please show me, possibly show all the code, to delete everything in a
folder, $deleteme for instance.
Thanks,
Blair Heuer
------------------------------
Date: Sat, 16 Oct 1999 05:23:45 GMT
From: "Mike Watkins" <mwatkins@promotion4free.com>
Subject: Re: recursive delete
Message-Id: <BZTN3.3275$AX.172617@news1.rdc1.ab.home.com>
Hi there,
Try this little bit of code which I wrote for a script I'm creating.
$newdir is the directory which you want to delete, without the slash at the
end, and the $rmdir variable is the location to the "rmdir" function, which
on UNIX servers is usually located at "/bin/rmdir". For Windows systems,
use just "rmdir".
##############################################
$newdir = "/home/mysite/www/directory";
$rmdir = "/bin/rmdir";
sub delete_site {
my ($user, $type) = @_;
my (@pages, @files, @dirs, $sl, $newdir);
$type = "\L$type\E";
use English;
## If we're on a Windows server
if ($OSNAME =~ /Win/i) {
$main::member_path =~ s/\//\\/g;
$sl = "\\";
} else { $sl = "/"; }
## Get the pages of the master site
opendir (DIR, $newdir) or die("Unable to open directory,
<i>$newdir</i>");
@files = grep (!/^\.\.?$/, readdir (DIR));
closedir (DIR);
my $subdir = '';
## Go through all files and directories in master site
SORTDIR:
foreach (@files) {
if (-f $newdir.$sl.$subdir.$_) { push @pages, $subdir.$_; }
elsif (-d $newdir.$sl.$subdir.$_) {
push @dirs, $subdir.$_;
}
}
## Get pages from sub dir of master site
my $x=0;
until (@dirs == 0) {
opendir (DIR, $newdir.$dirs[$x]) || die('Unable to open
directory');
splice @files;
@files = grep (!/^\.\.?$/, readdir (DIR));
closedir (DIR);
$subdir = $dirs[$x].$sl;
push @dir, $dirs[$x];
splice @dirs, $x, 1;
goto SORTDIR;
$x++; }
## Delete all web pages from web site
foreach $pg (@pages) {
unlink $newdir.$sl.$pg if -e $newdir.$sl.$pg;
}
## Delete all of the directories from site
foreach (@dir) {
open RMDIR, "|$rmdir $newdir$_" or die('Unable to delete
directory');
print RMDIR $newdir.$_;
close RMDIR;
}
## Delete user's main directory
open RMDIR, "|$rmdir $newdir" or die("Unable to delete directory");
print RMDIR $newdir;
close RMDIR;
}
##############################################
Hope that helps,
Mike Watkins
Blair Heuer wrote in message <7u8vs7$cck$1@fir.prod.itd.earthlink.net>...
>I am trying to find out how to do a recursive delete. I need to be able to
>delete folders regardless of what is within them. I looked around on
>DejaNews trying to find the answer, to hopefully not have to bother the
>board with repeated questions (sorry i was unable to do that), and found
>many people point to File::Find but never a good explanation. Could someone
>please show me, possibly show all the code, to delete everything in a
>folder, $deleteme for instance.
>
>Thanks,
>Blair Heuer
>
>
>
------------------------------
Date: 16 Oct 1999 05:00:42 GMT
From: <gert-jan@souverein.tmfweb.nl>
Subject: Re: Running Perl script locally on a win98 machine
Message-Id: <3808067a$1$203@nntp1.ba.best.com>
Erik van Roode wrote:
>
>
> Martin Cloutier <martinc@propage.qc.ca> wrote:
> > I am trying to run my scripts Locally on my win 98 machine using
> > Netscapo or Explorer as the user interface.
> > and cannot seem to make it work.
> > I am calling the CGI scrip from a form, but am not getting an answer
> > from the Script (although the script works well on the internet.
>
>
>You can't run Perl scripts locally because it's an interpreted language.
> The reason it runs fine on the internet is because there is a Perl
interpreter installed on your ISP's webserver ! Perhaps it can be done by
installing a Perl interpreter on your local machine. I don't know if this
is possible or where to get this program. But I'm looking into this
subject myself because I want to do the same thing. If I find anything
I'll send E-mail to above adress.
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Sat, 16 Oct 1999 15:26:57 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Running Perl script locally on a win98 machine
Message-Id: <IsUN3.5$GG1.1296@vic.nntp.telstra.net>
Martin Cloutier <martinc@propage.qc.ca> wrote in message
news:38076866.548767B@propage.qc.ca...
> I am trying to run my scripts Locally on my win 98 machine using
> Netscapo or Explorer as the user interface.
> and cannot seem to make it work.
> I am calling the CGI scrip from a form, but am not getting an answer
> from the Script (although the script works well on the internet.
>
> can anyone steer me in the right direction
>
> Martin Cloutier
>
You have to install a web server.
I suggest Apache for win32 from apache.org or Microsoft's Personal Web
Server, depending on your preferences.
Wyzelli
------------------------------
Date: Sat, 16 Oct 1999 04:55:59 GMT
From: "Mike Watkins" <mwatkins@promotion4free.com>
Subject: Substitute for Net::SSL?
Message-Id: <zzTN3.3271$AX.171434@news1.rdc1.ab.home.com>
Hello there,
I'm trying to create a Perl script which POST's some form data to a remote
SSL server. I also need this Perl script to be easily distributed and
installed.
Now, I tried using the libwww-perl module to do this, but in order to
communicate with a SSL server using LWP, you need to have the Net::SSL
module installed, which contains a ".xs" file which makes it harder to
install. I don't want to have to make everyone install a Perl module on
their server for this one script.
So next, I played around with the IO::Socket module. I can communicate with
a normal web server using the IO::Socket module, but not a SSL server.
I then read up on SSL server protocol and found out about the "SSL
Handshake", ect..., which sounds fairly hard to do. But will be willing to
create a Perl script for it if someone gives me some direction.
Does anyone know anyway I can "easily" post form data to a remote SSL server
without having to install any extra Perl modules? For example, using the
IO::Socket module?
Thanks,
Mike Watkins
------------------------------
Date: 16 Oct 1999 05:50:23 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: tr// question
Message-Id: <slrn80g4gv.j63.sholden@pgrad.cs.usyd.edu.au>
On Sat, 16 Oct 1999 02:02:34 GMT, Brandon <pooka@cygnus.ucdavis.edu> wrote:
>Ala Qumsieh wrote:
>>
>> Brandon <pooka@cygnus.ucdavis.edu> writes:
>>
>> > Abigail wrote:
>> > >
>> > > Brandon (pooka@cygnus.ucdavis.edu) wrote on MMCCXXXVI September MCMXCIII
>> > > in <URL:news:38064EA9.9A4F75E3@cygnus.ucdavis.edu>:
>
>> > can't get my chemisty experiment to work properly." "Go read the
>> > textbook again. I'm too busy coming up with clever signature lines."
>>
>> But teachers teach you *HOW* to solve your problems. They don't merely
>> give solutions. Abigail was being a good teacher there, IMHO.
>>
>> If that's your logic, then I can see you getting a calculator to add 1
>> and 1.
>
>That's a pretty clever analogy. Your own creation?
>
>Abigail didn't tell him _how_ to solve his problem. She merely reminded
>him of his problem, and not in a respectful way.
Abigail said in a nice polite way that the answer is in the manual. Instead
of saying "you are an idiot and didn't read the manual", instead the the
poster was asked which part of the manual they didn't understand.
Sounds like the polite way of pointing them towards the place where the
answer is written.
The scary thing is I've scored your posts _up_ since you seem to be
posting the most insane humourous things at the moment. I do have a cron job
which will change the 10 to a -9999 in a week or so in case I forget of
course.
--
Sam
You are bordering on ridiculous if you think you need to support your
premises. Such an argument is an infinite regression.
--George Reese in <wv0O1.1521$Ge.4809664@ptah.visi.com>
------------------------------
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 1091
**************************************