[10119] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3712 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Sep 14 16:07:49 1998

Date: Mon, 14 Sep 98 13:00:21 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Mon, 14 Sep 1998     Volume: 8 Number: 3712

Today's topics:
        determining size of multi-dimension arrays <ed@connectexpress.net>
    Re: determining size of multi-dimension arrays (Honza Pazdziora)
        difference between 'my' and 'local'? (Kevin Hawkins)
    Re: difference between 'my' and 'local'? <eashton@bbnplanet.com>
    Re: Easy solution but cant seem to find it??? (MercuryZ)
        File::Find and Stat() <mc@whoever.com>
    Re: File::Find and Stat() (Honza Pazdziora)
        finding out yesterdays date (Steve .)
    Re: finding out yesterdays date (Kevin hawkins)
        How do I use cgi locally using Netscape? <poohba@io.com>
    Re: How do I use cgi locally using Netscape? <webmaster@fccjmail.fccj.cc.fl.us>
    Re: How do I use cgi locally using Netscape? (Kevin hawkins)
        I'm looking after a CGI scripts <blackout6@hotmail.com>
        JPEG image scaler <jian@cisco.com>
    Re: Memory considerations with PERL <tobez@plab.ku.dk>
        Net::FTP on NT4 martinjb@cdrompub.demon.co.uk
    Re: passing an argument. nguyen.van@imvi.bls.com
    Re: passing an argument. (Matt Knecht)
        Performance problems with sockets under Win32 billy_gronk@my-dejanews.com
    Re: Perl & Java - differences and uses bjohnsto_usa_net@my-dejanews.com
    Re: Perl & Java - differences and uses <borg@imaginary.com>
    Re: PERL routine using wtmp? <mc@whoever.com>
    Re: Problem with print" Location: (Kevin Hawkins)
    Re: regex help (Matt Knecht)
    Re: regex help (Sean McAfee)
    Re: regex help <dgris@perrin.dimensional.com>
        search and replace between values (Steve .)
    Re: Who posts original posts on CLPM? <eashton@bbnplanet.com>
        Win32 Perl vs Binary Data in Streams <jjfink@searle.monsanto.com>
    Re: Win32 Perl vs Binary Data in Streams (Ethan H. Poole)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 14 Sep 1998 12:20:24 -0700
From: ed <ed@connectexpress.net>
Subject: determining size of multi-dimension arrays
Message-Id: <35FD6C6C.7C4D@connectexpress.net>

here's a toughie ...

$#variable returns the number of the last element in a one-dimensional
array.  does anyone know how to return the size of other dimensions?

for example: $data[1][6] = "stuff";

how can you determine that 6 is the last element in the second array??

thanks!!
ed kelly


------------------------------

Date: Mon, 14 Sep 1998 19:42:23 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: determining size of multi-dimension arrays
Message-Id: <slrn6vqscv.9jr.adelton@aisa.fi.muni.cz>

On Mon, 14 Sep 1998 12:20:24 -0700, ed <ed@connectexpress.net> wrote:

> for example: $data[1][6] = "stuff";
> 
> how can you determine that 6 is the last element in the second array??

$#{$data[1]}

Hope this helps,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


------------------------------

Date: Mon, 14 Sep 1998 19:23:43 GMT
From: jedihawk@mail.com (Kevin Hawkins)
Subject: difference between 'my' and 'local'?
Message-Id: <35fd6cb5.195855375@nntp.best.com>

What's the difference between 'my' and 'local'?

I've been using 'my' for most of my subs, to keep the variables in
their own, seperate stack, like this:

  sub test { my ($var1, $var2, $var3) = @_;
    ...
  }

Would it be a better idea to use 'local', like this:

  sub test { local ($var1, $var2, $var3) = @_;
    ...
  }

Thanks for your time.

Kevin Hawkins
jedihawk@mail.com
http://www.jedihawk.com/


------------------------------

Date: Mon, 14 Sep 1998 19:34:18 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: difference between 'my' and 'local'?
Message-Id: <35FD6D58.CD7BCF5B@bbnplanet.com>

Kevin Hawkins wrote:
> 
> What's the difference between 'my' and 'local'?

scope is the difference. local is dynamic scoping and my is lexical
scoping. i.e. local variables will be made available to other
subroutines, my variables will not. 

> Would it be a better idea to use 'local', like this:

depends on where and how you are using it. the local variable will be
more visible.

e.

"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon."  R. Carver


------------------------------

Date: 14 Sep 1998 17:59:17 GMT
From: sf@sf.com (MercuryZ)
Subject: Re: Easy solution but cant seem to find it???
Message-Id: <6tjlhl$484$1@birch.prod.itd.earthlink.net>

