Newbie problem

2002-07-30 Thread Ing . Pavel Koutn
Hi, I need to communicate with remote device through UDP protocol, this is my problem: If I send number to port UDP XY of remote device (number must be 2-bytes long), remote device will send me back this data structure: (Pascal-like) TS_QUE_TYPE = Packed Record tsqQueId : Word; tsqStatus

WIN32 Perl - Domain Disk Space Report Generator

2002-07-30 Thread Daniel Figueroa
When you look at the following Perl program which probes a NT domain for servers using Win32::NetAdmin::GetServers, and runs Win32::AdminMisc::GetDriveSpace( $UNCPath ) to retrieve disk utilization, how do you see the data getting written to $my_dir/DiskSpace.txt found in the subroutine show_it

Re: Post to a second CGI script

2002-07-30 Thread Steve Grazzini
Jim Lundeen [EMAIL PROTECTED] wrote: I have 2 scripts. One accepts 3 values LOGIN_USERNAME, LOGIN_PASSWORD and ACTION from an HTML form. That script looks in a user table in MySQL to verify the user. If valid, it passes them to MENU.CGI with LOGIN_USERNAME and a unique session number

Re: Post to a second CGI script

2002-07-30 Thread zentara
On Mon, 29 Jul 2002 20:06:09 -0400, [EMAIL PROTECTED] (Jim Lundeen) wrote: Here's the question: How to I post the LOGIN_USERNAME and USN to the MENU.CGI script? I don't want the user carrying the info around in the Location bar as ?USN=1234LOGIN_USERNAME=somebody -- I want it to be part of the

Help with the code please

2002-07-30 Thread Soheil Shaghaghi
Hello everyone, I want to be able to pass some variables from the page to a recommend it script, so I made a few adjustments like the following: use CGI; $q = new CGI; # $MAXNUM=5; $MAXNUM = $q-param('MAXNUM'); So, I pass the number of referrals from the URL, like: A

Re: Post to a second CGI script

2002-07-30 Thread Randal L. Schwartz
Jim == Jim Lundeen [EMAIL PROTECTED] writes: Jim Ok, perhaps not the most eloquent of methods, but here's what I Jim did (putting my little knowledge of JavaScript to use!)... If the answer is javascript, you're not done yet. Many corporate firewalls filter javascript. Many individual users

HTTP_EQUIV Meta Tag

2002-07-30 Thread John Pitchko
I can't get this HTTP_EQUIV meta tag to print. I am following the syntax right out of the man pages: print $query-start_html( -head = meta({ -http_equiv = refresh, -content = $refresh } ) ); And I get: Content-type: text/html Software error: Undefined subroutine main::meta called at

HTTP headers

2002-07-30 Thread Octavian Rasnita
Hi all, I want to print a zip file to the browser but I want to make the browser think that it gets the zip file directly, not through a CGI script. Why? Because when clicking on a link for downloading a zip file directly, the download managers are triggered, and the page visitors can download

RE: HTTP_EQUIV Meta Tag

