June 29, 2006

Search Your CF OO Hierarchy with getMetaData()

Filed under: ColdFusion — Phillip Holmes @ 11:18 pm

This is a useful little function I wrote that will recursively search your OO class tree by it's meta data. All you have to do is put this in your base class and then you're off to the races.

It will return the instance and state of the properties in the object you're looking for.

CODE:

  1. <cffunction name="getInstance" returntype="any" access="public">
  2.   <cfargument name="nameType" type="string" required="no" default=""/>
  3.   <cfargument name="returnType" type="string" required="no" default=""/>
  4.   <cfargument name="accessType" type="string" required="no" default=""/>
  5.   <cfargument name="roleType" type="string" required="no" default=""/>
  6.   <cfscript>
  7.     var ret = structNew();
  8.     ret.error = arrayNew(1);
  9.     ret.success = true;
  10.     ret.msg = 'SUCCESS';
  11.     ret.data = structNew();
  12.     try {
  13.          if(len(trim(arguments.returnType)) GT 0 OR
  14.             len(trim(arguments.accessType)) GT 0 OR
  15.             len(trim(arguments.roleType)) GT 0 OR
  16.             len(trim(arguments.nameType)) GT 0) {
  17.             for(it in this) {
  18.               retMeta = getMetaData(this[it]);
  19.               if((isDefined('retMeta.returnType') AND
  20.                 retMeta.returnType IS arguments.returnType) OR
  21.                 (isDefined('retMeta.access') AND
  22.                 retMeta.access IS arguments.accessType) OR
  23.                 (isDefined('retMeta.role') AND
  24.                 retMeta.role IS arguments.roleType) OR
  25.                 (isDefined('retMeta.name') AND
  26.                 retMeta.name IS arguments.nameType)) {
  27.                      ret.data[it] = this[it];
  28.             }
  29.           }
  30.         } else {
  31.          ret.success = false;
  32.          ret.msg = 'FAIL';
  33.          arrayAppend(ret.error,'MISSING_ARGUMENT');
  34.         }
  35.        return ret;
  36.     } catch(any excpt) {
  37.       ret.success = false;
  38.       ret.msg = 'FAIL';
  39.       arrayAppend(ret.error,excpt.message);
  40.       return ret;
  41.     }
  42.   </cfscript>
  43. </cffunction>

My Music

Filed under: Music — Phillip Holmes @ 11:06 pm

Recorded with Protools LE, these songs were a few of my first attempts at recording. I played all the instruments on these tracks and sequenced the drums from samples I found on the web.

I am currently in the process of writing more originals and refining the ones already canned. So stay tuned and I hope you enjoy these!

3 Mile Isle

EchoTized

FunkHog

Shasleevy

Average Groove

Supplemental:

Here is a new live track using my new Roland GR-20 unit. It is a cover of the classic Deep Purple hit "Perfect Strangers".

June 11, 2006

First Birthday Party

Filed under: Fun Stuff! — Phillip Holmes @ 11:23 pm

Aiden's first birthday party pics here. We had a fun day!

Aiden's First Birthday

The Holmes Blog