In article <35FBF56A.F2AA44B0@min.net>, jdporter@min.net says...
>
>MercuryZ wrote:
>> 
>> I wish to use LYNX to help automate some shareware downloads.
>> When you are in your telnet shell, and you type:
>> 
>> lynx www.shareware.com/directory/filename.zip
>> 
>> a message will come up asking you to select d for download
>> or c for cancel.  In perl, I am having trouble pressing the
>> d automatically.  In other words, I am able to system "lynx..."
>> but when the message comes up to select D or C I simply
>> can't figure out how to get perl to select D or C for me.
>
>So you're using lynx from within a perl program?
>That means you want to use lynx non-interactively.
>Have you read the lynx man page?
>Typing 'lynx -help' also gives you an overview of the
>command line options for using lynx in non-interactive mode
>(among other things).
>You probably want lynx -dump or lynx -source.
>
>hth,
>John Porter

Thank you...I am sure that I can find a solution by looking up the Lynx
manual and trying to work with it non interactively.   But,
is there a way to have perl basically automatically press D for you
at a designated time?? I have a few other projects that require this
knowledge.

Thanks, sean



------------------------------

Date: Mon, 14 Sep 1998 14:20:36 +0100
From: Martin C Brown <mc@whoever.com>
Subject: File::Find and Stat()
Message-Id: <35FD1824.90B45AE@whoever.com>

Anybody else seen this one?

I've got a script:

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

use strict;
use File::Find;

find(\&sendfile,'.');

sub sendfile
{
    print "Modtime of $File::Find::name is
",(stat($File::Find::name))[9],"\n";
}

If run this, then any files in directories  below '.' don't get stated
(on a longer version, stat() returns 'File not found')

OTOH, the line:

print "Modtime of ./foo/bar is ",(stat('./foo/bar'))[9],"\n";

Works perfectly....

I can get round it by using the full directory name to find() - but does
anybody know why this doesn't work as it should?

MC



------------------------------

Date: Mon, 14 Sep 1998 19:37:15 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: File::Find and Stat()
Message-Id: <slrn6vqs3b.9jr.adelton@aisa.fi.muni.cz>

On Mon, 14 Sep 1998 14:20:36 +0100, Martin C Brown <mc@whoever.com> wrote:

[...]

> If run this, then any files in directories  below '.' don't get stated
> (on a longer version, stat() returns 'File not found')
> 
> OTOH, the line:
> 
> print "Modtime of ./foo/bar is ",(stat('./foo/bar'))[9],"\n";
> 
> Works perfectly....
> 
> I can get round it by using the full directory name to find() - but does
> anybody know why this doesn't work as it should?

Well, it works as documented. Yes,

	$File::Find::name contains "$File::Find::dir/$_".
but
	You are chdir()'d to $File::Find::dir when the function is
	called.

So you most probably want to just call stat($_).

Hope this helps,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


------------------------------

Date: Mon, 14 Sep 1998 18:04:39 GMT
From: syarbrou@ais.net (Steve .)
Subject: finding out yesterdays date
Message-Id: <35fd5a3e.8691503@news.ais.net>

I have a system that outputs a comma delimited file and then is passed
to my linux box.  The first field is the date like 09/14/98.  The date
is actually the next days date since it passes the data at midnight.
The program has to do this because that's how it works so I can't set
it to send at 11:59.  I want to be able to reset the dates that are
sent to one day less.  Is there somthing to do this?  So if the date
is stamped 09/14/98 I want it to be 09/13/98.  Thanks.

Steve


------------------------------

Date: Mon, 14 Sep 1998 18:52:28 GMT
From: jedihawk@mail.com (Kevin hawkins)
Subject: Re: finding out yesterdays date
Message-Id: <35fd620c.193126014@nntp.best.com>

On Mon, 14 Sep 1998 18:04:39 GMT, syarbrou@ais.net (Steve .) wrote:

>I have a system that outputs a comma delimited file and then is passed
>to my linux box.  The first field is the date like 09/14/98.  The date
>is actually the next days date since it passes the data at midnight.
>The program has to do this because that's how it works so I can't set
>it to send at 11:59.  I want to be able to reset the dates that are
>sent to one day less.  Is there somthing to do this?  So if the date
>is stamped 09/14/98 I want it to be 09/13/98.  Thanks.
>
>Steve

I've been fooling around with times & dates recently.  I have a
project where the script must calculate tomorrow, but skipping dates
which are in a text file, plus weekends, plus move to the next day if
after 4pm... etc.  It's a pain, but I think I've got it done
(finally!).

Anyway, here's how I would do it.  Put the current time in a simple
variable like this:

  $my_time = time;

This is a long, harry-assed number (the number of non-leap seconds
since Jan 1st, 1970, to be exact).
Now set another variable to be your day (in seconds):

  $one_day = 86400;

The rest is easy:

  $my_time -= $one_day;

Now base all of your dates off of $my_time and you'll have it made.

Here is my little subroutine that I wrote for all my time displays (I
hope my tabs come out right):

