Sunday, August 31, 2008

Computer Humor... Truth In Multi-National Advertising?

Hey again,

You may recall, just a few days ago (I think...), we put out a script do language translation using Yahoo/AltaVista's Babelfish interface. I mentioned, briefly, in that post that, when translating something into a foreign language, I always like to do a "reverse translation" using the translated output from my original query, and see how close the back-translation comes to what I originally wrote. It can make for hilarious results. In fact, unless you're entering something like "hello," it's almost guaranteed to come back goofy when translated back to English (or your native language).

For instance, given a phrase, and randomly picking Italian for the language to translate to-and-from, we would get this:

Original Phrase: Can I get you a drink, officer?

Translated to from English to Italian: Posso ottenergli una bevanda, ufficiale?

Translated back to English: I can ottenergli a drink, official?

What??? Apparently, The Italian "ottenergli" has no literal or idiomatic translation in English. And, if the back translation proves anything, it's that direct translation between languages is fairly weak. The translator (preferably a human ;) needs to be able to translate idiomatic phrases and cultural nuances and adapt them accordingly.

The good news is that this can be even more hilarious for you :) At the Lost In Translation language-bouncing site, it'll put anything you want through multiple language filters and give you back something that more closely resembles gibberish than your original expression.

Even "Hello" is not immune!!! Here is the output (only the final output, although, on the Lost In Translation page it takes you through each step in the translation/back-translation process so you get a play by play on how your original meaning is mashed up and beaten into a sticky pulp of utter nonsense ;)

English Text Entered: Hello
After Final Back-Translation: Today

This makes no sense to me whatsoever (since I don't have a thorough understanding of all of the languages the site uses to "babelize" your original word or sentence). But it does make for some interesting reading. I've found, also, that if you choose not to include "Chinese, Japanese and Korean," your phrase has a better chance at surviving. For instance, "hello there," without the CJK, comes back as "hello there." With CJK, it seems to come back as either "highly there" or "today here" ;)

I, personally, find it very interesting to put my company's catch-phrase in. Any advertising slogan is generally good fodder, as well :)

I've tried to inline the initial "textarea" box here (you will be taken off of blogspot to tashian.com to get your results). If it doesn't work in your browser, you can get to the original Babel page here.

Cheers,



Enter English Text and "Babelize" it:




Include Chinese, Japanese, and Korean


, Mike




Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Saturday, August 30, 2008

More Funny Unix, Linux and Mainframe Error Messages

Hey again,

Trolling the net some more, I found a whole ton of funny Unix, Linux, mainframe, compiler, VAX, VMS, etc, error messages and I think we have enough material to span two posts here. So, in effect, today's post is also a "live test" of how long a blogspot posting can be. If it overruns, and the bottom gets clipped, you can get the material from its source at TMK.com.

WASTE OF TIME SAVER: ???? I'm starting to sound like these messages ;) Just as a heads up for anyone who visits the source listed above, you'll note that the string of emails they have posted there list the base href of this string of funny errors as http://www.oraclehumor.com/TextIndex/HumorText/errors.txt. I didn't include this as a hypertext link because it just goes to a placeholder page (I'm sure it was something else in its day ;)

I hope you enjoy this copious list of errors. You may recognize a few from our older post on Linux and Unix error messages (mostly the ones near the top), but I've read them all and can guarantee you plenty of fresh material (insofar as it's dated and, of course, only considered fresh in the context of this blog, since these errors were discovered and sent back and forth a while ago.... )

As usual, I've "modified" any and all swear words, to keep the "Safe Search" folk happy. I also removed the email footers and headers from the material. It helped save on space (this post is humungous - over 700 lines - without them), but you can check all that out, again, at the computer error messages list.

Enjoy, and keep smiling. It looks good on ya ;) ...For the record, my favorite is the very last one :)

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

From Version 7 UNIX: "Values of B will give rise to dom."

(no, I don't know what it meant (or if it still exists!)
but it had something to do with removing a directory with
a name beginning with '.'.)
--

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

Actually, my all-time favorite is:

FATAL system error #nnnn
CAUSE: We should never get here!

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

my favorite happened while i was transfering a file from one
machine to another. after about five minutes the machine still
hasn't copied the file and responds with....

OHHHH.... I give up
>
>Core dumped

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

My favorite is the PL/1 compiler message

"COMPILER UNABLE TO ABORT"

This is the message when the compiler has attempted to abort the compilation
five times, and has failed each time.

I don't know what happens next.

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

This is what the Univac 2200's os1100 os produces, when I fill my
program file beyond its capacity:

I/O TYPE 01 CODE 22 CONT 12 REENT ADR: 015245 BDI: 403034
PACKET ADR 045301
AN ATTEMPT WAS MADE TO WRITE BEYOND THE MAXIMUM ASSIGNED SPACE
FOR A MASS STORAGE FILE. AN ATTEMPT WAS MADE TO EXPAND A MASS
STORAGE FILE BEYOND THE MAXIMUM ASSIGNED SPACE. A READ
FUNCTION FOR A MASS STORAGE FILE SPECIFIED AN ADDRESS (WORD 5
OF THE I/O PACKET) THAT IS BEYOND THE MAXIMUM ASSIGNED SPACE.
A READ OR WRITE FUNCTION FOR A WORD-ADDRESSABLE MASS STORAGE
FILE SPECIFIED A MASS STORAGE ADDRESS (WORD 5 OF THE I/O
PACKET) AND A TOTAL DATA COUNT. WHEN THE MASS STORAGE ADDRESS
IS ADDED TO THE TOTAL DATA COUNT, THE RESULTING ENDING MASS
STORAGE ADDRESS IS GREATER THAN 2*/35-1. A READ OR WRITE
FUNCTION FOR A SECTOR-FORMATTED MASS STORAGE FILE SPECIFIED A
MASS STORAGE ADDRESS (WORD 5 OF THE I/O PACKET) THAT IS
GREATER THAN 2*/30-1. ADI ONLY: REFERENCE ATTEMPTED BEYOND THE
ASSIGNED FILE WHEN THE FILE IS CONFIGURED AS A FH-432 OR
FH-1782 DRUM.
(Filename: FEK*ONT)
END MAP. ERRORS: 1 TIME: 33.978 STORAGE: 054203/014304/035416/3/0220776
ERR$ TYPE 03 CODE 00 CONT 12 REENT ADR: 045147 BDI: 000015
USER EXECUTED ER ERR$.

The fun thing is that the err.msg.s are usually more like:
I/O TYPE 01 CODE 22 CONT 12 REENT ADR: 015245 BDI: 403034

and a register dump.

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

My favorite error message that I have *INCLUDED* in a program was:
ERROR: A really big F### UP has been detected !!

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

Disk drive error codes:

Momentaraly writing while seeking
Constantly writing while seeking
Momentaraly writing while reading
.....

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

If you run "strings" on the executable of gawk (the messdos version, at
least), you'll see a line with this message:

initstate: not enough state (%d bytes) with which to do jack; ignored.

I've no idea how to get gawk (GNU awk) to spit out this message, but it
appeals, somehow....

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

We have a PC clone with a flakey keyboard. It often produces the error
message "Keyboard not present, press any key"


A friend of mine in a compiler writing class produced a compiler with one
error message "you lied to me when you told me this was a program"

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

My favorite was "PROGRAMMER GOOFED . . . YOU SHOULD NEVER SEE THIS MESSAGE"

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

When I was at Purdue, the IE department had a DG Nova system that would respond
to attempts to run object programs formatted for a DG Eclipse system with the
message:

YOU CAN'T DO THAT!

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

A library automation package I once worked on had the message:

Man the Lifeboats! Women and children first! ....

Management was not amused when the first customer called in for
support with this message. :-)

No sense of humor, some of those mgt. types!

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

Okay, I know this isn't rec.games.trivia, but...

Can someone tell me the machine and editor which, when instructed to

MAKE WAR

would respond with

MAKE LOVE NOT WAR

