HDTenEightyP/NetNews huggingface dataset:
Newsgroups: comp.programming
From: blaak@csri.toronto.edu (Raymond Blaak)
Subject: Re: saving pointers to a file
Keywords: pointers pascal file saving anything else everyone :)
Date: 5 Oct 92 15:46:07 GMT

mgmam@uxa.ecn.bgu.edu (Mark A. Morrell) writes:

>You may have to tweak this a little bit, but let me see if I can
>summarize why this works:  

>1) You know the size and structure of the first element of the 
>   list when you write it out.  
>2) You traverse your tree following a predetermined algorithm.
>3) When you read the data back in, it will follow the same pattern
>   it did when you wrote it out, beginning with the known first element.
>4) You always know what the next structure is, and where it belongs,
>   because you are following the same algorithm when you read back in.
>5) You determine whether a pointer actually points to something by
>   comparing it with NIL when you read it in.  (Of the values a 
>   pointer may assume, this is the only one while will retain a
>   valid value when you read it back in.)
>6) If the next pointer in your algorithm is not NIL, then the next
>   chunk of data in your file is meant to be the data it points to.

>So in this manner, you can simply write out all your data sequentially,
>and then read it back in again.

This method works great, as long as your data structure has no cycles (is a
tree). The minute you have cycles you have to ensure that loops aren't
traversed infinitely during writing (strightforward). Upon reading the data
structure in from a file you have to make sure to link up nodes properly to
form the cycles again.

Cheers,
Ray
blaak@csri.toronto.edu
From: pdh@netcom.com (Phil Howard )
Newsgroups: comp.programming
Subject: Re: Calculating a CRC of other CRCs
Date: 6 Oct 92 18:49:04 GMT
Article-I.D.: netcom.1992Oct6.184904.23900
Organization: Netcom - Online Communication Services  (408 241-9760 guest)

schmidtg@iccgcc.decnet.ab.com writes:

>In addition, the program is organized as "chunks" and a chunk may be
>independently edited.  However, when the chunk is edited, I would like to
>avoid having to recalculate the CRC for the entire program.  I would like to
>somehow "incrementally" update the CRC based on a small change.  I doubt this
>is possible, so an alternative is to calculate a CRC for each chunk and then
>calculate the CRC for the entire program by calculating a CRC on all of the
>"chunk CRCs".  In that way, I can avoid having to examine the entire program
>each time a chunk has changed.

If the chunk changes size, for instance, that affects how any given bit
ultimately affects the ordinary CRC.

If your chunks are precisely defined, then you could certainly create a
list of CRCs, one for each chunk.

Q: would the list of CRCs also be so large as to preclude a raw compare?

Calculating the CRC of the file containing the list of CRCs should work,
but keep in mind that this is "CRC of file of CRCs of chunks" and is not
the "CRC of the original whole file".



>However, I don't know how reasonable it is to calculate "a CRC of other CRCs".
>There may be some statistical pitfalls in doing this which may reduce the
>effectiveness of the CRC and introduce the possibility of error.

If the size of the CRCs file is large, it should produce a reasonable CRC.

If it is small, why not just do a byte-by-byte compare?



I assume in all these cases that if the CRCs match, you find it acceptable
to assume equality.  In a program I wrote to hardlink identical files in
a file tree, I do not make this assumption.  However this is also because
it uses the UNIX checksum, which is not very good.  But in cases where there
is real loss of data, I would still fall back to doing a raw compare even
if a CRC32 says there is a match.

I am planning to use CRCs to test for repeats in a life game proram.  This
is so that a demo mode will automatically switch to the next demonstration
when the current one falls into an attractor.  In this case, the extremely
rare false equals are of no real consequence.  Simply assuming that an
equal CRC means equal data is OK here.

Be sure to consider the impact of a false equal to determine whether or
not to depend on it.  Is a human in the "sanity check loop" or not?
-- 
/***********************************************************************\
| Phil Howard  ---  KA9WGN  ---  pdh@netcom.com   |   "The problem with |
| depending on government is that you cannot depend on it" - Tony Brown |
\***********************************************************************/
Newsgroups: comp.programming
From: agc@bmdhh298.bnr.ca (Alan Carter)
Subject: Re: saving pointers to a file
Keywords: pointers pascal file saving anything else everyone :)
Organization: BNR-Europe-Limited, Maidenhead, England
Date: Thu, 01 Oct 1992 12:53:49 GMT