# tf
# time formatter
#
# accepts integer seconds (values given by 'time').
#
sub tf { my ( $t, $format ) = @_;
  $sec= (localtime($t))[0];				# second
  $min= (localtime($t))[1];				# minute
  $hour=(localtime($t))[2];				# hour
  $day= (localtime($t))[3];				# day of the
month
  $mon= (localtime($t))[4]; ++$mon;			# month
  $year=(localtime($t))[5];				# year
  $dayw=('Sun','Mon','Tue','Wed','Thu','Fri','Sat')[
(localtime($t))[6] ];			# day of the week
  $min='0'.$min if(length $min == 1);			# two-decimal
formatting
  $sec='0'.$sec if(length $sec == 1);			# two-decimal
formatting
  $mon='0'.$mon if(length $mon == 1);			# two-decimal
formatting
  $day='0'.$day if(length $day == 1);			# two-decimal
formatting
  $tf="$dayw $mon/$day/$year PST";			# normal
output
  $tf="$hour:$min:$sec $dayw $mon/$day/$year PST" if( 'full' eq
$format );	# full output
  return $tf;
}

Crude, I know.  But it works, and it's easy to understand.
Using this sub, I can do this:

  print"My time is ".&tf($my_time, 'full')."\n";

This should output something like:

  My time is 23:52:14 Sun 09/14/98 PST

Hope this helps!  May your scripts be bug-free (that means you don't
have to pay for the bugs).

Kevin Hawkins
jedihawk@mail.com
http://www.jedihawk.com/


------------------------------

Date: Mon, 14 Sep 1998 12:58:50 -0500
From: Chocolate <poohba@io.com>
Subject: How do I use cgi locally using Netscape?
Message-Id: <Pine.BSF.4.02A.9809141257460.11912-100000@schultz.io.com>

I am trying to run my cgi scripts locally on my computer before I put the
on the net.  How do i make this work.  Which program is best for this?

	      *		Web Page Designs	  *
	    <  poohba@io.com  |  www.io.com/~poohba >
	      *		  (919)599-5543		  * 
		



------------------------------

Date: Mon, 14 Sep 1998 14:17:59 -0400
From: "Bill Jones, FCCJ Webmaster" <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: How do I use cgi locally using Netscape?
Message-Id: <35FD5DD7.18A3B4E0@fccjmail.fccj.cc.fl.us>

Chocolate wrote:
> 
> I am trying to run my cgi scripts locally on my computer before I put the
> on the net.  How do i make this work.  Which program is best for this?
> 
>               *         Web Page Designs          *
>             <  poohba@io.com  |  www.io.com/~poohba >
>               *           (919)599-5543           *
> 

As much you have posted here in the past I can't 
believe you asked that here.

Search for answer via DejaNews.

HTH,
-Sneex- 
__________________________________________________________________
Bill Jones FCCJ Webmaster | http://www.fccj.org/cgi/mail?webmaster
__________________________________________________________________
We are the CLPM... Lower your standards and surrender your code...
We will add your biological and technological distinctiveness to 
our own... Your thoughts will adapt to service us...
 ...Resistance is futile...


------------------------------

Date: Mon, 14 Sep 1998 19:09:51 GMT
From: jedihawk@mail.com (Kevin hawkins)
Subject: Re: How do I use cgi locally using Netscape?
Message-Id: <35fd69ae.195079954@nntp.best.com>

On Mon, 14 Sep 1998 12:58:50 -0500, Chocolate <poohba@io.com> wrote:

>I am trying to run my cgi scripts locally on my computer before I put the
>on the net.  How do i make this work.  Which program is best for this?
>
>	      *		Web Page Designs	  *
>	    <  poohba@io.com  |  www.io.com/~poohba >
>	      *		  (919)599-5543		  * 
>		
>

Point thy browser to:

  http://www.ActiveState.com/pw32/

Then, you can run the Win32 version of perl on your own computer.
This, however, by no means guarantees that if it'll run on your little
home PC, it'll also run on the big bad server.  There are still many
little annoying differences.  But they're getting better!

Kevin Hawkins
jedihawk@mail.com
http://www.jedihawk.com/


------------------------------

Date: Mon, 14 Sep 1998 20:33:21 +0200
From: "... Denmark ..." <blackout6@hotmail.com>
Subject: I'm looking after a CGI scripts
Message-Id: <6tjnme$4nhm$1@news-inn.inet.tele.dk>

Hey...

I am looking after some cgi scripts that can:

 .1. Count how many times a person has clicked on a link, and how many times
at all!
 .2. A counter that count how many times a program is downloaded!


              Med venlig hilsen

                ... BlackOut ...




------------------------------

Date: Mon, 14 Sep 1998 11:01:05 -0700
From: Jian Zhang <jian@cisco.com>
Subject: JPEG image scaler
Message-Id: <35FD59E1.C47D7FA2@cisco.com>

Hi, I am looking for a small perl module doing jpeg image scaling
(shrinking to be exact).  I'll use it in a CGI script which first sends
shrinked (thumbnail) images  to the client.  Users then may click on the
thumbnail  to bring the original image up.  I do perl programming
myself, so if such a thing can't be found, I don't mind to create one my
self.  So info on either the module or how to creating one would be
greatly appreciated.

Thanks in advance.

Jian Zhang
San Jose



------------------------------