(no, I don't know the answer; someone told me about this one once)

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

It's TECO, on VAX/VMS, and goes like this:

$ make :== $ sys$system:teco32 make
$ make love
Not war?
*

Long live TECO!!!

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

Here are some that I found in reading the string-pool from Knuth's TeX:
[Note that I included these from the actual file, so the one with 'can
fix can fix' below is what's actually there!]


(That makes 100 errors; please try again.)


You can now delete more, or insert, or whatever.


Sorry, I don't know how to help in this situation.
Maybe you should try asking a human?


Sorry, I already gave what help I could...


An error might have occurred before I noticed any problems.


``If all else fails, read the instructions.''


This can't happen.


I'm broken. Please show this to someone who can fix can fix


I can't go on meeting you like this.


One of your faux pas seems to have wounded me deeply...
in fact, I'm barely conscious. Please fix it and try again.


Interruption
You rang?


IMPOSSIBLE.

NONEXISTENT.

ETC.

BAD.


A funny symbol that I can't read has just been input.
Continue, and I'll forget that it ever happened.


I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.


I dddon't go any higher than filll.


Dimensions can be in units of em, ex, in, pt, pc,
cm, mm, dd, cc, bp, or sp; but yours is a new one!
I'll assume that you meant to say pt, for printer's points.

----------------------------------------------------------------------
If things go amiss in Interactive Data Language, as they frequently do,
you get :

Something Rotten in Denmark, Interp Stack Not ALigned

just before the core dumps.

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

My own favorite, from one of DEC's less successful versions of the RT11
linker:

<Assorted DEC ID fruitcake> ILLEGAL ERROR

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

My first 'C' class was under 4.1 BSD. I forgot to name my
first program with a ".c" suffix; hence the following error message:

% cc prog1
ld: bad magic number


which was a bit confusing to a person who didn't know
about magic numbers or what even 'ld' was....

Then there is my favourite, 'sail', who asks for a scenario
number from a list; if anything but a valid digit is input, 'sail'
simply says "very funny" and exits.

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

The most common error message we got from a modula II compiler that I used
at an other company was "Unexpected ';', expecting ';'"

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

The early versions of TeX had this classic, which I believe the people at
Stanford even had printed on T-shirts:

You can't do that in horizontal mode.

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

My favorite was on the (gasp!) IBM 7094. Occasionally, the COBOL
compiler would die with just:

"COMPILER THWARTED".

This was in '74. I remember, because we had a tenth anniversary
party for the compiler (printed a date in '64 at the top of each
listing).

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

>We have a PC clone with a flakey keyboard. It often produces the error
>message "Keyboard not present, press any key"

In which case it's not really compaible. *The* message is

"Keyboard error or no keyboard present. Press F1 to continue."

Pull the keyboard lead out of an IBM (while power of), power on and
laaaaugh.

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

A program called "junk" written by a student here at PSU gives the
following error message:

"Argument is bletchful."

On the Commodore Amiga, system crashes are always indicated by a black
window with a red flashing border at the top of the screen with the
words "Guru Meditation" and a number.

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

This is probably just another Urban Legend, but ...

A large company had just gotten their first Macintosh. As Macs do, it
had a system crash, and popped up a window with a picture (uhh, excuse
me, icon :-) of a bomb on it.

Management ordered the building evacuated. And called the police ...

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

Doing a strings on our version of lint yields this error message; I have
no idea how to get it to spit out... stack overflow, maybe?

"lint's little mind is blown."

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

And a graph plotting program on the Amiga uses the red box with:

"Hot Damn! You need more ram!"

When it runs out of memory.

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

Not to mention the MPW C compiler (not all of these may be funny to all of you):

String literal too long (I let you have 512 characters, that's 3 more than
ANSI said I should)

.....And the lord said, 'lo, there shall only be case or default labels
inside a switch statement'

a typedef name was a complete surprise to me at this point in your program

You can't modify a constant, float upstream, win an argument with the IRS, or
satisfy this compiler

This struct already has a perfectly good definition

type in (cast) must be scalar; ANSI 3.3.4; page 39, lines 10-11 (I know you
don't care, I'm just trying to annoy you)

Can't cast a void type to type void (because the ANSI spec. says so, that's
why)

Huh ?

can't go mucking with a 'void *'

we already did this function

This label is the target of a goto from outside of the block containing this
label AND this block has an automatic variable with an initializer AND your
window wasn't wide enough to read this whole error message

Call me paranoid but finding '/*' inside this comment makes me suspicious

Symbol table full - fatal heap error; please go buy a RAM upgrade from your
local Apple dealer

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

I just got this error message while trying to spell-check a document:

"It seem you are trying to check the output from a word-processor. Not
only does this not make sense, but you would probably damage the file
if you tried so I am not going to let you do this!"

Well, what if I wanted to damage it!!!

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

Well just now while switching newsgroups i got this message:

It looks like the active file is messed up. Contact your news administrator
and leave the "bogus" groups alone, and they may come back to normal. Maybe.
^^^^^
----------------------------------------------------------------------

This one is not exactly an error message story, but it's close, so here goes:

Our department is currently developing a Diagnostics package for IBM-PC boxes,
and as one of our intermediate INTERNAL releases, we added a new menu, with
help screen etc, for a set of functions we were about to add. It went through
the normal internal review cycle, with the Dept head spending some time looking
at it as well. Unknown to us, the dept head shipped a copy to a customer to
get their comments. The memo we got back from the customer was quite funny,
and I quote:

The SYSTEM UTILITY menu functions have not been implemented. Therefore
no comments for this. Help for this menu is somebody's idea of a joke!
I can only assume the help will be changed when the menu functions have
been completed

The dept head had never looked at any of the help menus, so he didn't know
what was going on. When he came back to us to find out what the problem was
this is what he found:

Attention K-Mart shoppers: Blue Light special in out SYSTEM UTILITIES
department. for the next 10 days we will be taking requests for the
utilities that you think should be here. Thank you again for shopping
K-Mart.

Needless to say, the dept head was P-Oed, but he ignored the

INTERNAL USE ONLY
disclaimer we had put with the software.

probably not funny, just wierd

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

Error messages I've seen:

"Things are not looking good!"

"I didn't think this set of error conditions could ever happen"

"Now deleting all files. Goodbye" Then read a directory in order to make the
hard drive rattle!

When I was new to UNIX -> "file qwerty.asdfg has bad magic."
sounds like a real OS, no rinkydink stuff here?

And I knew some guys that were writing some SW to be used by local
clerical staff, and they got to a this should never happen, but we should
put in a message. Someone said the only person that could ever get into
this deep a mess is Linda, so they put a message that said
"Hi Linda! We wondered how long it would take, for you to mess up this bad."
Well sure enough, six months later,
Linda comes storming in mad as a wet hen, having discovered
that error message.

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

One amusing error message that I've seen is produced when you try to
restart the 'nnmaster' news program with the -k option. This should kill
the existing nnmaster so you can restart a new one- But if things go
wrong, you get the message "The running master will not die..."!!

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

This would have been a good one; unfortunately, it got caught before
the software went out (last place I worked):

"Shut 'er down, Clancy, she's a-pumpin' mud!"

The perpetrator, to my knowledge, was not found.

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

An error has occured on the error logging device.

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

I ran a program once which had a menu of commands, including one
to get help. If you pressed the help key you got:

"Out of order"

Very helpful!
In a simialr program, if you typed in an invalid command you got either

"Hey are you talking to me? Try again!"
or
"Invalid command. Feel ashamed for yourself and try again."
or
"Of all the commands available you picked the wrong one!"

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

I've never seen this error occur, but I noticed while hacking graphics
routines into the Z80 portion of Radio Shack's (Microsoft's) TRS-80 Model 16
M68000 Xenix. (Note that for a while, this computer supported the largest
Unix (-like) base in the world).

The Z80 handled all the of the IO in the machine and somewhere imbedded in
the code was the message "Shut her down, Scotty, she's sucking mud again!"

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

Back in the dark ages (1967 or so) I rewrote a large part of the IBFTC
Fortran compiler for the IBM 7040 to add in most of the goodies which
were becoming available in compilers for other machines. (The primary
models I used were S/360 FORTRAN G and the Sigma 7 Fortran, but I
stole ideas wherever I could.) Keeping track of the data within the
compiler was a complex chore (at the time I was in grad school, and
I was the only staffer on the project...can you say "long hours"?)

I wrote in numerous checks on the internal procedures, but didn't have
much in the way of recovery code if inconsistent data were detected
except to abort with an error message. I swiped the error message from
a GE system; as I wrote it the text was:

ERROR 1164 HOW IN THE HELL DID YOU GET HERE

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

Here are a few gems from our Harris VOS system.

We got used to seing this one a lot.

JOBCNTRL ER 512 : WARNING: FILE GENERATED.
>he 512
THE FILE WHICH WAS SPECIFIED AS THE 'COPY TO' OR DESTINATION FILE WAS
NOT THERE AND WAS THEREFORE GENERATED BY JOBCONTROL. IF YOU DID NOT
MEAN TO COPY TO A NEW FILE ELIMINATE THE FILE.

The next few are pretty amusing.

JOBCNTRL ER 76 : NO ACCESS FOR $TOAD SERVICE
>he 76
A USER PROGRAM MADE A CALL TO A $TOAD SERVICE AND THE USER DOES NOT HAVE
THE PROPER ACCESS TO BIT TO USE THAT SERVICE. ACCESS RESTRICTIONS
ARE PLACED ON THE $TOADS SERVICES IN GENERAL, AND $CPRIOR, $PABORT,
AND $SUSP FOR INDIVIDUAL RESTRICTIONS.

JOBCNTRL ER 2167 : NO ACCESS TO VULCANIZE PROGRAM
>he 2167
AN ATTEMPT HAS BEEN MADE TO VULCANIZE A REAL-TIME, MONITOR, OR NRH
TYPE PROGRAM, OR A PROGRAM WITH HIGH ACCESS, ACCOUNTING FILE ACCESS,
OR SUB-SYSTEM ACCESS. THE VULCANIZE REQUEST IS IGNORED BECAUSE THE
USER DOES NOT HAVE ACCESS TO GENERATE SUCH A PROGRAM.

JOBCNTRL ER 2211 : IT'S NOT NICE TO FOOL POP!
>he 2211
YOU JUST TRIED TO FAKE-OUT MOTHER NATURE, AND SHE CAUGHT YOU! SUPER-
VULCAN NOW HAS YOUR NAME ON HIS ENEMY LIST, AND YOU CAN BE CERTAIN THAT
FUTURE ATTEMPTS TO RESOURCE LFN 0,3,OR 6 WILL RESULT IN YOUR BEING
ABORTED, SPINDLED, MANGLED, FOLDED, PUNCHED, DELETED, AND DEALLOCATED.

This last message was often the cause of a sinking feeling late at
night.

JOBCNTRL ER 44 : PROGRAM FILE DESTROYED.
>he 44
THE PROGRAM HAS BEEN ABORTED DUE TO INCONSISTENCIES IN THE INFORMATION
GENERATED BY THE VULCANIZER. THE DISC COPY OF THE PROGRAM MAY HAVE BEEN
DESTROYED OR THE PROGRAM MAY NOT HAVE BEEN RE-VULCANIZED AFTER A MAJOR
SYSTEM RELEASE. IN ANY CASE RE-VULCANIZE THE PROGRAM (RLIBS ALSO).

Fortunately I don't have use this machine anymore :-) :-) :-)

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

>From the telephone switch world -

Outputs required from the ALARM SYSTEM
minor alarm
major alarm
critical alarm

alarm system failure alarm

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

Trailblazer for the Atari ST has a good one.
You press the [Help] key and the machine laughs at you.

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

A friend of mine screwed up somehow when he installed Windows 3.0 on his 386
running DOS 4.01, and now he can hardly run the damn thing without receiving
the following ominous-sounding declaration:

This application has violated system integrity and must be terminated.

No one at Microsoft seems to have heard of it.


Also, I've been told that on VMS, if you attempt to send out e-mail with an
invalid header, it will respond with "You are a charlatan."

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

Here's another one:

Occasionally our ultrix system will forget who you are and if you want
to "talk" to another user, the talk daemon will come back with

Go away. You don't exist.

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

My OS (QNX) has a command called TSK (short for TASK) which allows you to
view information to do with tasks (code size, id's, son, dad, etc) when
I first saw it a friend of mine showed me the list of commands, of which
one is tsk tsk, I tried it, and it came up with the following message:

Tsk tsk? Have I been a bad computer?

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

When I tried to compile a program, (which had compiled nice
on a SUN workstation with both gcc and cc) on one of our old
VAX 11/750 I got the fantastic error

.. line 2706 compiler error: schain botch

(4.3 BSD and cc)

Does anyone have any clue to what that means ?

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

In an earlier version of BSD (4.1?) if you did [I think it was a] "who" and
you were the only one on the system, it would print something like

Are you lonely?

Anyone have a better memory of this than I do?

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

I remember my old TRS-80 Color Computer. It only had 2-letter
abbrevisations for all errors. The one for "file not open" when
you tried to read/write a file was:

?NO ERROR

It amused me when it happened.

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

I got an error message on time while I was copying a file, and the
system seemed to be hung up. Just as I was going to attempt to abort
out the machine came back.


oh........ I give up.... dumping core now!


and the damn thing did !!!!!

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

When I was working at Mark Williams Company, I had a midnight project to
take the Atari-ST version of make and put much of the shell functionality
(as far as command line parsing, wild card expansion, and a few built-in
functions) and 'cc' into the make executable, thereby improving the speed
of builds and such. I never did finish this, but I changed the standard
$ make love
Not war?
...
to
$ make love
For heavens sake, doesn't anyone just talk anymore?
...
and considered adding a random selection of other comments, like
Not tonight, I've got a headache.
I beg your pardon?
Your place or mine?
Maybe someone else has managed to hide something like this into a
commercial package.

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

When I was in college the entire school was using a single PDP-11/40
under RSTS/E. We had somewhere around 20 DECwriter II's (LA36's) for
use by the students in various places around the campus. One evening
I encountered a terrified beginning FORTRAN student who had encountered
a bug in the FortranIV compiler we were running at the time. Something like:

FORTRAN FATAL INTERNAL ERROR
FATAL COMPILER DAMAGE REPORT FOLLOWS

followed by a page and a half of register and stack dump info. This
student was convinced that he'd broken the compiler, and that he'd be
in big trouble for breaking the compiler for everyone else.

