Posts Tagged with "wordpress"

FIX: WordPress 2.5 / Akismet 2.1.4

May 14th, 2008 at 11:59 am by Mark
Tags: , , , , , , ,

     There’s a stopper-style bug in the the latest Akismet plugin for WordPress.  If you have multiple pages of Spam Comments, it keeps returning the first fifty — not good if you get as much Spam as we do, as we have to periodically check for false positives.
     The fix is easy…

     In Akismet 2.1.4, change wp-content/plugins/akismet/akismet.php, line 483 from:

        $comments = akismet_spam_comments( $current_type );

     to

        $comments = akismet_spam_comments( $current_type, $page );

     And Enjoy.  😉

Fix the Google Sitemap Generator Plugin for WordPress

March 7th, 2007 at 12:23 pm by Mark
Tags: , , , , , , ,

     Arne Brachnold’s Google Sitemap Generator for WordPress is a pretty neat piece of software that’ll build a Google-style XML-Sitemap, and ping Google with it every time you update your blog.
     Good stuff for SEO, good stuff for making sure Google has your site indexed. 

     After setting up a few blogs with the latest, I found a caveat that just annoyed me to death: you’re in the Admin, but when you manually update the sitemap, it comes back with a blank page. Sure, I know how to work around it, but they guys I’m setting this stuff up for get all huffy about it.
     Pretty quick bug to figure out.  There’s even a nice ticket on Trac (Ticket 604) that I’m unable to post this solution to…
     Line 2463 of sitemap.php is:

<script type=”text/javascript” src=”list-manipulation.js” mce_src=”list-manipulation.js”></script>

     Of course, that doesn’t exist, but if we change it to:

<script type=”text/javascript” src=”../wp-includes/js/list-manipulation-js.php” mce_src=”../wp-includes/js/list-manipulation-js.php”></script>

     …then all is right and good with the world.

     Hopefully, Arne’ll drop this in his next release — and be able to close Ticket 604 on Trac.  😉

[Ed. Note: The text of this article refers to “the latest” WordPress (2.1.x) and version of the plugin for it (3.0xxx).]

Stock Photos

Simplicity Rules the Day

February 27th, 2007 at 9:16 pm by Mark
Tags: , , , , , ,

     Before I start this little rant, I just wanna say, this is not to ridicule Chris — he’s certainly worth his salt.  This was just an example — and a rather basic one, at that, given that this was more of an oversight than a faux pas — of something that’s been getting on my nerves for years.

     Every once in a while, someone’ll do something, semi-cool with a piece of software, but their execution makes it appear that they’ve forgotten why a given function works the way it does.  It happens a lot these days, and I’m glad I’m old enough to remember “why” things are like they are.

     A case in point — and Chris is a brilliant guy, mind you, and again, I’m not bashing him — was the beginnings of a WordPress plugin (blog software, for the initiated) to show extra formatting buttons in the Text Editor.

function st_addAdvanced($buttons) {
    unset($buttons[22]);
    array_push($buttons, ‘wp_adv’);
    return $buttons;
}

     It’s a pretty elegant little function.  It takes an array called $buttons, and changes the last value to ‘wp_adv’ and returns it.  Unfortunately, it makes things look ugly because of the way the $buttons array is used elsewhere in the code.
     He says, “Ahh, there are some formatting issues to take care of.”

     I’ve always had this bizarre K.I.S.S. approach to programming anyway.  I mean, hey, why bother calling two other functions, unset() and array_push() when I can do what I need with a single, local variable?

function st_addAdvanced($buttons) {
    $x=$buttons[21];
    $buttons[21]=’wp_adv’;
    $buttons[22]=$x;
    return $buttons;
}

     Sure, I could’ve used two, and said, “$a=$buttons; $x=a[21]; $a[21]=’wp_adv’; $a[22]=$x; return $buttons;” to save keystrokes…. but… I’d be wasting as much memory as I gained CPU by foregoing the functions.

     But that’s basically my argument about most Developers these days.  It’s a pretty serious can of worms for me to open, because I know I’ll have developers coming from all over to tell me I’m full of it…  Even though I was writing Assembler before their parents ever met, and have some pretty cool — working, useful, debugged — software under my belt…. Joke ’em if they can’t take a f… *shh*

     Seriously, it’s no wonder our CPU and Memory requirements are so ridiculously high these days.  There’s an API or a DLL or a Library for freaking everything!  Layers upon layers, upon more layers, with repositories and snippets and widgets and scripts galore!

     Our Universities teach this method, often telling people, “Do it this way!” without telling people “Why it should be done this way.”  The “simpler” things get, the more abstract they become.
     They’re not churning out programmers and problem solvers.  They’re churning out memorize-and-regurgitate linkers who can’t write code without the assistance of a Visual Integrated Development Environment.

     Hey … Wasn’t the whole point of all this Link Library, Visual garbage to make software development easier?  Faster?  More bug free?

     I used to sit down with vi, edit or Notepad and it’d take me a couple of days to write a program.

     I can use all these neato-keen, new-fangled hooks and VIDEs, and it’ll still take me a couple of days to write a program…
     But it might take weeks to debug.

     Most developers do the same thing… And spend a lot of time setting up their VIDE.  Or getting a bit of code they copied off the internet to work.  Or…

     But, hey … I’m probably full of it, right?

     As employers, educators and policy makers, we need to get back to basics.  Yes, teach how.  But teach why, as well.