Here (in reverse chronological order) are some of the more eyeball-worthy postings I've made over the years to alt.hackers, a fun, low-volume, and generally pretty high-quality newsgroup. All posts must either answer a question, or contain a hack. The group is self-moderated; if you don't know what that means, you can't post to it until you find out! *8)

From: chess@theogeny.com (David M. Chess) Subject: Welcome to 19100! Date: 04 Jan 2000 00:00:00 GMT Message-ID: <84tpeq$m88$1@news.btv.ibm.com> X-Client: Newz/Ponga (alpha) X-Trace: news.btv.ibm.com 947022106 22792 (4 Jan 2000 21:41:46 GMT) Organization: IBM Global Services North -- Burlington, Vermont, USA NNTP-Posting-Date: 4 Jan 2000 21:41:46 GMT Newsgroups: alt.hackers X-Complaints-To: news@btv.ibm.com The only Y2K bug I've found so far (aside from the grocery being out of non-skim milk and most kinds of bread last Sunday): I successfully updated my personal Website using my usual set of Perl scripts to synchronize the site with my hard drive on 2000/01/01. Then I went to re-modify one of the files I'd just modified, and the script died with a complaint from timegm() within Net::FTP. Surely not a Y2K bug in Perl itself, or in such a standard library? Examination of the code showed that in fact it wasn't. Perl is doing the right thing, and the code in Net::FTP, while not Y10K-compliant, could handle Y2K just fine. But when parsing the reply to "MDTM foo.bar" from the server, there was junk in one field. I did the MDTM (using "quote") manually, and the reply was roughly the very amusing "191000101114137". The initial substring there should of course be "2000", not "19100"; someone messed up in the obvious way. I wrote to the owner of the machine to tell him, but also coded up a workaround, by subclassing Net::FTP thus: # Net::FTP_DC.pm # # Subclass of Net::FTP just to work around the bug in the FTP server # where MDTM returns "19100" in the year field from MDTM commands. # package Net::FTP_DC; use strict; use vars qw(@ISA); use Time::Local; use Net::FTP; @ISA = qw(Net::FTP); 1; sub mdtm { my $ftp = shift; my $file = shift; return undef if not $ftp->_MDTM($file); my $message = $ftp->message; if ($message =~ s/^19100/2000/) { # fix bug! if (not defined ${*$ftp}{DID_FTP_BUG_MESSAGE_1}) { print STDERR "Hacking around '19100' bug.\n"; ${*$ftp}{DID_FTP_BUG_MESSAGE_1} = 1; } } $message =~ /(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)/ ? timegm($6,$5,$4,$3,$2-1,$1 - 1900) : undef; } Definitely a hack! *8) One bell/whistle included, where it will send a warning to STDERR once per Net::FTP object that shows the bug. This is so I can notice when they fix it. DC site: http://www.davidchess.com/ blog: http://www.davidchess.com/words/log.html work: http://www.research.ibm.com/people/c/chess/ joke: this guy walks into a bar; bounces right off!
From: chess@us.ibm.com (David M. Chess) Subject: Babelfish invariance Date: 27 May 1999 00:00:00 GMT Message-ID: <7ijdn0$3a7o$1@news.btv.ibm.com> X-Client: Newz/Ponga (alpha) X-Trace: news.btv.ibm.com 927808032 108792 (27 May 1999 12:27:12 GMT) Organization: IBM Global Services North -- Burlington, Vermont, USA NNTP-Posting-Date: 27 May 1999 12:27:12 GMT Newsgroups: alt.hackers X-Complaints-To: news@btv.ibm.com The first thing everyone does with a translator like Babelfish (http://babelfish.altavista.digital.com/) is to translate something from one's native tongue into some other language, and then back again, to see what happens. It's only a slight stretch to *continue* this process until you get to a fixed point of the transform (the resulting string is the same as the last one you put in), or a cycle (the resulting string is the same as the one you put in N steps back). A string in language A which, when translated into language B by Babelfish and the result translated back into A, yields A again, is said to be "Babelfish invariant". When the languages are not specified, English (for A) and French (for B) are assumed (English because we're Americans, and English is as close as Babelfish has to American, and French because we hear that that's the language Babelfish is best at). This has been a piece of lunchtime conversation for some time, but we've never really gone about it in a Major Way, because it's a pain to constantly cut and paste and select languages and wait for Babelfish to finish and stuff. Sure, we found amusing things like "To err is human." becoming the (Babelfish- invariant) "To wander human east.", but it wasn't the sort of thing you wanted to play with all day. After yet another lunchtime conversation the other day, I broke down and wrote a 100-line Perl script to do it automatically. It turns out to be a bit of a pain, and no doubt will require constant maintenance as the Babelfish site is modified, since the result coming back is intended for reading by humans rather than programs, and it's non-trivial to find the translated text among the add banners and help buttons in the returned page. But it basically works. So: D:\getbab>perl getbab.pl This is a silly hack. This is a silly hack. C'est une entaille idiote. It is a notch idiot. C'est un idiot d'entaille. It is an idiot of notch. C'est un idiot d'entaille. Definitely an idiot of notch. *8) One interesting discovery so far (aside from the fact that Babelfish often gives up on a translation, requiring one or more retries): the transform does *not* always lead to a fixed-point or a small cycle! There is at least one case that seems to lead to infinite expansion of the translation. That case is: "pizza". As witness: I like pizza. J'aime la pizza. I like the pizza pie. J'aime le p_t_ en cro_te de pizza. I like meat pie of pizza pie. J'aime le p_t_ en cro_te de viande du p_t_ en cro_te de pizza. I like meat pie of meat of meat pie of pizza pie. J'aime le p_t_ en cro_te de viande de la viande du p_t_ en cro_te de viande du p_t_ en cro_te de pizza. I like meat pie of meat of the meat of meat pie of meat of meat pie of pizza pie. J'aime le p_t_ en cro_te de viande de la viande de la viande du p_t_ en cro_te de viande de la viande du p_t_ en cro_te de viande du p_t_ en cro_te de pizza. I like meat pie of meat of the meat of the meat of meat pie of meat of the meat of meat pie of meat of meat pie of pizza pie. Exactly what's happening here is left as an exercise for the reader. It's clearly analogous, though, to what would happen if you tried to fully expand an acronym like "GNU"... *8) Next hack: take the current Q&D Perl code and package it up as an object-oriented module that knows how to talk to Babelfish, so one could (for instance) easily write a news-client hack that would take the material you're quoting and run it through the transform one or more times before quoting it, just for fun! (Quote-mangling idea due to Richard Ford.) DC http://www.research.ibm.com/people/c/chess/
From: chess@watson.ibm.com Subject: WAD hacking Date: 17 Sep 1998 00:00:00 GMT Message-ID: <360107fd.5b9c.chess@watson.ibm.com> Organization: IBM Microelectronics Division Newsgroups: alt.hackers So I had just finished polishing up a new DOOM level (coming soon to a cdrom.com shadow near you: "Pamplona: the Running of the Bulls"), and I decided that I wanted to try replacing the background music, something I hadn't done before. I fiddled with one of my algorithmic composition programs (see previous hacks) until I had something that was vaguely DooMy and not *too* horrible, and used MIDI2MUS to convert it into Doom's almost-MIDI binary format. Now I just had to stick it into my PWAD. The PWAD format is pretty simple: a header that tells you its a PWAD, how many sections ("lumps") it has, and where the lump-index starts. Then the lump-index is just an array of structures giving a lump-name, offset in the file, and length. Trivial! The one music-inserting utility I had lying around inserted a new lump by (1) requiring that the index be at the end of the file, (2) fixing up the "number of lumps" field in the header, and (3) sticking the new index entry and the new lump blat on the end of the file. This struck me as Really Cheesy, since you can only do it once; it causes the file to violate the index-at-the-end requirement that it itself imposes. Also I like having the index at the end; feels neater. The machine I was working on didn't have Perl, and REXX was giving me mysterious trouble for some reason (the PC-DOS 7 REXX.EXE and Win95 don't always get along; sometime I'll tell you about the day that no REXX program could output a byte with the high bit set). So I was feeling frustrated, when it occurred to me that after all I *did* have DEBUG! And the PWAD involved was well under 64K. So I just used several "l" and "n" and "w" and "e" and "r cx" commands to (a) rip the existing PWAD apart into one file containing the index and one file containing everything else, (b) patch the number-of-lumps and offset-to-index fields in the header, and (c) create a new file with an index entry for the MUS lump. Then I used COPY /B (I could have used DEBUG, but there would have been a bit more math) to glue them all back together again: modified header and data, MUS lump, new index entry, old index entries. The result didn't work the first time because I'd patched in a word backasswards, but that was pretty obvious, and upon fixing it, it worked great! I really do need to write my own more flexible WAD-manipulation tool sometime. Maybe in Java! - -- - David M. Chess | "Some look at the world as it is, and ask High Integrity Computing Lab | 'why?'. I look at the world as it is, IBM Watson Research | and say 'Hey, neat hack!'." - J. R. H.
From: chess@watson.ibm.com Subject: Bad Music hack Date: 10 Apr 1997 00:00:00 GMT Message-ID: <334d0f25.2469.chess@watson.ibm.com> Organization: IBM T.J. Watson Research Center Newsgroups: alt.hackers Years and years ago, I had an IBM Music Feature (a Yamaha FB-01 synth packaged up on a single board) in an IBM AT (hey, it was modern at the time), and I got the Technical Reference Manual and wrote some Pascal programs to compose music and play it out the IMF by talking to the I/O ports. I also bought a used reverb at the local long-haired-guys-in-torn-tee-shirts store, and hooked that up so that the IMF would sound less like a toy phaser. Had lots of fun letting it sit composing and playing very quirky music for hours at a time. But then we moved, and the computer got slower and slower and smaller and smaller, and eventually it and the reverb ended up gathering dust in the attic. Recently, we bought a way-cool IBM Aptiva, with built-in sound and stereo speakers in the monitor, and Windows 95, and all sortsa stuff like that, and I realized that I could now get back into the bad-music business. But having kids now I hardly ever have time to like *compile* stuff at home, so I really wanted an interpreted language. And I didn't know how to actually cause MIDI files to play on the new machine. First problem was solved when someone mentioned casually that REXX.EXE from PC DOS 7.0 is a perfectly fine standalone REXX interpeter, and works great in Win95 DOS sessions. Copied REXX.EXE from the laptop to the Aptiva, and the language problem was solved (don't worry, I do in fact have two DOS licenses lying around). Ported the MIDI-file-writing stuff from Pascal to REXX without much trouble. Hacked together some simple composition rules (I decided to start from scratch on the music part, rather than porting the Pascal, just for freshness). Now how to play it? Someone suggested I should look at PlaySound() on some Microsoft reference CD somewhere. I got no time to spend hunting for Microsoft reference CDs. But I searched for PlaySound() on the Web, and found that Microsoft has that reference CD entirely enWebified. Cool! Poked around in there, and found the fun mciSendString() function there, with which you can say things like 'mciSendString("play c:\tmp\foo.mid")' and it will magically do the right thing. Also cool! Borrowed a machine with the MSVC++ IDE installed on it, and ten minutes later I have an equivalent of telnet for mciSendString(). (IDE's are great when you need a short shallow learning curve and don't care much about ongoing ease of use.) While out in the Web, also found the description of Windows' version of General MIDI, so I'd be using a rational set of instruments (if and when I wanted to, of course!). So now I have (roughly): :top \rexx\rexx makesong.rx foo.mid echo play foo.mid >foo.rsp echo ]quit >>foo.rsp mcichat <foo.rsp goto top and I can annoy the whole family with awful music for hours! And to avoid the toy-phaser effect, I can turn on the Voyetra digital reverb that came with the machine; didn't even have to bring down the real (if dusty) reverb from the attic. Sample bad music attached... DC The following line should contain chars x20 thru x60. !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_` begin 666 pattan1.zip M4$L#!`H````&`'"B?2(8Y#@=30(``!\$```+````4$%45$%.,2Y-240-`@$2 M(Q05-C=HB9K;/`4&$A-$Q?:6]YM214O&^`T"#`B00/!JWG+7-#]6@/\';C0: MUFW+MF'3L@5I5N[;MB#G#.\RR9OMV[INR9:5X[T%BD0Y-B7(H6_AYI6;]BQ: MNB!CYLQYDR5(HF'MIB4+LJD+[(VV[-PYY1LK08("#2(XWE$'&K1LPGB_!/!- M!W3U[0:;EFG69/,"!,X0(.R#4`%"=DJ6H!/M#95L@.4-8'DC6/XET7M)\582 MO94L3X1+HI,$HC_)]4[2G15O@4J6L^NJ>!-,LAQ60/$?*=Y'BB,2&=]$BK>0 M\2UD>2(D4CP%$NE.$ECN`8_$(P4\[0*VIHJSJHE[F*VY@/&XI#6!H1W!T'B$ M0N*QI-5XEK06D#2>0##PHJM^["VB&1?0W07<F2I*M4GEJ05"R4;$(^I(`Y17 MQQ,T*K?,ZSO8'#O6'!]Y*=0!54RH"8I?*-0"??\GU(,_EN>`I!*J@:1B>6V5 M4!U$?T^H&WN,3P3C?Q3*$!W*4]&]!;S'#=&A[(MF>D>PWC&>!6L!P3S"=4]P M_3BB-X[NR5!(\0PH9#\98+P3V&]9BN4M<,?U3-#/"Q[).P7\[0&*^\$E^Y/` M?BHO,E]>+UB4#F4W6X#"F0*4I=<E*X6Z4`G8W`;]MN&-%5?1.Z`-8ZPX5_C# M[U38HWL.Z'X6UYM%\410_#'J=PRE,B`.J%CT3A#=$RS_C'4]8W\.[$$70O%V MT-TESBB>`F=$9W!656L9:+6,_;FP1_<T\(UZN@5L3<VMI%R(&]V[((ZD&6P< M4$L!`@H`"@````8`<*)](ACD.!U-`@``'P0```L``````````0`@```````` B`%!!5%1!3C$N34E$4$L%!@`````!``$`.0```'8"```````` ` end
From: chess@watson.ibm.com Subject: re: mail help? please? Date: 11 Mar 1997 00:00:00 GMT Message-ID: <3325b449.36df.chess@watson.ibm.com> Organization: IBM T.J. Watson Research Center Newsgroups: alt.hackers > From: bbelli@epix.net (John Belli) Sorry, I don't have a csh script for you (IBM hackers have a special dispensation that allows us to learn REXX instead of csh and bash and Perl, although I'm learning Perl; amazing pile of hacks, that!). > (Once I was so desperate I telnetted into the POP port and > entered commands manually.) There's some other way? *8) ObHack: I've been reading my mail in VM/CMS for utterly ever, and I'm resistant to change. I decided that it'd be good to get news arriving as mail also (I can't be expected to remember to run a newsreader every day!), so I hacked up a simple C program that spoke NNTP, and would nightly run on my OS/2 system, read a list of newsgroups, get all the latest postings, and send them to my VM account as mail. Some of the discussions that I follow are starting to use Lotus Notes, so I'm about to embark on the obvious thing: a Notes API program that will run nightly on my OS/2 system, get all the latest postings in the relevant Notes databases, and send them to me on (hehe) VM as (hehehe) mail. Boy, am I willing to go to a lot of trouble just to avoid changing a habit or two! Still, it's good clean fun... - -- - David M. Chess "Master, how may I comprehend the One?" High Integrity Computing Lab "Have you finished your coding?" "Yes." IBM Watson Research "Then go and compile!" -- Hacker Koan - -- -
From: chess@watson.ibm.com Subject: Random randomness Date: 04 Dec 1996 00:00:00 GMT Message-ID: <32a5ca3f.2aa8.chess@watson.ibm.com> organization: IBM T.J. Watson Research Center newsgroups: alt.hackers Two randomness-related postings to a.h within a few days, both just wrong enough to make me itchy. Sorry, I couldn't help myself... >From: jti0001@jove.acs.unt.edu (Jeremiah T. Isaacs) > I dont have a computer or a programmable >calculator on me, but I have a coin. !. I designate 0-10, 11-21, and >22-31 to the three friends respectively, flip the coin five times to make >a five digit binary number (decimal 0-31). yes, the results are a _little_ >biased against the third person, but the number generator was truly >random. ta-da! Yeah, well, that *works*. But quicker and fairer is just to flip the coin *two* times, and do: 0 0 - Person 1 0 1 - Person 2 1 0 - Person 3 1 1 - Flip them again True if your coin never shows tails the process never resolves, but that hardly every happens... *8) The above is my ObHack; I have to make a random choice between either three or four people once a week, and I always use whatever coin comes to hand. >From: markwag@execpc.com >they should randomly pick two numbers from 1 to 4 and send email if >and only if the numbers match. The probability that they will match is >0.0625. ?? Maybe I'm reading this wrong, but if you pick two numbers from 1 to 4 (uniformly distributed and all that default stuff), they will match one time in four, 0.25. You meant, I assume, that they should send the email iff the numbers are both 4? That's 0.0625... - -- - David M. Chess "Master, how may I comprehend the One?" High Integrity Computing Lab "Have you finished your coding?" "Yes." IBM Watson Research "Then go and compile!" -- Hacker Koan - -- -
From: chess@watson.ibm.com Subject: Lyric and Bubbles Date: 19 Apr 1996 00:00:00 GMT Message-ID: <317787a9.2724.chess@watson.ibm.com> organization: IBM T.J. Watson Research Center newsgroups: alt.hackers All I Really Want (with apologies to Alanis Morissette) Well, it's stressing me out, The GUI is crawling and all greyed out, And you say wha-a-a-a-a-a-a-t a loser! I don't want to select anything today, I don't like to drag and drop you see But I ca-a-a-a-a-a-a-a-n't help it. There I go clicking before the mouse has settled down Slap me with another menu And it would use up all my core If it hadn't crashed already If only I could hunt the Wumpus. And all I really want is a shell prompt, A place to type netstat -s. And all I really want are free cycles, Oh-o-o-o-o-o-o-oooh. Do I wear you out? You must wonder why I'm thrashing and all swapped out, I'm consumed by the system's bitmaps. I'm like Estella I like to type it in and then compile it out I'm frustrated by your interface. And I am frightened by the bloated hugeness of this code, If only I could grep the source-tree And I am fascinated by the bitly-conscious man, I'm humbled by his hacker nature What I wouldn't give to find a guru Someone who can write tight code And what I wouldn't give to find a hacker Oh-o-o-o-o-o-o-ooh! (If this doesn't make any sense to you, go get Jagged Little Pill and listen to the first track, real loud, several times. It won't make it any clearer, but it might distract you...) This little diatribe is not directed against any particular GUI, it's just a last protesting shout from a subsystem of my brain that will be completely obsolete a week from next Tuesday, when memory prices drop below US$10/terabyte, and the first 256-bit operating system ships. ("Dang it all sonny, I've written whole *programs* that were shorter than yer danged virtual addresses!" "Go back to sleep, g'pa...") Hack: We have this little toy consisting of a fan and some plastic gizmos that let you produce enormous soap bubbles by turning a little handle. My two-year-old is in love with it, and naturally it stopped working yesterday. The instruction manual has one of those lovely ass-covering "to ensure proper operation, disassemble the toy and wash all the parts in .9999999 pure methyl-amino parafin after every three minutes of use" warnings, so I figured that somewhere they'd used a part that was, say, soluble in bubble-soap. After struggling with eighty-seven little plastic one-way tabs, I got the thing open and discovered that in fact the switch (the only moving part in the circuit outside of the motor itself, which turned out to be decently sealed) was an incredibly cheap completely non-sealed single-pole double-throw switch made of clarinet reeds and scotch tape, garaunteed to stop working a couple of days after exposure to anything as caustic as Mr. Bubble. My switches and other non-audio-related gadgets are all still packed in a box somewhere in the basement (ah, adulthood), so I just cut the dead switch off, stripped a cm off of each wire, made little hooks out of the exposed leads, ran the wires out through a gap in the case, put it all back together, and showed my wife and my five-year-old the toy's new user interface. (Hey, if it were neat, it wouldn't be a hack!) The two-year-old had drifted off to watch Dumbo by that time, but I'm sure he'll eventually be pleased. My swtich may be a bit of a kludge (harharhar), but at least it's not water-soluble... - -- - David M. Chess | "Some look at the world as it is, and ask High Integrity Computing Lab | 'why?'. I look at the world as it is, IBM Watson Research | and say 'Hey, neat hack!'." - J. R. H.
From: "David M. Chess" <chess@watson.ibm.com> Subject: Hacks, ties, and videotape Message-ID: <19930218.30740.7938.corna@watson.ibm.com> Date: Thu, 18 Feb 1993 13:32:20 GMT Organization: IBM T.J. Watson Research Center newsgroups: alt.hackers This is really about something that someone *else* hacked, but the experience partook enough of the Hacker Nature that I think it deserves posting here. I'm for some reason on at least one "rich and gullible" ad-mailing list (I like to think that it's entirely mistaken, not just half!). The other day I got a call from someone wanting to sell me interest in an oil well in Texas. Yow! That's not what the story's about, though. Yesterday in the mail I got a 10-minute videocassette from some car company about some car. About as thrilling as you'd expect a 10-minute commercial to be, BUT the baby and I had a great time for the rest of the evening taking the cassette apart, playing with the pieces, and putting it back together again. All hackers must immediately go out and disassemble a video cassette, if they haven't already (maybe I was the only one left that hadn't). Not only do the major halves make excellant owl- masks (a 2-and-a-half-year-old assistant is highly recommended if you can obtain one), but the innards contain lots of interesting hacks. I normally think of manufactured objects like this as being variously screwed, glued, or sewed together; but (once you've undone the five little screws to get the major halves apart) a VC is full of little interestingly-shaped parts that are just sitting there, ready to pop out, fall out, or be grabbed by tiny fingers. This is no doubt "designing for manufacturability", but it definitely involves hacks! We eventually got it back together (all but one part that didn't seem to fit back anywhere), and it worked again (I guess that counts as a small hack in itself...). And now we know various Secrets of Technology, such as what tab to push to let you swing open the little door protecting the tape, why you can't spin the tape reels by hand (that's one of the cuter little hacks to be found inside), what recessed surface to push on if you do need to spin them by hand, and so on. Highly recommended! - -- - David M. Chess / "...net.net.god, High Integrity Computing Lab / I wanna be IBM Watson Research / a net.god..."