Sky is becoming bad quality…

Oliver Brown
— This upcoming video may not be available to view yet.

For anyone outside the UK, I’m referring to the digital TV broadcast by British Sky Broadcasting (if that is still their name).

They are stuffing far too many channels on there and as a consequence the quality is dropping. Before, you could occasionally see compression artefacts on the images, now they are everywhere. It’s especially noticeable with full screen changes when it’s dark. And once you know what it looks like it is impossible to ignore.

I have a scary theory though. Next year they are going to release SkyHD - basically Sky transmitting a High Definition signal. Now if they compress the channels the way they are now then it really won’t help since compression artefacts look worse at high resolutions. Unless the reason they are compressing channels is to fit higher bandwidth HD signals in. Or they could be doing it intentionally to exaggerate the gains from HDTV…

Wikime :)

Oliver Brown
— This upcoming video may not be available to view yet.

I’ve started editing more on Wikipedia. Not entirely sure why, but it’s quite fun.

If you don’t know what Wikipedia is, it’s a free online Encyclopedia that is editable by anyone. Also all the content is completely redistributable providing the license is kept with it. It’s theoretically multilingual too but only a handful of languages actually have content to rival print Encyclopedias. But the others are coming along.

I’ve also written a couple of articles that I don’t really know anything about - I just distilled stuff from various online sources. It’s easier than I thought too.

Me on Wikipedia/

Nice searching in Wordpress

Oliver Brown
— This upcoming video may not be available to view yet.

You may have noticed that all the tags on my posts point to URLs of the form /ob-search/_search+term_. That’s a reasonably simple bit of mod rewriting. This article is aimed at people who can do that.

I wanted a way for the search box to point to the same pages. I figured I could point the search form at a fake page and redirect (it with a HTTP status code of 302 so it is sent to the browser and the user sees it in his/her address bar) to the nice URL (which would secretly redirect to the real one).

So I came up with the following:

RewriteRule ^fake-search.php?s=(*.)$ /ob-search/$1

It didn’t work. Unfortunately Apache strips of query strings before the get to Rewriting and the reattaches them. So to sort it out I had to hack off the query string with one rule (which is accessed using an environment variable) and then extract the bit I wanted with another rule:

RewriteRule fake-search.php /-%{QUERY_STRING}? RewriteRule ^/-s=(.*)$ /ob-search/$1 [R=302] RewriteRule ^/ob-search/(.*)$ /index.php?s=$1

The third rule just does the “simple” redirecting as a said in the beginning.

The ? appending the query string on to the end afterwards. The hyphen in the first two lines could be anything you want - it’s just something for the second rule to recognise.

To finish it off I altered the search form’s action attribute to point to fake-search.php and all was well :) Try it :D

Wordpress.com Themes

Oliver Brown
— This upcoming video may not be available to view yet.

For those of you who don’t know, Wordpress.com is a Blogger type service run by the creators of Wordpress based on Wordpress.

I have to warn you I have no experience using Wordpress.com, and these comments are based on what I’ve heard.

There have a been comments about how theme support in Wordpress.com is very limited since they obviously can’t let people run arbitrary PHP code. I’m not sure what they do let you do but there is a way that will give almost the power of normal Wordpress templates.

I got the idea from Wordpress referring to it’s template markup as tags (since they’re enclosed in <?php ... ?>). Why not actually use XML tags that correspond to the Wordpress functions? These simpler themes could be transformed into real themes for Wordpress that the user never sees. If they were parsed with regular expressions and went through a callback they could be vetted so only real Wordpress functions are let through. Although it would have to be done carefully for security, it should be fairly straightforward.

So for instance, instead of <?php the_author() ?> you’d have <wp:the_author />.

Finally fixed my template…

Oliver Brown
— This upcoming video may not be available to view yet.

I’ve finally fixed the template. I didn’t realise that the damn thing was switching background images depending on whether this was a single post or not (I added the sidebar to all pages you see).

That’s a lot of links

Oliver Brown
— This upcoming video may not be available to view yet.

Quite old by now but still amazing to see: a reasonably long blog post in which every single word links to a different blog. Quite an achievement. Jeff Blanco

And one service to bind them all

Oliver Brown
— This upcoming video may not be available to view yet.

Google have a new project that could well replace half of their services, Google Base.

It’s a rather vague project designed to pursue their goal of organising the world’s information in the most direct way possible. Anyone can submit (almost) any information they want along with various attributes and labels describing the information and Google will make it searchable.

In theory Google Sitemaps and Froogle could just became specific version of this idea. The only limits on can be uploaded are fairly obvious matters of “decency”. Adult material does seem to be a allowed in general. The most eye catching item not allowed: “Posting is not permitted for the promotion of body parts or human remains.”

More features for Extending SimpleXML

Oliver Brown
— This upcoming video may not be available to view yet.

I’ve added two new public static function to [ExtendXML](/exml.txt). The first one is registerTagClass. This takes two arguments, the first is a tag name and the second is a class (that extends ExtendXML. This will make all children of that tag name become that class instead. The second is registerTagCallback. This takes one argument, a callback. That callback must take one argument, a tag name and must return the class (as a string) that those tags should become.

If for example you were parsing HTML and you wanted all paragraph p tags to be handled by ParagraphXML, you could use: ExtendXML::registerTagClass('p', 'ParagraphXML');

A word of warning, it’s case sensitive. If a callback is registered this will be used regardless of any calls to registerTagClass.

If you’ve never used callbacks before, they take one of three forms. Either a string that is the name of a function, an array with the first element a class name (as a string) and the second element a static method of that class (as a string) or finally, as an array with the first element an object and the second element a method of that object.

EXML, ExtendXML, SimpleXML, XML, parsing XML, PHP5, callbacks, programming, coding, parsing HTML, OOP

Overloaded functions?

Oliver Brown
— This upcoming video may not be available to view yet.

Will PHP ever support overloaded functions? I mean properly - I know you can painstakingly fake it using __call.

If I was on a mailing list I’d probably be able to ask someone who could answer.

Ah well.

PHP, programming, coding

Getting started with Galactic Horde

Oliver Brown
— This upcoming video may not be available to view yet.

Galactic Horde is an online strategy game that I’ve helped program. But I’ve only recently started playing. Unfortunately it can be quite a daunting idea since the game is rather complicated. This provides endless entertainment for people who have mastered it, but problems with regards to getting new players.

As such I intend to write a series of posts containing hints and tips for new players - something I am at the moment.

Unfortunately the only tip this post will contain is “Signup and try it out!”.