[17710] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5130 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 16 14:05:39 2000

Date: Sat, 16 Dec 2000 11:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <976993508-v9-i5130@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 16 Dec 2000     Volume: 9 Number: 5130

Today's topics:
    Re: (Beginner) Example CGI not working <a.v.a@home.nl>
    Re: basic code -- why won't it work??!! <mikecook@cigarpool.com>
    Re: chmod under Win32 <jeff_robertson@yahoo.com>
    Re: chmod under Win32 <bowman@montana.com>
    Re: Is Perl dying? <bowman@montana.com>
    Re: Is Perl dying? <andrew_lee@earthlink.net>
    Re: Language evolution C->Perl->C++->Java->Python (Is P <uri@sysarch.com>
        Language evolution C->Perl->C++->Java->Python (Is Pytho <alavoor-nospam@yahoo.com>
        linked lists and recursive functions <soeder@ai-lab.fh-furtwangen.de>
        POSTing data with SSL (Net::SSLeay) ?!?! kalexa2@my-deja.com
    Re: Pulling content from a HTML doc <someguyREMOVE@REMOVEsunflower.com>
    Re: Regex can't be greedy with /(a|ab)/ ? (Anno Siegel)
    Re: Regex can't be greedy with /(a|ab)/ ? <uri@sysarch.com>
    Re: Regex can't be greedy with /(a|ab)/ ? (Randal L. Schwartz)
    Re: Regex can't be greedy with /(a|ab)/ ? <uri@sysarch.com>
    Re: Regex can't be greedy with /(a|ab)/ ? (Anno Siegel)
    Re: Regex can't be greedy with /(a|ab)/ ? (Tom Christiansen)
    Re: Regex can't be greedy with /(a|ab)/ ? (Anno Siegel)
    Re: Regex can't be greedy with /(a|ab)/ ? <uri@sysarch.com>
    Re: Regex can't be greedy with /(a|ab)/ ? <uri@sysarch.com>
        Sorting of messages thirdgc@my-deja.com
    Re: Use PERL or Java? Which is faster? <tt@cryogen.com>
    Re: Use PERL or Java? Which is faster? <me@me.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sat, 16 Dec 2000 15:30:15 GMT
From: AvA <a.v.a@home.nl>
Subject: Re: (Beginner) Example CGI not working
Message-Id: <3A3B8BC7.6D20FA1A@home.nl>

Joe Schaefer wrote:

> "Garry Heaton" <garry@heaton6.freeserve.co.uk> writes:
>
> > I'm working with O'Reilly's "CGI Programming with Perl" and have just
> > typed-in the following example:
> >
> [...]
> > END_OF_HTML
>
> > [Fri Dec 15 23:50:22 2000] [error] [client 127.0.0.1] Premature end of
> > script headers: c:/program files/apache group/apache/cgi-bin/httpex.pl
> > [Fri Dec 15 23:50:22 2000] [error] [client 127.0.0.1] Can't find string
> > terminator "END_OF_HTML" anywhere before EOF at c:/program files/apache
> > group/apache/cgi-bin/httpex.pl line 3.
>
> Works fine for me - you might have a line-terminator problem
> on your last line of code.  Try editing the file on the server
> and retyping it:
>
> END_OF_HTML
>
> (no spaces after END_OF_HTML, and be sure you hit the return
> key.)
>
> If you can't edit it on the server, edit your local copy and
> be sure you upload it as an ASCII text file (so line terminators
> will translate right).
>
> HTH
> --
> Joe Schaefer

Make sure u type it directly on the lefthand side...so :
        END_OF_HTML wont work , because there is a space on the left

END_OF_HTML should work



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

Date: Sat, 16 Dec 2000 08:00:05 -0700
From: "Michael Cook" <mikecook@cigarpool.com>
Subject: Re: basic code -- why won't it work??!!
Message-Id: <EsL_5.620$Ri6.77031@news.uswest.net>

What Gopi said!
    Michael
--
== CigarPool ==
http://www.cigarpool.com

"Gopi Sundaram" <gopalan@cs.sc.edu> wrote in message
news:Pine.OSF.4.31.0012152325020.7772-100000@pearl.cs.sc.edu...
> On 15 Dec 2000, Sue Spence wrote:
>
> > One further suggestion - put your current directory ('.') in your
> > path ahead of everything else.
>
> Gaack! Don't ever do that! '.' shouldn't even be in your path in the
> first place. If it is, it should be at the very end.
>
> --
> Gopi Sundaram
> gopi@cse.sc.edu
>




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

Date: Sat, 16 Dec 2000 16:59:07 GMT
From: Jeff Robertson <jeff_robertson@yahoo.com>
Subject: Re: chmod under Win32
Message-Id: <91g70p$4l9$1@nnrp1.deja.com>

In article <8tK_5.569$Y2.8983@news>,
  "Bob" <bbgraph@scioto.net> wrote:
> I'd like to be able to chmod an entire directory of a group of files
within
> a directory from the command prompt rather than via Windows Explorer
under
> NT.

If you are talking about changing MS-DOS attributes like "read-only"
and "hidden", use Win32::File::SetAttributes().

If you need to change user/group permissions, use Win32::FileSecurity.
Note that NT already has a command called "cacls" that does this.

For recursively applying the changes to an entire directory (and all of
of its subdirectory), just use File::Find.



Sent via Deja.com
http://www.deja.com/


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

Date: Sat, 16 Dec 2000 10:07:46 -0700
From: "bowman" <bowman@montana.com>
Subject: Re: chmod under Win32
Message-Id: <1oN_5.708$N84.3537@newsfeed.slurp.net>


willem veenhoven <willem@veenhoven.com> wrote in message
news:3A3B7411.EC307171@veenhoven.com...
> Bob wrote:
> >
> > I'd like to be able to chmod an entire directory of a group of files
> > within a directory from the command prompt rather than via Windows
> > Explorer under NT.
>
> Uhh? You do not need and even can't chmod under NT ...

ActiveState does have a chmod(), though it is limited to modifying the
owner's permissions. what the OP probably wants is Win32::FileSecurity
which allows DACL manipulation.





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

Date: Sat, 16 Dec 2000 09:57:23 -0700
From: "bowman" <bowman@montana.com>
Subject: Re: Is Perl dying?
Message-Id: <ieN_5.694$N84.3517@newsfeed.slurp.net>


Joe Schaefer <joe+usenet@sunstarsys.com> wrote in message
>
> I never claimed to be such a person- what's QWBASIC?  :)

Probably a typo for GWBASIC, Gulf & Western's flavor of the month. (many
many months ago)





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

Date: Sat, 16 Dec 2000 18:58:40 GMT
From: Andrew Lee <andrew_lee@earthlink.net>
Subject: Re: Is Perl dying?
Message-Id: <3A3BBBA4.F856E230@earthlink.net>

Joe Schaefer wrote:

> Andrew Lee <andrew_lee@earthlink.net> writes:
>
> > No, not the language.
> >
> > Are there less jobs for Perl developers as the dot
> > com economy goes belly up?
>
> It's not going belly up- it's just the ebb following the
> multi-trillion-dollar millennial makework created by
> short-sighted programming, not a programming language.
> It's now finally appropriate to sack the responsible
> parties :)
>

