T.R | Title | User | Personal Name | Date | Lines |
---|
21.1 | | HERMES::MARTIN | | Sat May 05 1984 23:51 | 17 |
| Day of the week is easy when the date is expressed in the "Universal Date
Time Standard" that Tops-10/20 use. November 18th, 1858 is day 1, and the
number is incremented by 1 each day. My Popular Science Perpetual Calendar
and Bookmark says that Day 1 was a Thursday, so you take the day number, and
Wednesday is 0 MOD 7. Since there was a reference to screwed up NOTES files
having a date in 1858 a few notes back, I assume the same thing is available
on VMS. This is worthy of mention in a hacker file, because I discovered
the data-of-the-week trick by reading some hacker's code that used it. The
program actually added 4 to the date number before dividing by 7, because
then it could test for weekends by (date
Damned ^W
((date+4) MOD 7) AND %O'6' EQL 0.
I was reading the code with DDT at the time, because I was probing a .SAV
file, with no sources available. So that counts as hacking too.
/AHM
|
21.2 | | ACE::BREWER | | Mon May 07 1984 20:59 | 7 |
| I'll send you a file that I use to keep track of the backups I do on
my 750 system. It is useful in that I turn off the .com file on weekends
as a backup is not (normally) needed then...
I didnt write it ... I copped it off another machine.
-John
|
21.3 | | ORPHAN::BRETT | | Fri May 11 1984 15:45 | 6 |
|
ZELLER's congruence is totally unnec. on VMS - just get the system quadword
time, do an EDIV to get the #days since day 0, and then a plus followed by
a mod to get the day of the week...
/Bevin
|
21.4 | | MARVIN::ISBELL | | Tue May 15 1984 14:07 | 8 |
| I have a little FORTRAN program I wrote at college which uses Zeller's
whatsit to produce a calendar for any year. There is no checking
performed on the year requested, and no compensation for the calendar
change. Send me mail if you are interested in a copy. (This program also
contains an example of a hack to get the output format correct, which
could not be done with the FORTRAN I/O on the college system.)
Chris.
|
21.5 | | HARE::STAN | | Mon May 21 1984 22:35 | 6 |
| Come on guys - this file is for hackers.
If your calendar program doesn't print out the phases of the moon
then you're not hacking; you're just writing useful code.
Perhaps there should be another notes file somewhere for people
to file away useful code fragments.
|
21.6 | | REX::MINOW | | Tue May 22 1984 17:48 | 66 |
| ! Moon.tec puts the phase of the moon at the end of the text buffer !
! Programmed by Martin Minow. The algorithm is taken from Knuth's !
! The Art of Computer Programming, vol. 1. See also CACM Apr 63 !
! !
! The macro is loaded into Q register P !
! Internal Q register usage: !
! T Temporary storage of radix flag, etc. !
! Y,M,D Year, month, day !
! C,G Century and Golden number (Moon's 19 year cycle !
! E Epact (age of the moon on Jan. 1) !
! !
! Note: this routine is intentionally rather crude. !
@^UP%
[T [Y [M [D [C [G [E 10UT ^D ! Save registers and radix !
^BUD ! Get operating system date !
! RSX-specific code, get QY=year, QM=month, QD=day !
QD/512UY QD-(QY*512)UD QD/32UM QD-(QM*32)UD QY+1900UY
! Calculate EPACT !
QY/100+1UC ! Century, 1900 = 20 !
QY-(QY/19*19)+1UG ! Mentonic cycle "golden" number !
QG*11+20+(8*QC+5/25-5)-(3*QC/4-12)UE QE-(QE/30*30)UE ! Epact !
QE-25"E QG-11"G QE+1UE ' '
QE-24"E QE+1UE ' ! QE now has moon age on Jan 1. !
! Calculate the day in the year !
QM-02"E QD+031UD '
QM-03"E QD+059UD '
QM-04"E QD+090UD '
QM-05"E QD+120UD '
QM-06"E QD+151UD '
QM-07"E QD+181UD '
QM-08"E QD+212UD '
QM-09"E QD+242UD '
QM-10"E QD+273UD '
QM-11"E QD+304UD '
QM-12"E QD+334UD '
QM-2"G ! Leap year correction needed? !
QY-(QY/4*4)"E ! Maybe, is it one in 4? !
QY-(QY/100*100)"N QD+1UD ' ! Yes, leap it if not / 100 !
QY-(QY/400*400)"E QD+1UD ' ! Or if it's divisible by 400 !
' '
! Calculate phase of the moon and load the text !
! Note: The moon's period is 29.5 days, thus !
! 177 = (29.5 * 6) !
! 22 = (29.5 / 8) * 6 !
! 11 = 22 / 2 !
QD+QE-1*6+11UD QD-(QD/177*177)/22&7UD ! QD has the phase (0 - 7) !
ZJ
QD-0"E @I/new/ '
QD-1"E @I/waxing crescent/ '
QD-2"E @I/in the first quarter/ '
QD-3"E @I/waxing gibbous/ '
QD-4"E @I/full/ '
QD-5"E @I/waning gibbous/ '
QD-6"E @I/in the last quarter/ '
QD-7"E @I/waning crescent/ '
! Finish up !
10-QT"N ^O ' ]E ]G ]C ]D ]M ]Y ]T
% @^A/MOON.TEC now loaded into Q register P
/<ESC><ESC>
|
21.7 | | NACHO::CONLIFFE | | Tue May 22 1984 18:36 | 1 |
| I love it!!! And in TECO, too.. My favorite programming language!
|
21.8 | | HUMAN::BURROWS | | Wed May 23 1984 11:23 | 2 |
| OK, martin, are you going to regale us with the tale of your phase of the moon
bug?
|
21.9 | | REX::MINOW | | Wed May 23 1984 23:25 | 16 |
| fixed in .7
(The phase of the moon program had a phase of the moon bug that
caused the phase to go to 8 on the equinox full moon, which happens
twice a year. Wherefor the mask by 7).
Blame Knuth, it's his algorithm.
If you have strong stomach, search out the reference Knuth gives
for the Easter program in Volume 1. (CACM 1963, if I recall
correctly. He wrote that date of Easter program in Cobol.)
Then, again, I've written an Ansi Standard Escape Sequence Parser
in Microsoft Basic.
M.
|
21.11 | | TURTLE::COWAN | | Fri May 25 1984 12:20 | 14 |
|
I'm glad to see there are other TECO hackers out there. Come
to think of it, TECO must be the oldest unsupported progamming language
in the company, eh? Yes, yes, I know it is now supported under VMS V-whatever.
I used to work for a company that cycled large amounts of data
through their machine. Frequently, we came accross freak data entry
aids that were needed. Real people would have hired data entry help,
but my company preferred magic-- a la TECO. To you and I, it wasn't
real magic, it was just simple TECO complicated slightly to deal
with buffers that stopped at bad place. Consquently (see, they
did teach me something in college), I'll not ramble further.
Cheers, KC
|
21.12 | | MARVIN::ISBELL | | Mon Jun 04 1984 16:19 | 10 |
| The REAL TECO hack was RT-11 EDIT. This, as far as I can gather, is TECO
without all the nice bits. It had the effect of turning me totally off
TECO. On many occasions I entered a command string ending with an insert
of a number of lines. If there was some trivial error in the commands,
all the inserted text was lost.
Any editor which requires the escape key as a command terminator, and is
character orientated produces a strong conditioned reaction of aversion.
Chris.
|
21.13 | | LATOUR::KKLEINER | | Tue Jun 05 1984 12:11 | 3 |
|
.0, .5 - When such a notes file is started (oh no, not another one!) perhaps
it should be called HAKMEM.NOT (see #24.0).
|
21.14 | | NY1MM::MUSLIN | | Fri Jun 29 1984 00:09 | 5 |
| Re: .5
"Useful code," what's that?
-\- Victor -/-
|
21.15 | | NY1MM::MUSLIN | | Fri Jun 29 1984 00:26 | 6 |
| Somewhere I have a state machine parser that goes through a table of
allowed/unallowed states. The only use it has is to prove to a friend of mine
(a TOPS-20 specialist in the office) that VAX can simulate TOPS' %CMND jsys
(it also tries to simulate CLI - why do only one thing, right?)
-\- Victor -/-
|
21.16 | | Vaxuum::DYER | | Fri Jun 29 1984 20:16 | 2 |
| I believe Stan's done a good job simulating the %CMND jsys...
<_Jym_>
|