Escape Keys - TomdeMan's Blog

The Connect Recordings from CFUnited are now available on UGTV.

Even though I was unable to make the trip to DC, Rolando Lopez did an excellent job filling in for me. I will post the PowerPoint and Code Samples, as soon as I get Rolando's changes and updates.

In the meantime, here's the link to the recorded presentation from CFUnited. Adobe Connect

I have a handful of positions opening up here on the West Coast in Manhattan Beach, California.

If anyone is interested or knows anyone, please contact me for full job descriptions.

Senior & Junior CF Developer (experience with Coldbox a plus)

Front End Developer (jQuery, CSS, JS - Flash \ Flex a plus)

Quick Fix - Transfer and Reserverd Words

I ran in to this when I first started using Transfer ORM a while back, when I was building a new app. However, now I am curious for those working on an existing app and db structure.

If you have a table called User, for example, Transfer will throw an error. It generates the SQL without brackets [ ] and will usually indicate a syntax error. When really it's the reserved word USER that is throwing things off.

Originally, our team decided to rename the DB table to CoreUser and just map it in the XML to make the object look pretty. Again, this was for a new app we were building so it was early in the game and no additional refactoring was necessary at the time.

<object name="User" table="CoreUser">
<id name="UserId" type="GUID" column="UserId" generate="true" />

I did a quick Google search to see if any posts had mentioned another approach. Nothing new popped up, similar stories and struggles.

I happen to catch Mark online today and figured I'd run it by him. As always Mark hooked me up with a simple effective solution. So simple it made me feel stupid for not trying it.

Add the brackets to the table name in the transfer.xml file.

<object name="User" table="[User]">
   <id name="UserId" type="GUID" column="UserId" generate="true" />

Cake.

CFUnited Speaker Cancellation

Unfortunately, I had to cancel my trip to DC. A nasty case of Strep throat has me out of commission and living off of chicken soup right now.

I was really looking forward to the great opportunity and being a part this amazing event, Teratech worked so hard to put together.

I apologize to anyone who signed up for the session. In my place, I have asked Rolando Lopez, from About Web, to give my presentation.

Together IBM and AMD Break Speed Record

"A unique hybrid of Cell BE and AMD Opteron processors, has recorded an official throughput speed above one quadrillion floating point operations per second -- one petaflop."

You may have heard the phrase 'Cell technology' being thrown around before the Sony PS3 hit the shelfs. Well, sure enough the same basic architecture is being coupled with AMD Opteron processors to break new records when it comes to supercomputers and processing power.

The article goes on to mention that the tests were conducted last month at a benchmark of 1.026 petaflops. It notes Sun Microsystems has only a few weeks to make a run at there goal set back in June 2007 of 1.7 petaflops. But it looks like the DOE using IBM and AMD have set the bar fairly high.

Take a look at the full article: DOE supercomputer broke the petaflop barrier, conference acknowledges

Have Our CFML Prayers Been Answered?

I wanted to leave comments on Sean's and Ben's posts, but after writing them, they were just too long, and it can't hurt to drive a little traffic to one of the smaller people, right?

It seems the buzz around the direction of CFML relating to OpenBD, Adobe, and Railo has gotten serious. Rightfully so. You have three teams playing on the same field right now. For the spectators, or developers, for sake of metaphor, it's gonna be great to watch, and hopefully drive attendance.

Railo and JBoss, could be the spaghetti and meatballs of the CF community. They have just lit a fire that was dwindling. I pleaded for some consideration from Adobe when it came to marketing ColdFusion in my recent post. It got all kinds of feedback, but my opinion remains unchanged. As a matter of fact, I feel much relieved now.

I did not intend to put Adobe down, or offend anyone. It was more like yanking on a giants coat tails to get their attention. Not that I am or ever was going to jump ship and go Railo or OpenBD, but my confidence in CFML's lifespan was shaken. It has now been renewed. Whether it's Railo or not, the announcement should inspire all of us including those at Adobe.

JBoss is going to open up their Caching and Messaging, and introduce CFers to Hibernate. They may have to catch up in other areas...but WOW these three alone are major. I am not sure about their plans for distribution. I have not been able to find any facts, but I am assuming that Railo will either be included with install package or available in a plug-n-play manner.