Those responsible for the sackings have been sacked ...

>
> > Or, could it be that a critical mass of project managers
> > won't use Perl because (it seems) no two programmers write
> > Perl the same way?  Thus, languages like Python or Java are
> > more favorable for team development of reusable code ...
>
> Perl is written by programmers, for programmers.  How such an
> inherently utilitaritian endeavor could be construed as unfit
> for serious projects is beyond me.  If something sucks in
> perl(+CPAN), it goes the way of the dodo.  That's not like many
> other languages I'm familiar with, where "appropriate" code
> libraries are sanctioned by the illuminati who decide what's
> best for the rest of us.

Oy!  The Illuminati!  Like the folks at Microsoft or Sun (or Oracle or
Sybase ...).  I had the interesting experience of working on a Windows
3.1 project some years ago and using MS's version of C++.  I wrote a
template class and the compiler groaned and moaned ... I finally looked
at MS's documentation which succinctly described template classes and
their usefulness and that THIS version of the compiler did NOT support
them.  :-)

>
>
> > Just wondering.  (pleading for a world-wide minimum
> > proficiency & coding standard for Perl)
>
> Why?  Perl allows beginning programmers to accomplish
> tremendous things without having a clue as to what goes
> on behind the scenes.  I'd rather see a minimum proficiency
> at reading and writing standardized documentation than
> checking for a certified jaPh badge.
>
> A person that values encapsulation and understands the
> importance of a fixed API will eventually figure out how
> to implement it well in virtually any language. With
> perl(+CPAN), the time it takes to come up with a
> satisfactory implementation is usually quite short.
>