At another point that year, (April 1) someone (I won't say who) edited the
system error message file.


?Invalid Character At Terminal -- Please Go Away
?Unibus timeout -- send in a new quarterback
?Ouch, That HURTS!

And other gems. The computer center manager was not thrilled.

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

I worked on a UNIX system that had an editor called e. Once entered
it took control of the screen and required some highly unlikely sequence
of key strokes to exit. It was fairly easy to type e by accident so
to avoid this annoying fate some fellow aliased e to the message
You must be joking.
One day an e user decided to use his terminal and got a surprise.

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

> "Error: Error ocurred when attempting to print error message."

I once blew away my VMS shell process by redefining the standard error file
SYS$ERROR (I think, it's been awhile). You execute the command and things
are fine, then you run your pascal program which dies with an error printed
to PAS$ERROR. PAS$ERROR is assigned to SYS$ERROR, which is assigned to
something invalid. The OS wants to tell you that the error channel is
invalid, and what does it try to do? Print on SYS$ERROR. At this point, I
got a hexadecimal register dump(!!) and blown off the system. And this was
on a "commercial" OS. How graceful.

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

>"Error #1: Power supply not found"

Or my favorite real error message, found in the User's Manual for the Atari
800 computer, which produced only numbers for errors, so you had to look up
the translation in the manual:

ERROR 0: POWER NOT ON

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

Shortly after I started work at the Stephen F. Austin State University computer
center as a support person, we had a coed come in with a very strange problem.
She had been trying to do her FORTRAN homework, and had run across a bug in the
FORTRAN compiler (ANSF on Honeywell CP-V). On her printout was some diagnostic
information, followed by the words:

Break Rob's knuckles.

I've always wondered who Rob was, and what he did wrong.

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

>I think it was a remark in the BUGS section of the manpage for tunefs(8),
>something along the lines of "You can tune a filesystem, but you can't tuna
>fish"... Alas, all I can check right now is the Apple Unix man pages, which
>seem to have had the fishy witticisms excised. :-(.

The unix system we used at this university a few years back had two strange man
entries that went something like:

$ man fish

would give you:

Don't say "fish", Bishop. It doesn't mean anything.

and

$ man overboard

would give you:

# # ####### # ###### ###
# # # # # # ###
# # # # # # ###
####### ##### # ###### #
# # # # #
# # # # # ###
# # ####### ####### # ###

BUGS: No life raft

raf

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

> My personal favorite: "Oops! Error while handling error!"
> (a concurrent C compiler)

My favorites were from the older Apollo OS's, two of the systems errors
were (I believe I remember them correctly):

Can't find wicked faraway objects.
and
Can't fit 27" tape through 25" door.

These were actually given in response to a request for meaning from
the stcode.

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

>}On the venerable Model I Trash-80, the DOS had a vector reserved for what the
>}manual listed as "Unprintable Error". The exact meaning was never defined.

The MSDOS 1.0 manuals had a listing for "Invalid Error".
Talk about getting it wrong.

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

error messages. get this one (today, friday, MARCH FIRST, 1991) our mainframe
decided not to allow logins.

why was that?

Nobody was validated for access on february 29th, 1991 (btw, what day of the
week was that?!)

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

>[ in regards to the expression "if (a = b)" instead of "if (a == b)" ]
>
>Think *lint*. IMHO, there is nothing we need less than a compiler spitting
>out more useless verbage.

The only problem with that is that many PC based C compilers don't include
a lint program. It makes sense that the programmer at least have the option
of enabling various warning messages. Strangely enough, I once comitted
the exact opposite mistake. I had a C statement like this:

i == j;

The compiler (bless its little heart) gave me the warning:

"code has no effect"

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

(Sorry if this is a well-known one. I'm new to Unix.)

Just to rehash an old thread... Today, I accidentally sent an empty mail
message, and Ultrix said, "No message, no subject; hope that's ok."

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

Here is another first time post to the net. Hope it meets with your
approval...

I was learning PL/1 a couple years ago and for our first or second
assignment we had to split one file into two files based on the first char
on the line. The program compiled correctly and I even got output of sorts.
The result was the following line...

I the most critical examiner of all have determined that there is an error on
line 42.

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

Computers running a DTK BIOS report a parity error as:

Parity Error But Segment Doesn't Found

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

Then there was level D of TOPS (before DEC gave releases numbers, and
TOPS was the PDP-10 OP Sys; there was no TOPS-10 (or even Texex yet)).

MORE CORE AVAILABLE, BUT NOT FOR YOU

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

I love these. In the SunOS 3.0 source code, somewhere in the VM
system I think, there was a line that said:

panic ("Shannon and Bill say this can't happen");

I saw this one for myself, in 1986, working for a now-defunct company
that was a Sun source licensee at the time. (Saw it in the source,
that is - never saw it happen :-).

....

A DEC oldtimer told me that a DEC-10 once printed

PUNT

after a particularly misguided attempt to get it to boot, is this
one apocryphal?

Does anyone collect these things?

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

I've heard -- or read, I think -- about some code that contained the comment
"you aren't expected to understand this". Seems to me it was in TCP/IP.

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

>I've heard -- or read, I think -- about some code that contained the comment
>"you aren't expected to understand this". Seems to me it was in TCP/IP.
>/kenw

The Whitesmiths 'C' manual had a line like that in the bugs section
of the manual page after a particulary harrowing description of,
as I remember, an internal function.

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

> I've heard -- or read, I think -- about some code that contained the comment
> "you aren't expected to understand this". Seems to me it was in TCP/IP.

Deep inside the Teradyne hardware modeler code is a routine that feeds a
whole bunch of hex numbers into a SYS$QIO call. The only comment is
'Weird magic happens here'.

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

I don't collect these things, but I have one to add, and I'm hoping
someone has an Earthly explanation for it. This happened on a
VAX 11/750 running 4.3 BSD. We've all seen the "You have new mail."
message after the csh prompt, but ONCE it actually said instead
"Thou hast new mail." It's only happened once! And I swear it
happened! Has anyone else ever seen this? I don't even know what
triggered it!

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

Aaah, but then I want to know about *these* strings, found
(here) in /usr/local/bin/mail:

Too much "sourcing" going on.
Okie dokie
Mail's idea of conditions is screwed up
~h: no can do!?
Too many regrets
detract asked to insert commas
metoo
Somethings amiss -- no @ or % in arpafix
Made up bad net name
ubluit
Who are you!?
; why =

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

The Algol compiler for the ICL 1900 used very occasionally collapse with
the message:

"The impossible has happened!"

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

Tandy was big on the hidden Trek messages. On of their TRS-80 6.x
upgrades had an ASCII quote buried way out on an unused track.
Something like...

Beam me up Scotty, there's no life out here.

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

The VS/PASCAL compiler under VM/CMS (there, that's two V's already and I
haven't even gotten to the real point yet) goes one step further in compiler
honesty. If your program compiles successfully, it will issue

NO COMPILER DETECTED ERRORS.

I swear I can see the italicization on the words "COMPILER DETECTED."

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

Epoch has a few funny messages in it for disasterous circumstances.
Some of them are:

"Holy Panes Batman, the window's missing!" - when a X window structure
isn't there.

"Holy PH, Batman, the buffer's missing!" - a window without a buffer.
This one has actually been seen outside the lab.

"Holy Vectors Batman, I can't get more lines!" - malloc failed.

The error message I want to put in, but never have had the chance, is
"System Error - Sureness out of Bounds". You PLATO heads know what I
mean.

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

Expressionist (a Mac application for doing equations) has the
following error messages in it:

Mysterious Error -nnn

Internal Error: Illegal hedge TV number. (huh?? what?!)

Internal Error: BlinkThere or HiliteThere messed up.

Bad External File System: Boy, is your system messed up. :)

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

Honeywell's customer service department once got a very concerned
message from a confused customer whose MULTICS system had printed:

Hodie natus est radici frater

before giving up the (holy?) ghost. ``Today unto the root is born a
brother''.

This is a hack on ``Hodie natus est filius nobis'', or ``Today unto us
is born a son''. I don't know the reference exactly, but it's in
Handel's Messiah.

It seems a Multics hacker (allegedly Bernie Greenberg) at MIT had
inserted the liturgical allusion when it detected the ``impossible
event'' of the filesystem deciding it had two roots.

[Greenberg is also known for having taken notes in Latin (``for
clarity and precision'') when in the fever dream induced by first
exposure to a Rubik's Cube.]

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

In the IRC-server there are some "nice" messages, and here's a coupple of them:

Looks like mere mortals are trying to enter the Twilight Zone
FATAL: Major security hack. Notify Administrator.
Identity problems, eh ?
Bad Craziness
'tis is no game for mere mortals
Go away and get a life
Death before dishonour ?
Dave, don't do that...
Good afternoon, gentelman, I'm a HAL 9000 Computer
Only few mortals may try to enter the Twiligth Zone
Only real wizzards know the spells to open the gate of paradize
Trying to unlock the door twice eh ?
Use the force, Luke !
Change balls, please

My favorite is definitivly the "Bad Craziness" ... :-)

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

On an old Perkin-Elmer Machine, the Pascal Compiler would say:

"NONE of your errors have been found"

The compiler was smart enough to know that your program had errors anyway :-)

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

Now, granted, this is something one of us here did, but our VAX precedes
its panics with the message

"Well, you ran into something and the game is over."

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

My favorite RSTS/E error message is "Unused error message #xxx". Somehow
I managed to get these when hitting ^C as a certain program loads.

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

Take this for what it's worth, but at a shop where I once worked, an
overnight processing run would sometime fail with the error message:

"FALL DOWN GO BOOM"

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

Well, this is just a story, picked up from the early days of Usenet, so it's
possibly unfounded and furthermore some folks have likely already seen it,
but it gave me days of snickers.

Story goes that that some little text-edit subsystem of something or other
which had very few things that could go wrong had only one error message,
used for both user and internal errors:

Data potato doo-wop doo-wop

When pressed for an explanation, the programmer said: "well, I figured
it hd to print *something* when there was an error."

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

> When you type your mail and type ~C (typo for ~c) my unix mail tells me:
>
> Okie dokie, core dumped.

bash$ cat > x.c
main() { execl ("/bin/mail", 0); }
^D
bash$ gcc x.c
bash$ ./a.out
puke
bash$

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

On the old NCR Towers I used to get the following message on the
console whenever someone on a terminal would hold down the left
(or right - I forget which) arrow key:

spurious multibus interrupt

It took us a long time to figure out what was causing the messages
since nothing else bad happened and the people on the terminals
would be looking at their own screens while typing. Anyone on the
console, on the other hand, would look at the process table for
suspicious processes, etc.

NCR took the bug report with a great deal of disbelief, but their next
release of UNIX didn't have the problem.

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

I predict that Eighth Generation computers
will compile no programs, run no applications,
and access no data. Instead they will be
designed and tuned to give a continuously
variable spectrum of elegant and precise
error messages describing your failure to
induce them to do so.

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

As long as we're running strings on everything from here to
Berkeley...

Someone in a now-junked message pointed out something from lint. I
don't remember what it was, but here's one I did find in lint, SunOS
4.1.1 (I think):

EDOTDOT!!!!

Your guess is probably much better than mine.

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

You think THATS funny (it is), but strings "/usr/lib/sendmail" for a few laughs:

>From the silly:-

You wascal wabbit! Wandering wizards won't win!
savemail: HELP!!!!

to the plausible but still silly:-

Who are you ?
Can't parse myself!

to the plain ridiculous:-

MAIL DELETED BECAUSE OF LACK OF DISK SPACE

- not to mention all the SMTP "HELO" dialogue...

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

What about this one (present in SunOS 4.1.1 and who knows where else)
when attempting to use the csh builtin 'suspend' from a login shell:

Can't suspend a login shell (yet).

What's that supposed to mean??? Not until later in the afternoon? Not
until they rewrite the shell? Not until you get rid of stopped jobs?

:-) I got quite a chuckle out of that one.

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

