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!”.

Linguaphone rocks less

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

I just picked up Linguaphone German from my local library. 4 books and 9 CDs in a large box certainly looks impressive but I don’t think it’s as good as Pimsleur. Looking through the books it clearly goes to a higher level and has far more explanations of grammar in it. But I think it does it too quickly and I’m not convinced a beginner would find it much use on it’s own. For someone who already has familiarity with the language it may work quite well. Watch this space.

Buying text links…

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

There are quite a few marketplace-type sites out there facilitating text link trading. I don’t mean link exchanges, I mean buying and selling text links.

I’ve read a few reports of high profile sites having their PageRank-passing-on-ability removed by Google because of this, but for the most part it’s probably safe. The main reason being so many sites are doing it that the skew caused by removing those sites could well be bigger than the skew caused by leaving them in. On the other hand, it may not be that much of a problem. Although it is a very suspect argument, you could say that a site willing to pay that much (and we’re talking upwards of $15 per month per link) must have something to offer.

At the moment it doesn’t always work like that since many sites are some sort of affiliate adding no new content or are domain-parking-like sites. People are becoming aware of these things though (it’s easy to spot such pages in Google’s own sponsored sites section of search results) and as such more useful sites are actually using this as a valid advertising source.

If you’re interested you might try Text Link Brokers or Linkworth. Linkworth have lots of little tools people can use without actually buying or selling any links and have no minimum PR, and are more open. Text Link Brokers have been at it for longer and have more high PR sites (some PR 8 sites with .gov back-links).

Star Wreck

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

It’s about time I mentioned Star Wreck.

It’s an amazing spoof of Star Trek. Quite how amazing has to be seen to be believed. Some of the special effects are actually better than the real thing. Go to the site and at least download the trailer now (I’m on dialup and managed - it’s only 18Mb).

There is one catch however, it’s in Finnish…

Competing with Pimsleur

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

As I mentioned earlier, I’ve written the framework for a language learning system similar to Pimsleur. Well the approach is similar but the mechanics are different.

Basically each phrase (in English, the target language, what the instructor says) is a separate audio file. The system then chooses what you listen to automatically handling things like the right amount of repetition or you. How often something is repeated is time based meaning if people do things slowly they will find themselves repeating more often (which makes more sense since slower equates to using the system less often). I almost have a demo ready. The big thing I need however is voice talent. I’ve just about accepted that I will have to suffer by hearing myself but it’s not very clear what’s going on if the instructor, the English voice and the foreign voice are all the same person.

It is also extremely modular. Each module (a module could be a conversation, a sentence, a whole topic - whatever makes sense in the circumstances) has a list of requirements that has to be completed first. This means no explicit ordering of modules is necessary, the system picks whichever one the learner can do. This also allows some cross-language capabilities. If someone learns more than one language and something is similar or the same in the two, it could tell and possibly speed things up depending on how similar they are.

So if there is anyone who might possibly be interested, let me know. If you’re learning a language this could be ideal (during my Maths degree I discovered if I could explain something to someone else, it was a good sign I understood it myself) I’m not quite sure if, and how (or should) this make money but anyone who helps significantly would have a say in what happens with it.

iMode and cHTML

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

I’ve seen adverts around for iMode recently, with no idea what it was. Well I found out last night by coincidence after looking around Google Sitemaps. Well sort of. Although I didn’t look at the details it seems like some sort of alternative to WAP. What interested me more was cHTML, iMode’s equivalent of WML.

cHTML, or Compact HTML, is basically what WML should have been. Instead of completely new tags and new way of looking at things it’s just a subset of HTML that makes sense for mobile devices. There are a few extensions to normal HTML but these aren’t required and are very simple anyway (like using tel: in a link the same way you’d use mailto:).

Of course I don’t really have any sites that would make sense in a mobile world…

Just search for imode chtml for loads of bits of info.

Galactic Horde

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

You may have seen the link for Galactic Horde, an online game, in the links bar but never thought to visit. Well the link is not there randomly, it’s something I helped in. Specifically I wrote the PHP back-end for it.

Well I never really had time to play it myself and never knew exactly how the client interacted with what I wrote. The result is that I can read the forums for the game and have no idea what people are talking about. It’s really scary.

Have a look in their forums for an idea.

Hitchhiker’s Guide to the Galaxy

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

How dare they!

In 2004 they released original cast (near enough) dramatisations of the third, fourth and fifth Hitchhikers book without telling me! I always thought the book version had the better (and more developed) story and hoped (in vain I thought) they’d make an film/TV/radio/anything version of it. Well they did!

They’ve also given them interesting titles.

Tertiary Phase - Makes sense since “tertiary” comes after “secondary” Quandary Phase - Annoyed me at first since “quaternary” comes after “tertiary”. All is forgiven since they weren’t being serious, see below for the Quintessential Phase