I agree 500%.  Sadly, I have heard more and more critics of Perl and
they seem to be getting louder.  Maybe it is just me ....

On the other hand -- it is worth noting that just because you can do
something doesn't mean you should.  And the Perl motto of "There is more
than one way to do it", while satisfying to the individual programmer,
is a nightmare for those project managers that think developers can be
swapped in and out like so hard drives.  And, it is also a nightmare for
the poor developer who just inherited somebody else's ten thousand line
bizarro hack.

I bring this up because I just finished a project where the resident
developers (and manager) were more or less illiterate in Perl but chose
to use it for EVERYTHING and wanted me to fix it.  My suggestion was to
educate the developers (e.g.  try ... 'use strict;').  That was not the
answer they wanted.  And so I got sacked while they started to rewrite
everything in Java.  :-(


--

Andrew F



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

Date: Sat, 16 Dec 2000 17:36:29 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Language evolution C->Perl->C++->Java->Python (Is Python the ULTIMATE of  	languages??)
Message-Id: <x766kkgtf0.fsf@home.sysarch.com>


flame bait. go the fuck away. you obviously know not from what you
blather.

followups set

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Sat, 16 Dec 2000 17:08:38 GMT
From: Al Dev <alavoor-nospam@yahoo.com>
Subject: Language evolution C->Perl->C++->Java->Python (Is Python the ULTIMATE of languages??)
Message-Id: <3A3BA1BC.BAC2DFCC@yahoo.com>

Language evolution from C->Perl->C++->Java->Python (Is Python the
ULTIMATE of
languages??)

Python seems to be more robust, simple and architecture neutral than
Java.

Perhaps Python is ultimate programming language which will storm the
world!!

Here are some comparisons of Python and Java:

o Three years ago Java was a HOT topic and craze, today Python is a HOT
topic
  and is craze among programmers world-wide. Java programmers will love
Python!

o Python is object-oriented language just like Java, suitable for
  very large enterprises and for large projects (millions of lines of
code).

o Java corrected the mistakes made by C++. And C++ corrected mistakes
made by C.
  But Java is inferior to Python in many
  technologies (for eg Python implements Multiple inheritance
  and others whereas Java does not).

o Java is a very complex system - Java virtual machine is quite complex
   and if OS kernel changes (due to updates) then JVM becomes unusable
   Java fails to run properly and crashes. Also developing JVM for
   new versions of OS kernels is very time consuming. Whereas Python
   is written in "C" language and is quite simple and easy to recompile,

   port to various OS and various versions of OS kernels.

o Python is faster than Java for certain operations but Java is
  faster than Python for other operations. But overall (grand total)
Python
  is as good as Java. See
http://www.twistedmatrix.com/~glyph/rant/python-vs-java.html

o Python takes far less RAM memory than Java - If Java takes
   200 MB to run a program then Python takes only 40 MB

o Python is very robust and very stable as it is completely written in
   "C" and Python is a simple technology.

o Python programs are very small about 1/3 rd the size of Java programs
   for the same task. For example, a project was implemented in Java
   and total number of lines (characters) of the source code was about
3000
   lines (approx 120000 characters) and the same project was implemented
in
   python whose source code was about 1000 lines (approx 40000
characters).
   Smaller python programs means python code can be maintained better
than
   Java code.

o Python code is a readable-syntax code, python forces the programmer to

  use tabs to mark program-blocks. Where as Java code can be very ugly
  and does not enforce readable-syntax code. Python removes unnecessary
  braces of Java (which clutters the code) and many other syntax which
  make code un-readable.

o Implementing a project in Java takes about 3 times more time than
Python.
  If it takes 15 days to code in Java then you would take about 5 days
to
  code in Python. And runtime performance of Python and Java are almost
same.

o Python is GNU/GPL where as Java is proprietary (belongs to Sun
Microsystems).

o Python is Object oriented from ground up and will supercede Java and
PERL.

o Python incorporates the best of Scripting and Systems programming
language.
  But Java is 100% Systems Programming language (Java is not a scripting
language).

o Probably it is impossible to develop a programming language which is
better
  than Python. (Is Python the ultimate programming language ????)

o Python has "TkInter" GUI which runs on MS Windows and Unixes. Write
once
  in python and run everywhere

o Python has Web Application Server at http://www.zope.org comparable to

  Java's web application server http://www.enhydra.org

Python is at http://www.python.org
Python Java compared -
http://www.twistedmatrix.com/~glyph/rant/python-vs-java.html
Python compared to others - http://www.python.org/doc/Comparisons.html

Also visit
  http://aldev.8m.com
Mirror sites at
  http://aldev.webjump.com
  http://www.angelfire.com/nv/aldev
  http://www.geocities.com/alavoor/index.html
  http://aldev.virtualave.net
  http://aldev.50megs.com
  http://aldev.bizland.com
  http://members.theglobe.com/aldev/index.html

  http://members.spree.com/technology/aldev
  http://homepages.infoseek.com/~aldev1/index.html
  http://www3.bcity.com/aldev




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

Date: Sat, 16 Dec 2000 19:27:18 +0100
From: Oliver =?iso-8859-1?Q?S=F6der?= <soeder@ai-lab.fh-furtwangen.de>
Subject: linked lists and recursive functions
Message-Id: <3A3BB406.D5097F5D@ai-lab.fh-furtwangen.de>

I am able to programm C++ and know how to use $subject there.

Is it possible to use these functions under perl? I already tried, =

but there ist no Heap and Stack like under C++.

Cheers

Oliver S=F6der


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

Date: Sat, 16 Dec 2000 17:28:27 GMT
From: kalexa2@my-deja.com
Subject: POSTing data with SSL (Net::SSLeay) ?!?!
Message-Id: <91g8nn$5no$1@nnrp1.deja.com>

Dear Gurus,

I'm trying to do a HTTP POST via secure sockets layer to a cgi sitting
in a password protected directory using NET::SSLeay. This program (see
below) calls "test.cgi" which reads the POSTed data and spits it out in
HTML.

The problem is, test.cgi isn't getting the POST when I include the
make_header() subroutine. For example the program below works, but the
resulting HTML send back from test.cgi doesn't include the POSTed data -
- $ENV{'CONTENT_LENGTH'} isn't defined.

If I remove passoword protection from the directory and remove the
make_header() call and replace it with "" -- the data is passed...

Has anyone been able to POST data to a password-protected directory via
SSL? Can this be dome with NET:SSLeay? The PERLDOC seems to suggest you
can. Please help!

thanks,
kevin alexander



-----------

#!/usr/local/bin/perl

use Net::SSLeay qw(get_https post_https sslcat make_headers make_form);
use MIME::Base64;



($page, $response, %reply_headers)
     = post_https('www.blah.net',
                  443,
                  '/path/to/test.cgi',
                  make_headers(
                                'Authorization' => 'Basic ' .
MIME::Base64::encode("UserName:UserPassword")
                               ),
                       # "",
                          make_form   (
                                        'doit'  => '1'
                                      )
                        );

       print $page;
       print "-----------\n$response\n";




Sent via Deja.com
http://www.deja.com/


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

Date: Sat, 16 Dec 2000 09:50:06 -0600
From: "Hawk" <someguyREMOVE@REMOVEsunflower.com>
Subject: Re: Pulling content from a HTML doc
Message-Id: <t3n3slq778e346@corp.supernews.com>

A simple "I dont know either" would have sufficed. A snippet was, in fact
all I needed.

John Michael <johnm@acadiacom.net> wrote in message
news:3a3afa1f$1@news.acadiacom.net...
> I told you how to do it.
> It takes more than a snipplet of code and you will probably not get the
> script written for you here.  You are asking a for someone to do a job for
> you.  More infromation would be needed as well.
> Sorry
>
>
>
>
> "Hawk" <someguyREMOVE@REMOVEsunflower.com> wrote in message
> news:t3lrg3bbqdai67@corp.supernews.com...
> > Thats the problem. I don't have the slightest idea how to get the data
> from
> > the page! What Im looking for is a little snippet of code that will
fetch
> > anything between <!--CONTENT--> and <!--CONTENT END--> or whatever
> > "delimiters" I decide to use.
> >
> > John Michael <johnm@acadiacom.net> wrote in message
> > news:3a3ae995@news.acadiacom.net...
> > > Say the page you want to do this on is named sample.html
> > > use an server side include exec cgi line on a blank page that will run
> the
> > > script
> > > name the page sample.html
> > >
> > > On your original sample.html page Put what you want to retrieve like
so
> > > <!--
> > > %%NEXT_LINE%%
> > > information you want to retrieve
> > > -->
> > > Put the page in a directory somewhere to act as a template.
> > > THe script runs from the server side include when someone wants to
view
> > it.
> > > Read in the page requested from your template directory,
> > > get the line following
> > > %%NEXT_LINE%%
> > >
> > > do what you want with your info
> > > and print out the template page.
> > >
> > > OR
> > > Easier
> > > add this to the page
> > > <img src="http://yourdomain.com/cgi-bin/script.pl?info=whatever you
want
> > to
> > > get"
> > >
> > > point it to your cgi script
> > > grab the query string
> > > send back the location of the clear image gif.
> > > cya
> > > John Michael
> > > http://realtimescipts.com
> > >
> > >
> > > "Hawk" <someguyREMOVE@REMOVEsunflower.com> wrote in message
> > > news:t3lcfprf2inbf6@corp.supernews.com...
> > > > Hello,
> > > >
> > > >     This is probably simple but it has me stumped. What Id like to
do
> is
> > > > take a HTML document (one thats on my server, not another website)
and
> > > > insert comments in it. like :
> > > >
> > > > <!--CONTENT-->
> > > > Content to be retrieved here
> > > > <!--CONTENT-->
> > > >
> > > > And then have the script grab everything between the two
> <!--CONTENT-->
> > > > lines. Can someone post a little sample of code that would be able
to
> do
> > > > this?
> > > >
> > > > Thanks in advance!
> > > >
> > > >
> > >
> > >
> >
> >
>
>




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

Date: 16 Dec 2000 15:48:57 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <91g2t9$dvh$1@lublin.zrz.tu-berlin.de>

Uri Guttman  <uri@sysarch.com> wrote in comp.lang.perl.misc:
>>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
>
>  AS> Well, this type of transform extracts a sort key once per element
>  AS> and then applies a (usually) trivial comparison routine.  This
>  AS> makes it relatively hard for comparisons to contradict one
>  AS> another, even if key extraction suffers from side-effects (and
>  AS> might extract a different key each time).
>
>heh, i know how the ST and GRT work (i am the G of GRT :).

I'm sorry if I came across as trying to educate you about the function
of sort transforms; I am well aware of the meaning of G (and R) in
GRT.  While formally replying to you personally I was speaking to
clpm in general.

>                                                            but key
>extraction is different from actual sorting. if the sort compare
>function is not deterministic (like some rand thingy) and the sort code
>is not well written, it could crash or run forever. this is what happens
>with perl < 5.6. you can still do a sort key extraction and use a bad
>comparison function. the GRT eliminates the user level comparison
>function altogether so that problem would go away. the ST keeps it but
>simplifies it by doing key extraction in advance.

Right.  So a GRT is safe from contradictory comparisons. An ST could
theoretically suffer because of its user-defined comparison.  In
practice however, the hard part where things can go wrong is usually
key extraction, which is why the transforms factor it out in the first
place.  The remaining comparison tends to be simple and consistent,
even with an ST.

Anno


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

Date: Sat, 16 Dec 2000 17:33:12 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <x78zpggtk6.fsf@home.sysarch.com>

>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:

  AS> Right.  So a GRT is safe from contradictory comparisons. An ST could
  AS> theoretically suffer because of its user-defined comparison.  In
  AS> practice however, the hard part where things can go wrong is usually
  AS> key extraction, which is why the transforms factor it out in the first
  AS> place.  The remaining comparison tends to be simple and consistent,
  AS> even with an ST.

well, the main reason for the key extraction in both of those is speed,
not making the sort work more consistantly. even a slow sort compare
function with full key extraction works if it is written well. the
standard qsort used by perl < 5.6 was the problem if you returned
inconsistant results. the fact that early key extraction may make that
sort work better was never a goal and that was my point. it is just a
happy side effect. we had no control over the qsort algorithm used and
p5p chose the new one to remove the issue of crashin with inconsistant
compare functions. it doesn't affect sort speed on average (it has
different worst and best case behavior from what i gather).

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 16 Dec 2000 09:41:00 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <m1n1dwfemr.fsf@halfdome.holdit.com>

