Archive for the ‘Site Matters’ Category

Blog problems (once again)

Saturday, August 25th, 2007

As some of you may have noticed my blog has been decidedly offline for a week or so. Today I was sitting with the server and finally found the culprit. The problem is the with the Textile 2 (improved) plugin that I use (and usually love) on both my own site, as well as Susan’s and my mom’s.

I am still missing the plugin upgrade on my mom’s site (I can’t remember the admin password), but once I do it they should all work again.

Sorry for the downtime, but I have a few articles in the pipeline that should tidy you over within the weekend. I will also run with the default theme for wordpress until I make a new theme (which could take a while). I discovered how many plugins I was using in my theme and thought it was time to clean out.

Wordpress upgrade and Akismet

Sunday, June 25th, 2006

In my previous post I complained of all the comment spam I received. The deluge yesterday was the last straw and I upgrade wordpress today. Along with the upgrade I got a Wordpress API key and activated the Akismet plugin.

Several of my “online” friends have spoken well of Akismet, and funnily enough, the first comment since my Wordpress upgrade was a recommendation for Akismet. Although his comment came too late, I want to thank Eby for taking the time to write a few lines.

Along with my upgrade to Wordpress 2.0.3 I also moved my site from www.jonas.rabbe.com to jonas.rabbe.com along with the no-www plugin by PhotoMatt. No more WWW on my site.

I also moved Susan’s site from Movable Type to Wordpress. I still haven’t designed a theme for her, but I hope she’ll like Wordpress as much as I do. With her move came 143 comments, how many of those are comment spam I don’t know, at least Wordpress is easier for deleting comments than Movable Type 2.66. And as a final gesture I deleted the last traces of Movable Type from our web server.

Update: Now I’ve had Akismet running for about a week, and I have had no comment spam. Of course, I pretty much haven’t had any comments either. To tell you the truth, it’s a bit worrying. I’ve been used to getting several hundred comments spams over a weekend, and not even getting any in the Akismet spam queue is a little weird. I don’t know if it’s because I haven’t received any comments, or if they have just been deleted silently, correct me if I’m wronge, but I don’t think Akismet does that.

Oopsdate: I turned off the auto moderate plugin, but forgot to remove the function call from the theme. In that simple way I made it impossible for anyone to comment on my site explaining why I didn’t receive any at all. Thanks to Joen for spotting that.

Final update: Removing the function call did the trick, at least I’ve received plenty of comment spam since last night. And one even came through Akismet… tsk. tsk. tsk…

Comment spam, en masse

Sunday, June 25th, 2006

Comment spam has, unfortunately, been a part of blogging for me pretty much from the start. It was the reason I changed the wordpress with it’s easier comment administration interface.

Lately however, it has become extreme. Yesterday I received 541 pieces of comment spam! If that is not extreme I don’t know what is, especially for a site with maybe 100-200 unique hits a day, the majorite of whom are viewing one page.

The high number of comment spam has also highlighted another problem. I have all new comments (from people who haven’t commented before) go into the moderation queue where I then delete them before they turn up on my page. Loading a page with 515 comments (I had deleted some during the day yesterday) takes a looooooooong time. In fact it takes so long that the Textile 2 plugin I use for formatting my entries and comments times out… I actually have to turn off the plugin to delete all the comment spam.

I guess it’s about time I start thinking about upgrading Wordpress and looking into comment spam plugins.

Mintless

Monday, November 14th, 2005

Doh, I was fiddling around a bit with the design of The Engineered Boulderer and copied the header file for my theme from my test site on my powerbook to here. Unfortunately, I hadn’t added the call to the mint javascript on my test site, and didn’t get any data from 2 am Sunday, until I discovered it a 10 pm.

All translatiatized

Tuesday, November 1st, 2005

Looking through my referers in mint I noticed a google translation someone had tried to read my page in French. I thought that was pretty cool. I guess I’ll use “Bout de chapeau” instead of “Hat tip” from now on, and for some reason “Le Boulderer Machiné” sounds trés cool, although “Le Escalateur Machiné” would probably be more correct (I can’t figure out what boulderer is in French, but bouldering is simply called Bloc after the word for boulder).

International Characters in Textile 2 (Improved)

Wednesday, May 18th, 2005

Recently, I received a comment on the Super Archives about the lack of support for international characters in the implementation. Being a dane I should of course have caught this, but I guess I write too little of my native language.

The comment, however, tipped me off to a problem with both the live preview and the Textile 2 (Improved) plugin. The problem with the live preview was in the Javascript and has been corrected by Jeff Minard, while I haven’t been able to contact Adam Gessaman who’s responsible for the textile plugin (for some reason I can’t leave comments on his blog).

Anyway, for the rest of you who also use the Textile 2 (Improved) plugin I have here included the corrections needed for international character support (this also includes characters like ‘ and – ).

Changes

Change line 2721 from


