HDTenEightyP/NetNews huggingface dataset:
From: jagrant@emr1.emr.ca (John Grant)
Subject: is it possible to find max & next smallest in one pass?
Organization: Energy, Mines, and Resources, Ottawa
Date: Sun, 24 Jan 1993 04:07:02 GMT

Given an array of values, is it possible to find the maximum of
the array and the next smallest value in a single pass?  The reason
I want it in one pass, is that the array is actually a data file
of a million float values.

If so, I guess the same single pass could also find the min and next
highest value too?

-- 
John A. Grant						jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
From: williamc@aifh.ed.ac.uk (William Chesters)
Newsgroups: comp.programming
Subject: Re: Break up Microsoft
Date: 25 Jan 93 13:24:46 GMT
Organization: Dept AI, Edinburgh University, Scotland

Yes but surely :) the kind of market position that MS has had has had
some benefits for computer users.  Do you remember in the early days of
micros it looked like there would be an awful lot of incompatible
standards?  Until IBM and DOS came along of course.  The same thing
happened again with windowing systems.  OK, it would have been nice if
we had fixed on a better standard than DOS/Windows, but if there were no
standards in which developers could feel confidence, there would be much
less good software around.  Anyway, just the threat that Macs or Gem
might start being a real challenge did spur MS into some kind of action:
so there is _some_ competition.

I don't think UNIX is a counterexample to this line of reasoning.  The
reason UNIX was originally successful was that it was free and
everything else was proprietary and expensive.  (I think?)

Btw none of this justifies Bill Gates being quite as rich as he is!!!
--
signature
Newsgroups: comp.programming
From: buyan@aero.org
Subject: Moonrise/Moonset Code?
Organization: The Aerospace Corporation
Date: Wed, 27 Jan 1993 01:09:57 GMT

Anyone aware of code for determining moonrise/moonset as a function of date, 
latitude, and longitude?
Newsgroups: comp.programming
From: jagrant@emr1.emr.ca (John Grant)
Subject: need fast algorithm to intersect wiggly lines with polygons
Organization: Energy, Mines, and Resources, Ottawa
Date: Sun, 24 Jan 1993 05:08:19 GMT

I want to intersect an aircraft flight line with a bunch of polygons,
both closed and open (i.e. lakes, rivers, roads etc).

There is only 1 flight line, which is more or less straight, but not
always (availability of GPS navigation has lessened the restrictions
on flying a really straight line, also crosswinds tend to put a
few curves in the line).

The flight line has several hundred points in it (i.e. an (x,y) is recorded
every 1 s).  There may be many polygons.  For the open polygons, I need
just the single point(s) (it may intersect more than once).  For the
closed polygons, I need pairs of points (always pairs, i.e. if the
line starts in the middle of the lake, then that is the first point).
I won't worry about tangents where the 2 points are the same.

The co-ordinates are all cartesian (UTM), i.e. not geographic long/lat.

I know the bounding rectangle for the flight line and for each of the
polygons.  What I do now is to ignore all polygons whose boundingg
rectangles do not intersect with the bounding rectangle of the line.
After that, I do it the hard way.  I take every straight line segment
from [i] to [i+1] of the line and intersect it with every straight
line segment of the polygon from [j] to [j+1], using the usual
straight line intersection equations.  As you can imagine,
it is slow, but it works.  All co-ordinates and calculations are float.

I need this to draw a profile section of the flight line, showing the
open polygons it intersects as vertical lines and the closed polygons
as rectangles.

Any ideas or references?

-- 
John A. Grant						jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
Newsgroups: comp.programming
From: prener@watson.ibm.com (Dan Prener)
Subject: Re: Virus Programs 4 Sale  (Virus, Trojans, etc)
Date: Wed, 27 Jan 1993 06:44:07 GMT
Disclaimer: This posting represents the poster's views, not necessarily those of IBM
	<6577@balrog.ctron.com>
Organization: IBM T.J. Watson Research Center, Hawthorne, New York

In article <6577@balrog.ctron.com> smith@ctron.com (Lawrence C Smith) writes:

> In article <1993Jan26.070707.28320@emr1.emr.ca>, jagrant@emr1.emr.ca (John Grant) writes:
> >In article <1k2k6pINNdng@digex.digex.com> alby@access.digex.com (Albatross) writes:
> >>                            VIRUS'es    FOR    SALE
> >>Cost:            $20.00 per disk
> >>Contents:        10 Viri  per disk
> >>        I will hold NO responsiblity for such actions,
> >>        if incidents are incurred.

