ornoth: (Default)
2014-11-21 11:03 am

Your Mama Floats Right

And now, just to be a complete contrarian, I present some frontend-tech-oriented “your mama” jokes. We assure you that no mamas were hurt while composing this entry.

HTML-oriented:

  • Your mama’s got a really big <body>.
  • Your mama’s got no <head>!
  • Your mama’s just an <object>.
  • Your mama’s a <sub>.
  • Your mama’s got no parent element.
  • Your mama’s value attribute is set to zero.

CSS-oriented:

  • Your mama’s got no style.
  • Your mama’s got no class!
  • Your mama’s width is 110%!
  • Your mama exceeds her max-width!
  • Your mama’s got too much bottom-padding...
  • Your mama’s got her overflow: visible.
  • Your mama’s so easy she’s got a negative z-index!

Other tech-oriented:

  • Your mama’s got such a regular expression.
  • Your mama’s got an out of date plugin.
  • Your mama’s a vector shape, and she looks like somebody’s been draggin’ her handles…

And yes, your mama floats right, too!

ornoth: (Default)
2013-10-05 01:57 pm

Mysteries of the Universe

There really needs to be a corollary to Newton’s Second Law of Thermodynamics, stating that website maintenance is a constant (and un-winnable) battle against the Stupid introduced by other people.

Usually this involves a lot of quiet fuming while cleaning up the garbage left behind by the incompetent agents of entropy. But sometimes the Stupid is just so ludicrously headdeskingly perfect that there’s nothing you can do but laugh until you gag on your own puke. All the while, marveling at the “mysteries of the universe”.

For example, consider the following. While working on something, I once came across the following block of code on a production website:

$rss_feeds = "";
echo $rss_feeds;

Now, even if you’re code-illiterate, you can probably figure out what this does. It sets a variable to nothing and then prints… nothing.

Why? No reason. The only thing I can figure is that someone hired a contractor and paid them based on the sheer number of lines of code they produced.

Now, before I lose all the non-coders in the audience, here are a couple examples where people chose to demonstrate their mastery of their native language. For example, take this headline that appeared in a second-level heading on one page:

Private vs. Gevernment

Or this major announcement:

Without further adieu [...]

Or this favorite job listing of mine:

[...] is currently seeking a Senior FrontEnd Web Developer with 710 years of professional experience

Working our way into the code doesn’t have to be painful, though. How about this one: Need to name a file? Why not name it after your own awesome self?

$fileExt = 'markrules';

Another one that is easy for non-coders is this one:

<div id="left_content" class="right">

Yup. In the Stupid Universe, left is right and right is left.

Now how much would you pay? But wait: there’s more!

<?php //    include('ad_med_rectangle.inc.php'); ?>
<?php include('ad_med_rectangle.inc.php'); ?>

In PHP, two slashes are used to comment something out. So here we have a line of code carefully commented out. And then the exact same line, not commented out. Um… huh?

Speaking of comments, try figuring out what this one does:

$form->addElement('hidden', 'xzdf', 'A3104', array('id' => 'xzdf'));

Using names or key values with self-evident meanings is really overrated. The Law of Stupid instructs us to use completely nonsensical names, and make sure you don’t leave any comments in the code that might explain to the people maintaining your code what those random numbers and strings of characters actually mean!

And then there’s this mystery of the universe, a perennial favorite:

$term = ereg_replace("hero", "elongated sandwich", $term);

I can’t tell you why this site has such a strong aversion to heroes, but it’s clear that any time we find the word “hero”, we replace it with our preferred term “elongated sandwich”. No reason; we just do. No hero worship allowed here!

Here’s a fun one!

.blue_button {
    background: none repeat scroll 0 0 #ED8D1E;
}

Blue_button, huh? You might be forgiven if you thought that might actually show a button that was blue. But that background color of #ED8D1E? That’s dark orange. OF COURSE!

For some reason, “switch” statements seem beyond the grasp of many well-compensated “engineering professionals”. I’m not sure why it’s so difficult to do different things depending on whether a variable has a value of 1 or 2 or 3, etc. Is that so hard? Apparently it is. Here’s a nice example:

case 1:
     $url = 'http://www.awebsite.com/';
     break;
case 1:
     $url = 'http://www.awebsite.com/';
     break;
case 1:
     $url = 'http://www.awebsite.com/';
     break;
case 1:
     $url = 'http://www.awebsite.com/';
     break;
case 1:
     $url = 'http://www.awebsite.com/';
     break;

That’s a double dose of Stupid! Here, all the cases do exactly the same thing! But that’s okay, because they all test against the same value, too!

In plain English, it translates thus: if it’s a 1 you do this; but if it’s a 1 you still do this; or if it’s actually a 1 you would also do this; and if 1 you do the same thing too; and so on. That’s seventeen lines of code to do what requires only one. See what I mean about someone being paid per line of code?

Of course, that only works if you want to do something. Truly masterful Stupid code does nothing, like this switch statement:

switch($page[subnav]) {
}

Huh. Only outside of the Stupid Universe is it customary to write code to actually *do something*.

Of course, junior developers often aren’t wise enough yet to disguise the fact that they’re doing nothing. Consider this:

 

Yes, that’s nothing. That’s the whole contents of a file I found called small.css. Small, indeed! Perhaps they thought they weren’t leaving any evidence of their stupidity behind.

Here’s some additional CSS-flavored fun:

<div style="clear: left;"> </div>
<div style="clear: right;"> </div>

More from the Planet of the Confused: why not just do “clear:both”? Oh yeah, it’s because YOU HAVE NO IDEA WHAT YOU’RE DOING!!!

ttable tr td.odd {
     border-left: 0;
     border-right: 1px solid #fff;
}

Did the W3C create a new HTML tag (ttable) and I missed the news?

p.margin-left {margin-left: 15px; padding-right: 15px;}

So let me get this right: a paragraph called “margin-left” actually has equal margin on both sides? But on the left it’s a margin, and on the right it’s padding? That makes perfect sense, especially if you don’t understand basic HTML page layout!

Here’s an exemplary 12 lines of masterful coding:

if (isset($page_close)) {
$page_close .= <<<EOD
</body>
</html>
EOD;
} else {
$page_close = <<<EOD2
</body>
</html>
EOD2;
}
echo $page_close;

That’s just another example of how these guys clearly were getting paid per line of code. No matter what $page_close is set to, what those 12 lines of code really do is this:

</body>
</html>

No need for complex logic or any dynamic behavior. Good thing they inserted an extraneous IF/ELSE block, two “here quotes”, and echoing a variable, because how else would one know they were such masters of PHP syntax?

if (test_it_counter == 0) {
   computeForm(entry.form);
}
computeForm(entry.form);
test_it_counter++;

So the first time through this program, computeForm() get run twice in a row, just for kicks. I’m sure that works just great! I wonder why they didn’t run it twice every time?

<div id="nav" onmouseover="Tip('#nav { <br /> <var>float:</var> left; <br /> <var>width:</var> 788px; <br /> <var>height:</var> 36px; <br /> <var>margin:</var> 0; <br /> <var>padding:</var> 0; <br /> <var>background:</var> #fff url(images/navbg3.gif) no-repeat; <br /> <var>text-align:</var> center; <br /> } <br /><br /><cite>Note the hover action. </cite>')">

I have absolutely no idea what the coder was thinking here. If you hover over a nav, it displays a tooltip with a bunch of CSS code (which actually doesn’t get used and doesn’t appear anywhere in the page) and the message “note the hover action”. Glad that has been running out on the production web site for four or five years

My final example is a solve-it-yourself problem. Are you ready for a developer challenge? How long does it take you to spot the Stupid in this statement?