The SAIL compiler had a number of puns on sailing, one of which was the
compiler internal error message which referred to "dryrot" (if you don't
know anything about boats and sailing, be aware that "dryrot" is the
bane of a boatowner's existence, and once it sets in your boat is
doomed...). The modula "dryrot" message seems to indicate that at least
one implementor had used SAIL.

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

The classic short message was from JOSS, one of the early interactive
languages (from the mid-1960's; it ran on a machine at RAND Corporation
called the JOHNNIAC). It was on a small machine. It had one catchall
message:

EH?

this was based on the premise that the error would be so blindingly
obvious to the programmer that no further indication of the nature of
the error was required.

Wrong.

(I worked in another interactive system that thought this was such a
cute idea that they used it. This was a mistake. If you knew the
language, the cause of the error may have been obvious, but if you
didn't know the language you were in deep trouble. They extended this
philosophy to the printed documentation!)

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

Well, I've seen the "You are a charlatan" in a mail context before,
though only on a DEC-20. Lessee, any DEC-20s left... :-(

Oh yeah, sri-nic ..err.. nic.ddn.mil.

bordeaux$ telnet nic.ddn.mil 25
Trying 192.67.67.20 ...
Connected to nic.ddn.mil.
Escape character is '^]'.
220-NIC.DDN.MIL SMTP Service 6.1 at Fri, 26 Jul 91 18:21:06 PDT
220 Don't Worry.
helo nonesuch.noao.edu
250 NIC.DDN.MIL - Never heard of that name, bordeaux.kpno.noao.edu
helo cc.utah.edu
250 NIC.DDN.MIL - You are a charlatan, bordeaux.kpno.noao.edu
quit
221 NIC.DDN.MIL -- Be Happy!

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

We used a language called JEAN on ICL's 1900 series. We knew this was a
dialect of JOSS but it must have been closer than we knew as it used the
same error message.

The JEAN error message I liked was "Your expression has defeated me" which
was generated by a program such as
1.1 X=X
1.2 PRINT X

I never understood this until I was explaining to someone the meaning of
recursion in Algol. To demonstrate that simpler languages could not
handle recursion I gave JEAN a recursive definition of a factorial and
to my surprise it gave the right answer!

To understand this you also need to know that in JEAN
SET X=3 gave the variable X a value.
LET X=3 defined X as a function.
and the default verb was LET, not SET.

Hence "Your formula has defeated me" meant that it had run out of store
because of infinite recursion.

What a pity Basic defeated the much more elegant JOSS.

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

Twenty or so years ago, the Fortran IV compiler for the SDS Sigma 2
would occasionally comment at the bottom of your listing:

WARNING: 54 - PROGRAM NOT RECURSIVE

(That *looks* right. I'm pretty sure about the number and the text.)

I was somewhat startled by the message, since I knew Fortran programs
were not recursive.

Eventually, in a fit of boredom and despair, I wrote a recursive
program which produced the error message. Worked fine, too. So far
as I know, it may still be running. Wasn't RE-ENTRANT tho.

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

This carried over into other operating systems, including RT-11. Another
one I remember is HELP ME, which came back with:

Help is not available for you.

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

Masscomp C compiler:
"Insane structure member list"

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

In most cases I've found that a good way to find out what you can do with
a language is to read well-written descriptions of what you *can't* do
with it. I got into systems programming in the early 1960s by reading
the error message listings in the FORTRAN compiler, first for the 7090
FMS and later in IBSYS. Of course, in today's world the vendors would
have collective apoplexy if anyone seriously asked to see the compiler
sources, and the error message descriptions seem to routinely go something
like this:

Error ABC123D: User Error

Explanation: An unknown error has occurred in an unidentified program
while executing an unimplemented function at an
undefined address.

User Response: Correct error and resubmit.

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

(this is what an older version of MMDF says)

telnet deskpro.sow.econ.vu.nl smtp
Trying 130.37.48.1 ...
Connected to deskpro.sow.econ.vu.nl.
Escape character is '^]'.
220 deskpro.sow.econ.vu.nl Server SMTP (Complaints/bugs to: postmaster)
helo foo.bar
250 deskpro.sow.econ.vu.nl - Liar, Liar! Pants on Fire!
quit
221 deskpro.sow.econ.vu.nl says goodbye to kappl.cs.vu.nl at Tue Jul 30 22:13:43
.
Connection closed by foreign host.

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

I was just installing PCSA version 4.0 for DOS on a machine here, and after the
boot I got a system error. Okay, no problem, I do a quick

USE \\HOSTNAME

to see if the machine knows anything about the host. Lo and behold, it does
but it refuses to tell me:

Error: Success


-----------------------------------
, Mike




Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Friday, August 29, 2008

Mac OS X Shell Scripting Tips For Young And Old

Hey there,

Today's post, as the title suggests, is veering slightly off the beaten path of this blog's general content. But, in keeping with this blog's tradition (and mission) of exploring all things Linux and Unix, it's not too far of a stretch. Hopefully the "Mac" in the title didn't put anyone off (Like, say "Vista," might ;). We're actually going to be looking at their underlying Linux subsystem, which is where we come full circle and it all makes sense. Mac has been fronting their BSD'ish CLI for quite a while now and, if you can use RedHat, Suse, FreeBSD or any of the other myriad varieties of Linux on the market today, OS X's insides should be easy enough for you to figure out. I'm happy, also, that Mac has a Linuxy ( Is that a word? judges? ;) command line interface. The marrying of the fancy windows interface with the bare bones power of Linux should make it easier for the next generation of computer-savvy users to not only enjoy the pretty pictures ( and the funny sounds they make when you click on them with a pointing device), but also (by necessity) possess a rudimentary knowledge of the more powerful underpinnings of all that Window dressing.

Either that or they'll be highly proficient in Fake-DOS v49.x and, if something goes horribly horribly wrong, all the jobs in the tech sector will be for BAT file programmers. I secretly wanted to be one when I started out in this business. If someone threw me enough dough, I'd still do it. Can you imagine getting paid to barely be able to do anything? ;) No offense to Windows fans out there. I, admittedly, use it to run PuTTY, Cygwin, ActiveState Perl and many other useful programs and find it to be an excellent repository for all my log files and script backups... Getting off track; sorry ;)