Date: 14 Sep 1998 20:40:27 +0200
From: Anton Berezin <tobez@plab.ku.dk>
Subject: Re: Memory considerations with PERL
Message-Id: <8690jmv8pw.fsf@lion.plab.ku.dk>

Uri Guttman <uri@sysarch.com> writes:

>   NG> Does PERL return all the memory (real) it takes up during
>   NG> execution once the script has ended? I have a script which creates
> 
> do you mean after the process itself exits? if so all that is reclaimed
> by the OS and perl has nothing to do with it. if you mean in the
> process, all that memory is permanently allocated to it. it may be
> reclaimed by perl but it can never be given back to the system until it
> exits.

It depends.  For example, perl compiled on FreeBSD with native
malloc() does in fact give memory back to the system:

#! /usr/local/bin/perl
$|++;
my $pscom = "ps -o'pid rss rsz vsz' -p $$";
print "Stage  ";
system "$pscom | head -1";
$pscom .= " | tail -1";
for (1..3)
{
   $x[1e6]=1; 
   print "Large: ";
   system $pscom;
   undef @x; 
   print "Small: ";
   system $pscom;
}
__END__

produces the following output:

Stage    PID  RSS  RSZ   VSZ
Large:  9421 5056 5056  4184
Small:  9421 1224 1224   340
Large:  9421 5136 5136  4248
Small:  9421 1224 1224   340
Large:  9421 5120 5120  4248
Small:  9421 1224 1224   340

I have also heard (one day on p5p) that Mac does the same.

-- 
Anton Berezin <tobez@plab.ku.dk>
The Protein Laboratory, University of Copenhagen


------------------------------

Date: Mon, 14 Sep 1998 18:34:02 GMT
From: martinjb@cdrompub.demon.co.uk
Subject: Net::FTP on NT4
Message-Id: <35fd5f5b.37047341@news.demon.co.uk>

I have downloaded the CPAN module libnet so as to instal Net::FTP onto
my NT4.

The instructions as to how to use the package seem pretty good for
Unix users, but NT users are left to their own devices.

I tried moving the relevant .pm files to where I assumed they should
be, but my compiles still fall over with the message:

Can't locate Net/Config.pm in @INC 

But there was no Config.pm in the manifest.

Any ideas???


MJB (martinjb@cdrompub.demon.co.uk)


------------------------------

Date: Mon, 14 Sep 1998 18:08:39 GMT
From: nguyen.van@imvi.bls.com
Subject: Re: passing an argument.
Message-Id: <6tjm37$c94$1@nnrp1.dejanews.com>

I tried the following code, but it didn't print out what I want. is it any
thing wrong here?:

$DATE = <STDIN>;
chomp($DATE);
print  $DATE, "\n";

my input like this "1998/08/23-1998/08/24"
there was no error, but it gave me a blank output.

Thanks
Van Nguyen


In article <l3ZK1.14$0u4.128914@nsw.nnrp.telstra.net>,
  mgjv@comdyn.com.au (Martien Verbruggen) wrote:
> In article <6tc7lv$tqi$1@nnrp1.dejanews.com>,
> 	nguyen.van@imvi.bls.com writes:
>
> > chomp($DATE = <STDIN>);
> > $DATE = shift;
>
> Euhm, What is the purpose of these two lines? Have you read up on
> shift to see what it does?
>
> # perldoc -f shift
> [snip]
> If ARRAY is omitted, shifts the @ARGV array in the main program, and
> the @_ array in subroutines.
> [snip]
>
> So... You read a line from STDIN, store the result in $DATE, and then
> you proceed to overwrite that with whatever is in @ARGV (or @_). If
> that is really what you want, then ignore this post.
>
> > `browser_crno.ksh $DATE > $DOCS_DIR/browser_crno.html`;
> >
> > Note: I used backstick b/c I want a output.
>
> Which you then neatly ignore. If you want the output, you should
> capture it in an array or scalar.
>
> # perldoc -f system
> # perldoc perlop
> /qx
>
> Martien
> --
> Martien Verbruggen                  |
> Webmaster www.tradingpost.com.au    | In a world without fences, who needs
> Commercial Dynamics Pty. Ltd.       | Gates?
> NSW, Australia                      |
>

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


------------------------------

Date: Mon, 14 Sep 1998 18:46:01 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: passing an argument.
Message-Id: <JvdL1.286$VG5.2334179@news2.voicenet.com>

nguyen.van@imvi.bls.com <nguyen.van@imvi.bls.com> wrote:
>I tried the following code, but it didn't print out what I want.

Well, what do you want?  Do you just want it to print back STDIN?

>is it any
>thing wrong here?:

Nothing that I can see, but this isn't a full program, and I'm not sure
what you want, but I can guess.

>$DATE = <STDIN>;
>chomp($DATE);
>print  $DATE, "\n";
>
>my input like this "1998/08/23-1998/08/24"

Just how is this input being passed to your program?

>there was no error, but it gave me a blank output.

Note the difference between @ARGV and STDIN:

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

my $DATE = <STDIN>;
chomp $DATE;

my $ARGV_DATE = $ARGV[0];