In article <BvFCMB.CLG@uxa.ecn.bgu.edu>, mgmam@uxa.ecn.bgu.edu (Mark A. Morrell) writes:
|> In article <BuuDpw.J9u@acsu.buffalo.edu> 
|> 	masdough@ubvmsb.cc.buffalo.edu (Dough the Demented) writes:
|> 
|> Hello,
|>   I want to be able to save a "structure" containing multiple pointers to a
|> file.. I need some ideas on how to do it.. (I have a few.. but i want the best)
|> 
|> sample structure
|> 
|> aaa record
|>   1 stat field of type bbb
|>   9 pointers to type aaa
|> end aaa
|> bbb record
|>   a bunch of fields
|>   1 pointer to type ccc
|> end bbb
|> ccc record
|>   a few data fields
|>   1 pointer to type ccc
|> end ccc
|> 
|> I need to save all of the fields in all of the structures (so i can rebuild
|> everything later..)  I could go through and save everything in one file..
|> going through each structure, field-by-field.. Or I could put aaa in one file
|> and ccc in another..
|> Either way, I need to keep references of what points to what... What is the
|> best way to do this.. Assign a number to each "object" and save the number..?
|> 
|> Any help would be greatly appreciated :)
|> Thanks!
|> Dough

If you have to do a lot of this, it might be worth looking at soem of the
object oriented databases now available. Most of them can store objects
on disk and reconstruct their data structures on demand. Of course, you have
to write your objects in C++ or something similar, but that is a plus,
not a minus :-)

   Alan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Maidenhead itself is too snobby to be pleasant. It is the haunt of the
   river swell and his overdressed female companion. It is the town of showy
   hotels, patronized chiefly by dudes and ballet girls. 

   Three Men In A Boat, Jerome K. Jerome, 1889
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: Paul Placeway <pplacewa@bbn.com>
Newsgroups: comp.programming
Subject: Re: Costs per line of code
Date: 5 Oct 1992 21:37:58 GMT
NNTP-Posting-Host: bbn.com

< Tony Wingo writes:

< >"If one worker can dig a posthole in five minutes, how long would it take
< >ten workers to dig the same posthole?"

sjr@afterlife.ncsc.mil (Stephen J. Roznowski) replies:

< I prefer to think of the original question as follows:
< If a worker digs an average of 12 postholes an hour earning $10.00 per
< hour, approximately how much will it cost me to dig 120 postholes with
< 10 workers? [and to really get back to the intent of the original question
< how much are those postholes worth?]

Unfortunately, as Brooks points out, this is the wrong way to think
about a software (or hardware) project, because generally the group is
not making 120 different completely independent postholes (programs),
but one much larger hole (program).  Since the parts the individuals
are working on must fit together and work, building each piece is a
very small part of the total effort (and therefore cost).

So the question is more like "If a worker digs an average of 100
shovelfulls of dirt in an hour earning $10.00 per hour, how long will
it take 10 workers to dig 1 posthole?  How long if they are digging in
clay?  How long if digging in granite?"

		-- Paul Placeway <pplacewa@bbn.com>
From: laws@ai.sri.com (Kenneth I. Laws)
Newsgroups: comp.programming
Subject: Pascal -> C Translator?
Date: 29 Sep 92 05:34:03 GMT
Distribution: comp
Organization: Computists International

Hi!

I'm looking for macros or code to convert Pascal to C.
Specifically, HP Pascal from an HP 9000 Series 300 to
ANSI C for an embedded Sparc processor, programmed
using Objectcenter C (from Centerline (Saber)).  Partial
conversion would be better than nothing.

I'm making this request on behalf of Jan Lavergne of
Texas Instruments, lavergne@exame1.csc.ti.com.  Responses
to either of us or to comp.programming will be appreciated.

					-- Ken
