Introducing “Blocks 2015”

blocksYesterday, I blogged about the 5k Awards. I mentioned that I managed to find the “Blocks” project that Wouter de Jong and I entered, but that it didn’t work in modern day browsers. Of course, that was rather unsatisfactory.

So today, with the help of jsbeautifier.org, I spent some time fixing the javascript code, removing 20th century browser checks, and coverting upper case HTML tags to lowercase. The result is a working version of the original project. It may not look like much now, but 15 years ago, it did really well in the 5k Awards, reaching the top 5 in all categories.

Like the 2000 version, it lacks some basic HTML things – like a doctype declaration – to keep the file size down. It’s functionally and visually identical to the old version, but it now works in recent versions of Chrome, Firefox and IE. And thanks to modern day minifiers, the whole thing is now under 4 kilobytes.

Check it out here:

http://media.roytanck.com/5k/blocks/

Opening links inside WordPress comments in a new window

A project I’m working on requires all links to external sites to open in a new browser window or tab. This is easy enough for regular content, but I’ll have to figure out a way to add a target-attribute to links inside comments left by readers. WordPress automatically transforms URLs into links, but does not add this attribute. Unfortunately, many of the solutions I found a less than ideal. Somehow, the same piece of code keeps turning up in Google. Most search results are a variation of the following snippet (from Cats Who Code).

function autoblank($text) {
	$return = str_replace('<a', '<a target="_blank"', $text);
	return $return;
}
add_filter('the_content', 'autoblank');

This will simply replace every occurrence of <a with <a target="_blank". There are two problems with this approach.
More Opening links inside WordPress comments in a new window

Roy | April 2, 2015 | English,Programming | Comments (2)
Tags: , ,

I’ll no longer be developing WP-Cumulus

It’s been well over a year since I last blogged about WP-Cumulus. In the mean time, there have been all sorts of developments. I’ve been in serious talks with a potential buyer. That didn’t work out. I’ve tried, a number of times, to do a rewrite. That didn’t work out either. But most importantly, I gradually lost interest. Which is why I’ve decided I’ll no longer dedicate any time to Cumulus.
More I’ll no longer be developing WP-Cumulus

Taming wp_list_pages

Ever since pages got added to WordPress in version 1.5, wp_list_pages has been the way to get a list of pages. In the pre-widgets era, it used to be coded into pretty much every theme’s sidebar or header to generate the site’s menu.

Nowadays wp_list_pages is at the heart of the Pages widget, and it’s perfect for blog-type sites with a modest number of pages. But if you’re using WordPress as a CMS, and most of your content is written as pages, using wp_list_pages can cause serious performance issues.
More Taming wp_list_pages

Getting my Flickr/Picasa widget working again with Picasa’s new feeds

Recently, Picasa started serving its RSS feeds over https. From what I can tell, this has caused quite a view “clients” to fail. Digital photo frames seem to be affected, and so is my Flickr widget. Fortunately, there’s a quick fix.

I’ve run a few tests, and it seems that simply removing the “s” from “https” fixes the issue. Every feed I tried could be called up over regular old http as well, and all of them worked with my widget.
More Getting my Flickr/Picasa widget working again with Picasa’s new feeds

Erratic behavior with Flash’s textWidth property

Just a quick post in case anyone else ever runs into this and manages to find their way to my blog.

I just came across this in a client project I’m working on. I was using a TextField in Flash CS5, and needed to know the width of the actual text inside it for positioning purposes. What I found was that in about 50% of cases, the textWidth property would return zero instead of the strings length in pixels. I tried using autoSize on the TextField and found that it would shorten half of its instances to a single character or less, causing the rest of the line to be invisible.

At first I thought there was something wrong with the font file, but the same happened with Verdana. So I started randomly changing settings, and it turns out that the “anti-alias for readability” setting was causing this. As soon as I changed that setting to “anti-alias for readability” the textfields were being autosized properly, and reported their actual lengths through the textWidth property.
More Erratic behavior with Flash’s textWidth property

Roy | November 25, 2010 | English,Flash,Programming | Comments (10)
Tags: , , ,

bbAggregate lets you mix and match WordPress content

When I first started using WPMU, the now-integrated multisite version of WordPress, I found it strange that there were no built-in tools to aggregate content onto the main blog. It seemed to me that that was something plenty of people would want to do. Sure, there were plugins and hacks, but none of them were as polished as I’d like them to be.

Fortunately, things have changed. WordPress 3.0 now has multisite capabilities built right into it, and Bjorn Wijers, a friend of mine and one of Holland’s top WordPress developers, has created a really cool plugin to handle content aggregation. Called bbAggregate, this plugin doesn’t just collect posts from blogs to be displayed on the home page, it allows you to display aggregated content on any of your network’s blogs. And to do this it introduces the concept of streams.
More bbAggregate lets you mix and match WordPress content

iBubble Shooter now has nag screens, but can you really blame Absolutist?

Don’t get me wrong. I hate nag screens as much as anyone, but after playing the free version of iBubble Shooter for quite some time I’m can’t really blame them for trying to get me to upgrade. The game is based on the classic bust-a-move principle, in which you shoot bubbles from the bottom of the screen trying to group them together based on color. It’s pretty good, certainly the best touch screen translation of the concept that I’ve played. At € 0.80 it’s a steal. But that was even more true for the original free version.
More iBubble Shooter now has nag screens, but can you really blame Absolutist?

Roy | September 27, 2010 | English,Programming | Comments Off on iBubble Shooter now has nag screens, but can you really blame Absolutist?
Tags: , , , , , , , , , ,

Creating a split menu in WordPress 3.0

For a project I’m working on, I needed to create a split menu, where the top level navigation was in a horizontal menu in the header, with all underlying content listed elsewhere on the page. This turned out to be a little harder than I had anticipated, but I managed to get it working. Here’s how I did it. Feel free to add suggestions in the comments if you see room for improvement.


More Creating a split menu in WordPress 3.0

Snapatar now uses oAuth (phew!)

As some of you may know, Twitter is fading out support for “basic authentication”. This basically means that app developers (like myself) can’t just send a user’s login information to Twitter’s server when we want to send a tweet or change a setting. Instead the application needs to be “authorized” by the user using a process called oAuth.

For Snapatar, this meant I needed to make a lot of changes. OAuth is far from trivial to implement, and I was lucky to find a library that handles most of the complicated stuff. With it, I was able to get oAuth working on snapatar.com, and beat the August 16 deadline. More Snapatar now uses oAuth (phew!)

Roy | August 18, 2010 | English,Programming | Comments Off on Snapatar now uses oAuth (phew!)
Tags: , , , , , ,