Quick Tips
Quicktip: Simple File Based Cache Mechanism in PHP
Simple, yet effective enough, this is all the code I used to create caching for a feed retrieval to speed up subsequent requests.
Enjoy!
function _getFromCache($uniqID, $expireSeconds) {
$uniq = '/
if (file_exists($uniq) && time() – filemtime($uniq) < = $expireSeconds) {
return '
}
$somethingToCache = ‘
file_put_contents($uniq, $somethingToCache); //You will want to implement __toString() if this is an object or maybe you can just serialize it
return $somethingToCache;
}
Retrieve D-Link Router WPA Password via Firebug
Well I’ve done it a million times, I forget my WPA password and each time a new device comes along I have to change it for them all. Well no more!
0Automating MySQL Database Backups on the Command Line via mysqldump
Are you tired of manually running backups when you remember to?
If you are running your own server, or have access to the shell and cron jobs this tip is for you!
First off for a better understanding of mysqldump check out the MySQL reference manual. All mysqldump really does is output the necessary queries to rebuild your database to the current state it is at when run.
First I’m going to create a test database and some tables as examples:
2
