Templating

March 24, 2008 · Posted in Tech & Server Management · Comment 

I’ve been spending quite a couple of hours lately getting my new template engine to work. This piece of software, written in PHP (naturally), takes HTML templates and has the ability to substitute variables in that page, include other files in it, and hide or replicate sections of code (blocks). The positive upshot of this is that it allows you to keep the PHP and HTML code for a website as good as completely separated, which keeps both PHP and HTML clean and easy to modify something.

However, writing a template engine is everything except easy. I attempted it once before but gave up after having wasted lots of hours, but I finally decided to have another go. There’s a lot of pretty complex string parsing going on, and especially including other templates is a major pain in the ass. It can take forever to debug issues (such as pieces of HTML showing up in completely the wrong location). One bug that kept me busy in particular just added code to a template for no apparant reason. After long searching I finally found that the problem was the function that actually reads the files, which wasn’t cleaning up its buffer. And all that for a total of 23 kilobytes of code.

The engine works pretty smoothly though. Unlike many other template engines it does not make use of slow, complex and resource-intensive regular expressions. Not a single one. The result: 13 milliseconds average parsing time and 0.1 millisecond processing time, using a simple test template (that does use every feature the engine has several times over).

For the moment I’m using this for a litl’ project, but some time I might share the engine with the rest of the world.

Change of policy

March 19, 2008 · Posted in Tech & Server Management · Comment 

In the first post on this shiny new DamnLeet.com site, I’ve announced that from now on you must register and be logged in to post comments. From now, that is no longer necessary and anyone can post comments without logging in, however keep in mind that if it requires me to delete spam comments on a daily basis it’ll soon again be turned back the way it was.

Also I’ve updated the WordPress software to the shiny new version number 2.5-RC1. This may have caused everything to be unreachable for a short period of time.

The Story of Roy

March 19, 2008 · Posted in Random Things · Comment 

Once upon a time there was a very cool triangle named Roy. This triangle was green with red dots on his head and he was 37 years young. He lived in the Land of the Circles, which was somewhat odd, because he is after all a triangle. The Circles thought he was a bit of a strange circle, but then again most of them also thought that in some way that was cool (after all Roy is a cool triangle) and for that very reason he was chozen as the very first triangle-shaped king of the Land of the Circles.

The leaders of the neighbouring countries (Lawn and Plasticthrowawaycoffeecuptreerootjuice, which were both on the east side of the Land of the Circle because everything else on the cubic shaped planet was ocean) heard of this great news about Roy and therefore came to visit him, to have a nice cup of red paint together and talk about the relationships between their countries.

The king of Lawn was a rather fat little man, about the height of a banana, did not at all notice that Roy was actually a triangle. That is because the good man is blind for shapes: no matter what shape an object (or person) has, to him everything is simply square. Because he didn’t notice Roy was a three-angled triangle he gave him a compliment for his four perfect angles. Of course Roy wasnt’ too happy about that, because he, being a triangle,  posessed only three angles (however he did sometimes wish he could find a fourth because his mother always said that would look good on his green tie). Anyway, Roy wasn’t very happy about it, but since he knew the poor man is shape-blind he didn’t take any offence.

The count of Plasticthrowawaycoffeecuptreerootjuice however, didn’t take it very lightly. He found that Roy, in all his green-with-red-dotsness really didn’t have more than 3 angles and since he didn’t like the king of Lawn anyway he declared war on Lawn. He explained that Lawn had been doing secret weapon tests in an area very close with their border, that they were doing it was fine with him but he always said ‘Lawn, not in my back yard’.

To get the war over with as soon as he could, the count of Plasticthrowawaycoffeecuptreerootjuice imediatly took out his digital watch with InstaKill function. With a little click he opened the watch, aimed it at the king of Lawn, and corrected the time because the watch was five minutes off. The king of Lawn instantly died and he fell down on the ground, walked in a circle a few times, and stood back up to lie down in his coffin (which really was a small box because an entire coffin would be a waste of perfectly good wood since he was only as large as a banana).

After doing that the count of Plasticthrowawaycoffeecuptreerootjuice apologized for the mess and left for home. He claimed that he still had to tell a story to his children, otherwise they would refuse to go to sleep.