>>>>> "Anno" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:

Anno> Right.  So a GRT is safe from contradictory comparisons. An ST could
Anno> theoretically suffer because of its user-defined comparison.  In
Anno> practice however, the hard part where things can go wrong is usually
Anno> key extraction, which is why the transforms factor it out in the first
Anno> place.  The remaining comparison tends to be simple and consistent,
Anno> even with an ST.

Right.  The GRT gives you a speed increase over the ST and guaranteed
consistency at the expense of determining a reversible unique mapping
between the domain data and a single string.  For some problems,
that's no big deal; for others, it's a fine art. :-)

On the other hand, I came up with the ST in a five minute response to
someone asking why a sort was so slow.  G and R probably worked a bit
longer on their paper. :)

print "Just another Perl hacker,"

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


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

Date: Sat, 16 Dec 2000 17:53:10 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <x7zohwfe2h.fsf@home.sysarch.com>

>>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:

  RLS> On the other hand, I came up with the ST in a five minute
  RLS> response to someone asking why a sort was so slow.  G and R
  RLS> probably worked a bit longer on their paper. :)

actually we sorta borrowed the idea from a post seen here on sorting IP
addresses. we just generalized the idea to more key extraction methods
and ways to generate the single sortable string key. those came
quickly. writing the paper to express all of that plus other sorting
info took a good while but was fun.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 16 Dec 2000 17:54:58 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <91ga9i$e89$1@lublin.zrz.tu-berlin.de>

