Re: perl_run question

2001-05-05 Thread Brett W. McCoy
On Sun, 6 May 2001, shrini B wrote: > I am working on calling perl program from my c program. I have the perl file > name in argv[1]. I want the output in the buffer. How do i intercept the > output of perl_run function which is going to STDOUT so that it comes to the > buffer instead. Have you

perl_run question

2001-05-05 Thread shrini B
Hi I am working on calling perl program from my c program. I have the perl file name in argv[1]. I want the output in the buffer. How do i intercept the output of perl_run function which is going to STDOUT so that it comes to the buffer instead. Any help would be greatly appreciated. Please reply

Re: nested each(%hash) question

2001-05-05 Thread Me
[given a set of ranges, find items that are in range. one way is for each range, look at each item. runtime is proportional to sizes: range set X item set if this is too slow, what is a faster way?] *Design notes* If theory bores you, skip to *Implementation notes*. 1. Changing when you comp

Re: Need help with forms and files

2001-05-05 Thread Brett W. McCoy
At 10:52 AM 5/4/01 -0500, you wrote: >I am trying to append to an existing database and my cgi keeps coming up >with an Internal Server Error. I've looked this over many times with >different books as references, and I can't see what is wrong with it. My >form method is POST. Here is my code: Sha

Re: generating passwords

2001-05-05 Thread Jeff Pinyan
On May 5, Jos I Boumans said: > for (0..int(rand(4) + 4)) { > $_ = int(rand(2)); > if (/0/) { > $string .= $letters[rand(26)]; > } else { > $string .= int(rand(10)); > } > } #for This is a silly use of a regex -- it's rather wasteful. Just use: if (int rand 2) { $string .= int ra

Re: Need help with forms and files

2001-05-05 Thread SunDog
Hi Shawn, The internal server error is usually because, the unix server can't get the perl.exe to parse the .pl script. This is mostly caused by editing on Windows Client and FTP'ing up to a Unix machine. Try working on a Linux box ... and moving the files up from there. It's just th

Re: nested each(%hash) question