> >	There are probably many bleeding heart civil libertarians
> >	out there who will disagree with me, but I think it's
> >	about time we got some new laws that would make it a crime
> >	to distribute virus-related material, regardless of any
> >	disclaimers or denials of responsibility.

   [ ... examination of freedom and responsibility omitted ... ]

> On some reflection, I have to feel that distributing well-known viruses in
> such an above-board manner is probably a fairly neutral activity, whose
> benefits most likely weigh in close to the dangers.  On the other hand,
> if I spotted someone growing uge anthrax cultures in their basement for
> sale, I'd not be so sanguine.  I think there is room for argument on both
> sides.

Might there not be a simpler but overriding issue?  Does the person offering
these programs own the legal rights (copyrights, patents) to them?
--
                                   Dan Prener (prener@watson.ibm.com)
Newsgroups: comp.programming
From: kan9691@bcstec.ca.boeing.com (Ken Niedermeyer)
Subject: Re: Virus Programs 4 Sale  (Virus, Trojans, etc)
Organization: Boeing Computer Services
X-Newsreader: TIN [version 1.1 PL8]
Date: Tue, 26 Jan 1993 18:15:49 GMT

On 26 Jan 1993 01:03:05 -0500 Albatross(alby@access.digex.com) wrote:
: Cost:            $20.00 per disk
: Contents:        10 Viri  per disk
: 
: Anthony Williams            <- Make Checks Payable To
: 1200 Twig Terrace
: Suite 101
: Silver Spring,  Maryland
: 20904
: 
: 
:         I will hold NO responsiblity for such actions,
:         if incidents are incurred.

Sure and I'll just send you my root password while I'm at it!

If there isn't a law against distributing virus materials (infected or source)
there should be!!!

Why distribute something that is potentially dangerous to those who may not
know how to 'correctly' use it?  The only answer I can come up with is greed.
The 'American Way' never ceases to amaze me.

In some states you can be held responsible if you serve alcohol to a
obviously drunk person and that person injures somebody (including themselves).  I
can only hope that a similar law will soon be written for viruses.
-- 

---
Ken Niedermeyer			| The views expressed above do not represent
Computing Systems Analyst	| those of my employer.... (but when do they?)
Newsgroups: comp.programming
From: jagrant@emr1.emr.ca (John Grant)
Subject: Re: Virus Programs 4 Sale  (Virus, Trojans, etc)
Organization: Energy, Mines, and Resources, Ottawa
Date: Tue, 26 Jan 1993 07:07:07 GMT

In article <1k2k6pINNdng@digex.digex.com> alby@access.digex.com (Albatross) writes:
>
>
>                            VIRUS'es    FOR    SALE
>                        ----------------------------------
>        Have you every wanted to test out your virus Software to see if
>Norton Anti-Virus or Mcafee's Virus scanners really work and see if your
>blowing yor money or are you really protecting your vital computer data?
>
>        Well now you can play with some of the most ruthless & destructive
>virus'es known to man. See if the Dark Avenger virus really can be detected
>by these money hungry  anti-virus software companies, or if you dollars are
>paying off.
>
>Cost:            $20.00 per disk
>Contents:        10 Viri  per disk
>
	[...list of viruses deleted...]

>NOTE:   Use of These Virus with intent to Destroy Data is a Violation of
>        The Law.
>
>        I will hold NO responsiblity for such actions,
>        if incidents are incurred.

	If I ever find out that it was your greed for profit,
	and total disregard for ethics that spread a virus
	to my system, I won't hold any responsibility for my actions
	either, assuming I can find you.

	These actions as well as the disclaimer are not too much
	different than finding a loaded gun in your back alley
	and advertising it for sale, even though it doesn't
	belong to you, all the while proclaiming innocence
	and denying responsibility if someone gets hurt.

	There are probably many bleeding heart civil libertarians
	out there who will disagree with me, but I think it's
	about time we got some new laws that would make it a crime
	to distribute virus-related material, regardless of any
	disclaimers or denials of responsibility.

John A. Grant						jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
-- 
John A. Grant						jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
Organization: University of Illinois at Chicago
Date: Sun, 24 Jan 1993 00:24:06 CST
From: David James Alexander Hanley <U16244@uicvm.uic.edu>
Newsgroups: comp.programming
Subject: Re: Fast pu/getimage in BC/TC++ ???


  Well, I have some truly fast routines I have written for turbo c in
inline assembler.  However, there is no bounds-checking or anything
like that.  If you are interested, I will send them to you or post them here
-------------------------------------------------------------------------------
"In every country and in every age, the priest has been hostile to liberty.
He is always in alliance with the despot, abetting his abuses in return for
protection to his own" - Thomas Jefferson, 1814