--

Dr. Kenneth I. Laws, (415) 493-7390, laws@ai.sri.com.
Moderator of the Computists International AI/IS/CS mutual-aid association.
Ask about my weekly online career newsletter, The Computists' Communique.
Xref: sparky comp.programming:2775 comp.lang.c:14525 comp.lang.pascal:5820 comp.lang.objective-c:581
From: dave@cs.arizona.edu (Dave Schaumann)
Newsgroups: comp.programming,comp.lang.c,comp.lang.pascal,comp.lang.objective-c
Subject: Re: NO NUMBERS! (or even SHORT INTS!)
Date: 4 Oct 92 22:06:04 GMT
Reply-To: dave@cs.arizona.edu (Dave Schaumann)
Followup-To: comp.programming
Organization: University of Arizona

I am reminded of something I once read somewhere (yeah, I know -- real
specific, huh?).  Hmm... perhaps it was in _Elements of Programming
Style_?

Anyway, it said it was appropriate to have exactly 3 numbers in your program:
zero, one, and many.

-- 
Essentia non sunt multiplicanda praeter necessitatum -- William of Ockham
(Fact need not be multiplied beyond necessity)
From: sansom@dcs.glasgow.ac.uk (Patrick Sansom)
Newsgroups: comp.programming
Subject: Re: hash function
Date: 5 Oct 92 10:08:54 GMT
Organization: Glasgow University Computing Science Dept.

9119175@sunvax.sun.ac.za (Jacques Strydom) writes:

>I am looking for a hash fuction that operates on random strings of length
>between 3 and 30 characters.

Try:	Fast Hashing of Variable Length Text Strings
	Peter K. Pearson
	CACM June 1990 33(6), pp 677-680

Patrick.
-- 
Patrick Sansom                      | E-Mail:    sansom@dcs.glasgow.ac.uk
Computing Science Research Student  | Real-Mail: Dept. of Computing Science,
University of Glasgow               |		 The University,
				    | 		 Glasgow  G12 8QQ
From: bonnaud@rtf.bt.co.uk (Neil Bonnaud)
Newsgroups: comp.programming
Subject: Re: Daylight saving time (UK)
Date: 30 Sep 92 16:08:59 GMT
Organization: BT Customer Systems, Brighton, UK
Cc: bonnaud



Right.  First of all, thank you to everyone who mailed me:
Dave Perks, Dave Olsen, Mark Brader, Jim Mattson, Clive Feather, Peter Smith

Much of the stuff was about using Unix tables, historical changes or how
other parts of the world do it.  This may well prove usefull if the system
I'm working on is exported.

Anyway, to get specifiec information for the UK, I went to the local library
(Yes, honest, I did! ;-) ) and lo and behold, in the Guiness book of Facts:

"In the UK, summer Time is defined as the period beginning at two o'clock,
GMT, in the morning of the day after the third Saturday in March or, if
that day is Easter Day, the day after the second Saturday in March, and
ending at two o'clock, GMT, in the morning of the day after the fourth
Saturday in October.  In practice, this has been amended in most years to
bring the UK closer to the beginning and ending of daylight-saving time in
neighbouring EC [European Community] countries."

For the 'Final' word on the subject, I 'phoned the National Physical
Laboratory, who were most helpful.

In summary:
The dates are set by government order about three years ahead (there is
statutory obligation to do this); the European changes are about 1 month
different (clocks go back near the end of September);  in the next couple of
years we MAY arrive at a compromise date for the EC [HA!].
In spring the clocks go forward from 0100GMT to 0200BST and in the autumn
back from 0200BST to 0100GMT.

Jim Mattson made the point that Leap Seconds may be added sometimes.
The NPL confirm that one or two seconds are often added to the year, usually
December or perhaps June.  The number varies because the Earth is not quite
stable in either its rotation or orbit.  As it happens, none have been added
for the last two years.  Information about leap second addition is only
issued about three months in advance.  The MSF broadcast signal for time
setting contains information about leap second addition but you need a
high quality receiver to extract that information over and above the
simple time broadcast.

OK, back to work.  I hope I have satisfied everyone.
Thank you.