$html = htmlentities($html);

to


$html = htmlentities($html, ENT_NOQUOTES, $this->options['char_encoding']);

This makes sure the character encoding is taken into account when converting characters to their relevant HTML entities. The default character encoding for the plugin is utf-8 (see below).

Optionally, change line 37 from


$textile->options['char_encoding'] = 'utf-8';

to


$textile->options['char_encoding'] = get_bloginfo('charset');

This is only necessary if you use a character encoding on your blog which is different from utf-8 (not likely, but could happen).

Problems with the (Real) Live Textile Formatting

Saturday, May 7th, 2005

As I mentioned earlier I implemented the (Real) Live Textile Formatting (RLTF) to enable comment previews. I thought all was honky-dory until I tried working with some hefty javascript which was also initialized by the onload function of the body. My javascript initialize function was set to be called after the RLTF initialization, and it wouldn’t get called. A day and a half of debugging and I found the error which was in the javascript for the RLTF.

The RLTF is initialized by the liveReqInit function. In this function the “key down” (or whatever browser dependent) event is assigned to the “search field” using the addEventListener function. The problem occurs on a page where the search field doesn’t exist. The element is found using getElementById which returns null when the element doesn’t exist on the page, and the addEventListener is therefore called on a null object causing the javascript to crash. The crash means the chain of functions for the body onload will abort.

One solution is to check that the search field exists on the page. I do this by inserting the following code at the beginning of the liveReqInit:


	var searchElement = document.getElementById(searchFieldId);
	if( searchElement == null ) return;

Similarly, we should check that the result field exist by inserting


	var resultElement = document.getElementById(resultFieldId);
	if( resultElement == null ) return;

before if(emptyString == '') { near the end of the function.

I hope my headaches will prevent some for others.

Word Count Plugin for WordPress

Friday, May 6th, 2005

Inspired by Chris’ discovery of odd behavior in the wp-word-count plugin I set out to create a version which would not be cheated by occurrences of the word “img” in an entry. I am a coder and web-developer myself and could see myself writing snippets of HTML in my posts.

The solution I found was to run the relevant filters on the content, after I get it back from the database. Using the function apply_filters I was left with a chunk of real HTML. I could strip the tags of this HTML to count the words, and search the HTML for occurences of the <img ... /> tag by searching for the string “<img”.

So there you have it: The Engineered Boulderer’s Word Count Plugin.

Changelog

Version 1.1: Does not count wordpress included smilies as images. Added an argument to allow the plugin to count smilies as images.

Version 1.2: Corrected a bug in the implementation of version 1.1

Documentation

The template function the plugin provides is teb_word_count(display) which accepts two arguments.

display
(boolean) sets whether the function should display the number of words and images, or if it should return them.

  • true (default)
  • false

count_smilies
(boolean) set whether smilies should be counted as images. If false, the plugin will simply disregard smilies (neither count them as text, nor images).

  • true
  • false (default)

Disclaimer: This plugin has been tested to work on my test blog and here, but it could break in real life. If you see any problems with my implementation be sure to let me know.

Live Comment Preview

Thursday, May 5th, 2005

I have now implemented live comment preview on the comment form. The preview is the same (Real) Live Textile Preview as seen on Binary Bonsai and described in one of Joen’s amazing articles.

The (Real) Live Textile Preview is not a plugin such as several of the other preview solutions, rather it is a number of javascripts and php scripts. The javascripts attach a function to the “key pressed” event of the comment field. Every time a key is pressed the text is passed to the php scripts through the magic of XMLHttpRequest (or AJAX) and returned as HTML. This returned batch of HTML is then shown to the user in the preview box.

This solution is a little more complex that the pure javascript or even simpler WordPress plugins. However, it has the clear advantage of being correct Textile. One simple example is links, if you write a link as the last part of a sentence, the period will in the javascript solutions be counted as part of the link, the (Real) Live Textile Preview shows this correctly. Having used Textile since I started using MovableType, this is a big plus for me.

As Joen pointed out, however, there are also disadvantages to this solution. Each keypress has the potential of sending a request to you server, if many people write comments at the same time, this can become a real burden. To be realistic though, the number of comments I receive are very small and the added load to the server will probably only serve to get it a bit more in shape.

I’ll run with it as is for now, try out my comments and tell me what you think.

Category Count plugin for WordPress

Wednesday, May 4th, 2005

It’s official I have made my first WordPress plugin. As far as plugins go, however, it’s quite meager. The plugin contains one functionality, it counts the number of categories in which there are published posts. You can see it in action in the sidebar of my archives.

The template function the plugin provides is teb_category_count(display) which accepts a single argument.

display
(boolean) sets whether the function should display the number of categories, or if it should return it.

  • true (default)
  • false

Disclaimer: This plugin has been tested to work on my test blog and here, but it could break in real life. If you see any problems with my implementation be sure to let me know.