RE: error info...

2001-07-19 Thread Tillema, Glenn

Jext is a great editor too, written entirely in java, and is
free.

http://www.jext.org

cheers,
Glenn

Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc.
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com

 -Original Message-
 From: Mel Matsuoka [mailto:[EMAIL PROTECTED]]
 Subject: Re: error info...
 
 At 05:13 PM 07/19/2001 -0400, bc wrote: 
 if i use wordpad, in windows, instead of 
 notepad, which i was told b/c of this reason, 
 what do i save the script file as:  the 
 choices are:
 
 Or better yet, if you're using windows, get yourself a real 
 text-editor such as UltraEdit (http://www.ultraedit),

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Two Array into One Hash

2001-07-17 Thread Tillema, Glenn

I know there must be an easy way to do this but the solution evades me
and I'm hoping someone here either knows the answer or can point me in
the right direction so I can figure it out myself ... on to the
question;

I have two scalars, each contain a comma-seperated list of values;

$scaOne = 1,2,3,4,5;
$scaTwo = label one,labelTwo,label,label4,label five;

I want to put these into a hash where the end result would be this;

%hashOne = ( 1 = 'label one',
 2 = 'labelTwo',
 3 = 'label',
 4 = 'label4',
 5 = 'label five',);

Can anyone throw me a bone here?  =)


Glenn

Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc.   
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Two Array into One Hash

2001-07-17 Thread Tillema, Glenn

Thanks Darren!


I *knew* there was an easy way to do it! I rarely use slices that way
so I can see why it hadn't occured to me.

Oh, and yes, $scaOne and $scaTwo have the same number of fields in them.


Glenn

Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc.  
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com

 -Original Message-
 From: darren chamberlain [mailto:[EMAIL PROTECTED]]
 Subject: Re: Two Array into One Hash
 
 The easy way to do this is to split $scaOne and $scaTwo and use
 them in a hash slice:
 
   $scaOne = 1,2,3,4,5;
   $scaTwo = label one,labelTwo,label,label4,label five;
 
   @one = split /,/, $scaOne;
   @two = split /,/, $scaTwo;
 
   @h{@one} = @two;
 
 Or, more succicntly, replace the last three lines with:
 
   @h{split ',', $scaOne} = (split /,/, $scaTwo);
 
 This requires that $scaOne and $scaTwo have the same number of
 fields in them (but your problem suggests that they will).
 
 (darren)

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: How to make a script run in the background on a Win32 machine

2001-07-11 Thread Tillema, Glenn

 From: Mark Ross [mailto:[EMAIL PROTECTED]]
 Subject: How to make a script run in the background on a Win32 machine
 
 [---8--- Run script in the background on a Win32 machine --8--]

Mark,

I like to use Fire Daemon; http://www.firedaemon.com/. Fire Daemon helps
you set up Perl scripts as services.

Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc. 
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com



inline substitution

2001-06-25 Thread Tillema, Glenn

Argh!

I'm trying to replace underscores with '%20' when I print out a table
header. Right now I'm getting 1's instead of the substituted string! I know
I'm forgetting something .. what am I forgetting?

BEGIN--Sample--code--

@serverColumns = qw{Server_Type Server_Name IP_Address Model Processor RAM
Disk
 Special OS Nic_Speed NIC_Duplex NIC_MAC Serial Function B_Time B_Config
Contact
 Location};

print start_table({-style='border-collapse: collapse',-border=1});
print Tr(map{th({-style='width:80'},s/_/%20/)} @serverColumns);

END--Sample--code--


\Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc.   
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com



RE: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Tillema, Glenn

  Curtis == Curtis Poe [EMAIL PROTECTED] writes:
 
 Curtis my $foo_count = scalar @{[param('foo')]};
 
 That's nice, but I prefer:
 
 my $foo_count = () = param('foo');
 
 Less typing, less work for the machine.  Less noise.  More magic,
 though.  Oops, arguable on that. :)
 
 -- 
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - 

Let me guess ... param('foo') is assigned to a list ... the list is assigned
to $foo_count in a scalar context so the number of elements are returned.

Right?


Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc. 
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com



