Courtesy: Larry Wall, PERL MONGER FOUNDER DEVELOPER:KeyBoard Not found Press F1 to Continue: Programming logic, messages, and logic in software and in nepalese society.Our Nepalese society is now emerging into modern trends, practices, and technologies. Hope it helps get us caught from overboarding.
Larry Wall Says:I once wrote this error dialog after the users annoyed me: “USER ERROR: Replace user and press a key to continue” .It is a wonderful error seen from BIOS of PC era.In MrBunnysBigCupoJava there is the statement “A Java compiler compiles Java code into errors and warning messages, and in the process produces class files containing bytecode./* DO NOT UNCOMMENT THIS WITHOUT TALKING TO */
Found a year after the product was sold to our company; programmer was nowhere to be found, so I uncommented it with no ill effect. ” float sinful = sinf(angle);
float costly = cosf(angle);
More can be read below:
Seen, and believed…
[some long and messy code] # too drubnk to make this workkkkj. debugg latter.
——————————————————————————–
The classic piece of COBOL:
PERFORM SEX WHILE MAN EQUAL TO TASK
——————————————————————————–
Also COBOL:
REPEAT
…
UNTIL THE-COWS-COME-HOME
(or HELL-FREEZES-OVER, or YOU-GET-BORED, or any of a number of other things)
# Flower : Meaning
# $NetBSD: flowers,v 1.2 1997/03/26 06:30:56 mikel Exp $
# @(#)flowers 8.1 (Berkeley) 6/8/93
#
# Upside down reverses the meaning.
African violet:Such worth is rare.
Apple blossom:Preference.
Bachelor’s button:Celibacy.
Bay leaf:I change but in death.
Camelia:Reflected loveliness.
Chrysanthemum, other color:Slighted love.
Chrysanthemum, red:I love.
Chrysanthemum, white:Truth.
Clover:Be mine.
Crocus:Abuse not.
Daffodil:Innocence.
Forget-me-not:True love.
Fuchsia:Fast.
Gardenia:Secret, untold love.
Honeysuckle:Bonds of love.
Ivy:Friendship, fidelity, marriage.
Jasmine:Amiability, transports of joy, sensuality.
Leaves (dead):Melancholy.
Lilac:Youthful innocence.
Lilly of the valley:Return of happiness.
Lilly:Purity, sweetness.
Magnolia:Dignity, perseverance.
Marigold:Jealousy.
Mint:Virtue.
Orange blossom:Your purity equals your loveliness.
Orchid:Beauty, magnificence.
Pansy:Thoughts.
Peach blossom:I am your captive.
Petunia:Your presence soothes me.
Poppy:Sleep.
Rose, any color:Love.
Rose, deep red:Bashful shame.
Rose, single, pink:Simplicity.
Rose, thornless, any color:Early attachment.
Rose, white:I am worthy of you.
Rose, yellow:Decrease of love, rise of jealousy.
Rosebud, white:Girlhood, and a heart ignorant of love.
Rosemary:Remembrance.
Sunflower:Haughtiness.
Tulip, red:Declaration of love.
Tulip, yellow:Hopeless love.
Violet, blue:Faithfulness.
Violet, white:Modesty.
Zinnia:Thoughts of absent friends.
Perhaps suitable to give to a loved one accompanied with appropriate flowers?
— MatthewTheobalds
I almost don’t want to spoil this with an explanation, but… what you have found is a data file for quiz(6). To take the quiz, you would type “quiz flowers meaning”. Among the other amusing quizzes available are “quiz victim killer” and “quiz Middle-Earth capital”. –MossCollum
Two classic COBOL variable names in the code for a retail chain where I worked. Both were booleans that switched between different modes of operation: STUPIDF***KINGCHECK and BEEGEESFOLLYSWITCH — B.G. was the initials of the programming manager who created the first version of the code and handed it off to other programmers.
Comments:
I liked the early 80×86 assembler directive:
ASSUME NOTHING
It had meaning much beyond the original intention. Also, I once had to look through an assembler program which had about 15000 lines of uncommented code. Right in the middle was one solitary comment:
ld a, 1 ; load 1 into the accumulator
Why the contractor thought that one statement needed commenting I don’t know!
The contract probably stated, “must document code”. So, he did.
Somewhere in GNU source code, there’s something like this:
#ifndef STACK_DIRECTION
you
loser
#else
— SavasAlparslan
There was a page of highly optomized PDP-8 assembler in the middle of a simulator. It had one comment
HLT ; If you get here you are in trouble
— MarkSwanson
——————————————————————————–
One day a CDC 3400 suddenly printed a message and crashed. The message said: “On June 7, 1969 Josep Hurley declared that this case would never happen and we didn’t need to handle it.” The other, slightly junior, system programmer had added it after he lost an argument.
— MarkSwanson
——————————————————————————–
An early version of the MAGIC Rad tool was reputed to emit a message that said “MAGIC will now crash your system” — DominicCronin
——————————————————————————–
A circuit board logic simulator was greatly speeded up by checking for a specific condition and then jumping past a bunch of other steps. Finding and making this optimization took only half a day. Then the argument began about what to call the jump label (i.e. what was it that the simulator was really doing?)… Two days later, the programmer cut off the debate by relabeling the target ‘Raspberries’, since “You can’t argue with a total non-sequitur,” and made his release date.
——————————————————————————–
In the Java libraries (as of 1.5), at line 340 at java.awt.datatransfer.MimeType and line 295 of java.awt.datatransfer.MimeTypeParameterList, is:
// below here be scary parsing related things
And indeed there are.
Another funny thing (actually sad) is the duplicated code in the two classes, including JavaDoc and this comment. — DanielYokomiso
There’s also this in java.io.ObjectStreamClass (up to jdk 1.3.1 only):
//WORKAROUND compiler bug with following code.
//static final Class[] OIS_ARGS = {ObjectInpuStream.class};
//static final Class[] OOS_ARGS = {ObjectOutpuStream.class};
If you can’t see why this is so funny, check http://www.javaspecialists.co.za/archive/Issue046.html. — DanielYokomiso
A Russian gentleman on comp.lang.java.programmer, answering a question about floating point maths:
forget everything from school — you are programmer,
and here 2.1*3.6=7.559995
but sometimes (2.1*3.6==7.559995)!=true
this is the world with no rules after point — this is computer.
From the BEA WebLogic Server version 8.1 “Configuring and Managing WebLogic Server” document, pp 1.20 – 1.21:
: “To start the Administration Console:
: 1. Start an Administration Server. See Starting Administration Servers in the Administration Console Online Help.”
# — #perl was here! —
# Larry Wall is a lot sexier than Richard Stallman
# But I’ve heard Stallman is better in bed.
# Does he leave the halo on?
# * aether cocks her head at skrew…uh…whatever?
# Stallman’s beard is a sex magnet.
# Larry’s moustache is moreso, Fimm.
# oh yeah…women all over the world are hot for stallman….
# Moustaches make my heart melt.
# I dunno, there’s something about a man in hawaiian shirts…
http://search.cpan.org/src/JMUHLICH/Net-IRC-0.74/Connection.pm
http://search.cpan.org/src/JMUHLICH/Net-IRC-0.74/DCC.pm # this one even has continuity
it also has this (non-irc) gem:
# Tkil’s gonna love this one. 🙂 But what the hell… it’s safe to
# assume that the only thing initiating DCCs will be Connections, right?
# Boy, we’re not built for extensibility, I guess. Someday, I’ll clean
# all of the things like this up.
http://search.cpan.org/src/JMUHLICH/Net-IRC-0.74/Event.pm
http://search.cpan.org/src/JMUHLICH/Net-IRC-0.74/IRC.pm
Eww, gross, you just made us think of RMS having sex. Disgusting. The stuff of nightmares.
I’m sorry. I was young and foolish. 🙁 — dpt
From one of the same modules:
# Ye Olde Contructor Methode. You know the drill.
# Takes absolutely no args whatsoever
I really liked the aproach this code that had to process the first 5 tokens of a list (or less if there weren’t so much).
int j = 0;
if (tokenCounter >= 5) {
j = 5;
}
else if (tokenCounter == 4) {
j = 4;
}
else if (tokenCounter == 3) {
j = 3;
}
else if (tokenCounter == 2) {
j = 2;
}
else if (tokenCounter == 1) {
j = 1;
}
Maybe it was a case of taking FakeIt that step too far.
We have an internal web page that displays departmental structure as taken from a database in a tree structure. The default was to sort siblings alphabetically, but the dept. head wanted one of his direct reports to sort to the bottom instead of the top. When I went to modify the code a while back, I came across this comment:
/* Brutal Political Hack */
followed by a bunch of code that included a boolean variable called “bIs[Employee Name removed for anonymity]”
followed by /* Untainted version */ which had the “brutal political hack” removed.
There are really people that petty in the world? Sheesh.
——————————————————————————–
I recently ran across the following C function in production code:
int xilinx_prog(softc_t *sc)
{
if ((sc->status & (XILINX_PROG | XILINX2_PROG)) !=
(XILINX_PROG | XILINX2_PROG))
return 0;
return 1;
}
After much staring and some refactoring, I finally came up with:
int is_xilinx_programmed(softc_t *sc)
{
return (sc->status & XILINX_PROG) && (sc->status & XILINX2_PROG);
}
This was in the same system that had undocumented utilities with argument checking code like:
if (q == 1) {
printf(“Silly user, you must enter the correct syntax ”
“-i1 through 5 or\n -s1 through 5 and -d1 through 5\n”);
exit(0);
}
Neither of these examples is “ha-ha funny”, and the first example isn’t “peculiar funny”, either; it’s standard bit flag stuff. Woe unto any C programmer doing XILINX work who has trouble understanding the code as it was first written; you’d better brush up on your bit manipulations if you expect to understand XILINX devices, let alone C. Those who hate bit manipulation shouldn’t be in that line of work. Look again. The author’s problem was not with the use of bit masks (indeed, his solution shows that he understood them better than the original coder did), but with the facts that a) the comparison was poorly written (if nothing else, the original coder should have factored out the repeated bitwise OR term to a temp variable), and b) the if clause and the returns were completely unnecessary, as the function was effectively returning a boolean based off of a single extended comparison. I agree that it wasn’t funny, though, so much as sad. – JayOsako
What? No. If you mean for efficiency, there’s no need to factor out the repeated part, because the OR of the two flags is performed at compile time (or if the flags were variables — they’re not — an optimizing compiler would easily factor out the repeated subexpression itself).
Or if you meant that should be done for stylistic reasons, yes, it’s generally not desirable to repeat things unnecessarily, but in this particular case it seems a matter of taste, because typically there would be similar code nearby that did things like
(flag & (X | Y)) == (X) and
(flag & (X | Y)) == (Y) and then finally as above,
(flag & (X | Y)) == (X | Y)
…so that what looks like unnecessary repetition out of context, is often just part of an overall consistent coding pattern.
There is then a second argument for hiding the pattern in a macro, but in this case again that would be a judgement call, not just automatically right or wrong.
Using a conditional to return 0/1 rather than returning a boolean expression used to be necessary if the caller really needed 0 or 1, because long ago it wasn’t guaranteed that TRUE would equal 1 — this code may date back to that era.
So I see no clear evidence that the code should necessarily be called badly written, nor evidence that the second author clearly understood bit masks better than the original coder.
I do prefer returning a boolean expression directly, so I do like the rewrite, it just seems like a pretty minor thing to bring up as an example…was that really the worst piece of code that was run across on that project? If so then I am very impressed; usually there’s lots and lots of code much worse than that.
Suppose sc were volatile and reading the status cleared it. Then the original code should remain.
The second example is somewhat lacking in context, but it looks like the point is that some hardware engineer chose somewhat opaque syntax – as they usually do.
So anyway, not funny, not peculiar; should be moved to a different page.
——————————————————————————–
From the JargonFile:
The PDP-10 Reference Handbook (1969) contained a footnote on the first page of the documentation for DDT that illuminates the origin of the term:
: Historical footnote: DDT was developed at MIT for the PDP-1 computer in 1961. At that time DDT stood for “DEC Debugging Tape”. Since then, the idea of an on-line debugging program has propagated throughout the computer industry. DDT programs are now available for all DEC computers. Since media other than tape are now frequently used, the more descriptive name “Dynamic Debugging Technique” has been adopted, retaining the DDT abbreviation. Confusion between DDT-10 and another well known pesticide, dichloro-diphenyl-trichloroethane C14H9Cl5 should be minimal since each attacks a different, and apparently mutually exclusive, class of bugs.
: (The tape referred to was, incidentally, not magnetic but paper.) Sadly, this quotation was removed from later editions of the handbook after the suits took over and DEC became much more businesslike.
[Obviously the name DDT originally came from the bug-killing pesticide, and “DEC Debugging Tape” was a BackroNym.]
——————————————————————————–
One of my first programming projects was a POS (in either expansion of that acronym) in MsDos FoxPro for a local computer store I was working for in 1996. I was a bit more whimsical than I should have been; for example, the customer table was named ‘suckers’, while the employees table was ‘slaves’; the main error handling function, ‘oops’, popped up a window named ‘S_O_L’; and so forth. The project was never finished, but I held on to the code for ir’s humor value; it can be seen at http://josako.freeservers.com/tech/FoxPro/ – JayOsako
(Insert theory about correlation between whimsical naming conventions and projects not finishing here. Also, note to self: Do not hire JayOsako.)
——————————————————————————–
The following code was written by .
Unless it doesn’t work, then I have no idea who wrote it.
In my second year of college, I wrote a program to optimize neural net training with a genetic algorithm. Apparently I was inebriated at the time I wrote this, because my code, while correct, had some of the strangest comments I have ever written. I honestly don’t know what I was thinking when I wrote some of them. Some of them I recognize as script references, but I have no idea what they were trying to convey.
Found at the beginning of a loop that could run forever:
/* And now, ladies and gentlemen, the chord from HELL! */
Found near a particularly nasty fix for a fencepost error:
/* There are dumber f**ks than me out there, but not many */
Found near a piece of code that handled memory resizing, it made the new generation of neural nets inside the space for the previous failures. If it didn’t have to realloc at all the branch that executed was labeled:
/* These clothes are a little tight, but the price was right */
Finally, there was an error message in some of my test code that said:
“Nostradamus told me this would happen. Smug bastard.”
Sometimes I worry about myself. — DaveFayram
“These clothes are a little tight, but the price was right” is a reference to Final Fantasy VI.
Here are excerpts from some code I’ve found myself having to upgrade to a new server structure.
#include //I hate strings.
#include //I HATE STRINGS!!!
#include //I HAT TEH STRINGES!!! DIE! DIEDIE! DIE!!!!!!
/// A class for interfacing dotnet code with (product)’s plugin API.
/// As you may have noticed, making .NET code work with API code is a
/// pain in the ass, because it never occurred to Microsoft that .NET code
/// might one day have to exist on the same computer as API code. As
/// unbelievable as it is, programmers need to have their non-.NET software
/// [use] functions that were written in managed code. So, to better the meet the
/// needs of their developers, Microsoft made the process as inconvienient
/// as they possibly could. Enjoy.
/// This function converts stuff from a .NET String to an LPTSTR.
/// May whoever decided it should be this complicated be required to
/// write it 20,000 times on a tiny whiteboard with perfect penmanship,
/// rot in jail for two years, then have to try clean it all off using
/// nothing but his own saliva and a toilet brush without getting any
/// ink on his gloves.
Near some code that does a web request
public const string HTTP_USER_AGENT = “Dancing squirrels with teletype machines.”;
LPWSTR Name2 = Name; //shoot me now – seriously
And, of course
//The following was stolen in large part from MSDN by (name) & I.
//I tried to give it back, but they wouldn’t take it.
//I don’t blame them…
FreeBsd’s “shutdown(8)”. I think this must be newer than the historical reference (what, 1977, Steve Martin?), but I can’t be certain off the top of my head, and don’t feel like reading commit logs all night 😉 Comments mine.
/* declaration, line 101 */
void die_you_gravy_sucking_pig_dog __P((void));
/* Called in 256-267 */
for (;; ++tp) {
timewarn(tp->timeleft);
if (!logged && tp->timeleft timetowait);
if (!tp->timeleft)
break;
}
die_you_gravy_sucking_pig_dog();
}
/* and defined (initial portion) in 335-349 */
void
die_you_gravy_sucking_pig_dog()
{
char *empty_environ[] = { NULL };
syslog(LOG_NOTICE, “%s by %s: %s”,
doreboot ? “reboot” : dohalt ? “halt” : dopower ? “power-down” :
“shutdown”, whom, mbuf);
(void)sleep(2);
(void)printf(“\r\nSystem shutdown time has arrived0707\r\n”);
if (killflg) {
(void)printf(“\rbut you’ll have to do it yourself\r\n”);
exit(0);
}
You can learn quite a bit about BSD philosophy from that last printf….
We sent the firmware of our device to the manufacturer in Japan who modified it to create the manufacturing tests. When we got it back I looked over it and had a surprise. They abbreviated their variables, but any variable that had the word “count” in it was abbreviated not by dropping the “ou” but just the “o”. It was really hard to read that code with a straight face.
——————————————————————————–
I once wrote a routine to kill all the child windows in a dialog and called it Commit_Infanticide. Unfortunately, since our code could be audited by clients, our QA manager made me change it to something less frivolous like Terminate_All_Children.
From the Perl module Pod::Perldoc:
while () { # “The Mothership Connection is here!”
From http://svn.haeleth.net/pub/rlBabel/gloss.cpp
template
class test_p: public std::unary_function {
// Come quick! come quick! thou happy hour
// When C++ doth closures get,
// And gain thereby some modern power,
// And all this clumsiness forget
// (Though that may take a lifetime yet,
// Since standards are so hit-and-miss) —
// Till then, we’re stuck with crap like this.
int x_, y_;
public:
test_p(int x, int y) : x_(x), y_(y) {}
bool operator()(const T& t) const { return t.test(x_, y_); }
};
——————————————————————————–
LargeObjectDescriptor lobster;
——————————————————————————–
‘ This little beauty was written to allow those stupid ‘ user’s to undo thier cock ups.
——————————————————————————–
class CRepositoryMoronicExportInsteadOfImportItemDlg : public CRepositoryNewItemDlg
——————————————————————————–
Seen in a Crestron data file…
; Do not change the following line.
SmplCInputCue1=gwfreq
; You better not have changed it!
——————————————————————————–
/* This is a stupid class that I wrote under duress. I */
/* apologize to all affected. */
——————————————————————————–
This is an interesting if…
if (this.DdlPopList?.SelectedIndex? != 0)
{
this.DdlPopList?.SelectedIndex? = this.DdlPopList?.SelectedIndex?;
}
What do you think about WIKILEAKS?
By the way, anybody home?!
nice share
Comments I do feel guilty about
Doing 32-bit multiplication and division on a 16-bit machine like the PDP-11 needs cleverness. My PDP-11 C compiler used subroutines to do long * and /. The multiplication routine was
/
/ 32-bit multiplication routine for fixed pt hardware.
/ Implements * operator
/ Credit to an unknown author who slipped it under the door.
.globl lmul
.globl csv, cret
lmul:
jsr r5,csv
mov 6(r5),r2
sxt r1
sub 4(r5),r1
mov 10.(r5),r0
sxt r3
sub 8.(r5),r3
mul r0,r1
mul r2,r3
add r1,r3
mul r2,r0
sub r3,r0
jmp cret
which is neat, and I wasn’t smart enough to figure it out. I don’t feel guilty, though, because I didn’t then know who suggested it and I did acknowledge the fact.