[8451] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2068 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Mar 11 00:07:38 1998

Date: Tue, 10 Mar 98 21:00:32 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 10 Mar 1998     Volume: 8 Number: 2068

Today's topics:
    Re: Are There Any Snazzy Perl Editors for Windows? (Eric Weiss)
    Re: Are There Any Snazzy Perl Editors for Windows? <cee123@ibm.net>
    Re: Automating Visual C++ Builds with Perl (Danny Aldham)
        Binary Evolution NSAPI ISAPI???? <dberk@station.sony.com>
    Re: c.l.p.mod and TPI <dformosa@st.nepean.uws.edu.au>
    Re: comp.lang.perl.moderated (was Re: Tom, grow up [Re: (Nicholas Carey)
    Re: error??? <rjk@coos.dartmouth.edu>
        Getting date on an NT machine <ecs@talstar.com>
    Re: how to define @INC at runtime? e.g. $DEVBIN/lib/per <rhubbell@aw.sgi.com>
        make test fails on io/pipe for perl5.004_62 on Solaris  (B Michaud)
        NCSA & PERL <cyberman@sonoma.edu>
        Need help on Perl <alantam000@usa.net>
    Re: Need help on Perl (David Oswald)
    Re: nslookup? <c..bojswbo@64.usenet.us.com>
    Re: Open3 for Win32 (David Efflandt)
        Operator Overloading <glew@cs.wisc.edu>
    Re: Operator Overloading <glew@cs.wisc.edu>
        problem with mkdir() and permissions lewst@yahoo.com
    Re: problem with mkdir() and permissions <uri@sysarch.com>
    Re: Speed of sort routine vs. one-by-one compare   (123 <krollj@worldnet.att.net>
    Re: Speed of sort routine vs. one-by-one compare   (123 (Abigail)
    Re: Speed of sort routine vs. one-by-one compare   (123 <snowe@rain.org>
    Re: Speed of sort routine vs. one-by-one compare   (123 <uri@sysarch.com>
        Supported JavaScript Libraries??? <studio4d@IDT.NET>
        Wierd redirection problem with Location: culrich@i2000.net
    Re: Wierd redirection problem with Location: (David Efflandt)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 10 Mar 1998 20:35:40 -0500
From: eweiss@winchendon.com (Eric Weiss)
Subject: Re: Are There Any Snazzy Perl Editors for Windows?
Message-Id: <MPG.f6fb47b42d291be9896c4@news.dgsys.com>

Learning Tree uses an editor called fte in their Perl classes, but
I have not been able to find a copy of it on the web.  It is a nice
gui, syntax highlighting editor.  If anyone finds it, let us know.

Eric


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

Date: Tue, 10 Mar 1998 22:01:22 -0500
From: Charles Engelke <cee123@ibm.net>
Subject: Re: Are There Any Snazzy Perl Editors for Windows?
Message-Id: <3505FE82.2F4C@ibm.net>

Eric Weiss wrote:
> 
> Learning Tree uses an editor called fte in their Perl classes, but
> I have not been able to find a copy of it on the web.  It is a nice
> gui, syntax highlighting editor.  If anyone finds it, let us know.

Are you sure it was "fte", not "gte".  GTE is the GWD Text Editor,
available at http://www.iridis.com/gwd/  It's fits your description. 
Again, I have no affiliation with them, but I really like the editor,
and hardly anyone seems to know about it.

Charlie


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

Date: 10 Mar 1998 04:41:26 GMT
From: danny@lennon.postino.com (Danny Aldham)
Subject: Re: Automating Visual C++ Builds with Perl
Message-Id: <6e2g9m$4jl$1@lennon.postino.com>

X-Newsreader: TIN [version 1.2 PL2]

Daniel R. Kegel (dank@alumnae.caltech.edu) wrote:
: I'm trying to figure out how to script my Visual C 5.0 biulds.
: I used to use Makefiles, but Visual C 5.0 has made that nearly impossible.

Perl itself uses a Makefile to build on VC++ 5.0 . 

--
Danny Aldham             SCO Ace, MCSE, JAPH, DAD 
Field Service Manager    BCTel Systems Support
7000 Lougheed Hwy, Burnaby BC   (604) 444-8949


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

Date: 11 Mar 1998 02:10:21 GMT
From: "David Berk" <dberk@station.sony.com>
Subject: Binary Evolution NSAPI ISAPI????
Message-Id: <01bd4c92$92390af0$8481cccf@ntws40_berk>

Anyone try this out. I cannot get to the site.

David Berk
dberk@station.sony.com


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

Date: 11 Mar 1998 02:54:09 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: c.l.p.mod and TPI
Message-Id: <889584849.326190@cabal>

In <pudge-1003981427420001@ppp-32.ts-1.kin.idt.net> pudge@pobox.com (Chris Nandor) writes:

>In article <889525385.976597@cabal>, ? the platypus {aka David Formosa}
><dformosa@st.nepean.uws.edu.au> wrote:

># Then why is the bord of TPI acting as defacto moderators?

[...]

>Sigh.  Not one person on TPI's board was listed as one of the moderators. 
>What, you mean the provision that TPI can post "ads" makes it a
>moderator?  That is nonsensical.

I was told on this thread that ads would be sent to TPI, thay would look
at them and decide wether or not thay where apporprate to the newsgroup
and then post them. In other words thay are acting just as a moderator
would.

It is my option that looking a posts and deciding there approprateness
should be the task of the listed moderators.


--
Please excuse my spelling as I suffer from agraphia see the url in my header. 
Never trust a country with more peaple then sheep. 
Support NoCeM http://www.cm.org/                   
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

Date: Wed, 11 Mar 1998 01:04:45 GMT
From: a-bnc@microsoft.com (Nicholas Carey)
Subject: Re: comp.lang.perl.moderated (was Re: Tom, grow up [Re: The -w switch (was Re: better way to do this?)])
Message-Id: <3505e2fc.24322875@newsvr>

This discussion should take place on news.groups. Follows adjusted.

-- 


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

Date: Tue, 10 Mar 1998 23:09:46 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
Subject: Re: error???
Message-Id: <35060E8F.DD79E003@coos.dartmouth.edu>

John Porter wrote:
> 
> merlin wrote:
> >
> 
> Might I gently suggest that you change your pseudonym?
> The one you have chosen is considered a reserved name
> in this newsgroup.

That's a new one on me.  Since when does usenet have a concept of reserved usernames?

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: Tue, 10 Mar 1998 21:49:32 -0500
From: "Eric Smith" <ecs@talstar.com>
Subject: Getting date on an NT machine
Message-Id: <889584203.771280@nexus.polaris.net>

Just started porting my perl scripts to NT but how do you tell Perl to get
the date on an NT machine. 

If this isn't the correct place for this question please let me know where
the correct one is.

Thanks 

Eric Smith


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

Date: Tue, 10 Mar 1998 17:23:06 -0800
From: Richard Hubbell <rhubbell@aw.sgi.com>
Subject: Re: how to define @INC at runtime? e.g. $DEVBIN/lib/perl5 ??
Message-Id: <3505E77A.11D7438F@aw.sgi.com>

Brian Wheeler wrote:
> 
> In article <3505B1E3.66611A8D@aw.sgi.com>,
>         Richard Hubbell <rhubbell@aw.sgi.com> writes:
> > how to define @INC at runtime? e.g. $DEVBIN/lib/perl5 ??
> >
> >
> > Anyone tried this or maybe even have it working
> > already?
> >
> >
> > I'd like to be able to define the $DEVBIN in a variable
> > so that I could move the perl around like so:
> >
> >
> > $DEVBIN = "/usr/version11.1/"
> >
> > or if I was working on version11.2
> >
> > $DEVBIN = "/usr/version11.2/"
> >
> > I want perl to live with a certain set of sources maybe or
> > just be able to use it under /tmp/lib/perl5 or the like.
> >
> > perl -V
> >
> > would print $DEVBIN/lib/perl5 ( etc., etc. )
> >
> >
> > I've looked at 'use lib LIST' but that only works for
> > subsequent uses of 'use'.
> >
> > Checked www.dejanews.com, checked the FAQ, the book.
> >
> > Looks like it'll require a bit of hacking....
> >
>         Nah.  Just set the PERL5LIB environment variable....then it'll
> search in the places listed first.
> search in the places listed first.

Great, thanks.

Strange this isn't documented in the book???

Rick


> 
> Brian Wheeler
> bdwheele@indiana.edu

-- 
Richard Hubbell(Rick)   \
Alias|wavefront         / "Give me a firm place to stand,
805-884-7859 fax:8859   \  and I will move the earth!"
rhubbell@aw.sgi.com     /     --Archimedes


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

Date: Wed, 11 Mar 1998 04:47:47 GMT
From: bmichaud@SPAMNOT.excom.com (B Michaud)
Subject: make test fails on io/pipe for perl5.004_62 on Solaris 2.6 x86
Message-Id: <THoN.4$N4.55531@news.magma.ca>

I'm an absolute perl beginner attempting to build his first perl release.

The configure for perl5.004_62 went well, as did the make.  However, one of the 
tests failed, giving the following output:

io/pipe.............Confused test output: test 7 answered after test 9
FAILED tests 8-9
        Failed 2/10 tests, 80.00% okay

It was the only problem with the make test - does anyone know what this means, 
and how serious it is?  Can this build safely be used, and if not, what can I 
do to fix it?


Many thanks in advance.

Bernard Michaud
Excom Informatics Services

ps. Remove the spamguard from my email address before replying by mail.



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

Date: Tue, 10 Mar 1998 17:40:47 -0800
From: David McCall <cyberman@sonoma.edu>
Subject: NCSA & PERL
Message-Id: <3505EB9A.583AD2B5@sonoma.edu>

SunOS4.1.3 (Sparc IPX - 64mb & load of disk)......
NCSA httpd152 daemon & PERL53 w CGIpm(latest).
httpd is serving Web Course In A Box.

occassionally, a server will spawn a child process of PERL that appears
to hog the CPU (or gets stuck in some kinda loop).  I am unable to
determine the parent process nor what is going on in the perl program.
ultimately the system slows to a crawl and I end up kill -9 to the PERL
child.....everything seems to go back to normal slowly.  I have tried
terminating the root httpd process and after they all disappear I
restart
the server from the rc.local script....and that darn PERL process just
wakes right up and continues where it left.......This is a production
machine on this campus and it would be looking for a needle in a
haystack to find an enduser that may have been the unfortunate end
of that event....(like if they were taking a test online or something).

another error message at the client browser end is Server Error 500.
but I cant find anything there that resembles a honest clue to what is
going on....

I'm hoping that someone out the has a few other things for me to look at

or try before I just trash the ncsa and bring in apache.....

thanks ahead of time
SOS
cyberman@sonoma.edu



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

Date: Tue, 10 Mar 1998 20:26:47 -0500
From: Alan Tam <alantam000@usa.net>
Subject: Need help on Perl
Message-Id: <3505E856.94931C05@usa.net>

I'd like to write a piece of Perl script which do the following task:

When someone inputs some data on the form of my webpage, the data will
be written to a ASCII text file.

Could anyone help me on it?  Thanks for your assistance.

--Alan




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

Date: Wed, 11 Mar 1998 04:25:00 GMT
From: doswald@xmission.com (David Oswald)
Subject: Re: Need help on Perl
Message-Id: <350611d8.3728811@news.xmission.com>

On Tue, 10 Mar 1998 20:26:47 -0500, Alan Tam <alantam000@usa.net>
wrote:

>I'd like to write a piece of Perl script which do the following task:
>
>When someone inputs some data on the form of my webpage, the data will
>be written to a ASCII text file.
>
>Could anyone help me on it?  Thanks for your assistance.
>

At what point do you find yourself stuck?  Where exactly are you
running into trouble?


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

Date: 11 Mar 1998 00:08:22 GMT
From: Anirvan Chatterjee <c..bojswbo@64.usenet.us.com>
Subject: Re: nslookup?
Message-Id: <6e4klm$g1$1@samba.rahul.net>

Jim Murrell <lingjen@ra.isis.unc.edu> wrote:
> I have been trying to write a short perl script
> that takes an IP number and essentially does
> an "nslookup".   I would prefer not using the
> system call to do but tried gethostbyaddr 
> without too much success.  Does anyone have
> an example of some perl code that does this?

Yup. Grab the ever-so-useful Net::DNS for CPAN.

_____________________________________________________________________
Anirvan Chatterjee  . anirvan @ chatterjee.net .  PGP 2048/0xE2D13BA9
Fast & free new/used multi-bookstore searching @ http://www.mxbf.com/


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

Date: Wed, 11 Mar 1998 03:38:40 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Open3 for Win32
Message-Id: <3508ff9b.5151016@flood.xnet.com>

ronaldws@aol.com (RonaldWS) wrote:

>I have been doing some work lately that required the equivalent of
>IPC::Open3/IPC::Open2 under Win '95.  As far as I can tell they have not yet
>been ported.  Is that correct?  Is there other functionalityin the Win32
>modules, that I may have missed, providing equivalent functionality?
>
>I have managed to come up with some perl functions on my own that duplicate the
>basic functionality of IPC::Open3 (i.e. create a process and redirect the three
>standard handles to that process through pipes to the parent process).  If
>Open3 is not yet ported is anyone interested in this work?
>
>Ronald Schmidt.

I basically needed to feed an external program and get stderr status
from it as it happened (\r terminated lines) and independently
retrieve stdout (\n terminated lines) when I got around to it.

My solution was to fork a copy of the script to feed the process
through a fifo (appears to be a standard file to the program), use a
child with another fifo to grab redirected stdout and open a pipe to
read stderr from the process and forward that to another program
(percent meter).  Afterwards I grabbed stdout from the child.
Altogether 4 links between 3 copies of the script and 2 external
programs.

Without the fork and fifo, I could not seem to open a pipe to feed a
program that was not running yet.  The fork was able to independently
wait to send data, while I opened the program to receive its output.

This was in Linux, but I would be interested in seeing what you came
up with (my script is at http://www.xnet.com/~efflandt/quickspy2/).


David Efflandt/Elgin, IL USA
efflandt@xnet.com    http://www.xnet.com/~efflandt/


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

Date: Tue, 10 Mar 1998 22:00:09 -0600
From: Andy Glew <glew@cs.wisc.edu>
Subject: Operator Overloading
Message-Id: <35060C49.45FD8711@cs.wisc.edu>

Dang!  I swear I have seen this somewhere, but cannot figure out where...

Q: (how) can I do operator overloading in Perl?

I have found a posting that uses %OVERLOAD, but I need more details as to how to use it.

---

My application: the fairly standard trick of avoiding having to write a mini-language
parser, interpreter, etc., by munging the language until it looks like Perl code,
and then evalling it.  However, I would like to make my mini-language safe to
undef'ined data items: i.e. have undef + x => undef, etc., etc.  without printing
annoying error messages about uninitialized variables So I am thinking
that I could overload the regular operators to do a bit more checking for
undef, and to propagate undef's along.


---

Please reply by email since I don't read this group much.
glew@cs.wisc.edu




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

Date: Tue, 10 Mar 1998 22:11:20 -0600
From: Andy Glew <glew@cs.wisc.edu>
Subject: Re: Operator Overloading
Message-Id: <35060EE8.A21AC50C@cs.wisc.edu>

> Q: (how) can I do operator overloading in Perl?
>
> I have found a posting that uses %OVERLOAD, but I need more details as to how to use it.

Okay: I found the FAQ (took long enough).
And

How do I redefine a built-in function, operator, or method?

Why do you want to do that? :-)

If you want to override a predefined function, such as open, then you'll have to import the new definition from a different module.
See Overriding Builtin
Functions. There's also an example in Class/Template.

If you want to overload a Perl operator, such as + or **, then you'll want to use the use overload pragma, documented in the
overload manpage.

If you're talking about obscuring method calls in parent classes, see Overridden Methods.



But, of course, the overload manpage reference is inaccessible (at least temporarily).



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

Date: Tue, 10 Mar 1998 21:40:11 -0600
From: lewst@yahoo.com
Subject: problem with mkdir() and permissions
Message-Id: <6e510c$kr0$1@nnrp1.dejanews.com>

  hi.  i'm using perl version 5.003 on solaris.  when i try and use
  mkdir() in my perl script to create directories, the file permissions
  turn out wrong.  i can't figure out why.  for example,

  mkdir("cgi-bin",0775);

  the following statement creates a directory that looks like this:

  drwxr-xr-x   2 lewst    users        512 Mar 10 20:24 cgi-bin

  i then have to manually "chmod 0775 cgi-bin" to get the file
  permissions right.

  drwxrwxr-x   2 lewst    users        512 Mar 10 20:24 cgi-bin

  why is mkdir() not honoring the permissions mode that I specified?

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 10 Mar 1998 23:38:43 -0500
From: Uri Guttman <uri@sysarch.com>
To: lewst@yahoo.com
Subject: Re: problem with mkdir() and permissions
Message-Id: <x7zpixu9ik.fsf@sysarch.com>

lewst@yahoo.com writes:

>   hi.  i'm using perl version 5.003 on solaris.  when i try and use
>   mkdir() in my perl script to create directories, the file permissions
>   turn out wrong.  i can't figure out why.  for example,
> 
>   mkdir("cgi-bin",0775);
> 
>   the following statement creates a directory that looks like this:
> 
>   drwxr-xr-x   2 lewst    users        512 Mar 10 20:24 cgi-bin
> 
>   i then have to manually "chmod 0775 cgi-bin" to get the file
>   permissions right.
> 
>   drwxrwxr-x   2 lewst    users        512 Mar 10 20:24 cgi-bin
> 
>   why is mkdir() not honoring the permissions mode that I specified?

you have a umask value (probably 022 the default) which clears those
bits. set the value to 002 in your shell with the umask command or in
perl with the umask function.

uri

-- 
Uri Guttman                     SYStems ARCHitecture and Software Engineering
uri@sysarch.com                                          Have Perl, Will Hack
http://www.sysarch.com                (781) 643-7504 x*2  FAX: (781) 643-2710
Try the Best Search Engine on the Net -------->  http://www.northernlight.com


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

Date: Tue, 10 Mar 1998 20:20:39 -0600
From: "John A. Kroll" <krollj@worldnet.att.net>
Subject: Re: Speed of sort routine vs. one-by-one compare   (123)
Message-Id: <6e4skp$ig5@bgtnsc02.worldnet.att.net>

Uri Guttman wrote:

> in algorithm analysis the comparison is the only thing you count in
> O(). I/O is considered fixed linear overhead as ALL algorithms have to
> move the same dataset into and out of memory. the fact that it may
> dominate real time is IRRELEVANT to the order of the algorithm.
> eventually with a large enough dataset a even a log(n) algorithm will be
> dominated by the comparisons and not the I/O.

This is not necessarily true, in algorithm analysis you pick an appropriate
unit of work (be it swaps, comparisons, or whatever) to base your O( )
measurement on.
If the requirement here is to maintain the actual file in sorted order (as
opposed to merely being able to read the records in sorted order on
demand), the cost of moving data on disk will dominate and should
be what you use to compare algorithms.
Maybe I've misread the requirements.  But it seems like the problem
is you have an existing sorted file with 49,999 records in it, now you
need to add the 50,000 record (the previous records for all I know
were added hours ago).  In this case insertion sort is probably the best
algorithm to use.  The alternative of appending the 50,000 record at the
end and using a general purpose sorting algorithm, will typically perform
many unnecessary record exchanges, raising the cost of the sort.



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

Date: 11 Mar 1998 02:27:55 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Speed of sort routine vs. one-by-one compare   (123)
Message-Id: <6e4srb$2bp$1@client3.news.psi.net>

Uri Guttman (uri@sysarch.com) wrote on 1653 September 1993 in
<URL: news:x790qiulod.fsf@sysarch.com>:
++ 
++ abigail,
++ 
++ you throw around terms like O(logn) like you have taken an algorithm
++ analysis course but you make several mistakes in your letter.

As a matter of fact, I've *given* algorithm analysis courses.

++ abigail@fnx.com (Abigail) writes:
++ 
++ > Uri Guttman (uri@sysarch.com) wrote on 1652 September 1993 in
++ > ++ abigail@fnx.com (Abigail) writes:
++ > ++ 
++ > ++ > 
++ > ++ > What is a binary sort routine?
++ > 
++ > I know what binary _search_ is, but binary sort? No idea.
++ 
++ it is when you scan all the records into a binary tree O(log2n) and then
++ scan the tree in infix order giving you a sorted scan. very old and
++ basic algorithm for O(log2n) sorting.

Oh, please, *do* enlighten us. How do you scan N records in O (log N) time?
You aren't serious, are you? If you put the records in just any binary
tree, you get an Omega (N^2) algorithm, if you put the records in a
*balanced* tree, you get an O (N log N) algoritm. The latter is optimal
for sorting.

++ > ++ > It will be linear in the size of the file. For each addition.
++ > ++ 
++ > ++ not always true. depending on how the file is organized. unix has
++ > ++ bsearch and friends to find records in a sorted file which is O(log2n).
++ > 
++ > That's inefficient, as you can find records in O (log n), if you know
++ > how large the records are. But that's irrelevant. The insertion will
++ > take linear time worst case. (Average case too).
++ 
++ log2n is log(n) base 2 which is the same as log(n) when using order O().
++ maybe better written log2(n) (it is not log(2n))

Uhm, putting the base of the log there when you are talking about
with big-Oh is a bit redundant, as log_a (N) = log_b (N) / log_b (a).
I read log2n as log N * log N (commonly noted as log^2 N), since log
(2n) is the same order as log (n) as well, and hence the 2 meaning 2n
wouldn't make sense either.

++ all linear factors in O() are not important. only the function of N (the size
++ of the data set) count.

Indeed, the base of the log isn't important.

++ > ++ even a simple binary search of a linear file would be much faster than a
++ > ++ linear insert. you could find the record location in O(log2n) and then
++ 
++ > Of course, a binary search is faster than a linear insert. And a
++ > car is heavier than an apple, but that doesn't make the car a fruit.
++ 
++ oh, really. i have driven lemons :-)
++ 
++ > ++ copy large blocks until the insert point, insert the new record, finish
++ > ++ copying with large blocks. you eliminate many of the record compares
++ > ++ which is what eats up the cpu.
++ 
++ > Rubbish. You got to move a linear number of records. That will dominate
++ > the time spend. 
++ 
++ i will double your rubbish back if not satisfied.
++ 
++ in algorithm analysis the comparison is the only thing you count in
++ O(). I/O is considered fixed linear overhead as ALL algorithms have to
++ move the same dataset into and out of memory. the fact that it may
++ dominate real time is IRRELEVANT to the order of the algorithm.

My toes curl from the above statement.

++ eventually with a large enough dataset a even a log(n) algorithm will be
++ dominated by the comparisons and not the I/O.

Eh? Since when does log (n) grow faster than n?

++ so a binary search of the insert point, with large block I/O will be
++ FASTER than just a linear search and insert. which is my point.

Sure, but that's irrelevant. Since you're still doing a linear moves
*PER INSERT*, it's a quadratic algorithm.


Read a book. Please.



Abigail
-- 
perl -we '%_ = map {local $_ = $_; y/a-z/n-za-m/; ($_, $_)} @_ = map {lc} <>;
          print grep {$_{$_}} @_' < /usr/dict/words


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

Date: Tue, 10 Mar 1998 18:28:46 -0800
From: Nick Halloway <snowe@rain.org>
Subject: Re: Speed of sort routine vs. one-by-one compare   (123)
Message-Id: <Pine.SUN.3.96.980310181927.27587A-100000@coyote.rain.org>



On 10 Mar 1998, Abigail wrote:

> Uri Guttman (uri@sysarch.com) wrote on 1652 September 1993 in
> <URL: news:x7afayuzlb.fsf@sysarch.com>:
> ++ abigail@fnx.com (Abigail) writes:
> ++ 
> ++ > What is a binary sort routine?

What I need to do is to update a file that might have say 50,000 records,
with new records occasionally.  So it would be on disk, then either
read in record-by-record, or all of it would be read into memory.

By binary insertion, 
I mean a program that does something like this:  Reads the file
into memory, looks for the middle of the file, figures out whether the
new record belongs above or below the middle of the file, looks for the
middle of that half of the file, figures out where the record belongs
relative to that middle, etc.  If anyone has such a program, I'd
appreciate hearing about it.

For 50,000 records, is it worth doing this, or should the program just
read in the file record by record, compare each record to the new record,
then write it all out?  If it would be likely to take much more than a 
second to insert the new record with the easy method then programming the
binary method would probably be better.

thanks ...



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

Date: 10 Mar 1998 22:48:17 -0500
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Speed of sort routine vs. one-by-one compare   (123)
Message-Id: <x73egpvqf2.fsf@sysarch.com>

"John A. Kroll" <krollj@worldnet.att.net> writes:

> Uri Guttman wrote:
> 
> > in algorithm analysis the comparison is the only thing you count in
> > O(). I/O is considered fixed linear overhead as ALL algorithms have to
> > move the same dataset into and out of memory. the fact that it may
> > dominate real time is IRRELEVANT to the order of the algorithm.
> > eventually with a large enough dataset a even a log(n) algorithm will be
> > dominated by the comparisons and not the I/O.
> 
> This is not necessarily true, in algorithm analysis you pick an appropriate
> unit of work (be it swaps, comparisons, or whatever) to base your O( )
> measurement on.

but as i said ALL algorithms will have the same overhead reading in the
file and writing it out again. so it it a constant and you ignore it for
analysis.

> If the requirement here is to maintain the actual file in sorted order (as
> opposed to merely being able to read the records in sorted order on
> demand), the cost of moving data on disk will dominate and should
> be what you use to compare algorithms.

but how many compares will be the difference in algorithms not I/O.

> Maybe I've misread the requirements.  But it seems like the problem
> is you have an existing sorted file with 49,999 records in it, now you
> need to add the 50,000 record (the previous records for all I know
> were added hours ago).  In this case insertion sort is probably the best
> algorithm to use.  The alternative of appending the 50,000 record at the
> end and using a general purpose sorting algorithm, will typically perform
> many unnecessary record exchanges, raising the cost of the sort.

very wrong. you would have to read ALL the records in and write them
out. here is a much faster algorithm is high level pseudo code:

(assuming fixed size records you can seek to using perl seek,
 sorted records in file)

	do binary search on file and locate and save position to insert
	new record.

	read large block of data from file and save seek location

	write new record in insert point.

	LOOP:

		read next block of data and save ending seek point

		write last block back to file after inserted record or
		last written block

		continue loop until EOF

this will only read and write half the file on average. if the file
can't be overwritten in place, do the loop over the whole file and
insert the record in the correct place.

yes, in this algorithm the I/O dominates real time. but it is faster
than any other algorithm since it does the least record reads and
compares and even the least total I/O in the example i wrote.

uri




-- 
Uri Guttman                     SYStems ARCHitecture and Software Engineering
uri@sysarch.com                                          Have Perl, Will Hack
http://www.sysarch.com                (781) 643-7504 x*2  FAX: (781) 643-2710
Try the Best Search Engine on the Net -------->  http://www.northernlight.com


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

Date: 11 Mar 1998 03:16:13 GMT
From: Robert Cliche <studio4d@IDT.NET>
Subject: Supported JavaScript Libraries???
Message-Id: <6e4vlt$j5c@nnrp4.farm.idt.net>

I am looking for information (and vendor names) of companies that supply
'perl' and/or 'javascript' language packages that are supported (with
documentation and examples). The functions that I am thinking of include:

  - standard formatting and validation of date, number and string
  - standard timer routines
  - common functions
  - and other things...

I know that it may seem counter-intuitive to many members of this
newsgroup, but reducing the complexity of both 'javascript' and 'perl'
with some supported libraries is of great value for my company. I
am thinking that there must be a "tools.h++" - style library for these
great languages.

Thanks,

Robert Cliche
<studio4d@idt.net>



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

Date: Tue, 10 Mar 1998 19:52:02 -0600
From: culrich@i2000.net
Subject: Wierd redirection problem with Location:
Message-Id: <6e4qm0$g6s$1@nnrp1.dejanews.com>

I have a quirky problem...  The following works fine:

print "Content-type: text/html\n";
print "Location: /page1.htm\n\n";

(BTW... most people with problems with this method tend to put a double
"\n" after the first line... for those of you having similar problems...
it is print "Content-type: text/html\n";   NOT   print "Content-type:
text/html\n\n";

ANYWAY... back to the problem...

When I do:

print "Content-type: text/html\n";
print "Location: http://www.some-other-domain.com/page2.htm\n\n";

All that it does is display a hyperlink on the screen to
http://www.some-other-domain.com/page2.htm

Any ideas why it is printing a link rather than loading the content of that
page (which does have content)?  Thanks in advance.

- Chris
  culrich @ i2000.net

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Wed, 11 Mar 1998 04:01:37 GMT
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Wierd redirection problem with Location:
Message-Id: <350c0b89.8204812@flood.xnet.com>

culrich@i2000.net wrote:

>print "Content-type: text/html\n";
>print "Location: http://www.some-other-domain.com/page2.htm\n\n";
>
>All that it does is display a hyperlink on the screen to
>http://www.some-other-domain.com/page2.htm
>
>Any ideas why it is printing a link rather than loading the content of that
>page (which does have content)?  Thanks in advance.
>
>- Chris
>  culrich @ i2000.net

This has absolutely nothing to do with perl.  But like computers in
general, it is simply doing what you are telling it to do, print html.
If you want to redirect, try removing the "Content-type:..." line.


David Efflandt/Elgin, IL USA
efflandt@xnet.com    http://www.xnet.com/~efflandt/


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

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

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