picture home | pixelblog | qt_tools

omino code blog

We need code. Lots of code.
entries for category "wordpress"
David Van Brink // Thu 2008.11.6 10:44 // {wordpress}

WordPress Pages, Anywhere

Pardon this post which is about technical trivia unrelated to API’s and Weird Blinking Lights. But I needed to jot it down somewhere. It’s a note about including contents out of WordPress in parts of a site which aren’t under the WordPress installation.

Now that WordPress includes revision management (as of 2.6) I intend to use it for the whole site, but I didn’t want to rejigger the install directories. Recipe below the cut.
++more

oh, i dont know. what do you think?


David Van Brink // Mon 2008.09.15 18:36 // {wordpress}

one more wordpress plugin

Now that I’ve got my subroutines in place, making certain kinds of helpful WordPress plugins is dangerously easy!

I’ve added plugin such that <w w="George Washington"/> becomes a tiny Wikipedia link, like this: .

Pretty cool, huh? Now when I talk about cabbages and kings I can quickly refer you to authoritative information on the subject.

At some point I needs must package up these plugins to make them easier to share; til then, it’s possible at least to hork them from the plugins directory of this blog.

oh, i dont know. what do you think?


David Van Brink // Sun 2008.09.14 18:45 // {code scripting wordpress}

simple browser tricks

In a detour to a detour to some longer term goal, I needed to do some minimal HTML/JavaScript coding. The regularly scheduled hardware and WBL tinkering — including soldering, LEDs, and wireless sensors — will resume shortly.

++more

oh, i dont know. what do you think?


David Van Brink // Sat 2007.07.28 21:50 // {wordpress}

mimeo: new wordpress theme

For some reason I’m easily drawn into highly detailed activities which require short-lived arcane knowledge. (Perhaps “knowledge” is too generous a term for it.) But if you’re reading this, there’s a good chance that you have similar inclinations.

It was necessary to finally get a good grasp of cascading style sheets to create a wordpress theme which matched omino’s home page. I finally understand how the screenWidth = blockWidth + 2(padding + border + margin)! I wrote a dense interactive web page to help figure it out. You can try it here if you like.

I call it mimeo. One of the main goals of mimeo was to keep the readable narrow column from the “Kubrick” default, but allow lots of room for wide photos and code examples. Here’s the pre-tag in use (which is only relevant if the blog still uses mimeo by the time you read this):

SAMesh *createMesh(long *argbPixels,int width, int height, int pixelsPerRow,
                   float originX,float originY,float cellsizeX,float cellsizeY,
                   SAMeshEdgeBehavior edgeBehavior,float edgeConstant)
{
    SAMesh *result = 0;

    // we build the mesh with an extra half-sized border around the cells. 
    // Each point in the bitmap becomes a non-border vertex.
    int meshWidth = width + 2;
    int meshHeight = height + 2;
    int vertexCount = meshWidth * meshHeight;
    result = (SAMesh *)calloc(sizeof(SAMesh) + vertexCount * sizeof(SAMeshVertex),1);
    ...

If you’d like to use mimeo theme — it’s quite customizable for different colors and spacings — it’s available here.

oh, i dont know. what do you think?


David Van Brink // Sat 2007.07.28 20:58 // {wordpress}

mimeo theme

mimeo is a simple two column wordpress theme with the sort of simple design elements i like. also, narrow column for prose, because I think it’s easiest to read that way and generous right-hand spill-room for wider images and inline code examples.

download mimeo 0.75

oh, i dont know. what do you think?


David Van Brink // Thu 2006.12.14 14:44 // {wordpress}

Cheap Captcha for WordPress

Problem
I don’t know about you, but I have been getting, lately, dozens of spam WordPress comments. It was enough that it overwhelmed the occasional real comment (hopefully I havent deleted yours).

Experimental Solution
I forget where I heard of this, probably someone linked from Dan Jalkut’s Red Sweater, but they mentioned adding a simple “type this” field to the comments form. So, I finally went ahead and implemented just that. For mine, I added a required field asking that you type “hormel”.

The diff below is against dreamhost’s servers’ time-based .snapshot directory, which is here used as an incredibly weak revision control system, but adequate, sort of, for now. I’ve added it to several blogs with different versions of WordPress; the line numbers vary but the text remains the same.


[polyomino@gage] ~/subservientastronaut.com/blog: diff \
	wp-content/themes/default/comments.php \
	wp-content/themes/default/.snapshot/weekly.0/comments.php

90,92d90
+ <!-- the "hormel" hack is always shown, even to logged-in users -->
+ <p><input type="text" name="sekrit" id="sekrit" value="" size="22" tabindex="4" />
+ <label for="sekrit"><small>The word hormel (required)</small></label></p>

[polyomino@gage] ~/subservientastronaut.com/blog: diff \
	wp-comments-post.php \
	.snapshot/weekly.0

29,32d28
+ $comment_sekrit       = trim($_POST['sekrit']);
+ 
+ if($comment_sekrit != "hormel")
+               die( __('Thank you for your hormel product, robot!') );

The result is that the comments field includes a box like so:

Leave a Reply

Experimental Results

Over four days, the number of spam-comments dropped from many many dozens to just one. How did that one get through? Are they on to this?? Arrgh! The problem with security like this is that it only works until lots of people use it, at which point it becomes noticeable enough that the robots evolve to their next stage.

Of course, this does nothing to address a far more profound and fundamental issue: I aspire to have a readership who don’t think I need Viagra!

Addendum
2006.12.15 disabled trackback.php, and spam seems to have dropped to nothing. If it returns, I’ll activate akismet…

5 comments
Kent // Thu 2006.12.14 15:313:31 pm

Have you enabled Akismet, usually comes default with WordPress, you just need a WordPress.com API key? It’s catching all spam on my own blog.
http://wiki.lifetype.net/index.php/Plugin_akismet

–Kent

Daniel Jalkut // Thu 2006.12.14 22:3510:35 pm

Definitely agree that Akismet is worth a shot. It catches literally thousands of spam on my blog.

David Van Brink // Thu 2006.12.14 23:3211:32 pm

Kent! Great to hear from you! I found your music-ish blog too. I’ll be ’round.

Thanks for the recommendations for akismet; it is indeed one of the available plugins listed and I have my new WordPress API key ready and waiting. Perhaps I’ll activate it…

But I made the one further step of disabling trackback (apparently a fairly-used back-door for WordPress spam) and the rate seems to have dropped to *zero*. Maybe that will do the trick. Maybe not. Meanwhile, making you type a funny word amuses me.

I am guilty hubris & NIH, galore. No question of it.

Douglas // Sun 2006.12.17 23:0811:08 pm

Dude, just do Akismet.

Kent Sandvik // Sat 2006.12.30 21:319:31 pm

Trackbacks are actually nice. I still remember the day when I commented something in my blog based on a snippet in Thomas Dolby’s blog, and it showed up there, and Mr. Dolby himself commented on my entry. The power of trackbacks! Kind of usenet, but with a modern twist.

But yes, having a required word is just fine. With phpbb it does not work any longer, the phpbb spam systems are semi-smart and could go around it. One way is to have variations, type in words backwards, or every second word, or upper-case… –Kent

oh, i dont know. what do you think?



(c) 2003-2011 omino.com / contact poly@omino.com