This story is enlightening if you live in the States. Laws will change elsewhere though. This counterscript should help anyone when you’re talking to telemarketers though!
MVC, PHP and Smarty Caching…
Moving a purely procedural program to an OO design is a mammoth task, especially when that program is several years old and had bits added on over the while.
I’ve pruned out a lot of the extra features that are not needed now, and some that are simply silly, but now I’m coming to a stumbling block.
Smarty can cache content. The beauty of that is I can avoid a whole load of expensive operations like database queries, information lookups from remote sources, code loops, etc. In an MVC application, where should the check for cache freshness be?
- Should it be in the controller class so it can call the functions of the model to create the view?
- Should it be in the model, so the controller doesn’t have to know about the model? The model is where the expensive operations are anyway.
- Should it be in the view, because that’s the locality of freshness information? Isn’t caching an element of the display procedure?
If it’s in the controller, then the controller has to know about caching, is that bad?
If it’s in the model, then the controller is ignorant, and therefore not a controller.
If it’s in the view, the controller is ignorant, and the view is now “controlling” if functions are called in the model.
You can see where my reasoning is going with this..
The controller should probably have access to the cache information. It shouldn’t talk directly to the Smarty instance in the view however. It should talk to a function that takes data from the model, checks the cached views against that data and any timeouts and returns true or false.
For example:
class exampleController
{
function exampleController()
{
// skip unimportant bits.
// create model and view
if( $this->view->is_cached() == false )
{
// do some expensive operations in
// the model to create the view.
}
}
}
Or should that is_cached()
function be in the model? Please comment if you have any insights!
Synergy – The K_M out of KVM
Synergy looks very useful for sharing desktops!
Synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems, each with its own display, without special hardware. It’s intended for users with multiple computers on their desk since each system uses its own monitor(s).
Thank you ILUG for the link!
Where is Raed ?
MonMotha's IPTables Firewall
I’ve looked around for ages for a decent firewall generator script but I ran into problems with all of them. (No, I haven’t got time to learn about yet another firewall implementation! I gave up after ipfwadm!)
This script looks like it’ll do the business though! Just enter the network addresses of your internal lan(s), what ports you want to keep open, internal and external interfaces, and finally what networks to masquerade. Simple!
Update! Bah! Had to remove it again. It worked fine, except 2 users on our network had consistent problems connecting to our gateway for minutes at a time! Didn’t happen to anyone else though!
Owen's sick..
Owen’s sick but I don’t think it has anything to do with me, I have the flu, not gastroenteritus! (sp?) (Owen – you’ve no permalinks!)
b2 updates
I’ve updated this site to the latest release of b2++, you can take advantage of the new features by choosing another blog template from the “Template chooser”. Then go into b2options and enter your blo.gs ID. Your favourite blogs will then be listed, sorted by update time!
Even if you’ve no interest in blo.gs, the new release has a number of other updates you might like!
I'm sick today
I’m sick today. It had nothing to do with the extended weekend and everything to do with a flu bug that’s going around. *ugh*
Don’t even feel like working on anything either…
Oh yeah, I saw Xmen 2 last night and I enjoyed it! I thought it was more like a comic book format, skipping from one scene to another quickly. Others didn’t like that but I found the characters engaging, and it zipped along at a neat pace!
New b2++ snapshot
b2 and Blogrolling
Spitfire asked about blogrolling support in b2. I found Phil Ringnalda’s work on building a blo.gs parser and integrated it into b2++!
It’s not available here yet, but when it is, all you have to do to enable support for it is add the following to your blog template:
{blogroll blogID=”999″ blogteststring=”Somestring”}
I have the following in my template:
{blogroll blogID=”1927″ blogteststring=”Keith”}
Read Phil’s page above for a more detailed explanation of those parameters!