SEND E-MAIL TO : hanley1@earth.eecs.uic.edu
Newsgroups: comp.programming
From: reindorf@us-es.sel.de (Charles Reindorf)
Subject: Re: is it possible to find max & next smallest in one pass?
Organization: SEL-Alcatel Line Transmission Systems Dept. US/ES
Date: Mon, 25 Jan 93 10:00:31 GMT

 In article <1993Jan24.040702.6193@emr1.emr.ca>, jagrant@emr1.emr.ca (John Grant) writes:
|> Given an array of values, is it possible to find the maximum of
|> the array and the next smallest value in a single pass?  The reason
|> I want it in one pass, is that the array is actually a data file
|> of a million float values.
|> 
|> If so, I guess the same single pass could also find the min and next
|> highest value too?
|> 
|> -- 
|> John A. Grant						jagrant@emr1.emr.ca
|> Airborne Geophysics
|> Geological Survey of Canada, Ottawa

I don't know what context you with to implement your algorithm here. If you are simply
interested in getting the highest value out, then it is surely a simple O(n) operations
performed by a linear search and discussed in detail in the responses seen so far on the
net.

However, there is a method of storing a list of numbers in an array in memory as what is
called a "heap" (not like the usual memory heap). Maintaining your data in such a heap,
you can store new values in O(log n) cycles and *extract* the highest value (at the same 
time re-organising the heap) in O(log n) cycles too. The data is still maintained in a
linear array on disc or in memory and so there is no fragmentation. I am sure a description
is available in Knuth, but I got it out of a Prentice&Hall book (I think) called (something
like) "Data Structures and Program Design". Just a guess, but maybe this structure would be
useful to you.


--- Charles Reindorf
Newsgroups: comp.programming
From: jagrant@emr1.emr.ca (John Grant)
Subject: Re: Fast pu/getimage in BC/TC++ ???
Organization: Energy, Mines, and Resources, Ottawa
Date: Sun, 24 Jan 1993 04:53:18 GMT

In article <1993Jan22.173025.18333@news.unige.ch> jordi@scsun.unige.ch writes:
>
>Hello there,
>does anybody know if fast getimage/putimage routines exist somewhere.
>I would like to use them with Trubo C++ or Borland C++ for fast
>DOS Graphics ?
	Seems like you just answered your own question, didn't you?
	Turbo/Borland C has getimage() & putimage() functions in
	their graphics library.  See graphics.h.

	If I misunderstood your question, and you wanted putimage()
	& getimage() for other O/S, I can't help you.
-- 
John A. Grant						jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
From: mgmam@uxa.ecn.bgu.edu (Mark A. Morrell)
Newsgroups: comp.programming
Subject: Re: Maximum file size for MS-DOS
Date: 21 Jan 1993 22:39:48 -0600
Organization: Educational Computing Network
Distribution: usa
NNTP-Posting-Host: uxa.ecn.bgu.edu

In article <31744@nntp_server.ems.cdc.com> mtoms@ems.cdc.com writes:
>I need some help concerning reading/writing a binary data file to disk using
>Microsoft C Version 6.01 on a MS-DOS based machine.
>
>I created a file using fopen and began writing records to it.  I used
>fclose when I was done.  This part seems to work fine.
>
>However, when I began reading records (fseek, followed by fread) from 
>the file, fread failed when I got to about 65535 into the file.  I
>noticed that size_t is an unsigned int (16 bits??).
>Does anyone have any ideas how to write a data file (about 3 Meg) to
>disk?  Am I using the wrong functions?

You are probably using the right functions, but the wrong variables.  I
am not familiary with Microsoft C, but I do know that the DOS seek
function uses 32 bits.  If you are passing a 16 bit variable to the
function (and, of course, C won't tell you it's the wrong type), then
you won't be able to read past 65535.  It also seems likely that however
you are finding the address, you are just losing your high bits (and, of
course, C won't tell you about that either...).

You can read and write files with the standard DOS functions to over 4
Gigabytes.  I myself have created files 1+ Gigabytes in size with
standard DOS functions.
-- 
--------------------------------------------------------------------
Mark A. Morrell     Disclaimer:  _I_ probably don't even believe it.
Literary Reference:  The introduction to Cervantes' Don Quixote.
From: black@seismo.CSS.GOV (Mike Black)
Newsgroups: comp.programming
Subject: Re: is it possible to find max & next smallest in one pass?
Date: 24 Jan 93 14:49:57 GMT
Organization: Center for Seismic Studies, Arlington, VA

In article <1993Jan24.040702.6193@emr1.emr.ca> jagrant@emr1.emr.ca (John Grant) writes:
>Given an array of values, is it possible to find the maximum of
>the array and the next smallest value in a single pass?  The reason
>I want it in one pass, is that the array is actually a data file
>of a million float values.
>
>If so, I guess the same single pass could also find the min and next
>highest value too?
>

Seems to me that life is simpler than everyone makes it :-)

