Latest Writing

Setting Up Zend Framework 2 Autoloader

If you’re like me, you like to dig into the belly of things and twist them to your own uses. Tonight, I’ve been monkeying around with ZF2 autoloaders, and working out how they function.

I store my ZF install in a dir (Zend/) in my include path, so I don’t have to maintain copies for each site on my server.

Some useful notes on this:

The stock ZF2 download does not include a pre-generated classmap file. To generate this, go into the default unpacked archive folder, into bin/ and run this command:

php classmap_generator.php -l "/usr/share/php/Zend/"
// How to get an absolute path to the generated classmap file (return: /usr/share/php/Zend/autoload_classmap.php)
$classmapPath = stream_resolve_include_path('Zend/autoload_classmap.php');

// How to get the autoload up and running
require_once 'Zend/Loader/ClassMapAutoloader.php';
$autoloader = new Zend\Loader\ClassMapAutoloader();
$autoloader->registerAutoloadMap($classmapPath);
$autoloader->register();

That’s all for tonight folks!

Find MySQL Foreign Keys

Sometimes you need a quick way to find out what foreign key is blocking your action.

SELECT
    CONCAT(table_name, '.', column_name) AS 'foreign key',
    CONCAT(referenced_table_name, '.', referenced_column_name) AS 'references'
FROM information_schema.key_column_usage
WHERE referenced_table_name IS NOT NULL;

http://www.conandalton.net/2008/09/list-foreign-key-constraints-in-oracle.html

Javascript Element Properties From Object

How to create a HTML tag, using an object of properties.

$('#somediv').append($('<a/>', {href: '#', id: 'dothing', text: 'Do Thing'}));

About

I am a contract developer with a penchant for optimization (my most recent success took some code to 1% of the execution time it started with). Since 2003, I have been turning out cleaner and cleaner code, taking every opportunity to become a better developer. I emjoy producing high quality documentation and process flowcharts.

As far as my other skills, I have experience with the following software or fields:

  • Distributed Task Processing
  • Adobe Suite (Photoshop / InDesign / Illustrator / Premiere)
  • Linux System Administration
  • Windows Desktop Support

In my spare time, I enjoy photography and very occasionally dabble with electronics, or whatever else catches my attention from one day to the next (see my blog). And, like all mad scientists, I have a pet project under development.

Links



You Should Contact Me If

  • You want a free consultation about your problem. I offer a few a week, and I will be more than happy to hear your problem and let you know how to proceed.
  • You need a process problem solved.
  • You have a slow website, and you want someone to make the pain go away.
  • You have a cool idea that you want developed.
  • You want to implement task queuing or a distributed processing architecture. I can give you a one day Q&A to outline some of the pain points and development paths to take. This will save you a lot of time and bad surprises.
  • You need a pretty picture taken. Or a portrait. Or a picture of a baby. Or really anything you want a photo of.
  • There are gremlins in your pool. I do not want to solve the wet gremlins problem. You are on your own for that one.
  • Your house is on fire. I'm told there is an entire building full of people to solve this one.
Email: me@bendauphinee.com - © 2014 Ben Dauphinee