2002-07-30 Thread Bob Showalter
-Original Message- From: John Pitchko [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 12:59 PM To: Subject: HTTP_EQUIV Meta Tag I can't get this HTTP_EQUIV meta tag to print. I am following the syntax right out of the man pages: print $query-start_html( -head =

RE: HTTP headers

2002-07-30 Thread Bob Showalter
-Original Message- From: Octavian Rasnita [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 1:13 PM To: [EMAIL PROTECTED] Subject: HTTP headers Hi all, I want to print a zip file to the browser but I want to make the browser think that it gets the zip file directly,

Checking Form data

2002-07-30 Thread Kipp, James
What is the best way to validate form data. I have a form which the user enters dates like '08/01/2002'. What is the best way to make sure this format is entered. Should i use javascript here or regex? Thanks -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: Checking Form data

2002-07-30 Thread Ovid
--- Kipp, James [EMAIL PROTECTED] wrote: What is the best way to validate form data. I have a form which the user enters dates like '08/01/2002'. What is the best way to make sure this format is entered. Should i use javascript here or regex? Thanks Answering what I think you're asking:

RE: Checking Form data

2002-07-30 Thread Kipp, James
Answering what I think you're asking: Client-side validation (javascript) is fine for avoiding an unnecessary trip to the server, but it's easily avoided -- you can just turn javascript off. Therefore, server-side validation is mandatory lest you open up security holes. thanks.

Re: HTTP headers

2002-07-30 Thread Wiggins d'Anconia
My suspicion is that IE is looking ahead of time at the extension of the file requested and doing some guess work (*I could be wrong*) but in this case your only real option would be to rename your CGI script, which is a beautiful thing about the web/unix/etc, you can do this! You might try

Any better way to make 1000000 becomes 1,000,000 ?

2002-07-30 Thread Connie Chan
my $num = 100; # or whatever integer; $num = reverse($num); $num =~ s/(\d{3})/$1,/g; chop $num if $num =~ /,$/; $num = reverse($num); print $num; I have this script to make an integer with comma at every 3 digits, from right to left. (What should this presentation way name actaully ?? )

Sort table with dynamic order of fields

2002-07-30 Thread Connie Chan
In Excel, there is an interesting function which can sort a table by fields with any order and hierarchy order. Is there any module can do this for whatever array of array, hash of array... etc. ? But what I am looking for is not for and related to any database. So some of DBI functions maybe

RE: Any better way to make 1000000 becomes 1,000,000 ?

2002-07-30 Thread Beau E. Cox
Connie - Try this (not really much better) from Perl Cookbook #2.17: use strict; use warnings; my $num = commify (1_000_000); print $num\n; sub commify { my $text = reverse $_[0]; $text =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g; return scalar reverse ($text); } Aloha

Problem with Net::Ping

2002-07-30 Thread Angerstein
Hello, I wrote a big skript which uses net::ping (ping.pm) (and tk). I noticed that the resultes of Net::Ping are not identical to the system commad ping. Much more Items are not reachable over Net::Ping then they are over the system command. I can´t explain why. (Even after rewriting 500 lines

Re: Help, I suppose.

2002-07-30 Thread Steve Grazzini
T?mas gu?mundsson [EMAIL PROTECTED] wrote: I need help ( you figure ?) #!/usr/bin/perl use strict; use Cwd; my $phone_book = qw{ ^ THat should be '@phone_book' (or '%phone_book', really.) A list-in-scalar-context (my $var = qw/foo bar/;) evaluates to the last element of the

Re: Problem with Net::Ping

2002-07-30 Thread Sudarshan Raghavan
On Tue, 30 Jul 2002, Angerstein wrote: Hello, I wrote a big skript which uses net::ping (ping.pm) (and tk). I noticed that the resultes of Net::Ping are not identical to the system commad ping. Much more Items are not reachable over Net::Ping then they are over the system command. The

Re: Please help

2002-07-30 Thread Ramprasad A Padmanabhan
the outputs of a program can be to STDOUT or STDERR ( and also to files it opens internally ) On unix like systems STDOUT is known by 1 STDERR by 2 The output of a program on STDOUT goes wherever 1 is directed to similarly for STDERR 2 If U want to redirect STDERR to STDOUT use 21 eg.

Re: Please help

2002-07-30 Thread Sudarshan Raghavan
On Mon, 29 Jul 2002, Ning luo wrote: Hi Sir I have a perl script using system function, like system(perl goup 1basicName.scan 2basicName.err); goup is another perl script, what I want to do is executing goup, then print the results to the file basicName.scan, if it abort

Re: Classic text problem: matching consecutive newlines

2002-07-30 Thread Steve Grazzini
Kevin Zembower [EMAIL PROTECTED] wrote: I'm facing what I believe to one of the classic text manipulation problems, transforming a document which was typed with a hard return at the end of every physical line, and two consecutive newlines to mark the end of a paragraph. Would anyone help

Re: How initialize hash inside a while loop ?

2002-07-30 Thread Jean Berthold
Hello Jeff, In fact, As you seen .. I'm newbie in Perl (in english too !) I'm just trying to translate a korn-shell script to perl-script for learning I try to use hashes like structs in C language, is it possible ? I search an easy way like: declare a struct an put it's reference in an

Re: Any better way to make 1000000 becomes 1,000,000 ?

2002-07-30 Thread chris
This works for me http://search.cpan.org/doc/WRW/Number-Format-1.44/Format.pm use strict; use warnings; use Number::Format qw(:subs :vars); $THOUSANDS_SEP = '.'; $DECIMAL_POINT = ','; my @number = (123456789,123); foreach my $number (@number) { print format_number($number) . \n; } use

Re: How initialize hash inside a while loop ?

2002-07-30 Thread Felix Geerinckx
on Tue, 30 Jul 2002 10:51:56 GMT, [EMAIL PROTECTED] (Jean Berthold) wrote: In my case : my @array ; my $counter = 0 ; # how to declare the prototype for the record used below ??? my $record = { FS, SNAP_PATH, TAPE_POS } ; # don't function ... There is no need to declare a prototype. If

Re: How initialize hash inside a while loop ?

2002-07-30 Thread Sudarshan Raghavan
On Tue, 30 Jul 2002, Jean Berthold wrote: my @array ; my $counter = 0 ; # how to declare the prototype for the record used below ??? my $record = { FS, SNAP_PATH, TAPE_POS } ; # don't function ... You don't have to declare the keys of a hash beforehand. When you say my $record = {

Re: Classic text problem: matching consecutive newlines

2002-07-30 Thread John W. Krahn
Steve Grazzini wrote: Kevin Zembower [EMAIL PROTECTED] wrote: I'm facing what I believe to one of the classic text manipulation problems, transforming a document which was typed with a hard return at the end of every physical line, and two consecutive newlines to mark the end of a

RE: Sort table with dynamic order of fields

2002-07-30 Thread Timothy Johnson
Here's a thought: You can convert the Excel spreadsheet to a .csv file and then use DBD::CSV to sort the fields. You should be able to do this using Win32::OLE as long as you run it on a system with Excel installed. The macro code fro saving the file to a .csv is: ActiveWorkbook.SaveAs

Re: Help, I suppose.

2002-07-30 Thread Jeff 'japhy' Pinyan
On Jul 30, Tómas Guðmundsson said: my $phone_book = qw{ Fred 0123 John 4567 Bill 8901 }; If you had warnings on, you'd see that this wasn't doing very much. my $selection = 1; do { print \n Please select one choice; print \n 1. Enter name.; print \n 2. Quit.\n; chomp(my $selection

RE: WINNT

2002-07-30 Thread Kipp, James
I think you need to take a look at perdoc dbi. try breaking the script down into sections. first try just connecting to your datasource and see if that produces any errors, then proceed with the next section. also take a look at the docs for the execute(). you don't need to assign the execute()

cisco regexp

2002-07-30 Thread Hernan Marcelo Salvarezza
Hello all, i am parsing a cisco log and i can'nt find the exact regexp,following goes the log and the script.. Jul 25 10:39:12 10.0.0.1 852: 1d23h: %VOIPAAA-5-VOIP_CALL_HISTORY: CallLegType 2, ConnectionId 0 0 0 0, SetupTime *10:46:49.143 GMT Thu Jul 25 2002, PeerAddress 0051122323223,

Re: Problem with Net::Ping

2002-07-30 Thread Sudarshan Raghavan
On Tue, 30 Jul 2002, drieux wrote: On Tuesday, July 30, 2002, at 01:31 , Sudarshan Raghavan wrote: [..] The system ping command sends ICMP echo packets and by default Net::Ping sends udp packets. This will work only if the machine you are pinging supports udp echo requests. For

RE: cisco regexp

2002-07-30 Thread nkuipers
Jul 25 10:39:12 10.0.0.1 852: 1d23h: %VOIPAAA-5-VOIP_CALL_HISTORY: CallLegType 2, ConnectionId 0 0 0 0, SetupTime *10:46:49.143 GMT Thu Jul 25 2002, PeerAddress 0051122323223, PeerSubAddress , DisconnectCause 0 , DisconnectText , ConnectTime *10:47:09.753 GMT Thu Jul 25 2002, DisconnectTime

Re: Problem with Net::Ping

2002-07-30 Thread drieux
On Tuesday, July 30, 2002, at 09:18 , Jean-Luc BEAUDET wrote: [..] Yu have to be aware that, generally, if yu go out the local network FireWall block ICMP packets... The ping statement is not a good evidence test... excuse me while I giggle... a bit here. I have no idea how many times I

HTML, Urgent

2002-07-30 Thread Omar Shariff
Hi, i correct the problem with NT, and was the server html... Now i have another problem i'm trying to put a image in a page (its a form image) and write over with a database records... well my problem is: the image when i resize to enter in a Legal size, see bad, i see in other page that the

How to replace a literal with a variable

2002-07-30 Thread Larry Steinberg
Hi, How can I replace the literal nlf with a variable in the code below? Thanks in advance. sub parseLogLine { $line = $_; %searchInfo = (); @searchInfo = split / +/, $line; # found any listings? $numListings = $searchInfo[8]; $numCategories = $searchInfo[10]; #

problem with count record and while loop

2002-07-30 Thread loan tran
Hi everyone, Could you point out what is wrong the count and the while loop below? Here is part of the script: $sql_alias = qq( select aliasName = l.name from master..syslogins l, $eachdb..sysusers u, $eachdb..sysalternates a where a.suid = l.suid and a.altsuid =

RE: How to replace a literal with a variable

2002-07-30 Thread nkuipers
I'm probably not understanding what exactly you needbut...as I see it, $err holds whatever error message that you captured with a regex. So if you want to make a variable with the same name as the literal, dereference a variable with the name held in $err and the new var will autovivify:

RE: HTML, Urgent

2002-07-30 Thread Timothy Johnson
This almost sounds like something that the cgi list might be able to answer better. -Original Message- From: Omar Shariff [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 7:37 AM To: [EMAIL PROTECTED] Subject: HTML, Urgent Hi, i correct the problem with NT, and was the server

RE: How to replace a literal with a variable

2002-07-30 Thread Timothy Johnson
If you just want to repolace nlf with a variable, you can just replace it with a variable? if ($err eq $variable){ Or else you need to be more specific about what you need. -Original Message- From: Larry Steinberg [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 8:06 AM To:

empty a dir

2002-07-30 Thread loan tran
Is there a better way to do this in perl: $reportdir = '/sybase/dba/scripts/dbuser_report'; `rm -r $reportdir/*`; __ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED]

RE: empty a dir

2002-07-30 Thread Nikola Janceski
File::Path has a function called rmtree. -Original Message- From: loan tran [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 12:44 PM To: [EMAIL PROTECTED] Subject: empty a dir Is there a better way to do this in perl: $reportdir =

RE: empty a dir

2002-07-30 Thread NYIMI Jose (BMB)
Try this: @files=glob(/sybase/dba/scripts/dbuser_report/*); unlink(@files); HTH, José. -Original Message- From: loan tran [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 6:44 PM To: [EMAIL PROTECTED] Subject: empty a dir Is there a better way to do this in perl: $reportdir

RE: empty a dir

2002-07-30 Thread Nikola Janceski
nope that won't work. s/he wants recursive removal. not just files. check search.cpan.org for File::Path docs or perldoc File::Path use rmtree. -Original Message- From: NYIMI Jose (BMB) [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 12:54 PM To: loan tran; [EMAIL

Re: How to replace a literal with a variable

2002-07-30 Thread Larry Steinberg
Here is what I need. I hope this explains it better. I have a script which creates a report for No Listings Found errors. I'd like to adapt it to create a report for any ERR code condition in the log. The errors and values are below. TIA! Error | Value city not in state | TSE ZIP not in

your frank opinion requested

2002-07-30 Thread nkuipers
Hello all, I am a relative newcomer to the language (couple of months), and I totally love it. One way or the other, I use it almost every day in my work, and even beyond practical applications I want to improve my Perl as much as I can. I own the Camel 3ed, and between that and a

RE: HTML, Urgent

2002-07-30 Thread Perl
Hi, If I understand correctly, you want to have an image of a form underneath text written on top, to look like the text is in the form. The problem is the image is small and a bad resolution for printing, but high resolution makes it just look huge and prints on more than one page. I am not

Fw: Help, I suppose.

2002-07-30 Thread Tómas Guðmundsson
- Original Message - From: Tómas Guðmundsson [EMAIL PROTECTED] To: Janek Schleicher [EMAIL PROTECTED] Sent: Tuesday, July 30, 2002 8:41 AM Subject: Re: Help, I suppose. okey, I made it a hash now. And everything works and that's nothing but cool! But what do I do to make it more

Re: your frank opinion requested

2002-07-30 Thread Felix Geerinckx
on Tue, 30 Jul 2002 17:22:53 GMT, Nkuipers wrote: for someone who intends to pursue Perl while he's still breathing, would you recommend purchasing the Cookbook as an investment in skills and time-saving? Yes, without any doubt whatsoever. But why don't you convince yourself, and look at

Re: your frank opinion requested

2002-07-30 Thread drieux
On Tuesday, July 30, 2002, at 10:22 , nkuipers wrote: [..] for someone who intends to pursue Perl while he's still breathing, would you recommend purchasing the Cookbook as an investment in skills and time-saving? [..] it would have been nice to have had it around when i started playing

Re: cisco regexp

2002-07-30 Thread John W. Krahn
Hernan Marcelo Salvarezza wrote: Hello all, i am parsing a cisco log and i can'nt find the exact regexp,following goes the log and the script.. Jul 25 10:39:12 10.0.0.1 852: 1d23h: %VOIPAAA-5-VOIP_CALL_HISTORY: CallLegType 2, ConnectionId 0 0 0 0, SetupTime *10:46:49.143 GMT Thu Jul 25

RE: How to replace a literal with a variable

2002-07-30 Thread Timothy Johnson
Do you mean something like this? open(LOG,log.txt); my %errs = (); while(LOG){ chomp $_; my($details,$err) = split(/\|/,$_); $err =~ s/^\s+//; $errs{$err}++ if $err; } print Total for each error:\n; print -\n\n; foreach(sort

Re: your frank opinion requested

2002-07-30 Thread John W. Krahn
Nkuipers wrote: Hello all, Hello, I am a relative newcomer to the language (couple of months), and I totally love it. One way or the other, I use it almost every day in my work, and even beyond practical applications I want to improve my Perl as much as I can. I own the Camel 3ed, and

Re: your frank opinion requested

2002-07-30 Thread Janek Schleicher
Nkuipers wrote at Tue, 30 Jul 2002 19:22:53 +0200: I am a relative newcomer to the language (couple of months), and I totally love it. One way or the other, I use it almost every day in my work, and even beyond practical applications I want to improve my Perl as much as I can. I own the

Down and dirty duplicate deleter

2002-07-30 Thread Kirby_Sarah
Hi, I have instances where I want to delete duplicate elements out of an array. Is there an easy way to do this? -Sarah -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Down and dirty duplicate deleter

2002-07-30 Thread Nikola Janceski
{ my %seen; @uniq = grep { !$seen{$_}++ }, @arrayWithDups; } -Original Message- From: Kirby_Sarah [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 30, 2002 3:04 PM To: [EMAIL PROTECTED] Subject: Down and dirty duplicate deleter Hi, I have instances where I want to delete

RE: Down and dirty duplicate deleter

2002-07-30 Thread Jeff 'japhy' Pinyan
On Jul 30, Nikola Janceski said: { my %seen; @uniq = grep { !$seen{$_}++ }, @arrayWithDups; } That comma will get you. Either grep BLOCK LIST or grep EXPR, LIST but never grep BLOCK, LIST -- Jeff japhy Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia

RE: Down and dirty duplicate deleter

2002-07-30 Thread nkuipers
Load the elements of an array into a hash. Then put the unique keys back into the array; add other goodies like sorting if you need, but one barebones way of doing it would be: for (@array) { chomp $_; $hash{$_}++ } @array = (); @array = keys %hash; -- To unsubscribe, e-mail: [EMAIL

Re: Down and dirty duplicate deleter

2002-07-30 Thread Robin Norwood
Kirby_Sarah [EMAIL PROTECTED] writes: Hi, I have instances where I want to delete duplicate elements out of an array. Is there an easy way to do this? Sure, The Perl Cookbook provides several ways - here's one: (Recipe 4.6, page 102) my @list = qw/one two three one two five/; my @uniq;

Re: Down and dirty duplicate deleter

2002-07-30 Thread Jeff 'japhy' Pinyan
On Jul 30, Jeff 'japhy' Pinyan said: On Jul 30, Kirby_Sarah said: I have instances where I want to delete duplicate elements out of an array. Is there an easy way to do this? Yes, and the FAQ tells you:

RE: Down and dirty duplicate deleter

2002-07-30 Thread Nikola Janceski
as per Japhy, corrected below { my %seen; @uniq = grep { !$seen{$_}++ } @arrayWithDups; } ## then ignore this @uniq = map { my $temp = $_ ^ $temp; } @uniq; undef @uniq; # now @uniq contains no duplicates. (nor anything else). :P -Original Message- From: Nikola Janceski

file with unique records

2002-07-30 Thread Pedro A Reche
Hi all, I have a file that it looks as it follows: name1 ADASDADFSDF ADASDADFSDF SDFDSFDSDFDF name2 ASDFDFDFFDF ADFEERERREWR ADFADFQERQEWR name1 ADASDADFSDF SDFDSFADFDF SDFDSFDSDFDF name3 SDAFSDFDFF WERWERER WERWERER and I want to have something like this: name1

RE: File munging: from $old to $new, using filehandles andarrays ....

2002-07-30 Thread McCormick, Rob E
John, thanks for the succinct suggestion on the set in place edit extension.I'll humbly accept additional yo here's how to simplify this deal examples. ;^) I could still be doing a number of things wrong, I can launch the script , but it 'hangs', my prompt doesn't return. I'm not getting an

Re: file with unique records

2002-07-30 Thread John W. Krahn
Pedro A Reche wrote: Hi all, Hello, I have a file that it looks as it follows: name1 ADASDADFSDF ADASDADFSDF SDFDSFDSDFDF name2 ASDFDFDFFDF ADFEERERREWR ADFADFQERQEWR name1 ADASDADFSDF SDFDSFADFDF SDFDSFDSDFDF name3 SDAFSDFDFF WERWERER WERWERER and I want to have