Uri Guttman  <uri@sysarch.com> wrote in comp.lang.perl.misc:
>>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
>
>  AS> Right.  So a GRT is safe from contradictory comparisons. An ST could
>  AS> theoretically suffer because of its user-defined comparison.  In
>  AS> practice however, the hard part where things can go wrong is usually
>  AS> key extraction, which is why the transforms factor it out in the first
>  AS> place.  The remaining comparison tends to be simple and consistent,
>  AS> even with an ST.
>
>well, the main reason for the key extraction in both of those is speed,
>not making the sort work more consistantly....

>...happy side effect...

Yes, of course.  I just thought it worthwhile to point out the effect.

Anno


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

Date: 16 Dec 2000 10:59:42 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <3a3bad8e$1@cs.colorado.edu>

In article <x7zohwfe2h.fsf@home.sysarch.com>,
Guri Uttman  <uri@sysarch.com> wrote:
>actually we sorta borrowed the idea from a post seen here on sorting IP
>addresses. we just generalized the idea to more key extraction methods
>and ways to generate the single sortable string key. those came
>quickly. writing the paper to express all of that plus other sorting
>info took a good while but was fun.

I have an ancient perl script called "addrsort" that does this.

    #!/usr/bin/perl
    while (<>) {
	unless (/([^<]+\@[^>\n]+)/) {
	    warn "No addr? $_";
	    next;
	} 
	push (@data, $_);
	($addr = $1) =~ y/a-z/A-Z/;
	$addr =~ s/(.*)\@//;
	push (@user, $1);
	if (!$addr) {
	    # die "no addr: $_";
	    next;
	} 
	@addrs = reverse split(/\./, $addr);
	# die unless @addrs;
	$taddr = sprintf ("%-20s " x @addrs, @addrs);
	push (@addr, $taddr);
    } 

    print @data[ sort { $addr[$a] cmp $addr[$b] 
				    ||
			$user[$a] cmp $user[$b] 
				    ||
			$data[$a] cmp $data[$b] 
		    } 0..$#data];

It dates from perl4 days, at least, and maybe earlier.

This isn't exactly what you did (you didn't have parallel arrays),
but the sprintf trick is certainly of venerable heritage.