Why compare BOTH numbers??  If we find a new max, then the old max is
obviously the next highest, isn't it?? The same would follow for however
many maxes you wish to find.  No more than one comparison necessary.


/* Finds the maximum and next-maximum of of first 1000 pseudo-random numbers. 
 * We'll divide by 1000.0 just to get a floating point number. 
 * Add a similar primer and one more if-check and you can find the min 
 *   and next-min too. 
 */

main()
{
	float value, max1, max2, tmp;
	int i;
	max1 = random() / 1000.0; /* Prime the pump */
	max2 = random() / 1000.0;
	if (max1 > max2) { /* Swap the first two if necessary */
		tmp = max1;
		max1 = max2;
		max2 = tmp;
	}
	for (i = 2; i < 1000; i++) {
		value = random() / 1000.0;
		ivalue(value > max1) { /* New max and demote old one */
			max2 = max1;
			max1 = value;
		}
	}
	printf("%g %g\n", max1, max2);
}
-- 
-----------------------------------------------------------------------------
 black@beno.CSS.GOV             land line: 407-676-2923  | I want a computer
 real home: Melbourne, FL       home line: 407-242-8619  | that does it all!
 CSI Inc, Computer Software Innovations, Palm Bay, FL
From: samw@bucket.rain.com (Sam Warden)
Newsgroups: comp.programming
Subject: Re: how to calculate PI
Date: 27 Jan 93 05:29:39 GMT
Organization: Rick's Home-Grown Un*x

jagrant@emr1.emr.ca (John Grant) writes:

>In article <LOWRY.93Jan20104500@rotor.watson.ibm.com> lowry@watson.ibm.com (Andy Lowry) writes:
>>One of the coolest formulas I've seen in Gregory's formula:
>>
>>  pi/4 = 4*atan(1/5)-atan(1/239)
>	[...stuff deleted...]

>	Huh?  What's wrong with just plain ol'
>		pi=4.0*atan(1.0);
 
As has just recently been pointed out here, the Taylor series for
arctangent is "slow to converge" at 1.0, so the first formula is
faster.  How slow?  These people are masters of ironic under-
statement.  :-)  Being provoked by this discussion I just tried
it.  Waiting for just the fifth digit makes watching paint dry
seem positively exhilarating.

-- 
 
samw@bucket.rain.com (Sam Warden) -- and not a mere Device.
 
Newsgroups: comp.programming
From: dnl@convex.is.macsch.com (David Lombard)
Subject: Re: how to calculate PI
Organization: MacNeal-Schwendler Corp.
Date: Thu, 21 Jan 93 21:07:39 GMT

In article <LOWRY.93Jan20104500@rotor.watson.ibm.com> lowry@watson.ibm.com (Andy Lowry) writes:
>In article <peterd.727508100@tscc2> peterd@tscc2.macarthur.uws.edu.au () writes:
> > Anyone out there have an algorithm for calculating PI ?
>
>One of the coolest formulas I've seen in Gregory's formula:
>
>  pi/4 = 4*atan(1/5)-atan(1/239)
>

Howzabout:
		pi = atan2( 0.0, -1.0 )

No fuss, no muss, no bother...

Regards,
DNL
                      MY_COMMENTS, MY_OPINIONS.

David N. Lombard    The first thing we do,         The MacNeal-Schwendler Corp
dnl@macsch.com      Let's kill all the lawyers.    815 Colorado Blvd
(213) 259-4911      II Henry VI, IV.ii             Los Angeles, CA  90041
From: gowen@jade.tufts.edu (G. Lee Owen)
Newsgroups: comp.programming
Subject: Re: Virus Programs 4 Sale  (Virus, Trojans, etc)
Date: 28 Jan 93 23:05:10 GMT
	<1993Jan27.064241.11819@organpipe.uug.arizona.edu>
	<C1IvBz.8yu@undergrad.math.waterloo.edu>
	<SPACKMAN.93Jan28105931@disco-sol.dfki.uni-sb.de>
Organization: Tufts University - Medford, MA

Said spackman:
> If you want something to compare to prostitution, what about 
> operatingsystems sales?  You *can* use a computer without an
> operating system, you know.
	Would you care to enlighten me as to just what you can use it
