Passing Application scoped variables to ColdSpring within Model Glue

Passing defaultProperties in ColdSpring with Model Glue

Or Using defaultProperties with CS and MG. I couldn't figure out which title would be better.

Basically this is a guide on how to pass variables into ColdSpring. In my case from the Application scope. Recently I've been working on a Model Glue, Transfer, and ColdSpring app and came across a problem which I couldn't find a direct answer to online. The application I'm working is only a small part of the site and has some settings in the Application scope which needs to remain there. Usually I put all my variables in a ColdSpring/Model Glue simpleConfig Bean (using the class ModelGlue.Bean.CommonBeans.SimpleConfig) but this time I needed CS to get the variables from the application scope. This actually isn't too hard as you can pass properties(dynamic variables) into the config.xml e.g.

Here's the code for creating the bean factory. You would find this in onApplicationStart or at the top of your Application.cfm.

Code for Application.cfm/cfc

<!-- First we create our global vars in the Application scope -->
<cfset application.settings = structNew() />
<!-- Add our DSN name to the Settings struct -->
<cfset application.settings.dsn = "myDSN" />
<!-- If our bean factory doesn't exist then we create it. You could also check for a url.reinit var as well here -->
<cfif NOT isDefined("application.beanFactory")>
   <!-- Our struct to hold the variables we are going to pass to ColdSpring -->
   <cfset properties = structNew() />
   <!-- Our struct to hold the variables we are going to pass to ColdSpring -->
   <cfset properties.dsn = "dsn_reference">
   <!-- Create our bean object -->   
   <cfset application.beanFactory = createObject("component","coldspring.beans.DefaultXmlBeanFactory").init(structNew(), properties)/>
   <!-- Pass a fully qualified path to a bean definition xml file -->
   <cfset application.beanFactory.loadBeansFromXmlFile(expandPath('/config/beans.xml'), true)/>
</cfif>

In our Beans.xml we need to reference the properties structure by the key.

[More]

Comments (0) Print Send del.icio.us Digg It! Linking Blogs

1194 Views | Posted At : December 6, 2007 5:32 AM | Posted By : Andy Jarrett
Related Categories: ColdFusion, model-glue, ColdSpring, Rough Guide

Transfer and TQL

I love working with Transfer and Mark Mandel has done an amazing feat of giving it some really good documentation. But I remember when I was getting started I was looking for a rough guide to the TQL language for Transfer and how to implement it. So based on all the information at www.transfer-orm.com/transfer/documentation/ here's a quick start to TQL.

Please note: I am presuming you already know how to set up Transfer and have basic knowledge of how it works.

For this example here is our Transfer.xml configuration file:

<package name="post">
   <object name="Post" table="post_table">
      <id name="postid" column="postid" type="numeric"/>
      <property name="postText" type="string" column="postText" />
      <property name="postDate" type="date" column="postDate" />
   </object>
</package>

[More]

Comments (2) Print Send del.icio.us Digg It! Linking Blogs

1037 Views | Posted At : October 23, 2007 12:56 AM | Posted By : Andy Jarrett
Related Categories: Transfer, Rough Guide

Adding a property to BlogCFC

The other title was, How I added the FeedBurer URL to BlogCFC - imagine whatever your prefer :o)
If you haven't heard Feedburner has recently been acquired by Google. Which as it seems with all Google acquisitions means us users end up getting something free out of it and to with keep up traditions Feedburner now offer their "Pro" services for free.

[More]

Comments (2) Print Send del.icio.us Digg It! Linking Blogs

1424 Views | Posted At : July 4, 2007 6:45 AM | Posted By : Andy Jarrett
Related Categories: ColdFusion, Blogging, Rough Guide

Ant: Passing attributes to Build.xml

Critter on a previous post asked "if you can pass in attributes to the build.xml file?" From the Terminal this is as easy as adding another argument "-D".

[More]

Comments (3) Print Send del.icio.us Digg It! Linking Blogs

2524 Views | Posted At : June 29, 2007 3:48 AM | Posted By : Andy Jarrett
Related Categories: Ant, Eclipse, Rough Guide

Installing ANT on Windows and or Mac OS X

I'm gonna try and cover the two OS's here so be kind.