That's old school door knocking, reincarnated, if you ask me. Its gonna put CF in front of more managers, more developers (Java and CF), and at an Enterprise level.

Beautiful.

Just makes you wonder what the next big announcement will be, and by what team...

Coldfusion? No body does Coldfusion anymore.

It's good to see everyone is taking the time to discuss and think about CF and its future. I just hope we don't spend too long talking and justifying while other products like Railo, and openBD put their efforts into development and a more proactive marketing strategy.

Software is heading down the same path as music and movies on the internet. While the MPAA has spent years attempting to get things under control, they have only wasted the time and money involved. Now, artists and independent movie makers have made their own way using the new technologies available. I know it's not as easy for Adobe to cash in on tickets and merchandise, but I am sure they are intelligent enough to find the equivalent.

I don't have the answer, but if I had to make an off the cuff decision, I like the sound of distributing Standard for free and charging for Enterprise. It would allow for CF to be evaluated by more then just developers. Rather then pleading CF's case and trying to show management why its worth the $, let the smaller companies create some jobs and buzz with the Standard Edition. We are a dying breed, but we are not dead. You can rebut that all you want, but tell me how often you hear 'Coldfusion? No body does Coldfusion anymore.'

Truth is, Adobe hold the reigns to a lot of our livelihood. We've been doing this so long, and most of us have a passion for it. There'd be nothing worse then having to let go and move into something new at this stage of the game. I don't think anyone means to point fingers or stir the pot, but its a political conversation and thats usually what happens.

I am grateful Adobe picked up Coldfusion and didn't abandon it. But Adobe is not depending on income from Coldfusion to stay alive. They also have one of the best anti-piracy schemes in place for their other software packages. They should realize the opportunity to be a part of the future. Acrobat.com and Google's suite of online applications are taking the food out of giants like Microsoft's mouth. CF gives us the power to create RIAs and services like this. GIVE us that power, and let us be proud to thank you with a link back POWERED BY ADOBE icon. External links from trusted sites are the new gold in the SEO world.

Adapt. Please.

I have a form with two sets of check boxes. I need to validate a selection from each set has been made before I allow a submit. jQuery has a handful of selectors to help you easily get a hold of elements. The common approach is to treat the check boxes as a single object, and traverse through each node using the .each() method. But I wanted to find a simple one-line approach I could re-use for each set.

Typical Approach (single set of check boxes)

$("input[@type=checkbox][@checked]").each(
function() {}
);

That's not going to work if you have two sets of check boxes on the form with different names.

<input type="checkbox" name="fieldName" id="fieldId" value="fieldVal" />
<input type="checkbox" name="fieldName" id="fieldId" value="fieldVal2" />
<input type="checkbox" name="fieldName" id="fieldId" value="fieldVal3" />

<input type="checkbox" name="fieldName2" id="fieldId2" value="fieldVal" />
<input type="checkbox" name="fieldName2" id="fieldId2" value="fieldVal2" />
<input type="checkbox" name="fieldName2" id="fieldId2" value="fieldVal3" />

Don't make the mistake of using the ID as a selector: $('#fieldId:checked') It will limit you to the first element of the set.

To validate a required selection has been made, we'll select the check boxes we need by selecting the checked ones by name, and counting the size(nodes) of the object. From there the logic is in your hands. In this example, I am checking to see if at least one has been checked in either set.

if($('input[@name=fieldName]:checked').size() == 0){
   alert('Please Make A Selection for fieldName');
}else if($('input[@name=fieldNames]:checked').size() == 0){
   alert('Please Make A Selection for fieldNames');
}

We know how to use the Coldbox environment interceptor to load different values for datasources. We know how to circumvent datasource.xml files with Transfer by using a datasource bean. Now, how can we use ColdSpring to put it all together for us.

