Category Selected:

tutorials

Blog

Don't Forget persistent="false" When Autowiring Entities

Curt Gratz |  January 21, 2011

I ran into a strange error yesterday that I couldn't seem to find out what was happening.

I was getting coldfusion.runtime.TemplateProxy cannot be cast to java.lang.String when trying to save an entity using ColdFusion ORM.  

Google was turning up nothing, so I started systematically removing lines of code.  It started working when I removed the line that did an entityLoad on a different object.  What was weird was I was just using that object to get a bit of data and not even for the object I was saving that caused everything to go boom, and if I removed the save, everything worked fine.  Then I remembered that the Hibernate session is affected so I took a deeper look at the entity that a loaded.  Sure enough, I was autowiring a property and didn't have persistent="false" on that property, causing it to throw the "coldfusion.runtime.TemplateProxy cannot be cast to java.lang.String" error.

Changing it from something like this

property name="shippingOriginationZip" inject="coldbox:setting:shippingOriginationZip";

to this

property name="shippingOriginationZip" inject="coldbox:setting:shippingOriginationZip" persistent="false";

fixed it all up.  Of course, like all coding solutions happen, this was in the middle of the night when I was no longer working on the code that this came to me.

So remember folks, if you have a property in an persistent CFC that is not persistent, be sure to say so!

Read More

ColdBox at the OpenCF Summit

Curt Gratz |  January 19, 2011

ColdBox will be at OpenCF Summit. Don't know what the OpenCF Summit is? It is "a community gathering focused exclusively on advancing free and open source software in the CFML community."

I will be hosting a offical ColdBox Unconference. I am very excited to meet with other developers(ie YOU) and have a conversation about advancing ColdBox and sharing some of the different ways we can use the robust framework in our development. I am also excited about learning more about some of the different Open Source ColdFusion projects and ways we as a community can advance those projects. What a great concept for a conference.

If you are wondering why you should care open this "open source" stuff, Bob Silverberg recently posted Why Contribute to Open Source Projects?

If you are wondering why you should go to the OpenCF Summit, check out Jamie Krug's post Go To OpenCF Summit!

If you still aren't convinced to go, the great news is, the price was just dropped to $30. So for the price of a dinner you get

  • A 3 day professional conference
  • A great lineup of speakers
  • The chance to participate in a community "hackfest"
  • The opportunity to network within the greatest development community on the planet

If you have any ideas for things you would like to discuss at the ColdBox Unconference, leave me a comment and we will do our best to cover your idea in some fashion, or just come to the event with your creative juices flowing.

See you at the OpenCF Summit.

Read More

ColdBox Sample Applications get some ColdBox 3.0 love

Curt Gratz |  October 01, 2010

We are proud to announce that all of the ColdBox sample applications have been updated for the upcoming ColdBox 3.0 release. Sample applications are important as they increase the speed of entry into any development related task.

Give me a good sample and I can adopt it to my needs and be well on my way to learning the concept.

We believe so much in them, that there are over 20 of them covering a number of different techniques and tasks for ColdBox.

You can download the latest versions of our sample applications for ColdBox from http://github.com/ColdBox/coldbox-samples

Here is a quick run down of the sample applications.

Hello World

by Luis Majano

LightWire Sample

by Luis Majano

JavaLoader

by Luis Majano

News Web Service

by Luis Majano

Feed Reader Samples

by Ben Garrett

Feed Generator Samples

by Ben Garrett

Sample Login App

by Luis Majano

UDF Library Usage

by Luis Majano

i18N Sample Gallery

by Paul Hastings & Luis Majano

ColdBox Flex Tester

by Luis Majano

ColdBox cfcViewer Sample

by Luis Majano

ColdFusion 8 Ajax Sampler

by Sana Ullah & Luis Majano

Coldbox SES

by Sana Ullah & Luis Majano

Simple Blog

by Henrik Joreteg & Luis Majano

Ajax ColdBoxReader

by Oscar Arevalo

Transfer Sample

by Luis Majano
A very simple CRUD and Listing application using Mark Mandel's Transfer Library. This is a great example to learn how to tuse the Transfer Library and the ColdBox Framework.

Advanced Transfer Sample

by Ernst van der Linden
ColdBox-ColdSpring-Transfer

Security & Transfer Sample

by Ernst van der Linden & Luis Majano
ColdBox-LightWire-Transfer

