Posts Tagged programming

Abusive and fun comments in source code

Posted by on Wednesday, 29 April, 2009

From time to time I have noticed you get some interesting comments in various programs. I thought I would share some of the more amusing comments I’ve found.

In . Clearly a programmer whos had a bad day.

Change log

r11 by paracelsus on Sep 11, 2007 Diff
Photoshop loader is DONE for now, fuck you

// At this point, I’d like to take a moment to speak to you about the Adobe PSD format.
// PSD is not a good format. PSD is not even a bad format. Calling it such would be an
// insult to other bad formats, such as PCX or JPEG. No, PSD is an abysmal format. Having
// worked on this code for several weeks now, my hate for PSD has grown to a raging fire
// that burns with the fierce passion of a million suns.
// If there are two different ways of doing something, PSD will do both, in different
// places. It will then make up three more ways no sane human would think of, and do those
// too. PSD makes inconsistency an art form. Why, for instance, did it suddenly decide
// that *these* particular chunks should be aligned to four bytes, and that this alignement
// should *not* be included in the size? Other chunks in other places are either unaligned,
// or aligned with the alignment included in the size. Here, though, it is not included.
// Either one of these three behaviours would be fine. A sane format would pick one. PSD,
// of course, uses all three, and more.
// Trying to get data out of a PSD file is like trying to find something in the attic of
// your eccentric old uncle who died in a freak freshwater shark attack on his 58th
// birthday. That last detail may not be important for the purposes of the simile, but
// at this point I am spending a lot of time imagining amusing fates for the people
// responsible for this Rube Goldberg of a file format.
// Earlier, I tried to get a hold of the latest specs for the PSD file format. To do this,
// I had to apply to them for permission to apply to them to have them consider sending
// me this sacred tome. This would have involved faxing them a copy of some document or
// other, probably signed in blood. I can only imagine that they make this process so
// difficult because they are intensely ashamed of having created this abomination. I
// was naturally not gullible enough to go through with this procedure, but if I had done
// so, I would have printed out every single page of the spec, and set them all on fire.
// Were it within my power, I would gather every single copy of those specs, and launch
// them on a spaceship directly into the sun.
// PSD is not my favourite file format.

Heres another amusing one.

* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !!!!!!!!!!!!!!DOING SO FUCKS THE BUILD PROCESS!!!!!!!!!!!!!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

At the top of a particularly convoluted and otherwise completely uncommented code:
// Abandon all hope, ye who enter here.
In some PHP code for a webpage :

// Since this file is loaded on every page, and since
// I want the following function on every page, I’m going to
// cheat and include it here even though it has nothing to
// do with the other things in this file.
// If you don’t like it, bite me!

Seen, and believed…

[some long and messy code] # too drubnk to make this workkkkj. debugg latter.

The source code of PerlLanguage’s Net::IRC modules has numerous chunks of funny conversation from the #perl IRC channel in it. My favorite:

# — #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…

Spotted this in the source code for one of the ApacheAnt tasks:

: /*
: * build notes
: * The reference CD to listen to while editing this file is
: * Underworld Everything, Everything
: * variable naming policy from Fowler’s refactoring book.
: */

/usr/src/linux is full of fun.

** “seek and ye shall find”…praying never hurts either…
** ggg sacrafices another 710 to the computer gods.

* These chips are basically fucked by design, and getting this driver
* to work on every motherboard design that uses this screwed chip seems
* bloody well impossible. However, we’re still trying.
* skb to avoid No=0 (choose one: Ugly [ ] Tasteless [ ] VMS [ ]).

For an illuminating experience, try grep -ir word /usr/src/linux, where word is one of the following: fuck, shit, damn, hack, kludge, “:-(“, “no idea”, awful, stupid, and of course XXX… I’m sure you can think of your own candidates.

One could probably make some significant contributions to the Linux codebase simply by doing this, then seeing if they can figure out how to fix the problem the coder was griping about. Hell, there are probably several Linux kernel hackers who do just that, though admittedly a lot of the problems are related to bizarre hardware or outside software which the system has to interface with, which the coders can do much about. Even so, it would probably be a useful thing to do. KiboDebugging??

* 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 a test code that said:

“Nostradamus told me this would happen. Smug bastard.”

Here are excerpts from some code found whilst doing an upgrade to a new server structure.

#include <wchar.h> //I hate strings.
#include <tchar.h> //I HATE STRINGS!!!
#include <string> //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.

Found in a depracated .c file:

/* fit round peg into square hole, if necessary… */
/* well, actually any damn peg into whatever hole we have to work with… */
/* use (the) force, if necessary */

Learning python

Posted by on Tuesday, 7 April, 2009

Learning Python is very easy with this quick and easy python tutorial going over the basics.