So, why the Mac? Yesterday, my son ( 5 years old and still kicking - literally ;) started kindergarten. I went to the orientation, because I didn't want to miss out on a milestone in my son's life just so I could catch the early train home, and - to my amazement - they actually had 3 Mac's in the classroom. Computer training (to what degree, I'm unsure) is now part of the curriculum in "kindergarten." This may come as no surprise to a lot of you, but I (being the almost-old fogy that I am) was blown away. I remember kindergarten (well, ...some of it, anyway ;) and I have hazy recollections of dealing with wooden blocks (sometimes with letters and numbers painted on the sides), stuffed animals, monkey bars, crayons, paper and absolutely nothing more "technical" than the interpretation of another person's tone of voice ;) I actually was introduced to computing in the 7th or 8th grade when our school went all out and picked up 3 or 4 TRS-80's from Radio Shack. My first program was a simple if/else clause following a question and "input prompt." My only other masterpiece was an ascii art drawing of a really long diagonal line ;)

Anyway, seeing my kid go off to school - for the first time on his own - in the big yellow bus this morning still haunts me. Not in a bad way. More of an onset of realizations that things are much different now than they were when I was young, that my kids are going to grow up and eventually move out on their own and fiercely demand their independence (even though, for now, they're still sticking like glue ;), that I'll eventually really miss the way things are now and that I waste far too much time "not" paying attention to the most important things in my life. So this little OS X crib-sheet is my way of giving my son something extra (taking time away from my work to give to my son, instead of the other way around which, although considered normal, seems increasingly counter to the development of a healthy relationship with anyone; let alone your own flesh and blood) even when I can't be there with him in person.

Here's to you, Ian. Hopefully, you'll find these tips helpful, easy to follow (hint: don't ask the "teacher" for help with these ;) and you won't use them to bring those Mac's down to whatever their equivalent of a blue-screen is ;) Either way, you'll make me proud :) I love you unconditionally and, if you just want to stop reading at this point, make sure you check out number 10 on the list below before you check out completely :)

NOTE: These links (except the last) all point back to MacOSXHints.com. Although I would love to (I actually do own a G4, with OS X Leopard, that's sitting in storage ;), I can't take credit for them. From what I've found tinkering around with other people's boxes, I could probably write a thing or two, based on recollection, and have it work out correctly, but - for now - I'll leave it to the folks who really know what they're doing with OS X.

Enjoy,

My Lifted List Of Probably Fun Things To Try On An Existing OS X Macintosh (especially a public one ;)

1. Grab all the emails from an address book

2. Show all events in the Calendar's search results

3. Install the FISH shell

4. Move your cursor without moving the Zoomed-In screen

5. Create a Dock bookmark to show all Safari bookmarks

6. Become root using sudo with no password

7. Professor Fizzwizzle and the Molten Mystery - A Fun Puzzle Game

8. Easily add iTunes lyrics to songs via AppleScript

9. Create a visual catalogue of setups and dialogues

10. Send Carly (of iCarly.com) a personal Txt Message <-- He loves that show, although he may hate me by the time he gets around to reading this ;)

, Mike




Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Thursday, August 28, 2008

Online Encyclopedia Shell Script For Linux And Unix

Hey There,

Today's Linux/Unix bash shell script is a follow up (and the finishing touch, I hope ;) to a whole slew of scripts we've written to mine the knowledge on tap at reference.com. If you missed any of the others, you can still find them in our older bash script posts to access the online Thesaurus and, of course, the online dictionary. This time we're breaking the chains and losing the albatross by finally attacking (with some level of precision) the Online Encyclopedia and producing a shell script does it as much justice as we could muster.

Note added after initial post: Forgot to include the Online Language Translation Script. It fits in with this bunch fairly well :)

One of the major differences you'll note between this script and the others is that we've included a "pager" variable. If you've ever checked out the reference.com Online Encyclopedia you're aware that the average return on a query is substantially larger than what you get back from a typical dictionary definition or thesaurus synonym query (not to mention the size of your terminal window). The screen shots we have for you, below, were the result of painstaking effort trying to find a word or phrase that didn't have an exceedingly long and thorough write-up. We chose "/usr/bin/more" as the pager for this script, but it can be easily changed to "/usr/bin/less," or whatever your favorite pager program happens to be.

After toying with this project for a while, trying to figure out why some pages worked, some didn't and where in the good Lord's name any consistent marker could be found to create consistent output, I've actually kind of gotten into using it. Now, if I'm at my terminal "working my fingers to the bone ;) " I can just type:

host # ./ency.sh engelbert humperdinck

and try to figure out what my generation "doesn't" see in him ;) ...apologies to die-hard fans.

Like our previous scripts, this script uses wget and sed. This script was also an attempt at "brute force scripting" (just writing it as we think it), but it ended up being so aggravating trying to find the right mix of regular expressions to get back decent results for the broadest amount of queries, that I think the method can, now, only be referred to as "blunt force scripting" (that's our new term for scripting as if you'd just been hit in the head with a brick ;). There are a few places the script could be tightened-up, but, to be perfectly honest with you, we're scared to death of changing anything about it right now. Maybe later, when we've steeled our nerves ;)

Below are a few screen shots of the script's output. The first is for an actual "one-pager" on a query for a pretty decent novel named Glamorama and the other is what you can expect to see when your query returns the equivalent of 15 leatherbound volumes of text on a query for Robert DeNiro. The last, just shows common error messages we generated on purpose.

Possibly interesting fact: If anyone out there is having an 80's moment and vaguely recalls Toni Basil ("oh, Mickey, you're so fine, you're so fine, you blow my mind..." why do I know the lyrics? ;), you'd be surprised to know that even "her" entry spanned multiple pages. I was actually surprised to find that she's also an actress and starred with Jack Nicholson in Five Easy Pieces under the very same name.

Click on the captures below to see them all in IMAX:

Glamorama Encyclopedia Entry

Robert De Niro Encyclopedia Entry

Encyclopedia Shell Script Errors

As one last bit of explanation. There are 2 specific error conditions that we ended up throwing in here. One is pretty obvious, involving No Results being found. The other had me going for a little while, since I was positive that a query on "linux" must have some return, since a query for "unix" did. It turns out that, when the Online Encyclopedia returns way too many results (I believe around 752 for "linux") it will state that it found a whole ton of results and is only going to show you one. The glitch in the program here is that, at some large number, it says that but then doesn't return an actual entry. I ended up noticing this when I finally broke down and parsed the HTML return and saw nothing, followed by a visit to the website via browser where I noticed the condition. You can see what I'm talking about right here, unless they've fixed it already (or it only happens intermittently). In any event, we wrote a check so that, if there are a large number of results, and it does return one, you'll still get it, but you'll get a self-explanatory error message if you hit this bug. Not that it needs to be said, but every query returns more than one result (insofar as our field-testing has gone), and the default behaviour of the site is to only return the top "one" and include links to the others.

Hope you enjoy this script, and can find some use for it. Any suggestions for improvement would be greatly appreciated. Be forewarned; there is the possibility that some of your queries may come back with extra parts added on that we didn't catch (usually tacked on to the end... phew), which could also make the output look horrible. This is the best we've got "for now" :)

I'm just glad somebody already figured out how to order Pizza online so I don't have that hanging over my head ;)

Cheers,


Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License

#!/bin/bash

#
# ency.sh - More than you ever wanted to know about anything
#
# 2008 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

if [ $# -lt 1 ]
then
echo "Usage: $0 Your Encyclopedia Terms"
echo "May be two or more words separated by spaces"
echo "but only one definition per execution."
echo "Ex: $0 money"
echo "Ex: $0 the beatles"
exit 1
fi

args="$@"
wget=/usr/bin/wget
pager=/usr/bin/more

if [ $# -gt 1 ]
then
args=`echo $args|sed 's/ /%20/g'`
fi

echo

$wget -nv -O - http://www.reference.com/search?q="$args" 2>&1|grep -i "No results found" >/dev/null 2>&1

anygood=$?

$wget -nv -O - http://www.reference.com/search?q="$args" 2>&1|grep -i "<cite>" >/dev/null 2>&1

toomuch=$?

if [ $anygood -eq 0 ]
then
args=`echo $args|sed 's/%20/ /g'`
echo "No results found for $args"
exit 2
fi

if [ $toomuch -ne 0 ]
then
args=`echo $args|sed 's/%20/ /g'`
echo "Too many results returned for $args"
echo "Try doing a broader query - For Ex:"
echo "$0 linux = Too many results"
echo "$0 linux os = Information!"
echo "Double check at www.reference.com"
echo "to see the difference"
exit 3
fi

$wget -nv -O - http://www.reference.com/search?q="$args" 2>&1|sed '1,/Cite This Source/d'|sed '/External links\|See also\|More from Wikipedia/,$d'|sed -e :a -e 's/<[^>]*>/ /g;/</N;//ba' -e 's/$/\n/'|$pager

exit 0


, Mike




Douglas Taylor submitted these enhancements to make the output look much nicer. Thanks, Douglas!


1) Run the output through fmt before outputting. It will wrap the paragraph text fairly nicely, although it kind of destroys tabular data, and the indenting can get weird, or

2) Use lynx with the -dump option instead of wget. I replaced the final wget command with

