Cunning closures

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

I just wrote a nifty bit of Javascript to allow nested lists to be displayed as a tree with little buttons to hide and show parts. It’s incredibly simple to use.

Firstly include the javascript file with a script tag (obviously). Then put a span element around the list you want to be undisplayable that has the class tree (in fact it can be any element with the correct class).

The clever bit (for me at least) is that it uses a closure to do this. Explaining what a closure is is difficult to do quickly but it involves a function returning a function that is altered by the values passed to the function (the first one). It’s being used right now in my sidebar to display “pages”.

The power of coincidence

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

In March I spent a weekend in Blackpool with my girlfriend, mainly to go to Blackpool Pleasure Beach, a theme park. While we were there we briefly met a guy trying to sell us a CD of “monk rock” or something (one of those people collecting for a good cause basically.

Well yesterday we met him again in Rotherham. Same person doing the same thing. Quite how unlikely it is that one of us could meet the same guy twice is amazing, but we spend a lot of time apart so to think we could both meet him together is even more amazing.

I think I’ve found my traffic

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

Have you heard of hReview? It’s a microformat aimed at marking up reviews of things in a consistent way with web pages (or any XML based document). The wiki discussing it links to implementations and SiteReviews.org implements it and so gets a link.

Whoopee!

PHP Security Checker

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

Here’s an interesting utility (that most WordPress users will have seen already since it’s mentioned on the news part of the dashboard: a PHP Security Checker.

I’m not sure how it works; it sounds like it just scans PHP scripts and returns references to possibly dodgy bits of code. Donncha O Caoimh of Holy Shmoly! raised a point that I never really thought about - the security of WordPress themes. However much the creators of WordPress like to point out that their template files don’t require knowledge of PHP, that doesn’t mean you can’t put PHP in them to do whatever you like… Maybe this utility will help.

Let there be colour

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

I decided if Ryan is going to post more often there needs to be an easier way to tell our posts apart, so I decided to fiddle around with the theme a bit. Basically all I did was put a div tag around all the posts setting the class to the author of the post and then added style information for .Ryan and .Oliver. I also changed the top header slightly too.

OrbWars Has Closed!

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

Well Oliver mentioned this briefly below, but I thought I’d just point it out again, as I just realised you can’t post comments to Pages, only Posts!!! So now at least anyone wanting to comment can do so! Anyway, check this out for details: http://www.oliverbrown.me.uk/orbwars-closed/

Donate Blood!

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

I gave blood today and I thought I’d quickly ask you all to give blood! A lot of people I talk to who don’t give blood tend not to have a good reason not to other than vague apathy (i.e. just not getting round to it).

So if you can give blood (and you probably can), you should give blood!

Some links below for information about donating blood:

UK America Scotland Ireland

Or just search Google for donate blood and your country of choice for information.

donate blood, blood donor, blood, donor

PageRank 5?

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

According to the Google Toolbar in FireFox www.oliverbrown.me.uk now has a PageRank of 5.

My conclusion is that tags are a good way to get links to your blog since a quick search on Google for oliverbrown.me.uk returns mainly sites indexing tags in some way.

So if you aren’t using them already (and apparently two thirds of blogs aren’t) then get using them!

PHP tutorials

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

I’m contemplating writing a mini-tutorial about OOP in PHP. I know there are many out there already but I have a friend in particular I’m trying to get to get to grips with this so he can help with parts of Galaxia Reborn (some parts are superbly modular; I may put the specs for such online and maybe have an online editing option of some sort for anyone who wants to help).

Either way writing a tutorial would probably be a good exercise as well as a good source of useful content .

“to get to get to” has to be a quote of the year or something.

Pimsleur Rules

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

I made an interesting loan from my local library a couple of days ago; Pimsleur Complete German I. It’s a lot better than I expected. Whether it really is as good as it seems I can’t really judge since I haven’t really got to any material that is completely new to me.

The progress feels fairly slow but to be honest it isn’t any slower than most book-based courses should be since it forces you to do the exercises you might normally just gloss over.

For anybody considering learning a language I strongly suggest trying to find a copy of the Pimsleur course for it (i.e. not buy if you can avoid; they’re expensive).

Just to prove I’m not the only one who likes this, check these comments from someone learning Spanish.

(Unfortunately they don’t do Finnish by the way.)