computer violence

taken from #linux on irc.linux.ie

<dredg> rndc flush
<paul> dont forget to put the seat down after
<dredg> funny guy
<kverens> !flush paul
<doneagai2> Mean Bastard
<davidd> KICK HIS ASS, MOFO!
<paul> dredg: i try
<ompaul> oh yeah here we go again coding through violence
<davidd> 🙂
<doneagai2> ompaul: you mean there is another way?
<ompaul> yes object throwing
<ompaul> yes extremist methods
<doneagai2> ompaul point taken
<bigbro> while(1){ kill -9 `pgrep $person`; };
<bigbro> hahahahahahahahahahahahahahaa etc…
<ompaul> bigbro mass storage devices for the bodies?
<bigbro> ompaul: Something like that 😉
<minus1> bigbro: no no no. it’s _mwuhahahahahaaaaa_
<bigbro> minus1: Trust me on this one, I need NO help with maniacal laughs… Just ask any of my victims^H^H^H^H users… 😉
<ompaul> vic users – you support vic 20s ?

saved by the blog

damn, blogs are important!
Only a few hours ago, I came home to find that my hard-drive had fried – again (yes, I know – “Go buy a new one”. My reply: “Show me the money!”).
Luckily, I tend to write down the answers to technical problems I’ve overcome – makes it easier for me to find the solution when it happens again!
And, as is evident, it happened again.
So, I moved the blog off my home server, and onto my company’s managed server, then recreated the system; first, by downloading and installing WordPress, then by uploading the database of the old one (luckily I kept it on a different drive!), then by downloading Donncha‘s amendments again, applying them, then reading through my last blog entry to tell me what needed fixing.
Instead of four hours or so to debug the patches, it only took me about an hour to do the whole lot!

integrating wordpress with smarty (continued)

Mostly, everything in the integration of wordpress and Donncha’s Smarty code had already been done – i just needed to figure out why little errors were creeping in.
The first I tackled was one where posts appeared with mangled titles on the front site. After a bit of grepping, I found that it was the template command {the_category} that was screwing up.
An example of the screw up was:
<a href="?cat=0" http://verens.com/index.php?cat="1&quot;" title="Category: &lt;a href=">General</a>"&gt;[<a href="http://verens.com/index.php?cat=1" title="View all posts in General">General</a>]
That one, while it took some time to find the cause, was a cinch to fix – simply delete everything in the wp-blogs/main/templates_c/ directory! Next time you view the page it’ll be much better…
…but not perfect – what appears as {the_author} in the template was displayed as “kaekae” in the front – the username doubled. A bit of code-searching and testing revealed that the_author() was returning ‘kaekae’ via $authordata->user_nickname.
I thought I had it when I tracked it down to get_userdata() in wp-include/functions.php, but a bit of testing revealed that the if conditional never became true – for some reason $cache_userdata[$userid] was not empty.
After much frustration, I finally noticed that the second parameter of the_author() was $echo = true, which triggered an echo of the user id in that function, doubling the output as the call from the template also printed it to screen.
I changed the true to false, then went looking for calls to that function to make sure they worked fine.
In wp-atom.php, wp.php and wp-rdf.php, I changed instances of <?php the_author() ?> to <?php echo the_author() ?>, and removed the second parameter and associated code from the function.
It is my considered opinion that the second parameter was a stupid idea which merely saved a few bytes of typing by the programmers. It is always a bad idea to directly echo a function’s return value from within that function, unless that is the purpose of the function.

wp_smarty

I’ve just installed Donncha’s Smarty patch on top of my 1.2 install of wordpress. To get it working properly, though, I had to then download a fresh install of Smarty and install it.
Make sure to edit the wp-includes/class-smarty.php such that it is pointing to the correct location of your installed Smarty.
Apart from that, there were just a few permissions changes to make. When you see permissions errors, just either chmod 777 (the easy way, but slightly insecure) the directory mentioned, or chmod 755 (recommended!) the directory and chown it to either apache or httpd (or whatever – the webserver user).
There are still some glitches to work out, but I’ll get them later.

wordpress

Nice. I’ve had this thing installed only a few minutes, and I already admire it!
It’ll be nice to work with, I think.
Unfortunately, I couldn’t get version 1.3 working with PHP5, but 1.2 works just fine with PHP4.3.