<!-- coldbox -->
   <bean id="ColdboxFactory" class="coldbox.system.extras.ColdboxFactory" />
   <bean id="Coldbox" factory-bean="ColdBoxFactory" factory-method="getColdbox" singleton="true" />
   
   <!-- transfer -->
   <bean id="TransferFactory" class="transfer.TransferFactory" singeleton="true">
      <constructor-arg name="configuration">
         <bean class="model.TransferConfig">
            <constructor-arg name="DSNBean">
               <bean factory-bean="ColdBoxFactory" factory-method="getDatasource">
                  <constructor-arg name="alias">
                     <value>${Transfer_DSNAlias}</value>
                  </constructor-arg>
               </bean>
            </constructor-arg>
            <constructor-arg name="configPath">
             <value>${Transfer_ConfigPath}</value>
            </constructor-arg>
            <constructor-arg name="definitionPath">
             <value>${Transfer_DefinitionPath}</value>
            </constructor-arg>
         </bean>
       </constructor-arg>
   </bean>
      
   <bean id="Transfer" factory-bean="TransferFactory" factory-method="getTransfer" singleton="true" />
   <bean id="Datasource" factory-bean="TransferFactory" factory-method="getDatasource" singleton="true" />

That's what my coldspring.xml file would look like. There are a few things to note. I use Coldbox to get the Datasource information I need because it has already been defined in the Coldbox config or environment file. This is the reason I wanted to avoid a datasource.xml file for Transfer. Otherwise, I'd have the same DSN info repeated all over the place.

I also point to model.TransferConfig. A simple extension of the Transfer Configuration bean. You can learn more about that from my previous post.

If you notice, there is a Transfer_DSNAlias argument being passed into the Coldbox getDatasource method. This tells CB which DSN you want to load up and pass on to Transfer. Coldbox allows for multiple datasources to be stored for use in your App. But Transfer only connects to one at a time. So I made it a setting in the config/environment.

Here's a peak at my environements.xml file.

<environment name="development" urls="" patterns=".local">
   <Setting name="DebugMode"               value="true" />
   <Setting name="DebugPassword"               value="" />
   <Setting name="ReinitPassword"               value="" />
   <Setting name="EnableDumpVar"               value="true" />
   <Setting name="HandlersIndexAutoReload"          value="true" />
   <Setting name="ConfigAutoReload"            value="true" />
   <Setting name="HandlerCaching"               value="false" />
   <Setting name="EventCaching"               value="false" />
   
   <Setting name="Datasources" value="{'MyDSNAlias': {'Alias': 'MyDSNAlias' , 'Name': 'MyDSN', 'DBType': 'mssql', 'Username': 'dbusername', 'Password': 'dbpass'}}" />
   
   <Setting name="Transfer_ConfigPath" value="/config/transfer.xml.cfm" />
   <Setting name="Transfer_DefinitionPath" value="/model/definition" />
   <Setting name="Transfer_DSNAlias" value="MyDSNAlias" />
</environment>

That's it.

By default Transfer expects a path to a datasource.xml file. However, the TransferFactory.init() method will accept a configuration bean. Which you can find in the transfer.com.config path. The Configuration.cfc init() method is only looking for paths as arguments, and sets the DSN username and password to blank on creation. The object does have a hasDatasourceName() method, so how do we utilize this?

Well, I extended the object and overwrite the init() method. It now accepts a datasource bean and sets the DSN info in Transfer with it. When Transfer natively calls hasDatasourceName() it will bypass checking the datasourcePath.

<cfcomponent displayname="TransferConfig" hint="This is a TransferConfig Bean" output="false" extends="transfer.com.config.Configuration">
   
   <cffunction name="init" hint="Constructor" access="public" returntype="model.TransferConfig" output="false">
      <cfargument name="dsnBean"            type="any"      required="no"   default="" />
      <cfargument name="datasourcePath"      type="string"   required="no"   default="" />
      <cfargument name="configPath"         type="string"   required="no"   default="" />
      <cfargument name="definitionPath"      type="string"   required="no"   default="" />
      
      <cfscript>
         variables.instance = StructNew();
         
         setConfigPathCollection(ArrayNew(1));
   
         setDatasourceName(arguments.dsnBean.getName());
         setDatasourceUsername(arguments.dsnBean.getUsername());
         setDatasourcePassword(arguments.dsnBean.getPassword());

         setDataSourcePath(arguments.datasourcePath);
         setConfigPath(arguments.configPath);
         setDefinitionPath(arguments.definitionPath);
   
         return this;
      </cfscript>
   </cffunction>
   
</cfcomponent>

More Entries