First things first, goto http://ant.apache.org/bindownload.cgi and download the appropriate archive (zip) file: apache-ant-[VERSION NUMBER HERE]-bin.zip

[More]

Comments (10) Print Send del.icio.us Digg It! Linking Blogs

3586 Views | Posted At : June 27, 2007 4:23 PM | Posted By : Andy Jarrett
Related Categories: Ant, Eclipse, Rough Guide

Ant: Copying files and directories

I know that I've done a post on copying files with Ant, but I really want to take this further and into more detail. To save my fingers a lot of the text below is taken from my first post as moving and copying directories/files is a similar command in principle.

I also want to mention that I am running all my Ant tasks via Eclipse and not the command line. If there is a demand to know how to install Ant and run it from the command line I'll do that post separately. At this point I'm assuming you've got Eclipse and you know you way around it enough? Before we do begin you will need to ensure that you can see the Console 'View', you can get to this by going to:

[More]

Comments (4) Print Send del.icio.us Digg It! Linking Blogs

5615 Views | Posted At : June 24, 2007 4:41 PM | Posted By : Andy Jarrett
Related Categories: CFEclipse, Eclipse, Ant, Rough Guide

Ant: Moving files and directories

First off I wanna say that I'm running all my Ant task via Eclipse and not the command line. If there is a demand to know how to install Ant and run it from the command line I'll do that post separately.

So, what is Ant? Well to steal a quote from Mark Drew, think of Ant as .bat files on steroids. You use XML to describe a set of commands to run a whole range of tasks to do anything from SVN/CVS checkouts, unit tests, FTP, emails, sql, moving/copying folders/files generally just name it!

In this guide I want to cover creating a build.xml file and moving files/folders. I'm assuming you've got Eclipse and you know you way around it enough. Before we do begin you will need to ensure that you can see the Console View.

[More]

Comments (1) Print Send del.icio.us Digg It! Linking Blogs

3184 Views | Posted At : June 24, 2007 4:38 PM | Posted By : Andy Jarrett
Related Categories: CFEclipse, Eclipse, Ant, Rough Guide

Building and installing Apache 2 on a Mac

Ok Below is a rough guide to get anyone up and going when it comes to building and installing Apache 2 from source. We're gonna do this all from the Terminal found in /Applications/Utilities/Termain.app.

Please note that '$' means new line, don't type this character If you want to know about any of the commands we make from the terminal you can always type "man + command" e.g.

$ man curl
If you run the above code it should tell you that
curl is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, GOPHER, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction.

This will also detail the options I use.

[More]

Comments (7) Print Send del.icio.us Digg It! Linking Blogs

2357 Views | Posted At : June 12, 2007 1:15 AM | Posted By : Andy Jarrett
Related Categories: apache, Mac, Rough Guide

CFUnit and CFEclipse

I did mention back in January that the CFUNIT disappeared from the then current CFEclipse build. Well its back with 1.3. This also means the guide I wrote a while back is now valid again: Running CFUnit in CFEclipse quick guide. I also know it is still works as I've found myself going over my own post :o) Time to start back on those test cases.

Also included in the 1.3 update is the CF Frameworks Explorer and don't forget to check out the intro to this feature on CFE T.V.

Comments (1) Print Send del.icio.us Digg It! Linking Blogs

1410 Views | Posted At : May 29, 2007 1:23 PM | Posted By : Andy Jarrett
Related Categories: ColdFusion, CFUnit, CFEclipse, Rough Guide

Maintaining your laptop battery Life

The other day I noticed my current battery capacity was around 65%, which for a MBP under a year old I was a little annoyed at. According to iStat Nano, a [excellent] system monitor widget and confirmed with Coconut Battery the maximum battery charge I could currently hold would be around 3500mAh instead of the factory default of 5500mAh.

After a quick search on the Apple site I have managed to bump it back up into the 90% region. How? Easy, I Calibrated the battery, something you should do every 2 months or so!.

[More]

Comments (8) Print Send del.icio.us Digg It! Linking Blogs

4316 Views | Posted At : April 25, 2007 12:32 AM | Posted By : Andy Jarrett
Related Categories: Mac, Rough Guide

More Entries