Archive for category Articles

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 http://code.google.com/p/xee/source/browse/trunk/XeePhotoshopLoader.m?spec=svn28&r=11 . 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
Adobe

// 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.

* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !!!!!!!IF YOU CHANGE TABS TO SPACES, YOU WILL BE KILLED!!!!!!!
* !!!!!!!!!!!!!!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 */


The old yes/no game.

Posted by on Saturday, 18 April, 2009

“Yes, we’ll allow you to use that voucher for computer training.”

No, they won’t – quite. They’ll allow you to use the voucher for computer training on Microsoft products, but not (for example) Linux equivalents.

This is a comment from Microsoft’s representatives:

to announce the company’s donation of 30,000 vouchers for people in the state to learn new computer skills, positioning themselves for better jobs.

excerpted from http://www.techflash.com/microsoft/42925097.html peeled from the news feed at Groklaw.net.

Frankly I find it unsurprising, especially given the comment down further in the article, where they call on other companies to do similarly.

Smith made it clear that the company isn’t about to see its donation, with a value of at least $3 million on the low end, used to promote the use of competing programs. At the same time, he said Microsoft “would be thrilled” if other companies in the software industry took similar steps to promote training on their own products.
Gregoire said she’d like to see other companies demonstrate the same level of “generosity” and “leadership” as Microsoft in that regard.

Microsoft know that non-Microsoft companies simply don’t get the same level of penetration for their software training, because large amounts of American (and even global) businesses have standardised on Microsoft, and will continue to do so for the forseeable future.

Why not step up to the plate properly, Microsoft?


Debian GNU/kFreeBSD

Posted by on Saturday, 11 April, 2009

Found at http://wiki.debian.org/Debian_GNU/kFreeBSD_why

Here are the reasons why we think Debian GNU/kFreeBSD could be preferred to other systems such as FreeBSD and Debian GNU/Linux.

They’re not absolute truths, nor do we expect everyone to agree with them. So please don’t engage in an endless discussion trying to convince someone that Debian GNU/kFreeBSD is the best. That kind of things do us more harm than good.

Why would you prefer Debian GNU/kFreeBSD to Debian GNU/Linux?

  • Cleaner or more standard kernel interfaces:
    • Single /dev implementation via devfs, instead of the 3 discordant ways of handling /dev that Linux provides.
    • OSS as the default sound system (i.e. the standard interface supported by almost every Unix-like system around).
    • OpenBSD Packet Filter (pf).
  • Other nice security features, like jails.

  • Support for NDIS drivers in the mainline kernel. On Linux, NdisWrapper is unlikely to make it into the mainline kernel.

  • Possible support for ZFS in the mainline kernel. Due to license and patent issues, ZFS is unlikely to appear on Linux.
  • kFreeBSD offers an alternative in case Linux is branded illegal by the SCO case or other threats. In legal terms, Linux sources are like a minefield. kFreeBSD is much less vulnerable to such attacks because of its less bazaar-like development model.
  • kFreeBSD developers often have more interest in merging new features rather than spawning forks all along (the port to Xbox is a very good example. See the responses from Linus Torvalds and kFreeBSD developers).

  • Some people say that kFreeBSD has better performance and/or stability (especially in disk/filesystem areas).
  • The FreeBSD kernel might support some hardware which Linux does not support and/or the FreeBSD kernel support might be better (less bugs).

Why would you prefer Debian GNU/kFreeBSD to FreeBSD?

  • If you like the Debian package system (or its package set) more than FreeBSD ports (just a matter of preference).
  • If you like GNU userland more than BSDish one (again, just a matter of preference).
  • If you don’t have anything against GPL or other copylefted free software licenses, you’ll appreciate that useful kernel modules like ext2fs driver, the upcoming reiserfs and xfs, or the upcoming ethernet driver for Xbox are (or will be) compiled in on the default kernel.
  • If you’re concerned about running a 100% free system, our commitment to the Debian Free Software Guidelines (DFSG) guarantees that Debian GNU/kFreeBSD doesn’t contain any non-free software. In fact, we have removed some non-free binary-only drivers that are contained in the upstream FreeBSD tree, like the ath driver.

Now I found this very interesing myself as I have used both systems and liked them both. I found debian to be better in respects for configureability via apt, and FreeBSD was equally good with its ports, though time consuming compiling somewhat. FBSD generally i found handled higher loads on production servers better, though to be fair that would be a HUGE serverload and for the most part Linux would do fine.

So if this happens, I would definately be one counted in having a nosey and giving it a go. However I do wonder if it would take off enough, and have enough support behind it to keep it going (and anyone whos in sysadmin hates trying to upgrade something no longer supported!)