lynx -dump http://www.reference.com/search?q="$arg" |sed '1,/Cite This Source/d'|sed '/External links\|See also\|More from Wikipedia/,$d'|sed 's/\[[0-9]*\]//g'|$pager

and the result looks fairly nice.


Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Wednesday, August 27, 2008

The Upside Down Of HTML On Unix and Linux: Backward

Hey there,

If today's title throws you off a little, that's good. I was going for an allegorical representation of the output of today's Perl script in the title of this post. The beauty of it is, even if I don't succeed, I have done my job, since (although this script is supposed to produce upside down and backwards HTML pages) the outcome of any input handed off to today's script may, or may not, have every single line reversed and in top to bottom order. In fact, when it comes to the more complicated issue of handling tags that dictate image, span, table, style and other such extravagant beautification, it may turn out a web page so horribly disfigured that you'll hardly recognize it. ...although, maybe that was the point. I allow my friends to talk me into wasting my time on folly like this far too often. ...probably because I enjoy it ;)

If you recall, or haven't checked it out yet, we put out a much more predictable script to reverse all the text in an HTML page yesterday ...well, most of it anyway. Reversing HTML tags themselves produces empty space for the most part :)

But, here it is: My final "figurative gun to the head" script-for-hire this week. When you see how beautifully the code is rendered and how the subtle nuance of each line seamlessly blends with every other in an intricate weave of logical, if not poetic, symmetry, you'll agree that I must be completely full of @@@@ :) Today's script is pure hack-n-slash. If anything, it might be eligible for priority placement in the circular file ;)

I took a snapshot of the bottom of my blog (I don't want to infringe upon anyone else's copyright but my own ;) from before the script conversion, shown here:

Click below to experience this picture in it's original splendour:

The sane version of our HTML page

and then this one of the top of the page after running it through the script:

Click below to be taken to another page where a larger version of this indecipherable nonsense resides:

The confusing version of our HTML page

The aim was, of course, to grab everything between the "body" tags in an HTML file, reverse every line - writing from right to left - excluding HTML tags, while printing the lines within the "body" in order from last to first. It's very easy to run on any webpage you download, like so:

host # ./updown.pl webpage.htm
Upside Down File Saved As: updown.webpage.htm.htm


And then you can open that up in your web browser and be amazed. Of course, your mileage may vary. Sites like Google were they do heavy CSS or any page that relies primarily on pictures to represent text won't give you that same sick-in-the-pit-of-your-stomach feeling. In fact, interestingly enough, except for the fact that you lose the pictures, Google comes out of a run through this script looking almost exactly the same!

Hope you enjoy playing around with this as much as my friends enjoyed criticizing my work while they casually ignored their own ;) Just kidding. But, in all seriousness, again, your results will most definitely vary. Take this script with a grain of salt, an ounce of prevention, a pound of cure and a ton of prescription pain-killers ;)

Tomorrow, we'll get back to some meatier subject matter,

Cheers,


Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License

#!/usr/bin/perl


#
# updown.pl - Completely fudge your web page!
#
# 2008 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

if ( $#ARGV != 0 ) {
print "Usage: $0 yourwebpage.html\n";
exit(1);
}
$FILE=$ARGV[0];

if ( ! -f $FILE ) {
print "File $FILE does not exist! Exiting...\n";
exit(2);
}

$OUTFILE="updown.${FILE}.htm";
$muck_it_up = 0;
open(FILE, "<$FILE");
@file=<FILE>;
close(FILE);

open(OUTFILE, ">$OUTFILE");
foreach $line (@file) {
if ( $line =~ /<BODY[^>]*>/i ) {
$muck_it_up = 1;
print OUTFILE "$line";
} elsif ( $line =~ /<\/BODY>/i ) {
$muck_it_up = 0;
foreach $ud (@upside_down) {
print OUTFILE "$ud\n";
}
print OUTFILE "$line";
} elsif ( $muck_it_up == 1 ) {
$tag = $line;
if ( $tag =~ /</ ) {
if ( $tag !~ /<(!|img|br)/ ) {
$tag =~ s/<\//<zOiKs/g;
if ( $tag !~ /zOiKs/ ) {
$tag =~ s/</<\//g;
}
$tag =~ s/zOiKs//g;
$tag =~ s/(<(h[12345]|span|a |br|p|div|textarea)[^>]*>)/$1<bdo dir="rtl">/ig;
$tag =~ s/(<(\/h[12345]|span|a |br|p|div|textarea)>)/<\/bdo>$1/ig;
}
}
unshift(@upside_down, $tag);
} else {
$line =~ s/(<(h[12345]|span|a |br|p|div|textarea)[^>]*>)/$1<bdo dir="rtl">/ig;
$line =~ s/(<(\/h[12345]|span|a |br|p|div|textarea)>)/<\/bdo>$1/ig;
print OUTFILE $line;
}
}
close(OUTFILE);
print "\nUpside Down File Saved As: $OUTFILE\n";
exit(0);


, Mike


Banner for College Student-Oriented Sites (728 version 1)



Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Tuesday, August 26, 2008

Perl Script To Reverse HTML With BDO on Linux and Unix

Ahoy there,

Today, we're putting out a little Perl script to deal with the obscure. Now, I realize that my view is biased heavily by living on American soil, but I can't remember, for the life of me, the last time I came across a Hebrew web page. And by Hebrew, I mean the whole reading from right to left thing. I probably wouldn't even understand it if I recognized it when I saw it ;) It did remind me however, that HTML 4.0 introduced a tag to deal with just that sort of translation. Come to think of it, when applied more liberally it would be a great translation tool for Japanese comic books that read from right to left and from back to front. Anyway, all this talk of forward and backward, left and right... just add up and down and I'll be running to the drug store for some Dramamine ;)

To get directly to the point (finally ;), the tag we're using in this script is called, simply, "bdo." It actually has more options than the "one" we're going to use, but the "dir" attribute is essential in allowing this script do what it does very simply (and actually the only required attribute). The dir is short for direction and can have a value of either "ltr" (left to right) or "rtl" (right to left). So, if you're reading this blog in Hebrew or Japanese, all you need to do is flip flop the value of that variable in the script and it will reverse your HTML pages as well :)

For completeness' sake, the bdo tag can have the following additional attributes (none of which are "required"): class, id, lang, style and title.

The bdo tag is also only valid when used within its own container, or as an attribute of one of the following: a, abbr, acronym, address, applet, b, big, blockquote, body, button, caption, center, cite, code, dd, del, dfn, div, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, i, iframe, ins, kbd, label, legend, li, noframes, noscript, object, p, pre, q, s, samp, small, span, strike, strong, sub, sup, td, th, tt, u or var.

To give you an idea of what today's Perl script accomplishes, I pulled down our website front page, from yesterday and put it through the grinder.

Here's an original snapshot of yesterday's HTML page:

Click below to see this bad boy in full size ;)

Original Web Page

and the "somewhat" reversed version after feeding it to bdo.pl:

Click below to see this gigantic headache in full size ;)

Reversed Web Page

Fun? Yes. Amusing? Possibly. Subject of a lifelong obsession? Doubtful, I hope ;)

You can run the script (which is only written for the command line, but could be easily tweaked to use in a CGI framework) very simply, like this:

host # ./bdo.pl tlaum.htm
Reversed File Saved As: tlaum.htm.5964.html


It can also be improved upon so that it catches every little last thing! You may notice problems with text styles and certain portions of text not getting reversed. This is a limitation of the script, as it stands, and can, most definitely, be improved upon. If it bothers you a lot, you can always use perltidy to clean up the code some ;)

Easy peasy. Enjoy :)


Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License

#!/usr/bin/perl

# bdo.pl - Use the bidirectional tag for once in your life ;)
#
# 2008 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