2001-05-05 Thread Jeff Pinyan
On May 5, Jim Conte said: >the ($key, $value) of %one is a span of time. > >I need to compare this span of time over every $key of %two. > >while (($key1, $val1) = each (%one)) { > > while (($key2, $val2) = each (%two)) { > > if (($key2 >= $key1) && ($key2 < $val1)) { >

nested each(%hash) question

2001-05-05 Thread Jim Conte
I have 2 hashes, %one and %two. the ($key, $value) of %one is a span of time. I need to compare this span of time over every $key of %two. Here's what I have: while (($key1, $val1) = each (%one)) { while (($key2, $val2) = each (%two)) { if (($key2 >= $key1) && ($key2

Re: Counting lines on a file

2001-05-05 Thread Jos I Boumans
*nods* its why i said careful with what kind of file you use... large files dont respond well to this. a very clean way to do it imho is something like this: ### open a file specified on the command line ### open(I,"$ARGV[0]); ### undef the line seperator, gobble up the file in $in ### {local

Re: generating passwords

2001-05-05 Thread Peter Scott
Here's one that will generate a password exactly 8 characters long composed of two words with a random punctuation character between. (I'd just composed this for someone else.) Substitute an appropriate name of a file of words (one per line, no punctuation) if you don't have /usr/dict/words.

Re: generating passwords

2001-05-05 Thread Jos I Boumans
Here's a little code snippet that might help you on your way this will generate a random pwd of letters and number between 4 and 8 chars. sub usrpwd { #usage $var=usrpwd(); my @letters = ('a'..'z'); my $string; for (0..int(rand(4) + 4)) { $_ = int(rand(2)); if (/0/) { $string .= $lette

Re: generating passwords

2001-05-05 Thread Jeff Pinyan
On May 5, Collin Rogowski said: >rand(123 - 48) + 48: I am glad you used this construct (and even moreso that you explained the mathematics and logic used therein). I have dealt with programmers who used to write simple mIRC scripts, and expect rand(10, 30); to return a number from 10 to 30

Re: generating passwords

2001-05-05 Thread Casey West
On Sat, May 05, 2001 at 12:02:15PM +, cherukuwada subrahmanyam wrote: : Hi, : Is there any easy way to generate random string of particluar length. : The idea is to generate passwords randomly. : I did it using rand function i.e. generating random number and replacing the : number with corres

Re: Counting lines on a file

2001-05-05 Thread Casey West
On Sat, May 05, 2001 at 12:12:08AM -0400, Jeff Pinyan wrote: : On May 4, Brett W. McCoy said: : : >On Fri, 4 May 2001, Susan Richter wrote: : > : >> Can someone tell me what command I can use to go to machines and count the : >> lines on a certain file? I have log files for every machines (20 al

Re: Counting lines on a file

2001-05-05 Thread Jeff Pinyan
On May 5, Jos I Boumans said: >open(I,"$ARGV[0]"); >my @foo = ; >print scalar @foo; It is considered a dubious practice to read a file into an array; this can use of lots of memory. It is particularly wasteful if the goal is just to find out how many lines there are. Another wasteful use is:

Re: Counting lines on a file

2001-05-05 Thread Brett W. McCoy
On Sat, 5 May 2001, Paul wrote: > > --- Mike Lacey <[EMAIL PROTECTED]> wrote: > > my $file = $ARGV(0); > > carefull there -- $ARGV(0) will probably err. >^ ^ > use $ARGV[0] instead. That's what I meant, as I had posted in a followup message. -- Brett

Re: Counting lines on a file

2001-05-05 Thread Paul
--- Mike Lacey <[EMAIL PROTECTED]> wrote: > my $file = $ARGV(0); carefull there -- $ARGV(0) will probably err. ^ ^ use $ARGV[0] instead. ^ ^ __ Do You Yahoo!? Yahoo! Auctions - buy the things you want at great price

Re: Problems installing DBI help urgently required!!!!!!

2001-05-05 Thread Paul Cotter
Were you using CPAN or PPM? If you were using PPM it was not working for a chunk of yesterday (Friday EST) - but it works today. > I unzipped the DBI.zip into a dir and unpacked the DBI.jar file. > then I used ppm install DBI ,but it says > Error installing package could not locate a ppd file

Re: generating passwords

2001-05-05 Thread Collin Rogowski
This generates passwords consisting of letters (lower and uppercase), numbers and printable punctuation (?,.-_[(, etc.) (ASCII 48 - 122). $required_length = 10; for ($i = 0; $i < $required_length; $i++) { $passwd .= chr(int(rand(123 - 48) + 48)); } print $passwd, "\n"; Discussion: rand(123 -

Re: Skipped lines

2001-05-05 Thread Brett W. McCoy
On Fri, 4 May 2001, David Monarres wrote: > I thought that CTRL-Z was the key combo in the Windows world. (but for 2000 > I do not know) Yep, still ^Z in Win2K also. -- Brett http://www.chapelperilous.net/btfwk/

generating passwords

2001-05-05 Thread cherukuwada subrahmanyam
Hi, Is there any easy way to generate random string of particluar length. The idea is to generate passwords randomly. I did it using rand function i.e. generating random number and replacing the number with corresponding alphabet. Is there any easy way??? thanks, _

Re: Problems installing DBI help urgently required!!!!!!

2001-05-05 Thread Jos I Boumans
if you're using ppm already, just try this on the command line: your/path/to/perl/ppm install DBI make sure you get the right dbd drivers too tho do a 'search dbd' and pick out the one you need, followed by an install DBD-YourDriver that should get you started. Regards, Jos Boumans -

Problems installing DBI help urgently required!!!!!!

2001-05-05 Thread Pradeep RajagopalaPanicker
Hello, I unzipped the DBI.zip into a dir and unpacked the DBI.jar file. then I used ppm install DBI ,but it says Error installing package could not locate a ppd file for package DBI. Can someone give a suggestion. [EMAIL PROTECTED] ___

Re: Counting lines on a file

2001-05-05 Thread Jos I Boumans
Here's something that might work for you, depending on how long the files are: open(I,"$ARGV[0]"); my @foo = ; print scalar @foo; handling it this way will also allow you to do matching on lines fairly easily if thats something you like. set $/ to something else if you dont want to discriminat