Chris Tate-Davies

An archive of helpful tit bits of information for development, and probably some stuff that is incomplete, wrong or boring…

Zend_Date – difference between 2 dates

I keep having trouble with this simple calculation! So, here is a little example to get the amount of days between now and the next occurance of July 1st. //set up the 2 date objects $now = new Zend_Date(); $next = new Zend_Date(); //we want July 1st $next->setDay(1)->setMonth(7); //if we are currently after july this [...]

Piwik – open source alternative to Google Analytics

Google Analytics vs Piwik

ThreadSMS – Review

My Nokia doesn’t have threaded SMS view – and its very annoying. So, after searching about for a suitable application for this, I came across ThreadSMS by eHandySoft (http://ehandysoft.com/threadsms.htm) Functionality: Quick to load, and quick to navigate. On my N97 mini the scrolling was very smooth and precise. The threads are loaded with contact pictures [...]

Reading the MySQL binary log

Having MySQL dumping out binary logs is a very good failsafe for backup redundancy. But, how do you get any of the information out of them? If you know a time span that you need to investigate, then you can easily use the mysqlbinlog utility: mysqlbinlog –start-datetime=”2010-07-27 14:30:00″ –stop-datetime=”2010-07-27 15:00:00″ > backup.txt This will export [...]

Accessing the Zend_Application from a page

If, like me, you need to access some Zend_Application resources (such as multidb resources) – then you need a reference to the Zend_Application and the bootstrap. I use this: if (null == $this->_application) { $this->_application = Zend_Controller_Front::getInstance() ->getParam(‘bootstrap’); }

Retrieve email using regex

ThisĀ horrendousĀ regular expression will parse a string and return a valid email address from it. $email = “<’Freddy’> fred@live.com”; preg_match(‘/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/’, $email, $match); echo $match[0]; This will return: fred@live.com Basically, if you pass an array as the third parameter of the preg_match method, it will be filled with the preg_match results, and the first item of the [...]

Online regex -> php tool

I’ve found an excellent online tool, where you can give it a regex, and it will spit out the PHP syntax for use with preg_replace, preg_match, etc. I’m forever getting ‘Unknown modifier’ errors when trying to insert regex’s into my PHP code. This sorts it out for you. http://regex.larsolavtorvik.com/

I wrote one of the first social networking sites

Its not a claim to fame, or a preempt to a court case to a ‘big hitter’, but back in the year 2000, when I was a fledgling junior programmer, I wrote an ASP web site based around a bunch of ‘buddies’. You could add people to your list, message them, upload a picture (just [...]

Getting Ant to run on Windows 7 (64bit)

If like me, you use Ant to deploy builds, etc, and you have migrated to Windows 7 – you may well have troubles getting ant to run. It all worked flawlessly under Ubuntu, but Windows is a different beast – here’s a step by step guide to getting it working.

Remove svn folders from Ubuntu

When backing up a source code working copy, you don’t always want all the little .svn folders everywhere. You can “export” the working copy, or if you forgot, you have remove them all. Change the the folder containing the working copy (this is very important*) cd /home/username/www/sitename/ And then remove them all, recursively with this [...]

« go backkeep looking »
  • Chris Tate-Davies

    Hello there. This is my little "repository" on the world wide web. Its for nothing more than documenting things that I might need again in the future. You could describe it as an extension to my memory.

    Also an online collaboration of my thoughts through the day. I'll try to keep the real random stuff out and keep the blog on course.

    Thanks for stopping by... Hope you find what you're looking for...

  • Tags