print "STDIN   == $DATE\n";
print "ARGV[0] == $ARGV_DATE\n";
__END__

And, invoke it like this:

hex@log1:~/perl/test$ echo Standard Input | ./test_date Argument

And you get:

STDIN   == Standard Input
ARGV[0] == Argument

Does this help?

-- 
Matt Knecht - <hex@voicenet.com>


------------------------------

Date: Mon, 14 Sep 1998 17:56:07 GMT
From: billy_gronk@my-dejanews.com
Subject: Performance problems with sockets under Win32
Message-Id: <6tjlbo$bea$1@nnrp1.dejanews.com>

Hi,

Apologies if this same question has already appeared but I got lost in
registration in the middle of my last attempt.

My problem is some client/server programming I'm doing at the moment.
Communication between NT/95 and UNIX is appallingly slow (minutes) whereas
UNIX to UNIX is much faster (seconds). Why is this? Is there anything I can
do to increase the speed? I have read through all the documentation on
perlipc and IO::Socket and none mention any problems.

I am using perl version 5.004_02 and the standard Windows TCP/IP
implementation.

Any help would be gratefully welcomed.

B.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


------------------------------

Date: Mon, 14 Sep 1998 17:51:15 GMT
From: bjohnsto_usa_net@my-dejanews.com
Subject: Re: Perl & Java - differences and uses
Message-Id: <6tjl2j$asm$1@nnrp1.dejanews.com>

In article <905757998.909140@thrush.omix.com>,
  Zenin <zenin@bawdycaste.org> wrote:
>         Please learn to cut your quoting down, thanks.

I will try.

[snip options for enabling more connections]

Database vendors offer a variety of communcations protocols now. DecNet, IPX,
NetBios, TCP/IP, Shared Memory, Named pipes etc. Adding HTTP seems like a
small change.  Adding a $15,000 per CPU, go on a 2 week course to learn how
to use it, application server seems like an expensive change.

Apart from that the application server I have work with are not that special.
They seems to sell better to management than anyone who has to use them.

[snip people are being taught to ignore efficiency.]

People who have built a few systems and seen them used know that there will
always be some efficiency issues.  They rarely relate to saving an odd CPU
cycle.

>         In general I try to architect systems which can scale to anything,
>         up or down. :-)

Are you optimising programmer time like this? I tend to think it is best to
try to create independant reusable bits and pieces that would fit into any
overall architecture.  The independance seems to make things easier to test.

> : There are plenty of people who do pretty good stuff on NT.
>
>         And as soon as they do, MS blows them away or buys them. :-)

Microsoft certainly tries to blow away computer vendors, but they have not hit
the market share of the stock brokers very much.

I think there are plenty in the computer industry that make themselves pretty
easy targets.  Its hard to combat such a powerful competitor.  Even the best
will most likely fail.

[snip]
>
> : However Intel servers are more powerful than Unix boxes of not very long
> : ago.
> : I believe that all sites *can* be architected to work on Intel NT Servers.
>
>         HotMail.  Even Microsoft themselfs couldn't do it, so I question
>         your beliefs here. :-)

This has more to do with the cost of rearchitecting an existing system than
with the performance paramters of a particular task.  If there was a
substantial requirement for changes in Hotmail which required a rewrite
anyway, then the rewwrite would most likely occur on NT.

www.microsoft.com is on NT servers.

[snip]

>         Unix understands that different people want to do different things
>         in different ways, if only slightly.  NT thinks everyone should be
>         happy with the pretty buttons they make and if you don't like
>         it you're just wrong.

I find the limitations of HTML at the client far more onorous than any at the
server.

>         Sure, you can start farming servers under nearly any OS.  There are
>         still limitations with this route.  Also, there are large costs per
>         extra box far beyond just the cost of the raw hardware.  Admin costs
>         are not cheep, and if two Unix boxes can do the work of six NT boxes
>         you've probably just saved $300k a year in admin costs. -Last I
>         checked MS still recommend one admin per NT server...  I don't
>         think I've *ever* met a Unix admin that only was responsible for a
>         single machine unless the company only had a single machine total.

If a single NT server is a file server, database server, www server and FTP
server, then you may need more than one admin.

However none of our NT servers get one full time admin.  I do the admin for 3
in spare time when I am not programming.  It takes me about 3 hours a month. 
That mostly entails backups, and maintaining users (web publishers,
programmers, and people who can access priveleged (non public) information).

[snip]

> : I spent 95% of my time coding Java and C++ not worrying about performance.
>
>         Server, or client side?

Both.  As long as the database picks the right query plan and there are not to
many queries.  Performance is fine.

Of course our oracle servers version 7.3.4 can get the query plan wrong
pretty easily.	My favourite is a two table join which takes three minutes
with the cost based optimiser.	The rule based optimiser gets this to 3
seconds, and the right hints make it instantaneous.  I know about statistics
they were up to date.

Good programmers tend to go for a reasonably efficient design because the best
design from other perspectives usually is resonably efficient.

> : I worried about clean, correct design, and code.
>
>         Which is good, but the above goals and performance issues are not
>         unmixable.