Neil Bonnaud
Newsgroups: comp.programming
From: msb@sq.sq.com (Mark Brader)
Subject: Re: Daylight saving time (UK)
Organization: SoftQuad Inc., Toronto, Canada
Date: Wed, 7 Oct 92 00:21:31 GMT

> > > OK then - a follow up question from me - am I right in thinking that
> > > a) for the UK the clocks go forward from 1AM to 2AM and back from
> > > 2AM to 1AM?
> > In Germany it goes from 2:00 AM to 3:00 AM (in spring) or 3:00 AM to
> > 2:00 AM (in fall).

I have no idea whether the above is correct, but I believe that earlier
in this thread someone stated that a similar rule applied in the US, and
this was not corrected.  That is definitely wrong; the standard in the US
and Canada is to go forward from 2 AM to 3 AM, and back from 2 AM to 1 AM.
If you have access to a UNIX system configured for such a time zone, you
can verify that this is what it implements.

> Does anyone know of a document that would summarize the customs/localizations
> that different political units have adopted regarding summer-time/daylight-
> savings-time and their equivalents [Does South American have daylight savings
> time in January, for example?]

A few years ago the Official Airline Guide used to include a page giving
all the change dates for the current year.  I haven't seen one lately to
know if they still do.  The OAG used to come in two volumes, each the
size of a phone book, called something like North America and World.
The latter actually covered all flights not entirely within North America,
and was the one with the time zone list.
-- 
Mark Brader		    "It can be amusing, even if painful, to watch the
SoftQuad Inc., Toronto	     ethnocentrism of those who are convinced their
utzoo!sq!msb, msb@sq.com     local standards are universal."	-- Tom Chapin

This article is in the public domain.
Newsgroups: comp.programming
From: ratner@ficus.cs.ucla.edu (David Ratner)
Subject: Re: C programing
Organization: UCLA, Computer Science Department
Date:  6 Oct 92 22:00:18 GMT

ai686@cleveland.Freenet.Edu (Ishaq Syed) writes:


>I am highschool student..and I would like to request a book that
>would teach me C in a si,mple way.  All the books I have incountered
>so far have been very complcateed.  I would like a name of a book that
>is good for self learning people.  The place I can buy the book would also 
>be nice.  Thank you very much.

Book:  K&R.  (Kernighan and Ritchie - "The C Programming Language").
Place: bookstore.


--
* *  ***  *     *    |   Dave "Van Damme" Ratner
* *  *    *    * *  / \  ratner@cs.ucla.edu
* *  *    *    ***  \ /  
***  ***  ***  * *   |   "Wham Bam, thank you Van Damme!"
From: hansm@cs.kun.nl (Hans Mulder)
Subject: Re: NO NUMBERS! (or even SHORT INTS!)
Organization: University of Nijmegen, The Netherlands
Date: Mon, 28 Sep 1992 17:37:37 GMT

In <exuptr.722.717694259@exu.ericsson.se> exuptr@exu.ericsson.se (Patrick Taylor) writes:

>But, Jon, what about all my loop variables (i1,i2,i3,i4)  ;-)

Better call the i_one, i_two, i_three, i_four, etc.
Makes your code much more readable, portable, maintainable, etc.

:-)

HansM
Newsgroups: comp.programming,comp.lang.c,comp.lang.pascal,comp.lang.objective-c
From: tholle16@ursa.calvin.edu (Tim Hollebeek)
Subject: Re: NO NUMBERS! (or even SHORT INTS!)
Organization: Calvin College
Date: Mon, 28 Sep 1992 22:15:54 GMT

hansm@cs.kun.nl (Hans Mulder) writes:

>In <exuptr.722.717694259@exu.ericsson.se> exuptr@exu.ericsson.se (Patrick Taylor) writes:

>>But, Jon, what about all my loop variables (i1,i2,i3,i4)  ;-)

>Better call the i_one, i_two, i_three, i_four, etc.
>Makes your code much more readable, portable, maintainable, etc.

>:-)

>HansM

NO!  The ANSI standard should specify that you have to call them:

First_Loop_Control_Variable, Second_Loop_Control_Variable, etc.

:)
--
--------------------------------------------------------------------
*******     Tim Hollebeek  ==> tholle16@ursa.calvin.edu      *******
Screw up your courage!  You've screwed up everything else.
Newsgroups: comp.programming,comp.lang.c,comp.lang.pascal,comp.lang.objective-c
From: markh@csd4.csd.uwm.edu (Mark)
Newsgroups: comp.programming
Subject: Re: Translators preserving comments
Date: 1 Oct 1992 12:30:18 GMT
Organization: Computing Services Division, University of Wisconsin - Milwaukee
NNTP-Posting-Host: 129.89.7.4

In article <1a5qtfINNa9p@bigboote.WPI.EDU> rcarter@wpi.WPI.EDU (Randolph Carter <Joseph H. Allen>) writes:
>Every once in a while I get the desire to make a really good ANSI-C to K&R-C
>translator...

Better get another desire.  Translating ANSI-C to K&R C isn't just an exercise
in syntatic transformation.  You also have to translate out all the
ANSI-exclusive features of the library functions, for instance:

                ANSI                         K&R
              realloc(X, 0)                free(X)
              realloc(0, S)                malloc(S)

Also ANSI-style preprocessor directives can't be directly translated into more
traditional C directives too easily.
Newsgroups: comp.programming,comp.lang.c,comp.lang.pascal,comp.lang.objective-c
From: yamada@stego.ifa.hawaii.edu (Hubert Yamada)
Subject: Re: NO NUMBERS! (or even SHORT INTS!)
Organization: University of Hawaii, Institute for Astronomy
Date: Tue, 6 Oct 1992 22:07:50 GMT

In article <1ao349INNbb2@uwm.edu> markh@csd4.csd.uwm.edu (Mark) writes:
>In article <mcdonald.355@aries.scs.uiuc.edu> mcdonald@aries.scs.uiuc.edu (J. D. McDonald) writes:
>>OK look at this, which, like the nutation of the moon, is a better example:
>...
>
>(Calculation intensive routine)
>>#include <math.h>
>>#include "astro.h"
>>/* ....jupiter */
>>p_jupiter (t, s, dml, ds, dm, da)
>...
>
>There's the problem.  You could end up using the same routine for every planet
>and all the comets, if only the orbital parameters and masses had been
>extracted out.
...
>This is something I wrote that does short-term orbital extrapolation.
[much code deleted]
>   tV -= (tR - 90.0); Dir = 1;
>   if (tV < -180.0) tV += 360.0; else if (tV > 180.0) tV -= 360.0;
>   if (tV < -90.0) Dir = 0, tV = -180.0 - tV;
>   else if (tV > 90.0) Dir = 0, tV = 180.0 - tV;

I don't understand what point you are trying to make.  Your text seem
to be disputing the previous poster's claim, which was that for certain
types of computations, embedding explicit numbers in a program is more
sensible than using defined constants.  But at the same time your own
code supports the his position.  I see a lot of explicit 360.0's and
180.0's and the like.  Wouldn't your own arguments suggest that these
should really be replaced by defined constants too?  (Actually, this
isn't a completely unreasonable suggestion.  After all, not everybody
works in degrees.)

The point that you made about going back to the original computations,
and not using methods that were designed for human calculation is a
good one.  But there are times when this is impractical.  For example.
if I needed to compute some odd function that I have never seen before,
If I could go to Abramowitz and Stegun's _Handbook of Mathematical
Functions_ and find an approximation that was guaranteed to have a
certain accuracy over a particular range, it would be a lot faster than
studying the function myself and figuring out how to compute it
directly.  In many cases, this would also be much more computationally
efficient than direct calculation.
-- 
Hubert Yamada                   * Our hero is called before the alien
yamada@galileo.ifa.hawaii.edu   * potentate!  Where it becomes clear that
yamada@uhunix.uhcc.hawaii.edu   * Spiff is about to be sacrificed to appease
Bitnet: yamada@uhunix.bitnet    * the evil god they call "Nollij"!
From: markh@csd4.csd.uwm.edu (Mark)
Newsgroups: comp.programming
Subject: Re: Costs per line of code
Date: 6 Oct 1992 03:49:04 GMT
Organization: Computing Services Division, University of Wisconsin - Milwaukee
NNTP-Posting-Host: 129.89.7.4