RE: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Tillema, Glenn

  my $foo_count = () = param('foo');
 
 Tillema, Let me guess ... param('foo') is assigned to a list 
 Tillema,... the list is assigned
 Tillema, to $foo_count in a scalar context so the number of 
 Tillema, elements are returned.
 
 Tillema, Right?
 
 Probably simpler than that.  param is invoked in a list context,
 so it does its listy-thing, and returns a list of N elements.  This
 list attempts to be assigned to the () list, which tosses everything
 after the 0th element (that is, EVERYTHING) as unneeded.  However,
 since that list assignment op was in a scalar context, it returns
 the number of original elements (not the number of kept elements),
 and that's back to N again.  And that N goes into $foo_count.
 
 There's never a list assigned to $foo_count in a scalar context...
 the phrase doesn't even make sense to me. :) You can't assign a list
 to $foo_count.  It can never happen.  Never.  A list cannot exist in a
 scalar context... the guts of Perl mandates that.
 
 -- 
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - 

That's how it was phrased in the camel; List assignment in scalar context
returns the number of elements produced by the expression on the _right_ side
of the assignment...  Your explanation certainly goes into much more detail,
however. Thanks!


Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc.   
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com



RE: Extra INPUT TYPE=hidden NAME=.cgifields VALUE=ACTION ?

2001-06-21 Thread Tillema, Glenn

 Tillema, That's how it was phrased in the camel; List 
 Tillema, assignment in scalar context
 Tillema, returns the number of elements produced by the 
 Tillema, expression on the _right_ side
 Tillema, of the assignment...  Your explanation certainly 
 Tillema, goes into much more detail,
 Tillema, however. Thanks!
 
 Ahh, there's HUGE difference between
 
 list assignment _in_ scalar context
 
 and
 
 list assigned _to_ [a scalar]
 
 Let's draw that out.  First is:
 
 $foo_length = () = SOME_LIST
   == list assignment in
 = __ scalar context
 
 Second might mean something like:
 
 $foo_length = SOME_LIST # although this can't happen
   = list
 =   assigned to
 === scalar
 
 See the difference?  And the latter can't happen.
 
 -- 
 Randal L. Schwartz - Stonehenge Consulting Services, Inc. - 

I know I've certainly tried it ... :) I see the difference, thanks!


Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc.  
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com



RE: How to generate a table ?

2001-06-15 Thread Tillema, Glenn

 -Original Message-
 From: Curtis Poe [mailto:[EMAIL PROTECTED]]
 Sent: Friday, June 15, 2001 6:00 PM
 To: [EMAIL PROTECTED]
 Subject: RE: How to generate a table ?
 
 
 Heh.  I keep saying 'factor out common elements', but I 
 didn't bother to do it in my snippet :)
 

Curtis,


Note my liberal use of CGI.pm elements .. ever since I upgraded our library
it hasn't been a p.i.t.a. to use anymore .. :)

... it's been infecting all of my scripts now.


cheers,
Glenn

Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc.  
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com



RE: How to generate a table ?

2001-06-15 Thread Tillema, Glenn

#!/usr/local/bin/perl -w

use CGI qw/:standard *table/;

$cust_id = cust;
$acct = account;
$title = title;

%hofEntries = (1 = {label = Customer Id,
 name  = NEWCUST_ID,
 def = $cust_id,
 size = 10,},
   2 = {label = Account,
 name = NEWACCT,
 def = $acct,
 size = 15,},
   3 = {label= Title,
 name = NEWTITLE,
 def = $title,
 size = 15,});

$q = new CGI;

print header,
  start_html;

print start_table;

foreach (sort keys %hofEntries) {
   print Tr(td({-align=RIGHT},
   $hofEntries{$_}{'label'},b(':')),
td({-align=LEFT},
   $q-textfield(-name=$hofEntries{$_}{'name'},
'-default'=$hofEntries{$_}{'def'},
 -size=$hofEntries{$_}{'size'},
 -maxlength=$hofEntries{$_}{'size'})));
}

print end_table;
print end_html;


I noticed that you kept repeating the same things over and over so I shoved 
the table contents into a loop. For three entries it doesn't really save you a lot of 
space but as your number of entries increase it will.

I'm sure someone else can come up with a better way of loading the hash to make it 
even simpler ...


