I visited Mel and Sharon last night to see the 2 new members of their family. Aren’t they cute? 🙂

I visited Mel and Sharon last night to see the 2 new members of their family. Aren’t they cute? 🙂
I’m now using the latest nightly GTK2/XFT build of Mozilla/Firebird that I linked to before and it’s very, very nice!
I did use an earlier build of this before but for some reason started using these ones instead.
The latest nightly build is a *lot* more responsive than the one I just moved from! 🙂
The Smarty manual explains how to use Templates from other sources such as databases. It doesn’t however give an example of caching templates from these sources. I ran into a spot of trouble when I tried to be clever about checking the freshness of a db based template.
I didn’t want to interogate the db on every request just to check if a template is stale or not. Why have caching when you have to hit the db anyway? The db_get_timestamp() function has to be modified to check the freshness in some other way then.
I used a 0-byte file in a web-server writeable directory. Unfortunately it didn’t work. The is_cached() function would return false and I’d assign Smarty variables to prepare a new version of the web page, but when I called the display() function it displayed the last cached version!
It took me a while to figure out that both is_cached() and display() call the db_get_timestamp() function. As the file I used to flag a refresh was deleted on the first run I had to retain the timestamp somehow. That’s where the global $filetimestamp array comes in.
touch scratch/index.tpl
to update the template cache.function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
{
global $filetimestamp;
if( is_file( 'scratch/' . $tpl_name ) == false )
{
if( $filetimestamp[ $tpl_name ] != '' )
{
$tpl_timestamp = $filetimestamp[ $tpl_name ];
}
else
{
$tpl_timestamp = mktime (0,0,0,date("m")-1,date("d"), date("Y"));
}
return true;
}
else
{
$tpl_timestamp = filemtime( 'scratch/' . $tpl_name );
$filetimestamp[ $tpl_name ] = $tpl_timestamp;
unlink( 'scratch/' . $tpl_name );
}
return true;
}
if( $smarty->is_cached( 'db:index.tpl' ) == false )
{
print "regenerating cache!<br>";
$smarty->assign( 'date', time() );
}
$smarty->display("db:index.tpl");
I don’t think this is much of a bug really.
String indexes of arrays should always be quoted and when they appear as part of a larger string it’s faster to seperate the strings with the dot operator. See my comment on Keith’s post above for more.
Maximise your browser window and take a look at this animation of a famous scene from The Matrix. Be warned that the animation is 4MB in size so it might be wiser to wget it first!
Nice! According to this article, While Linux graphics played a role in the animated movie “Shrek,” “Sinbad” is the first movie the studio has made entirely using Linux.
Yes, I’m back at home. Sorry Mark, can’t review LXG for you!
I’m going home tomorrow night for 2 weeks. I’ve been in Chicago for almost 6 weeks now and just got used to looking for cars on the wrong side of the road, and American lifestyle in general. I’ll be back though and staying until the end of August!
Here’s the view from my desk here. That’s The John Hancock Center where Martina and I had dinner a few weeks ago. From the 95th floor we looked down on the fireworks at Navy Pier!
The Register has a reply from Mark McCarron, the author of the “perfect solution to spam” mentioned here a few days ago.
I’m gobsmacked reading through it. He boasts of software piracy and damaging school and public computers! He says that he tortured his computer teacher. He says that his GIEIS servers won’t use TCP/IP, but will be “connected to the rest of the Internet via a bridge (gateway)”.
Conclusion
I am right, everyone else is wrong. Told you I was arrogant.
crap.
I wasn’t expecting much after seeing blog headlines from other sites but I was really disappointed by the film. The first half hour is great, that car chase is exciting at first but it goes on too long. After that I wondered where the story was. Sure, there was one or two scenes with dialog but I never felt for the characters like I did in T2.
Save yer money and go to Legally Blonde 2. heh.