--tom


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

Date: 16 Dec 2000 18:16:35 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <91gbi3$eaj$1@lublin.zrz.tu-berlin.de>

Uri Guttman  <uri@sysarch.com> wrote in comp.lang.perl.misc:
>>>>>> "RLS" == Randal L Schwartz <merlyn@stonehenge.com> writes:
>
>  RLS> On the other hand, I came up with the ST in a five minute
>  RLS> response to someone asking why a sort was so slow.  G and R
>  RLS> probably worked a bit longer on their paper. :)
>
>actually we sorta borrowed the idea from a post seen here on sorting IP
>addresses. we just generalized the idea to more key extraction methods
>and ways to generate the single sortable string key. those came
>quickly.

People have been doing this in a haphazard manner for ages[1].  Many files
contain redundant fields "for sort purposes".  The good thing is,
Perl encourages doing this on the fly.  This again encourages thinking
about it as a method instead of an ad hoc heuristic.  When the right
people do the thinking we get a pretty paper like _A Fresh Look..._

>         writing the paper to express all of that plus other sorting
>info took a good while but was fun.

Even the benchmarks?

Anno

[1] Well, computer ages, if you know what I mean...


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

Date: Sat, 16 Dec 2000 18:37:33 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <x7wvd0fc0i.fsf@home.sysarch.com>