<?php if ($isForm = false) {

This one’s an all-time classic and a personal favorite. When comparing a variable to a literal, professional software engineers always put the literal first. Do you know why? Well, the above is a perfect illustration why. The reason why will be left as an exercise for the reader.

ornoth: (Default)
2006-04-17 03:52 pm

The Black Idol

I guess it’s kinda funny that I don’t talk about DargonZine much here, since I’ve always considered DZ my life’s work. I guess I figure most people aren’t interested in the daily travails of running an Internet writing group.

But it’s been a long, long time since I last plugged the zine, and my friends list has turned over quite a bit, so I think it’s about time to let you know what it is, and what’s been going on. But first, in case you somehow know me but don’t know about DZ, I’ll give you the standard overview.

DargonZine is the longest-running electronic magazine on the Internet, and probably the longest-running writers’ group on the Internet, as well. I started it back in 1984—yes, twenty-two years ago—in order to bring aspiring writers together. The magazine prints free amateur fantasy fiction, but it’s really just the vehicle for the writing group. It’s one of those collaborative anthologies (aka “shared worlds”), but it’s low on magic and crazy stuff, and there’s a heavy emphasis on quality of writing.

So that’s the background. Now for the current news. We just sent out DargonZine 19-4, which is the climax—but not quite the end—of a major three-year, fourteen-writer collaborative storyline called The Black Idol. We started working on it at our 2003 Writers’ Summit in Austin, and it has filled 14 issues since the first story came out in DargonZine 18-1.

It’s the biggest and most successful collaboration we’ve ever attempted, and I’m really proud of the writers who put it together. But you can read more details about the arc and how I feel about it in the DZ 19-4 Editorial. Suffice it to say that it’s a major milestone, a staggering accomplishment, and a sign of the next step in the magazine’s evolution.

If you’re interested in DargonZine, you can get full issues or just new issue notifications via our Subscription page, or subscribe to our RSS feed. But LiveJournal users get a special deal: you can add the user [livejournal.com profile] dargonzine_feed to your friends list and have announcements of new issues show up right on your friends page. Painless and very handy, I must say; I hope you make use of it!

Although you probably couldn’t tell from the content of my journal, DargonZine is a major part of my life, and has been for nearly a quarter century, and the people who have been part of it are among some of my closest friends. I’m honored that over the years, many people have valued it enough to devote their time and energy to it.

There’ll be another DZ-related post in the near future, in all likelihood, as I’ll be heading off to Cincy for our annual Writers’ Summit in a few weeks, to reconnect with my clan and see what we can come up with as a followup to the tremendous Black Idol story.

ornoth: (Default)
2003-10-28 01:06 pm
Entry tags:

Do me a favor…

DargonZineToday I created a syndicated feed on LiveJournal for DargonZine, the electronic magazine I put out. People can now add [livejournal.com profile] dargonzine_feed to their friends list, and each time an issue comes out they’ll be notified of it by a brief post that will appear on their friends page.

I really need your help in making it easier for people to add the feed to their friends list. How can you do that? Easy! Just add [livejournal.com profile] dargonzine_feed to your own friends list. That’s all there is to it!

See, every LJ user is given a small number of “points” that can be used to subscribe to syndicated feeds. The “syndication price” of each feed is based on how many people are subscribed. The more people who subscribe, the less it costs each one.

But that makes it hard to start up a new feed, because no one will join until the “cost” goes down. That’s especially true for free users, who only get .99 points, total. Once you get over the hump of getting your first handful of readers, the syndication cost drops dramatically, and even free users can subscribe.

So please: do me a favor and add [livejournal.com profile] dargonzine_feed to your friends list today. You’ll only get one brief notification each month or so, similar to the ones already appearing in [livejournal.com profile] dargonzine_feed’s journal, but it’ll make a big difference in how easy it is for other LJ users to receive those notices.

By the way, if you don’t know what DargonZine is… DargonZine is a strictly noncommercial electronic magazine that prints original medieval fantasy stories that are written by aspiring Internet writers and set in a common milieu as a part of the magazine’s collaborative writing project. The longest-running electronic magazine on the Internet, DargonZine was founded in 1985 as a way for aspiring fantasy writers on the Internet to meet and improve their craft through mutual contact and collaboration as well as feedback from a representative readership via the Internet. New readers and prospective writers are enthusiastically welcomed. For more info, visit our Web site at www.dargonzine.org.