August, 2005

Aug 05


I hadn’t partied much this year until a few weeks ago and had forgotten how good it tastes. The last three weekends have seen three brilliant parties and a couple of really good clubs. These days though, going clubbing just seems like a warm up for going to a party, which are much more fun when you’re with the right crowd. I’ve met some exceptionally cool people and had a silly amount of fun winding people up, climbing along couches with Sarah while laughing uncontrollably and generally arsing about in fine style.

At one stage this weekend my mate Paul said,

“Mark, I think that you are Jesus Christ”

Any party where someone tells you you’re the son of God then later suggests that you get cloned for deployment in warzones and nominated for the Nobel Peace Prize has just got to be good, right?

Aug 05

Ten year anniversary of JMCs death

JMC died ten years ago. I remember when it I first read about it. This isn’t really a post about him – it’s more about me wondering how ten years have gone past since then. I mean… wow, ten years!

For those who don’t know, Jason McRoy was a leading UK downhill racer at the time and general handy lad on a bike. Most notably, for me at least, he was in the Dirt video (came out about the time he died if I remember correctly) which is probably the most inspirational video I’ve seen. Sure, being fifteen and highly impressionable definitely helped, but this thing was special. It just summed up pretty much everything biking was about at the time for me. Obviously they were stacks better than us, but they weren’t really doing anything we weren’t doing every night after school. There wasn’t any triple backflip 360 superman crap, just a bunch of guys going out and messing about on their bikes on some pretty ordinary looking trails. Stonking stuff. Ten years since that video. Crazy.

But, of course, it’s not that crazy really – more stuff has happened since then than I could ever remember, nevermind write down. Life has been full to the brim and then some. I’ve changed, my friends and family have changed, in fact everything seems to have changed so much. But I think back over the last ten years and have very few regrets. My life has been brilliant so far. Not always good, but brilliant nontheless. And that’s important. Maybe I’ll read this post in ten years and think the same thing. I hope so.

Note to self in 2015: presumably life still consists of running about doing cool stuff. If so, there’s a chance you’ve been too busy to do all those cool things you dreamt about. You’re running out of time. Quit work and spend all your money if you have to, but get them done.

Aug 05

Templating engines

I’ve been working on a PHP template engine over the last couple of weeks. As with a lot of things, there are mixed views about templating. I used to advocate not touching them – they’re slower, sometimes restrictive and sometimes make you learn a new language. I just couldn’t see the point. But after working with a few different designers/HTML coders, the clouds started to clear – although some were completely fine with with PHP, some got confused and some even got scared of doing very much at all – I decided that a template engine was the way to go, especially as if you the right one you get free presentation and business logic separation (a Good Thing – use Google if you want an explanation).

Ian Leitch’s post on templating popped up on Gentoo Planet today and he seems as confused as a lot of people are. He points out that templating systems usually go one of two ways – allow a limited set of commands or allow loads of commands. I agree that if you want to enable a lot of commands, you should probably scrap the whole templating thing and give full access to PHP or whatever, although this has a whole new set of considerations. Some people say that if your designer can’t learn PHP you should find a different designer. Unfortunately, in my world, this isn’t always an option. I have to work with a variety of designers/HTML coders and often have no control over who they are. Occasionally, if God is feeling particularly unkind, I have the unparalelled joy of working with HTML dreamweaver table based designers or other such scum. What would you rather these clowns had their hands on – PHP/Ruby/whatever or a limited set of operations of your choosing? In the end, what you use probably depends on circumstance as much as anything else. If you are lucky enough to only work with designers who are comfortable and proficient with your scripting language of choice, then templating gives you far fewer gains than if you have to work with people who you’d rather not give access to the filesystem to. But I still think there are gains to be had.

I looked into some template engines – there are hundreds of them – but couldn’t find one that seemed right (I guess that’s why there are hundreds of them), so decided to write my own. I might write more about my own template engine in another post, but to whet the appetite (or not, as is probably the case) I based my engine on the following:

  • Not all designers are stupid and crap with code. But some are.
  • The template code should be easy to read and write.
  • You should be able to load a template file in a browser (without a web server) and view the placeholders.
  • Should be easily maintainable and extensible.

While developing my system, an added bonus has been that I’ve found it way nicer to code templates now than using foreach, echo, etc. This wasn’t really part of the main plan, but it’s lovely that it’s worked out like that. Maybe I’ll write more about it later.

I get the impression that he likes the idea of separating presentation from business logic but that he doesn’t want to restrict what developers can do.

Aug 05

Port forwarding awkwardness

Thanks to Jonathan for pointing this out, it may save someone some frustrating hours.

When setting up port forwarding (to route traffic on a certain port from the public internet to a specified machine on your LAN), the port forwarding will not work if you try to access your public IP from within your LAN. I haven’t found a good explanation of why this is, only that the router is unable to loop the request back to the local machine. Actually, that’s not entirely true – some routers do loopback and allow the forwarding to work, but from what I understand, most do not.

Who can guess what I spent ages trying to get working over the weekend? To be fair, I was getting confused because SSHing from a shared webhost into my local machine would work, yet trying to access any Apache served pages on my machine wouldn’t work and would on occasion crash the router. This definitely counts as one of those ‘pokey’ problems.