Illidium cfc Code Generator

by Brian Rinaldi

This is a port of the actual application. It is by far specifically designed for ColdBox. It might contain unusual or redundant code.

Read More

Importance of Var Scoping

Luis Majano |  September 24, 2010
I can honestly say that there are always requests on the ColdBox lists or work that say, "Hey the application is taking my server memory, why does ColdBox do that!".  First of all, the ColdBox platform when placed in memory is less than 1kb of memory.  The rest that gets loaded into an application is because of your application code.  Second, the biggest culprit is the misuse or the not using of var scoped variables in event handlers or doma...
Read More

Combine/Merge ColdFusion arrays with Java Array addAll()

Curt Gratz |  July 21, 2010

Have you ever wanted a quick and easy way to combine arrays in ColdFusion.  I have done this a number of ways in the best, but came across this gem and thought I would share.

All ColdFusion arrays are of the Java vector type, we can use the underlying java.util.Vector class methods, specifically the addAll() method.

Keep in mind that this is not a "documented" use of arrays in ColdFusion, so at any version it may stop working.

Merging two arrays in ColdFusion with the java.util.vector.addAll()

ar1 = ["a","b","c"]; ar2 = ["d","e","f"]; ar1.addAll(ar2); writeDump(ar1);

 

Read More

Coldbox 3.0 and the CFC Config...

Curt Gratz |  June 29, 2010

One of my favorite new features of Coldbox 3.0 is the ability to have a CFC only config file. Thats right, no more XML. No don't get me wrong, XML has its place, but I love the ability to get funky with my config file. With it now being a CFC, I can do some crazy cool stuff.

For example

  1. I can now have my config files all extend a base config file or any other CFC, now thats cool.
  2. I can get creative with defining my enviromental variables, or create any other kind of helper functions.
  3. I can easily set a variable anywhere in the config file and EASILY refer to it.

These are just a few of the ways that I have already taken advantage of the Config.cfc.

What are some ways you have? Feel free to comment with any crazy or funky ideas you've used or plan to use with a fully ColdFusion-ifide (its a word, look it up) config file, I'd love to hear them.

Read More

ColdBox Plugins - A wealth of hidden treasure

Curt Gratz |  May 28, 2010

Today I was getting ready to send a file from my app to the browser for the user to download.  I was all set to use cfcontent to do this, but knowing ColdBox I thought I would do a quick check to see if the framework had any nice convenience methods for me to use to make life easier and sure enough... sendFile() in the core Utilities plugin.

getPlugin("Utilities").sendFile(file="test.txt");

So, this post is just a quick word of advice.  Don't reinvent the wheel.  If you are doing something, anything common, check the docs and see if ColdBox can do it for you.  You will be amazed at whats available in the core plugin set already for you to use.  

Plug it In

Plug IT IN

Here are just a few I use commonly.

ORMService - generic ORM Service helper for Hibernate
QueryHelper - all sorts of goodies in here, sorting queries is one of my favorite. Or the querySim.
Validator - all sorts of standard validation methods here. checkEmail and checkIPAddress are my favorites.
FileUtils - This is a utilities library that are file related. Lots of fun methods here.
Utilities - A good mix of a variety of handy methods, like todays gem sendFile()

 

Read More

SES Routing Hidden Gem: Route Variables

Luis Majano |  April 15, 2009

When using ColdBox's SES routing mechanisms you will come to a point where you would like to create variables depending on when a specific route matches or not.  You can do so very easily by using the argument called matchVariables, which is a simple string of name-value pairs you want to create in the request collection (This was added in version 2.6.3).  However, a hidden feature that we just documented that has been enabled since version 2.6.0, is that you can also pass na...

Read More

ColdBox and URL Rewrites with IIS 7

Luis Majano |  April 06, 2009

This is a post to help people know that there is a free URL rewrite for IIS7 that microsoft has built and it is pretty darn snazzy. You can get the download from here: http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1691.

The documentation for the rewrite tool is here: http://learn.iis.net/page.aspx/460/using-url...

Read More

Creating Dynamic Model Mappings

Luis Majano |  March 25, 2009

Tony Garcia has created a nice blog entry on how to create dynamic model mappings using ColdBox's Model Integration features.  I really enjoyed the read and approach Tony took.

http://www.objectivebias.com/blog/entry/dynamic-model-mappings-in-coldbox

...
Read More