Out on the beer again eh? Here’s a beer troubleshooting matrix I was mailed this morning. Thank you Google for finding it for me!
The new Mozilla 1.1beta doesn' …
The new Mozilla 1.1beta doesn’t play very well with Galeon 1.25 so don’t try and mix them or “bad things will happen”! muhahahaha!
Be careful when tuning your Li …
Be careful when tuning your Linux servers. Sometimes strange things happen. I followed some of the directions listed here and our server rejected half the connections to Apache. I rectified that by making the values smaller, like this:
echo 32768 > /proc/sys/fs/inode-max
echo 19000 > /proc/sys/fs/file-max
Stats are up on previous days, so when tuning file handles go up slowly, not to the levels the previous document stated.
Ok, so the UK Government recog …
Ok, so the UK Government recognises open source software. That’s great for them. Meanwhile, those of us stuck in the e-commerce non-hub of Europe that is Ireland have to condent with a Government that’s in the pockets of Microsoft. Maybe this’ll have an impact on things here as we usually tow the line when the UK does things.
Mandrake's operating losses ar …
Mandrake’s operating losses are down! Good news for the makers of the best Linux desktop distribution! More info to be found in the MandrakeSoft Shareholder Newsletter.
Salon introduced Userland webl …
Salon introduced Userland weblogs today. Here’s Dave’s side of the story. I’m going to keep an eye on this. I’d like to see what success a mainstream company has introducing weblog technology to the masses. What would happen if every website offered weblogs? Would a community grow up around that site?
In other news, Niall pointed the ILUG at this story which says Bill Gates was shat on. Sort of.
Linus compares vi patches to a …
Linus compares vi patches to a new sport – I’ve bungy jumped but I wouldn’t do it the way he suggests!
The current, and out of date r …
The current, and out of date release of PHP-Accelerator almost works with the new version of PHP. It works most of the time but just as I was talking to my boss a demo page bombed out because it had exhaused all 8MB of memory! *grrr* Where’s the source so I can recompile it?
Finally, I get around to putti …
Finally, I get around to putting some pictures online. This picture was taken in Crete. This guy owned the place we had a feast in one night, way up in the mountains! As the night wore on his bandana moved ever closer to the side of his head as the wine was consumed!
Yammas!
Caching PHP applications using …
Caching PHP applications using Smarty
Using Smarty is daunting at first, there’s so much it can do. Here’s a way to take advantage of Smarty’s caching functionality in your pre-existing applications.
What we’re going to do is use the PHP4 output buffering and cache the output of your script through that.
Create a simple template on your webserver somewhere. It doesn’t even have to reside in the visible path of the server. In fact, it probably shouldn’t! In that file will be one Smarty variable, $text. This variables is going to hold the entire contents of your script output.
Your script is going to have various inputs that define what gets shown, ie. username, message number, etc. We’re going to cache the output based on those bit of information. In our example that’ll be the uid, $uid of the user.
—–/home/www/include/templates/text.tpl—–
{$text}
—–/home/www/include/templates/text.tpl—–—–/home/www/htdocs/test.php—–
require(‘Smarty.class.php’);
$smarty = new Smarty;
$smarty->caching = true;
$template = “/home/www/include/templates/text.tpl”;if($smarty->is_cached( $template, $uid )==false)
{
// Create new content, cached data is stale or isn’t cached.
$text = “Hello World”;
ob_start();
// Call legacy code that prints directly to the browser
// Get data from database, do other expensive things.
$text .= ob_get_contents();
ob_end_clean();
$smarty->assign(‘text’, $text );
}$smarty->display( $template, $uid );
—–/home/www/htdocs/test.php—–
If your legacy code has to interogate the database then you’re saving a huge amount of time doing this. Even if it’s nothing but print statements, chances are Smarty will do it quicker if it’s cached.