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.
Author Archives: Donncha
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.
New look, new design. The site …
New look, new design. The site is now table free and as such probably won’t look too great in Netscape or older browsers. Hell, it might not even look great in MSIE (I know the logo above doesn’t display correctly in that browser). Get Mozilla and install it!
An Open Letter To Angelina Jol …
An Open Letter To Angelina Jolie – I recently read about your impending divorce from that guy you were married to. Divorce can be a difficult time in anyone’s life, so let me be the first to say, “Hey baby, what’s up? You want to ride in my van?” — and I mean it. I would really like to take you for a ride in my van. It’s white.
Google's great, or more specif …
Google’s great, or more specifically, it’s great to find old stuff on the Internet. Unlike real life, if you remember saying something on a mailing list or webpage, but not sure when or where you wrote it, fire up Google and go searching.Someone mailed me asking if I had considered doing a Postfix version of my install-sendmail script. I had. *grin*