Tony Wingo writes:
>"If one worker can dig a posthole in five minutes, how long would it take
>ten workers to dig the same posthole?"

sjr@afterlife.ncsc.mil (Stephen J. Roznowski) replies:
< I prefer to think of the original question as follows:
< If a worker digs an average of 12 postholes an hour earning $10.00 per
< hour, approximately how much will it cost me to dig 120 postholes with
< 10 workers? [and to really get back to the intent of the original question
< how much are those postholes worth?]

In article <ld1ddmINNo95@news.bbn.com> pplacewa@bbn.com (Paul Placeway) writes:
>... the question is more like "If a worker digs an average of 100
>shovelfulls of dirt in an hour earning $10.00 per hour, how long will
>it take 10 workers to dig 1 posthole?  How long if they are digging in
>clay?  How long if digging in granite?"

If I write an expert system that can generate programs from voice specification
how much do I charge for the software I tell it to develop?

Or to carry the analogy with digging pot holes through: if I create a new
brand of robots with the ability to dig holes an inhumanly fast speeds, and
with the ability to self-replicate using nothing but the energy of the sun,
the chemical compounds in the air and ground to fuel its work and replication,
how much do I charge for making my robot species dig 1,000,000 holes while I
kick back and enjoy my leisure in the tropics?
From: bonnaud@rtf.bt.co.uk (Neil Bonnaud)
Newsgroups: comp.programming
Subject: Re: Daylight saving time (UK)
Date: 28 Sep 92 08:28:15 GMT
Organization: BT Customer Systems, Brighton, UK


Just a couple of replies so far - both state that the date is set arbitarily
by government but within bounds.

OK then - a follow up question from me - am I right in thinking that
a) for the UK the clocks go forward from 1AM to 2AM and back from 2AM to 1AM?
b) other countries using daylight saving time change at the same time?

I presume that, in the spring, 01:30 local time does not exist when the
clocks go forward.  In the autumn there will be two occurences of 01:30
local time when the clocks go back.  How do other systems cope with this
'anomally', especially when validating user input?

I know, questions, questions, questions but I suppose this is what really
justifies the net.


Neil Bonnaud
BT Customer Systems.
Newsgroups: comp.programming,comp.lang.c,comp.lang.pascal,comp.lang.objective-c
From: rhorn@csws17.ic.sunysb.edu (Robert Horn)
Subject: Re: NO NUMBERS! (or even SHORT INTS!)
Organization: State University of New York at Stony Brook
Date: Mon, 28 Sep 1992 19:15:48 GMT

In article <1992Sep28.003421.1246@RedBrick.COM> jfr@RedBrick.COM () writes:
>The problem I started thinking about is WHY IN THE WORLD WOULD ANYONE
>USE SHORT INTS IN A PROGRAM, particularly one done for a workstation-level
>machine (i.e., large memory model, etc).  I can see the need for memory
>conservation to some degree, but certainly there is no performance
>benefit on most machines today (there may even be a performance penalty

the two most popular C compilers for the mac have the following data sizes:

		short		int		long

THINK C		2 bytes		2 bytes		4 bytes
MPW C		2 bytes		4 bytes		4 bytes

Pascal Integers are 2 bytes, LongInts are 4. (the toolbox is written
for pascal)

in order to keep things compatable across compilers, plain ints
are never used.


-- 
rhorn@ic.sunysb.edu           Never choose a college because it has a duckpond.
From: alphag@terapin.com (Charles Ying)
Newsgroups: comp.programming
Subject: Re: NO NUMBERS! (or even SHORT INTS!)
Date: 30 Sep 92 15:03:01 PST
Organization: BBS


Well, numbers are used VERY often for issues such as addressing complicated AI
structures, number id and number processing is a very useful thing. Although
this is a pointless discussion as there is BCD math to take care of most of the
limitations of computers dealing with numbers.