>>>>> "TC" == Tom Christiansen <tchrist@perl.com> writes:

  TC> This isn't exactly what you did (you didn't have parallel arrays),
  TC> but the sprintf trick is certainly of venerable heritage.

well, we never claimed to have invented it. we heard from others that a
similar single string key was used in IBM sorts in the 60's. all we did
was make it perlish and comprehensive to support many types of keys.
BTW, pack is the way to do create GRT keys with the shortest size in
most cases, not sprintf. you can use either one as to your taste.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Sat, 16 Dec 2000 18:41:29 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <x7u284fbu2.fsf@home.sysarch.com>

>>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:


  AS> People have been doing this in a haphazard manner for ages[1].  Many files
  AS> contain redundant fields "for sort purposes".  The good thing is,
  AS> Perl encourages doing this on the fly.  This again encourages thinking
  AS> about it as a method instead of an ad hoc heuristic.  When the right
  AS> people do the thinking we get a pretty paper like _A Fresh Look..._

in my followup to tom i said this was done in the 60's. i don't know if
they did it on he fly or not.

  AS> Even the benchmarks?

larry did most of those. i wrote a benchmark scaffold to compare many
sort tricks and sizes and such but never completed it. it was aiming to
be a large project. i also have a GRT generating module which has
languished in a lousy state for 18 months. god knows when i will have
time to finish it. it would be a killer if i ever did.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Sat, 16 Dec 2000 18:25:18 GMT
From: thirdgc@my-deja.com
Subject: Sorting of messages
Message-Id: <91gc2a$86o$1@nnrp1.deja.com>

I wrote a bulliten board script for my site and I want to add a new
feature. I'm trying to get the list of messages on the main page to go
in order of when they were last replied to. This is how I figured I
could do it. When a post is posted I open the file that has all the
info for the main page(bb.txt), then I copy that to a temperary file
(temp.txt) except for the entry of the post the user is posting and
then after all the rest are copied i print the post the user posted or
replied to at the bottom of the file. I can get the all the entries
copied and then rename the temp.txt to bb.txt, but it still keeps the
entry of the file the user post and still adds the entry to the bottom.
This is the script:

$old = "bb.txt";
$new = "temp.txt";

