Unfortunately after years of service, the current venue for the Melbourne ColdFusion user group venue is no longer available to us.
If anyone knows a venue in Melbourne that is happy to have some geeks once a month doing presentations on ColdFusion and other related Adobe technologies, please shoot an email to:
Steve AT cfcentral DOT com DOT au
Or you can
contact me directly , and I will pass it onto Steve.
Failing any of that, if you are interested in attending the Melbourne CFUG, please stay tuned to the
CFAUSSIE mailing list , as announcements will be made to where we will eventually end up.
Please do note, it is really important we find somewhere. There are some great presentations lined up for the next few months, including Flex development and ColdFusion / Java integration, and without a venue none of this will happen.
User groups are an important part of what keep ColdFusion alive and strong, so any and all suggestions are more than appreciated.
I don't know how many times I've gone looking to do asynchronous processing in ColdFusion, and come up against the myriad of hacks, workarounds and that general feeling that I want to poke my eyes out with a rusty spoon.
Now that
JavaLoader exists, integrating Java with ColdFusion becomes so ridiculously easy, it would have been relative heresy if I hadn't sat down for an afternoon and wrote a library for making asynchronous HTTP GET and POST requests.
To use the
asyncHTTP library , you simply have to drop /asyncHTTP/ the folder in your web root, or create a mapping to it.
From here we create an instance of the AsyncHTTP.cfc:
asyncHTTP = createObject("component", "asyncHTTP.AsyncHTTP").init();
Now that we have an instance of the AsynHTTP CFC, to do an asynchronous GET request, we simply call:
asyncHTTP.get("http://www.site.com/mytemplate.cfm?var=value");
If we want to pass form data across, we can also do an asynchronous POST request, like so:
formData = StructNew();
formData.var = "value";
asyncHTTP.post("http://www.site.com/anothertemplate.cfm", formData);
That is it! It is as simple as that.
Please
download the library, give is a spin, and any questions, feedback, bugs or general comments, please either reply to this blog post, or shoot me an
email .
Previously we looked at doing basic CRUD operations in Transfer, and I was going to look at some of the composition options that are available, but I decided we would look at primary keys instead first.
Primary keys are an integral part of almost any database driven application, and consequently are an integral part of Transfer as well.
When a Business Object is inserted into the database, a primary key value will need to be supplied, either by the database generating the unique value, or by code generating the unique value.
A Business Object will need to know the value of its primary key, so that it knows what record it is representing.
Transfer will handle this process for you, and how it does that is configured through the <id> element that is found within the
Transfer configuration file .
There are three different ways that Transfer does this:
Retrieves Database Generated Primary Keys
By default, Transfer will attempt to retrieve numeric keys that are generated by the database. Understandably, this happens differently for each supported database -
- Microsoft SQL Server: Generates Identity value
Example: <id name="IDPost" type="numeric" />
This will retrieve the last inserted Identity key that was generated by SQL Server.
- MySQL: Generates 'auto increment' values
Example: <id name="IDPost" type="numeric" />
This will retrieve the last inserted auto increment value that was generated by MySQL
- PostGreSQL: Generates primary key values through sequences
Example <id name="IDPost" type="numeric" sequence="post_seq" />
This will retrieve the last sequence value that was by incremented by PostGres.
Transfer can Generate Primary Keys
Transfer can also generate primary key values for you. There are three different types of primary keys that it can generate -
- Numeric
Example: <id name="IDPost" type="numeric" generate="true" />
This will generate a unique numeric value for the table
- UUID
Example: <id name="IDPost" type="UUID" generate="true" />
This will generate a UUID value for the primary key
- GUID
Example: <id name="IDPost" type="GUID" generate="true" />
This will generate a GUID value for the primary key
Manually Override Transfer
Last, but not least, you are able to manually override Transfer's primary key controls to insert a record with a primary key value of your choosing.
A Business Object generated by Transfer will have a set() method for its primary key. If this value is set before the Object is inserted into the database, Transfer will attempt to insert it using this value.
For example,
<cfscript>
post = transfer.new("post.Post");
post.setIDPost("george");
transfer.save(post);
</cfscript>
This will attempt to insert the Post with the primary key value of "george".
With these three options, you should have all the control you need to manage primary keys within the database.
More details on Transfer can be found here .