cheers,
Glenn

Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc. 
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com

 -Original Message-
 From: Moon, John [mailto:[EMAIL PROTECTED]]
 Sent: Friday, June 15, 2001 5:08 PM
 To: [EMAIL PROTECTED]
 Subject: How to generate a table ?
 
 
 Could someone please suggest a simpler way to generate this 
 table ...
 
 print
 'table',
 'tr',
 'td align=right',
 'Customer Id B:/B ',
 '/td',
 'td align=left',
 $q-textfield(-name='NEWCUST_ID', 
 -default=$cust_id,-size=10,
 -maxlength=10),
 '/td',
 /tr\n,
 'tr',
 'td align=right',
 'Account B:/B ',
 '/td',
 'td align=left',
 $q-textfield(-name='NEWACCT', -default=$acct, 
 -size=15,
 -maxlength=15),
 '/td',
 /tr\n,
 'tr',
 'td align=right',
 'Title B:/B ',
 '/td',
 'td align=left',
 $q-textfield(-name='NEWTITLE',-default=$title,
 -size=50,-maxlength=100),
 '/td',
 /tr\n,
 /table\n;  
 
 John W Moon
 



RE: javascript within print tag

2001-06-14 Thread Tillema, Glenn

 The CGI module is not supposed to export any functions 
 without their being explicitly requested. 
 Maybe you have a version that someone else hacked?  No matter.

I honestly wouldn't know .. all of the functionality seems to be there.

   Also, since you are already using CGI.pm, why not take 
   advantage of its full functionality?
  
  Because I hate the way it lay's out the HTML! All HTML 
  elements are in Capital letters ...
 
 If it's printing out your tags in lower case, you definitely 
 have an issue with CGI.pm.  Check your version number (print
$CGI::VERSION).
 2.753 is the latest version and generates valid XHTML:

Heh heh .. looks like I was using an older version (v2.37); an upgrade fixed
that problem plus added some functionality that wasn't available before
(escapeHTML).  Thanks!

  I appreciate your insight into CGI.pm, but I think I'll 
  just keep doing things the way I have (for now).
 
 So long as it works, that's fine by me :)
 
 Cheers,
 Curtis Poe

It didn't work .. but it does now!  Thanks again!

cheers,
Glenn

Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc.
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com



RE: javascript within print tag

2001-06-13 Thread Tillema, Glenn

 As written, this script won't work.  If you call the 
 'header()' function directly, you need to
 import this function from CGI.  One way to do it is:
 
 use CGI qw/:standard/;

It works in the script I copy and pasted from ... :)
 
 Also, since you are already using CGI.pm, why not take 
 advantage of its full functionality?

Because I hate the way it lay's out the HTML! All HTML elements are in
Capital letters (not xhtml compliant) and the source is layed out in a
manner that makes it difficult to read. Is there a switch to make CGI.pm
layout the code in lower-case?

 #!/usr/local/bin/perl -wT
 use CGI qw/:standard/;
 use strict;

 print header();
 my $javascript =END;
 SCRIPT LANGUAGE=JavaScript
 alert('test');
 /SCRIPT
 END
 print start_html( -title  = 'test script',
   -script = $javascript );
 
 Note that this reads very much like the actual Web page would 
 and is fairly easy to follow. 

Your code above introduces extra SCRIPT LANGUAGE=JavaScript and
/SCRIPT elements to the page causing a javascript error. It is easier to
follow, however.

 Getting used to the built in HTML functions of CGI.pm can 
 make the resulting HTML code much cleaner.
 
 Cheers,
 Curtis Poe
 
 =
 Senior Programmer
 Onsite! Technology (http://www.onsitetech.com/)
 Ovid on http://www.perlmonks.org/

I appreciate your insight into CGI.pm, but I think I'll just keep doing
things the way I have (for now).

cheers,

Glenn

Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc.
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com



RE: javascript within print tag

2001-06-12 Thread Tillema, Glenn

Here is how I do it;

#!/usr/local/bin/perl -w
use CGI;

print header();
print head\n,
 titletest script/title\n;
print DONE;
SCRIPT LANGUAGE=JavaScript
   alert('test');
/SCRIPT
DONE
print /head\n;

cheers,


Glenn

Glenn Tillema  [EMAIL PROTECTED]
ADC Telecommunications, Inc.
PO Box 1101, MS 508
Minneapolis, MN  55440-1101
Learn about ADC - The Broadband Company - www.adc.com

   - Original Message - 
   From: [EMAIL PROTECTED] 
   To: CGI Beginners 
   Sent: Tuesday, June 12, 2001 4:41 PM
   Subject: javascript within print tag
 
 
   i have a script that generates html. i would like to put 
 some javascript
   in the head/head tags which is being generated, but escaping the
   javascript is a nightmare.
   does the print tag allow you to enter all this tedious 
 code without
   escaping?
   if not, do i have another choice to get around this?
 
   thanks -cjm