Of course it remained to be a strange fact that the king of the Land of the Circles was a triangle. After a while the press noticed, and Roy was forced to step down as king. A new king was elected, however because the new king was a perfect circle he kept rolling off the throne, and so he was forced to step down as well.

And they lived more or less happily everafter, and they often chose new kings…

Odd

March 17, 2008 · Posted in Tech & Server Management · Comment 

Yesterday I decided more or less randomly to check up on the server’s bandwith consumption. I found a somewhat massive spike in it around 10:00 AM (which is very odd considering it was on a Sunday). It lasted for about 20-30 minutes, at 10 megabit per second (10% of the uplink capacity). The result was over 3 GB of traffic, but considering I’ve got more than enough it doesn’t make a lot of difference (except that this bigass spike looks supid on the graphs).

Now we’re talking bandwith statistics anyway, I managed to get Cacti working on server 3 (one of my local machines). It basically polls network equipment and uses the data to make nice graphs (it monitors the backplane and each switch port). It’ll also be running on any LAN-party I either organize or visit, so for all those who are going to CampZone 2008 and are in our tent: I know how much pr0n you’re downloading.

The 2nd FoF song I announced in the previous post is still pending, I havn’t really had the time (read: didn’t feel like) finishing it currently.

Also I’m investing more and more time in a little software project of mine. I won’t run into any details of it yet, but it should some day run behind the scenes on this server. It’ll be quite neat actually. Of course it’s written in PHP, and it does quite a few things which most of the people didn’t even know it was at all possible with PHP. Anyway, the SVN repository is growing on an almost-daily basis. Gotta love SVN: once you get it working, it’s quite useful. Branching/tagging, reverting back if you did something wrong, etc etc etc – not to mention that now my precious code is stored on 4 different computers (my desktop, laptop, this server which hosts SVN and the backup server).

Oh well. Soon I’ll be posting my l33t story about Roy. Roy is a triangle who becomes king in the country of the circles. It’s very interesting. :)

Conquer this

March 9, 2008 · Posted in Blog, Random Things · Comment 

It’s been about a week and this are kinda up and running. I admit that at the moment of writing there’s a little subdomain that doesn’t really want to cooperate, but I don’t see any error at this moment and it’s half past eleven (PM, yes) and the weekend hasn’t been quite as relaxing as weekends are supposed to be. Oh, and mail doesn’t work. Maybe because I’m just too lazy to set up a mail system (mind you, if you think setting up a webserver is easy, try the mail part). Oh well, I currently don’t really need one anyway.

The title of this article is ‘Conquer this’, which is referring to my ‘latest’ creation. Actually I created it about two weeks ago (and in the meanwhile I’ve been watching Stargate episodes and playing some games). This creation is a litl’ song for the game Frets on Fire (a rather entertaining Guitar Hero ripoff for the PC). I found that there was a serious lack of blackened death metallish stuff, so I figured that the song Conquer All from Behemoth would be a nice addition. Initially I created it on Medium difficulty, and however the first part is more like Easy, once the song progresses it’s not so much Medium anymore. Nearly Impossible would be a better description. If you think you can handle the game (and if you don’t think so as well), go ahead and try it. Download it here: Behemoth – Conquer All (Frets on Fire).

I also have another song in the works. The song’s title is Korobeiniki, more commonly known as the Tetris theme song. I am planning to finish it this week or so :)

As I mentioned, I’ve been watching (quite a lot of) Stargate episodes lately. Yesterday I saw the new Stargate movie, titled The Ark of Truth. To me it just feels like a regular two-part episode than a movie, and if you havn’t seen at least the final two seasons of Stargate SG-1 you probably won’t understand the story at all, but I rather liked it. The opening of the movie feels incredibly epic, and there’s some really nice shots in there. Now SG-1 both started and ended with a movie, and let’s be honest, this one is a lot better than the original Stargate movie which tends to get a little boring because it’s so damn LONG. I’m now close to having seen ALL of SG-1, and the Atlantis season 4 finale has aired as well (which I unfortunately havn’t been able to see yet). Luckily season 5 has been announced long ago, and let’s just hope that they’ll continue for many more seasons.

kthnxbye