Latest Writing

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'}));
Javascript HTML Fun

Here are some useful Javascript snips for working with form data.

How to get the name of the HTML tag for an element:

this.nodeName.toLowerCase()

This code will see if we have a map set of inputs (somename[]):

// See if we have a map here
var mapFound = 0;
if (thisName.indexOf('[]') != -1) {
    mapFound = 1;
    thisName = thisName.replace(/[\[\]']+/g, '');
}

How to take a map of inputs and turn them into a Javascript map type var, and toss the empty ones:

var map = $(thisName).map(function(){
    if (this.value != '') {
        return this.value;
    } else {
        return null;
    }
}).get();

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