open (OLD,"< $old") || dienice("Can't open $old: $! \n");
@old1 = <old>;
($file,$topic,$name) = split(/\|/, @old1);
open (NEW,"> $new") || dienice("Can't open $new: $! \n");
select(NEW);
while (<OLD>) {
#part that's supposed to stop the entry that the user made from being
copied
        if ($FORM{'num'} ne $file) {
	print NEW $_  || dienice("Can't write $new: $! \n");
	}
}
close(OLD) || dienice("Can't close $old: $! \n");
close(NEW) || dienice("Can't open $new: $! \n");
rename($old, "$old.orig") || dienice("Can't rename $old: $! \n");
rename($new, $old) || dienice("Can't rename $new: $! \n");


open(bb,"+>>bb.txt") || dienice("Can't open bb.txt: $! \n");
print bb "$num|$FORM{'topic'}|$FORM{'name'}\n";
close(bb);

Can anyone help me with fixing this? Or do you know of a simpler way of
doing this? Any help is appreciated.
Thanks,
Chris


Sent via Deja.com
http://www.deja.com/


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

Date: Sat, 16 Dec 2000 14:49:56 GMT
From: Tim Tyler <tt@cryogen.com>
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <G5o178.2wp@bath.ac.uk>

In comp.lang.java.programmer Csaba Raduly <real.email@signature.this.is.invalid> wrote:
: And so it came to pass that "BarryNL" <wiz@hogwarts.edu> wrote:
:>"Sunil Matta" <smatta@acm.org> wrote:

:>> No comparison. Perl is blindingly fast. Java is slow.
:>
:>Er, don't you have that the wrong way round. If you think Java is
:>slow I suggest looking at something like the Java ZX Spectrum
:>emulator which runs about 4x the speed of the real thing on a
:>Pentium III. 

: Or at (one of the many) ZX emulators written in C, which run 10x faster 
: (so they need a slowdown parameter) on a Pentium 100.

That would not help you with comparing the speed of Java and Perl.

If you want to compare Java with C, see some Java vs C benchmarks.

You can find some of these at http://www.javalobby.org/features/jpr/

A ZX Spectrum emulators are unlikely to be useful as a benchmarks
in either case, since you have no idea how well they are written.
-- 
__________                  http://alife.co.uk/  http://mandala.co.uk/
 |im |yler  tt@cryogen.com  http://hex.org.uk/   http://atoms.org.uk/


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

Date: Sat, 16 Dec 2000 11:45:42 -0600
From: "Rand" <me@me.com>
Subject: Re: Use PERL or Java? Which is faster?
Message-Id: <t3nagcrtrgnn34@corp.supernews.com>

You know, if we are talking server side (such as CGI vs. servlets), it
doesn't really matter if Java executes faster than Perl because Java
servlets don't have the startup costs that CGI scripts do.  When a servlet
starts, it remain resident in memory so it can do things like use database
connection pools, store it's state in regular variables (instead of having
to write them to disk), etc.
"Csaba Raduly" <real.email@signature.this.is.invalid> wrote in message
news:Xns900B6FFBFquuxi@194.203.134.135...
> And so it came to pass that "BarryNL" <wiz@hogwarts.edu> on 12 Dec
> 2000 wrote <917d9m$5cq$4@nereid.worldonline.nl>:
>
> >"Sunil Matta" <smatta@acm.org> wrote in message
> >news:90lvji$jv9$1@nnrp1.deja.com...
> >> No comparison. Perl is blindingly fast. Java is slow.
> >
> >Er, don't you have that the wrong way round. If you think Java is
> >slow I suggest looking at something like the Java ZX Spectrum
> >emulator which runs about 4x the speed of the real thing on a
> >Pentium III.
> >
>
> Or at (one of the many) ZX emulators written in C, which run 10x faster
> (so they need a slowdown parameter) on a Pentium 100.
>
> --
> Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
> mailto:csaba.raduly@sophos.com      http://www.sophos.com/
> US Support +1 888 SOPHOS 9      UK Support +44 1235 559933
> You are in a maze of twisted little minds, all different.




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

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 5130
**************************************


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