if ( $#ARGV != 0 ) {
print "Usage: $0 yourwebpage.html\n";
exit(1);
}

$FILE=$ARGV[0];

if ( ! -f $FILE ) {
print "File $FILE does not exist! Exiting...\n";
exit(2);
}

$VAR=$$;
$OUTFILE="${FILE}.${VAR}.html";

open(FILE, "<$FILE");
@file=<FILE>;
close(FILE);

open(OUTFILE, ">>$OUTFILE");
foreach $line (@file) {
if ( $line =~ /(h[12345]|span|a |br|p|div|textarea)/) {
$trans = $line;
$trans =~ s/(<(h[12345]|span|a |br|p|div|textarea)[^>]*>)/$1<bdo dir="rtl">/ig;
$trans =~ s/(<(\/h[12345]|span|a |br|p|div|textarea)>)/<\/bdo>$1/ig;
print OUTFILE "$trans\n";
} else {
print OUTFILE "$line\n";
}
}
close(OUTFILE);
print "\nReversed File Saved As: $OUTFILE\n";
exit(0);


, Mike




Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Monday, August 25, 2008

Unix and Linux Online Language Translation Script

Hey There,

This week's start-off Linux/Unix bash shell script is a follow up to our previous online dictionary shell script and Thesaurus shell script. I was thinking of doing the online Encyclopedia today, but, for some reason, I got sidetracked on The BabelFish Language Translation Site.

This script offers the full functionality of the original website's text translation, except I left out the HTML page translation part. I figure if you're going to translate an entire webpage, it would look a lot nicer using a regular web browser ;)

Like our previous scripts, this script uses wget and sed. This script was also written using "brute force" scripting (that's my term for writing while I think it through). I don't know (at this point) where it could be made better, but I'm sure that it can :) I'll give it some thought later, and any recommendations are always welcome!

BTW, a huge "shout out" to the folks at AutoPOST for help getting all the POST elements I needed to pass in the POST request to the online translator. (I fuddled around for hours before I went looking for help... ). Good stuff. Check it out :)

Below is a screen shot of the output spewed when you throw the script the "-h" flag:

Click the picture below to see it in full size:

language preference abbreviations

Below is a screen shot of the script's output translating from one language to another, then back again (to see how literal the translation was - this can be very funny sometimes ;) and a long convoluted statement showing one limitation of the script with regards to the handling of "special" international characters:

Click the picture below to see it in full size:

language translations

To get started, either do:

host # ./trans.sh <-- for a straight up help screen

or:

host # ./trans.sh -h <-- to list out the required short names needed to do the translations BabelFish is able to do, as well as the regular help.

Hope you enjoy this bash script, and can find some use for it. Any suggestions for improvement would be greatly appreciated, of course :)

Cheers,


Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License

#!/bin/bash

# trans.sh - Ich verstehe nicht ;)
# Translate between languages using Yahoo's BabelFish
#
# 2008 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

if [ $1 == "-h" ]
then
echo "Usage: $0 TranslationPref YourQuotedPhrase"
echo
echo "TranslationPref Values:"
echo
echo "zh_en => Chinese-simple to English"
echo "zh_zt => Chinese-simple to Chinese-traditional"
echo "zt_en => Chinese-traditional to English"
echo "zt_zh => Chinese-traditional to Chinese-simple"
echo "en_zh => English to Chinese-simple"
echo "en_zt => English to Chinese-trad"
echo "en_nl => English to Dutch"
echo "en_fr => English to French"
echo "en_de => English to German"
echo "en_el => English to Greek"
echo "en_it => English to Italian"
echo "en_ja => English to Japanese"
echo "en_ko => English to Korean"
echo "en_pt => English to Portuguese"
echo "en_ru => English to Russian"
echo "en_es => English to Spanish"
echo "nl_en => Dutch to English"
echo "nl_fr => Dutch to French"
echo "fr_nl => French to Dutch"
echo "fr_en => French to English"
echo "fr_de => French to German"
echo "fr_el => French to Greek"
echo "fr_it => French to Italian"
echo "fr_pt => French to Portuguese"
echo "fr_es => French to Spanish"
echo "de_en => German to English"
echo "de_fr => German to French"
echo "el_en => Greek to English"
echo "el_fr => Greek to French"
echo "it_en => Italian to English"
echo "it_fr => Italian to French"
echo "ja_en => Japanese to English"
echo "ko_en => Korean to English"
echo "pt_en => Portuguese to English"
echo "pt_fr => Portuguese to French"
echo "ru_en => Russian to English"
echo "es_en => Spanish to English"
echo "es_fr => Spanish to French"
exit 0
elif [ $# -ne 2 ]
then
echo "Usage: $0 TranslationPref YourQuotedPhrase"
echo "For Tranlation Options: $0 -h"
echo "Ex: $0 en_de \"hi there. How are you?\""
echo "Ex: $0 en_it \"hi there. How are you?\""
exit 1
fi

langtran=$1
oargs=$2
args=`echo $oargs|sed -e 's/?/\\?/' -e 's/&/and/' -e 's/ /+/g'`
fromlang=`echo $langtran|awk -F"_" '{print $1}'`
tolang=`echo $langtran|awk -F"_" '{print $2}'`
echo

case $fromlang in
zh) longlang=Chinese-simple;fromlang=$longlang;;
zt) longlang=Chinese-traditional;fromlang=$longlang;;
en) longlang=English;fromlang=$longlang;;
nl) longlang=Dutch;fromlang=$longlang;;
fr) longlang=French;fromlang=$longlang;;
de) longlang=German;fromlang=$longlang;;
el) longlang=Greek;fromlang=$longlang;;
it) longlang=Italian;fromlang=$longlang;;
ja) longlang=Japanese;fromlang=$longlang;;
ko) longlang=Korean;fromlang=$longlang;;
pt) longlang=Portuguese;fromlang=$longlang;;
ru) longlang=Russian;fromlang=$longlang;;
es) longlang=Spanish;fromlang=$longlang;;
*) longlang="Unrecognized Language!";fromlang=$longlang;;
esac

case $tolang in
zh) longlang=Chinese-simple;tolang=$longlang;;
zt) longlang=Chinese-traditional;tolang=$longlang;;
en) longlang=English;tolang=$longlang;;
nl) longlang=Dutch;tolang=$longlang;;
fr) longlang=French;tolang=$longlang;;
de) longlang=German;tolang=$longlang;;
el) longlang=Greek;tolang=$longlang;;
it) longlang=Italian;tolang=$longlang;;
ja) longlang=Japanese;tolang=$longlang;;
ko) longlang=Korean;tolang=$longlang;;
pt) longlang=Portuguese;tolang=$longlang;;
ru) longlang=Russian;tolang=$longlang;;
es) longlang=Spanish;tolang=$longlang;;
*) longlang="Unrecognized Language!";tolang=$longlang;;
esac

wget=/usr/bin/wget

echo
echo "Original $fromlang: $2"
echo
echo -n "Translated $tolang: "
$wget -nv -O - http://babelfish.yahoo.com/translate_txt?ei=UTF-8\&doit=done\&fr=bf-res\&intl=1\&tt=urltext\&trtext=${args}\&lp=${langtran}\&btnTrTxt=Translate 2>&1|grep -i 'result'|egrep -iv 'txt-form|tips 1'|sed -e 's/$/\n/' -e :a -e 's/<[^>]*>/ /g;/</N;//ba' -e 's/\&[A-Za-z]*\;/ /g' -e 's/ / /g' -e 's/\(.\)$/\1\n/' -e '/^ *\t*$/d'
exit 0


, Mike




Pete had this interesting comment to share. It brings up a very interesting way of attacking the script and you might find it useful in other situations as well! Our Thanks for the great observation!


Hi! When I copied in the script and ran, I got "unary operator expected at line 11." (or something simlar). I think it was just a slip up ( I do it often ), using the "C" syntax, instead of the shell syntax. In any case, changing to a single "=" corrected that. I usually, also, use the following test construct to avoid problems with shell scripts, when the tested variable may happen to have null contents.

If [ "x$1" = "x-h" ] ... that way, test never has to deal with a null argument.

Pete


Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.

Excellent Web Hosting At An Affordable Price!
www.authorswebhosting.com
These Are The Guys I Use To Host My Online Presence!