Entries Tagged as 'Coldfusion'

Clearing template cache automatically through the ColdFusion gateway .... varScoper bundle NOW included

Coldfusion 10 Comments »

A bit back Brian Szoszorek showed a wonderful example on how to use Cold Fusion's gateway functionality to help streamline the use of the Trusted Cache. This article was brought to my attention by a fellow co-worker (Mike Schierberl) and after reviewing the article in detail I was stunned on how powerful this was and how easy it was to implement. So I decided to tweak it here and there to see what else it could do.

Here are the tweaks:

  • Incorporated Mike Schierberl's varScoper as an optional feature. If you update or add a cfc it will run a varScope check against it and log it into a VarScoper.log file within cold fusions log folder. Auto-watch it threw your favorite file watching tool (Example: Logwatcher for cfEclipse) and you have a realtime varScoper running telling you if there are any unscoped vars within the file you just added/updated. For varScoper fans I see this as being very nice!
  • Made the clear caching method to be just a little smarter (ability to just removing specific files from the cache rather than clearing the entire cache itself)
  • New method "setEventGateway" that will create the needed cfg file and gateway entries within Cold Fusion Administrator. Very Cool.. Very Powerful.. and Very Easy!

You can download the code here.

NOTES:
There seems to be a few bugs within the adminapi interface for clearing the cache. Currently when you attempt to remove a file from the cache after a file has been removed you receive an error stating it cannot remove it from the cache since the file does not exist on the server. To fix this we just clear the entire cache when a file is removed. Another bug is when you delete, then add the file back into the cache. For some reason it does not pick it up. To fix this we do clear cache call on the file being added. I'm not sure why this works, but it does. I will be posting this to Adobe to see what's up.

Here are the steps on how to implement:

1)       Create a new directory that the component will live in and place the component in there

a.       Example: C:\inetpub\wwwroot\templateListener

2)    Set the cfpassword variable to reflect your cfpassword. This needs to be hardcoded within the component in order for the gateway to work properly.

3)    Access and run the setEventGateway method provided within the component and provide it the directory you want to watch

a.       Example: #createObject("component", "templateListener").setEventGateway(directoryToWatch="c:/inetpub/wwwroot")#

4)       Turn on Template Caching within Cold Fusion Administrator by (CF Admin -> Server Settings -> Caching -> Trusted Cache)

5)       Confirm that the Gateway Instance is running by (CF Admin -> Event Gateways -> Gateway Instances)

6)       If you want to turn off the varScoper check then you can turn it off by adjusting the "runVarScoper" flag at the top of the component to false

invokeMethod() - How to make a dynamic method call

Coldfusion 15 Comments »
A few months ago I caught myself building a method that would invoke another method from within a component. Basically something similar to functionality provided by the “cfinvoke” tag, but could be used through cfscript or strait against a component...

Read more...

Spry & multiple nested data sets - Mach-II

Frameworks , Coldfusion , Spry No Comments »
Last week I posted a blog about how to use Spry nested datasets (very simple example). Now I am expanding that example by incorporating Mach-II v.1.6. This is a key if your application already uses the Mach-II framework or even Model-Glue. If you are NOT using Mach-II then scan the provided UML diagram to see how it flows and incorporate it into your desired MVC framework.....

Read more...

Unit testing with MXUnit - Dive in!

Frameworks , Coldfusion No Comments »

Last week I was looking over blogs and ran across a blog by Sean Corfield talking about a unit testing framework named MXUnit. Well curiosity caught me and I dove right in to see what it could do. As expected I found a good unit testing framework that could easily take the place of many others out there, which was a relief. I say this only because I currently use cfcUnit, which is also a good framework, but it has not been updated for quite some time, and if you are like me, it’s nice to work within a framework that is updated periodically. Yes?

Now at that point I only played with it enough to know it was a good one to start using, but what really placed it on my radar was the fact that is came with a great EASY to use eclipse interface. I saw this through one of Charlie Arehart’s great online meetings presented by Bill Shelton (one of the many developers of the framework) and all I can say is check it out. It is WELL worth it!  

Now this is something I usually keep to myself, but it’s important in my book and I would not doubt it being important for other developers out there, but seeing the fact that there are many developers maintaining this framework. To me this is gold! It lets me know that this framework will have more of a chance to be appreciated, maintained and used within the cold fusion community.

 Check out Sean Corfield's blog on cfEasyMock as well if you use mock's in your unit testing environment.

Spry & multiple nested data sets

Coldfusion , Spry No Comments »

Lately I have been working with Spry and seeing all the amazing things it can do. Just the other day I was messing around with working with multiple nested data sets derived from a master data set and I thought I would share my experience. 

 All in all, it was fabulous. The way spry can work with nested data sets it top notch. I was able to pull one "master" data set, then build new nested data sets from that master. I was even able to build a nested data set from a nested data set... very very nice! After I had all my data sets I was able to use one region to display all of my information.

 I used Cold Fusion as the back end supplier of the data, but anything can be used.

 I have attached example code so you can see what I did. Download it here!

Powered by Mango Blog. Design and Icons by N.Design Studio
RSS Feeds