I certainly hope not.  Otherwise we are pretty doomed.

>  IMHO, there is no "correct" design, just a "good"
>         design. -A reason of many I don't like Python.  Part of a good
>         design takes performance into account.

Don't know python.  I assume you are talking about its intrepreted nature, and
pure OO design.

> : The speed of the underlying language got around the inefficiecies in my
> : code.
>
>         To rely on this is what I would call, "sloppy" code myself.  "I'll
>         just do whatever I want and if they don't like it they can just
>         upgrade there hardware" doesn't work with me.

I certainly don't appreciate this attitude in toolkits I use.

However I mostly find that when performance is inadequate it is because of
excess calls to an external library or resource, not coding inefficiencies.

> : People are moving more code to servers, to serve the increasing online
> : population, and to reduce support costs associated with client
> : configuration.
>
>         It's not just that issue.  It's also the simple fact that work
>         should be done where the data is.

This has always been true.  'Client/Server database' tools like VB,
Powerbuilder, and SQL Windows still put all the code on the client.

The recent migration to server based code has more to it than the efficiency
of this approach.

> : The cost of coding these systems is higher than development for clients.
>
>         Simply because the programmers have to actually start to care
>         about performance, something they were not tought in school. ;-)

Anything which raises the, already high, costs of software development is
going to be a problem.

> : I believe that improvements in computing science and tools will reduce this
> : gap.
>
>         The computer science is there now, and has been for ages.  More
>         tools will surface, but I still think the teaching good CS will
>         play a much larger role.  I don't think most general computer
>         science programs actually do anything close to a good job.  I
>         base this on the fact that most of the best software engineers
>         I've worked with have had anything but CS degrees.  The few
>         that do have CS degrees are more often then not the ones that
>         I've seen problems with.  This also goes to show that
>         programmers, like artists, are born not schooled.

I  can't say that my CS degree left me much of a programmer.  I learn't alot
more in the 1 year after the degree than the 3 years during. However my marks
in the degree did get me my first job, so it did what I needed.

Most of the best developers I have worked with have CS degrees.  It seems to
me that many useful development skills can be learnt.

> -Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:

Brendan Johnston


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


------------------------------

Date: Mon, 14 Sep 1998 19:37:00 GMT
From: George Reese <borg@imaginary.com>
Subject: Re: Perl & Java - differences and uses
Message-Id: <wfeL1.1594$E9.5405535@ptah.visi.com>

In comp.lang.java.programmer George Reese <borg@imaginary.com> wrote:
: In comp.lang.java.programmer Zenin <zenin@bawdycaste.org> wrote:
: :         Has Python finally developed zero-width lookahead and lookbehind,
: :         assertion, both positive and negative?  Interlaced code in both
: :         the search and replace constructs?  Subexpressions?  Conditional
: :         expressions?  Inlined modifiers?

: I could not answer this question fully for either Perl or Python.  Hopefully
: someone else who knows Python well can answer it.

Sorry to followup my own post.  The answer is: yes.  Python 1.5
supports all of this.

-- 
George Reese (borg@imaginary.com)       http://www.imaginary.com/~borg
PGP Key: http://www.imaginary.com/servlet/Finger?user=borg&verbose=yes
   "Keep Ted Turner and his goddamned Crayolas away from my movie."
			    -Orson Welles


------------------------------

Date: Mon, 14 Sep 1998 17:01:40 +0100
From: Martin C Brown <mc@whoever.com>
Subject: Re: PERL routine using wtmp?
Message-Id: <35FD3DE4.CDBCD641@whoever.com>

I don't have code for monitoring, but heres some very basic code for reading in
wtmp/utmp entries.

I just wrote it five minutes ago, so expect a few problems.

The only things you'll need to change are the packstring (see the utmp manual
entry) and ut_types - these values work for Solaris 2.5.1.

----

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

use strict;

my $packstring = "a8a4a12ssssl";
my $reclength = length(pack($packstring));
my @ut_types = qw(EMPTY RUN_LVL BOOT_TIME OLD_TIME NEW_TIME INIT_PROCESS
    LOGIN_PROCESS USER_PROCESS DEAD_PROCESS ACCOUNTING);

open(D,"</var/adm/wtmp") or die "Couldn't open wtmp";
my $rec;

while(sysread(D,$rec,$reclength))
{
    my ($user,$userid,$line,$pid,$type,$eterm,$eexit,$time) =
unpack($packstring,$rec);

    print "$user, $userid, $line, $pid, $ut_types[$type], $eterm,
$eexit,",scalar localtime($time),"\n";
}




------------------------------

Date: Mon, 14 Sep 1998 19:19:34 GMT
From: jedihawk@mail.com (Kevin Hawkins)
Subject: Re: Problem with print" Location:
Message-Id: <35fd6c06.195679809@nntp.best.com>

On Mon, 14 Sep 1998 10:44:11 -0700, Bob Mc Mahon <bobby@alpstreet.ie>
wrote:

>Hi
>
>            I'm running a perl script , the script itself works fine but
>at the end of it I have
>            eg......
>
>                {
>                print "Location: http://www.netscape.com\n\n";
>                }
>
>
>                        The problem is that it print the location on
>screen intead of actually taking you there.
>                I think it is still using the Content-type header, if it
>is does anybody know how to end headers so that you can start a new one?
>

Yeah, don't output the first MIME-type.  If your "Location:" line is
the FIRST line, then it'll work.  If you output some other line, just
about ANY other line first, then it won't work right.

Kevin Hawkins
jedihawk@mail.com
http://www.jedihawk.com/


------------------------------

Date: Mon, 14 Sep 1998 18:02:59 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: regex help
Message-Id: <nTcL1.391$o72.2297336@news3.voicenet.com>

Edward Glamkowski <eglamkowski@angelfire.com> wrote:
>I am processing a file containing addresses, and need to remove all
>periods in the file, EXCEPT for those associated with P.O. or U.S.
> [snip]
>For example, if I have a line of address which reads:
>U.S. Rte. 22
>(most addresses span more than one line, but that really shouldn't 
>cause any difficulties in and of itself).
>
>What I want in the end is 'U.S. Rte 22', not 'US Rte 22'
>
>Any pointers would be much appreciated :)

You don't need regex help.  You need to decide exactly what you're
trying to parse first.  If you want to preserve certain contrusts (Like
'U.S.'), then save them in a hash, and make sure you don't strip them.

Or, it may be easier to realize that you always want to clean up 'Rte.',
'St.' and 'Blvd.', etc....  If that's the case, then put those into a
lookup hash, and make sure you just edit those.  Maybe you need a
combination of two methods.

My best advice would be to try something... ANYTHING, then pull out any
phrase you're unsure of, and save it.  Then, look over what you've
extracted as unsure data, and use that information to make your lookup
hashes more accurate.

-- 
Matt Knecht - <hex@voicenet.com>


------------------------------

Date: Mon, 14 Sep 1998 18:32:24 GMT
From: mcafee@waits.facilities.med.umich.edu (Sean McAfee)
Subject: Re: regex help
Message-Id: <YidL1.2703$F7.11498268@news.itd.umich.edu>

In article <35FD540C.196@angelfire.com>,
Edward Glamkowski  <eglamkowski@angelfire.com> wrote:
>I am processing a file containing addresses, and need to remove all
>periods in the file, EXCEPT for those associated with P.O. or U.S.
>I have the following:
>    if ($addr1 =~ /(\w+\.)+/)  { $addr1 =~ s/(\w+)\./$1 /g; }

>But that obviously doesn't take into account the U.S. or P.O.
>The problem I have is what happens when you run into a line containing
>both U.S. AND a period somewhere else in the line.  How do I remove the
>periods from one 'word' and not another?

Hmm.  Tricky.  This is one way to do it:

($tmp = $addr1) =~ tr/.//d;
$n = 0;
while ($addr1 =~ /(U\.S\.|P\.O\.|\.)/g) {
	$n++, next if $1 eq ".";
	substr($tmp, pos($addr1) - 4 - $n, 2) = $1;
}

What this code does is create a copy of the original line and strip all of
the periods out, then replace all of the "U.S."s and "P.O."s based on those
strings' locations in the original line.

-- 
Sean McAfee | GS d->-- s+++: a26 C++ US+++$ P+++ L++ E- W+ N++ |
            | K w--- O? M V-- PS+ PE Y+ PGP?>++ t+() 5++ X+ R+ | mcafee@
            | tv+ b++ DI++ D+ G e++>++++ h- r y+>++**          | umich.edu


------------------------------

Date: Mon, 14 Sep 1998 18:56:02 GMT
From: Daniel Grisinger <dgris@perrin.dimensional.com>
Subject: Re: regex help
Message-Id: <6tjo72$bgu$1@rand.dimensional.com>

[posted to comp.lang.perl.misc and mailed to the cited author]

In article <35FD540C.196@angelfire.com>
eglamkowski@angelfire.com wrote:

>For example, if I have a line of address which reads:
>U.S. Rte. 22

>What I want in the end is 'U.S. Rte 22', not 'US Rte 22'

A single regular expression approach (that requires perl5.005)-

    $address = 'U.S. Rte. 22';
    $address =~ s/(?<!USPO)\./ /g;

Unfortunately that won't do what you want if U.S. or P.O. is
lowercase, nor will it do the right thing if you have other
abbreviations matching ([USPO]\.) .  If you add /i to the split,
then all you really do is increase the number of places where
you may inadvertently leave .'s that you don't want.

I'd try a multi-pass approach, first replacing occurrences of
U.S. and P.O. with a different string, just to be safe-

    $address = 'U.S. Rte. 22';
    $address =~ s/(?:
                    (u)\.(s)\.
                  )
                 |
                  (?:
                    (p)\.(o)\.
                  )
                 / 
                 defined($1) ? "%$1%$2%"
                             : "%$3%$4%"/egmix;
    $address =~ s/\./ /gm;
    $address =~ s/(?:%(\w)%(\w)%)/ uc("$1.$2.") /egmi;

