Chris Tate-Davies

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

Automatic Windows Process Dump Script

I have a laborious task at the moment, of exporting our server process list to see how much memory certain programs are using. I was getting a little bored of remote accessing the server through VNC so decided to use a BAT file to do the work for me. However the problem was, I wanted [...]

CSV file of Windows Process list

If you need a CSV file of the currently running  processes in Windows you can use the task manager command line tool. C:> TASKLIST.EXE This will dump the task list to the screen. But there are several options you can use: C:> TASKLIST.EXE /V /FO CSV > filename.csv The above will produce a nicely formatted [...]

PHP App Testing

Think: “What am I testing?” 1) Set-up Instantiate your class Look for dependencies, are there any that need mocking? 2) Exercise We test our real objects that need testing, or mock objects that don’t but are required by SUT (System Under Test) 3) Verify Real object results Expectations of mocked objects 4) Tear down Destroy [...]

Resetting forgotten MySQL root password

If you have forgotten your root password for MySQL, then don’t panic. Although, if you don’t have root shell access, then do panic! Anyway, to reset a password, you need to stop MySQL and restart it with a special setting that allows you to login without passwords. Obviously this is a dangerous switch and you [...]

Changing your MySQL root password

When you installed MySQL, you would have been asked for a root password. If you were testing or something similar, you may have used an empty password. This is all well and good until you need to put your server into production. So, how do you create one? > mysqladmin -u root password NEWPASSWORD This [...]

How to pass data from Controller to Zend Form

To pass data from your controller, to a Zend_Form, you can utilise the config parameters: $this->view->form = new Contact_Edit_Form(array(‘contactName’ => ‘Chris’)); This will pass a very simple array to the form, and from within the form, $data = $this->getAttrib(‘contactName’); $data will then contain Chris

Zend Console – get values passed

When using a CLI script with options, I like to use the Zend_Console. If my options are as follows: $console = new Zend_Console_Getopt( array( ‘i-s’ => ‘test option 1′, ‘e’ => ‘test option 2′) ); For instance, > php myScript.php -i OPTION To get the “OPTION” string for the -i parameter $arg = $console->getOption(‘i’); $arg [...]

JQuery – bind event to non existant element

We all have to bind events to elements: $(‘#link).click(function(){     do some stuff }); But, what if that element doesn’t exist yet? Well, you can use the “live” handler: $(‘#link’).live(‘click’, function(){     do some stuff }); This will carry the event handler on and will match any future element that matches the selector. More information [...]

Facebook – Download *all* of your data

You can download all the data you’ve ever uploaded to Facebook if you like. Once you are logged in, click this link: https://www.facebook.com/editaccount.php?ref=mb&drop and press the “Download your information” link. It will take a while as it packages up all images and videos too. Facebook will email you when it’s ready and hey hoe, you can [...]

MySQL Query Profiling

This inbuilt part of MySQL allows you to look closely at queries run – per session. And you can use this information to find bottlenecks. To enable profiling, run this command in the MySQL client: SET profiling = 1; This will turn on the profiling. Then for each query you run, MySQL will log all the [...]

« 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