for, besides a paperweight or a low-efficiency heater (unless you're
talking a PDP-11, which old-timers tell me is a very good heater).

> Right. Exactly. With knowledge you can defend yourself. Bring on
> the knowledge.
	The flip side of that coin is that, with knowledge, one can
make a more effective attack.  Is that particularly applicable to this
virus sale arguement?  I doubt it, unless you include source code.
But I don't believe he is doing it.  My short, sweet and personal
opinion is that a distributor of viruses is -- a distributor of
viruses.  You wouldn't want him to sneak one in on a disk with
wordperfect, why would you want him to get money for doing it
up-front.  Purely personal opinion.

	Of course, I think we are all overlooking the legalistic side
of this question.  Are these viruses public domain, freeware,
shareware, commercial?  Is this gentleman paying royalties to the
owners, or just taking advantage of the fact that the authors are
unlikely to take him to court?

	(gentle :> on the last line).



--
--Greg Owen
	gowen@forte.cs.tufts.edu, gowen@jade.tufts.edu
"C Spot. C Spot run. C Spot run without a core dump! Run, Spot, Run!"
From: ags@seaman.cc.purdue.edu (Dave Seaman)
Newsgroups: comp.programming
Subject: Re: how to calculate PI
Date: 21 Jan 93 18:40:37 GMT
Organization: Purdue University

In article <c8h3xpm@rpi.edu> rogerj@aix.rpi.edu (Diversion (Jeff Rogers))  
writes:
> lowry@watson.ibm.com (Andy Lowry) writes:
> >In any case, you can use Taylor expansion to get atan(1/5) and
> >atan(1/239).  I understand there are more high-powered schemes out
> 
> Maybe this is the answer (to my question above), but I don't see why a
> taylor expansion would work for some values and not others.

It's called "radius of convergence." The Taylor expansion in question is

	atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...

and it turns out that the radius of convergence is 1. That means the  
series converges for |x| < 1 and diverges for |x| > 1. For x = 1 you get

	pi/4 = atan(1) = 1 - 1/3 + 1/5 - 1/7 + ...

and the series converges, but with painful slowness. You have to add  
around a thousand terms just to get three-digit accuracy, and for each  
additional digit you need ten times as many terms. Compare this with

	atan(1/239) = 1/239 - 1/(3*239^3) + 1/(5*239^5) -  ...

which converges very rapidly, and you can see the advantage of using small  
arguments in the atan series.

--
Dave Seaman
ags@seaman.cc.purdue.edu
From: bhclose@kuhub.cc.ukans.edu
Newsgroups: comp.programming
Subject: Help w/ Modem Programming
Date: 25 Jan 93 17:19:21 CST
Organization: University of Kansas Academic Computing Services


Help:
	Can anyone inform me a good way to detect when one's modem has
"found" another modem signal.  In other words, how does one discern
between, say, just a dial tone or a voice, and that eeeeeeeeeeecccchhhhh
noise?  There must be some register on the modem, but I cant seem
to find it anywhere.  BTW, I'm coding in C.
						Brett
Newsgroups: comp.programming
From: boutell@isis.cshl.org (Tom Boutell)
Subject: Re: DISMANTLE MICROSOFT (Was Re: Industry market shares)
Keywords: Microsoft
Organization: Cold Spring Harbor Labs
Date: Mon, 25 Jan 1993 16:10:08 GMT

Boy howdy I tellya, Microsoft is evil evil evil, yup.

Of course, never mind that for a company without competition to worry about,
they have a strange tendency to keep producing new and better products.
Never mind, more importantly, that these figures utterly ignore the
issue of international competition. No, there isn't much international
competition for the U.S. software giants yet. There wasn't much for
the U.S. automakers at one point either. 

If Microsoft were sitting around in a fat, lazy fashion, as the
U.S. automakers were when the Japanese wave hit, that'd be one thing.
But as it is, they're quite competitive and they're consistently improving
their products. Some of us have our beefs with their compilers, but 
it's hard to deny that Excel is the most powerful spreadsheet
yet built.

I agree that a split of Microsoft might be beneficial to the
industry, but I hope it won't be done ham-fistedly, with the backing
of those who "have it in" for Microsoft. Software is an unusual
market: it's one in which the U.S. holds both a production and
a technological lead. Microsoft, as the spearhead of that market, is
a significant national asset, and if we do break it up we'd best
do it in such a way as not to ruin its competitiveness.

-T

-- 
Tom Boutell, boutell@cshl.org

Clausthaler is the best non - alcoholic beer in the known universe.
Newsgroups: comp.programming