This also converts u.s. and p.o. to U.S. and P.O. .

Hope this helps.

dgris
-I'd also probably replace .'s with nulls instead of spaces
to preserve the visual appearance of the string, but that 
may just be me.
-- 
Daniel Grisinger           dgris@perrin.dimensional.com
`Bangladesh.  Because life is too short to run bad code.'
                               Jon Orwant


------------------------------

Date: Mon, 14 Sep 1998 19:28:16 GMT
From: syarbrou@ais.net (Steve .)
Subject: search and replace between values
Message-Id: <35fd6df6.13739807@news.ais.net>

I have a line like:

http:www.url.com/cgi-bin/hi.cgi/jim.zip?fx=joe.joe.net

I want to delete everything from http through fx= .  Problem is the
jim.zip part changes values on each line.  Is there a way to do this?
Thanks.

Steve


------------------------------

Date: Mon, 14 Sep 1998 17:56:54 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Who posts original posts on CLPM?
Message-Id: <35FD5684.E76AF98B@bbnplanet.com>

Asher wrote:

> Check out:
> http://www.magicnet.net/~asher/comp.lang.perl.misc.html

Interesting. Where is your protocol and your control for this? What are
you endeavouring to prove here? Where is your standard error? e.g. I
have been using Mozilla (gack) for the last few weeks due to my mungling
xemacs which I havn't had time to un-mungle. 

As raw data though, it is curious.

e.

"All of us, all of us, all of us trying to save our immortal souls, some 
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon." R. Carver


------------------------------

Date: 14 Sep 1998 18:53:25 GMT
From: "Joel Finkle" <jjfink@searle.monsanto.com>
Subject: Win32 Perl vs Binary Data in Streams
Message-Id: <01bde010$dc273ee0$12322389@Joel.monsanto.com>

A vendor sent us data which consists of the following:
	ID		char	10
	Length	int	16-bit binary
	Data		Variable (up to 5K or so seen)

The problem is that the binary length field may occasionally contain
really nasty binary characters like ctrl-Z, which ends the stream
for many Wintel programs (no I'm not uploading 200 megabytes to
my ISP just to screen the sucker).

My end goal is to place the data into a database as a 'memo' field.
MS Access quits on the first ctrl-Z, as does Excel, as does ActiveState's
Perl 5.003 (I'm a little out of date, but the release notes don't
indicate I'd have better success).

Is there a way of reading the data such that I can still get whole
records without threat of quitting on a ctrl-Z (ASCII 26, I know, I know).
Strangely enough, I've never seen a line break generated by this.
Wintel uses CR/LF for line break, so it's possible I've never hit
that (let's see... carry the... 3338 characters?) length, and a CR
or an LF by itself gets ignored.

I'd appreciate follow-ups to joel.finkle@monsanto.com, as my news
feed is reaaaaallly sporadic.

Joel Finkle


-- 
"That's the kind of wooly-minded liberal thinking that gets a man eaten!"
  Principle Snyder, 'Buffy the Vampire Slayer'


------------------------------

Date: 14 Sep 1998 19:35:13 GMT
From: ehp@gte.net (Ethan H. Poole)
Subject: Re: Win32 Perl vs Binary Data in Streams
Message-Id: <6tjr5h$7u6$1@news-1.news.gte.net>

[Posted and Emailed]  In article 
<01bde010$dc273ee0$12322389@Joel.monsanto.com>, jjfink@searle.monsanto.com 
says...
>
>A vendor sent us data which consists of the following:
>        ID              char    10
>        Length  int     16-bit binary
>        Data            Variable (up to 5K or so seen)
>
>The problem is that the binary length field may occasionally contain
>really nasty binary characters like ctrl-Z, which ends the stream
>for many Wintel programs (no I'm not uploading 200 megabytes to
>my ISP just to screen the sucker).
>
>My end goal is to place the data into a database as a 'memo' field.
>MS Access quits on the first ctrl-Z, as does Excel, as does ActiveState's
>Perl 5.003 (I'm a little out of date, but the release notes don't
>indicate I'd have better success).
>
>Is there a way of reading the data such that I can still get whole
>records without threat of quitting on a ctrl-Z (ASCII 26, I know, I know).
>Strangely enough, I've never seen a line break generated by this.
>Wintel uses CR/LF for line break, so it's possible I've never hit
>that (let's see... carry the... 3338 characters?) length, and a CR
>or an LF by itself gets ignored.
>
>I'd appreciate follow-ups to joel.finkle@monsanto.com, as my news
>feed is reaaaaallly sporadic.

you need to binmode(FILEHANDLE); the file handle.  This will force the file 
to be read as binary data.

-- 
Ethan H. Poole            | Website Design and Hosting,
                          | CGI Programming (Perl & C)..
========Personal========= | ============================
* ehp @ gte . net *       | --Interact2Day--
http://home1.gte.net/ehp/ | http://www.interact2day.com/



------------------------------

Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 3712
**************************************

home help back first fref pref prev next nref lref last post