Rob Gonda's Blog

my dream came true: RDS for Eclipse

yes, that's right! RDS support for Eclipse was released.... finally. They've been talking about it for a while, but no it's official... I can finally get rid of homesite.
Thus far I've been using both, because sometime I do need RDS support... right, I shouldnt be using it for production, and I can setup ftp, yara iara yara... I like RDS because it's way faster than ftp.

Behold Model-Glue users! MG+AJAX Made easy

I just released a new improved version of ajaxCFC for the Model Glue framework. Now it's even easier to add Ajax to your robust ColdFusion MVC applications. I modified the Echo Example and added a Contact Manager Example to show how it works. All open source and included in the ajaxCFC download. The contact manager example is the same that comes with Model-Glue, using the same controller, models, and views ... slighly Ajaxified :)

[Updated] IMPORTANT NOTE: The XML Socket works on port 1225, so if you're behind some firewall preventing that traffic you will not see the refreshes. I am still working on some port 80 proxy, but for this experiment just open that port.

btw, I will be demonstrating all this at the upcoming Spring Conference, this week.

If that wasn't enough, included is also the next level of Web 2.0 applications; a mash-up of ColdFusion / Model Glue / ajaxCFC / XML Binary Sockets / CF Event Gateways... This combinations allows you to only for your presentation layer to interact with the server in the background, but also for the server to push data to the clients. No more Ajax pulls every 3 seconds interval, now the server can just broadcast the command to all clients. I shall call it Apocalypse. ;)

I modified the Contact Manager example that comes with model glue to use Ajax and Socket servers... now every time anyone adds/edits/deletes a contact all clients' views will get updates... just imagine the possibilities. Just try it yourself... open two browsers and see them interact.

I will try to briefly explain the framework the best I can.

First, you need the BER version of the model glue framework; Joe still hasn't officially released MG v1.1.

Now, the framework consists of a model: ajax.cfc, some JavaScripts included in the views/js folder, and a rendering view ajaxResponse.cfm. That's it...

How do it work...
The examples that come with Model-Glue use a private Layout hanlder, so I just added two more: AjaxLayout and SocketLayout... Now every time you need to respond an Ajax request you use the AjaxLayout, and if you want to broadcast something through the socket, you use the SocketLayout.

I modified the controllers init and OnRequestStart to parse the Ajax request... once it gets to your controllers handler all Ajax vars will be sent to you as regular event values, which you can get with getValue. There's not much more you need to know there...

Your controller will do its thing and set vars to be used in modelglue.xml ... now, here's the beauty ... when you use the AjaxResponse renderer your views will modify DIV Layers, or anything with the view's ID ... For example, if your body has a container calls contentForm, once you render a view with that name, all content will get placed inside that DIV...

If you need to run scripts you can use a reserved view name: 'script'. If you create a view with that name, all code inside that view will get evaluated in the client side. I modified the Echo Example to use this method so you can see what I mean.

The socket implementation is still in alpha mode... I just finished the prototype today... how does it work?!

I added a 1px Flash movie that weights only 1k that all it does is to open a socket connection to a ColdFusion Event Gateway. I rewrote the XML Binary sockets that comes with CFMX7 to better suite the Flash XML Socket protocol. I also added a few methods such as onConnect and onDisconnect. Anyways, when you need to talk to the server to do it through Ajax, but if the server needs to talk to you, it will do it through the XML Gateway. The beauty is that you do not need to modify anything or create any custom handler for it ... The flash movie uses FS Command to communicate with JavaScript and triggers the same calls the Ajax response would, so the same rendering in the server works for either method.

I included the org.gonda.socket.jar file, which would have to be registered as a custom event gateway to make the contact manager example to work. Just point your JVM class path where the file is, restart ColdFusion, and register a new gateway:
Name: FlashSocket
Class: org.gonda.socket.SocketGateway

Then create a new instance and call it 'flashSocket1'. I provided the cfg file in the example too.

In the main view, both IP and port are passed to the Flash file as FlashParams... will easily see how to modify it.

I know, you are thinking it's too much, but it's not THAT complicated ... and it's well worth it ...

Ok, so what is the catch? There are a couple of issue I still need to work on ... one) The socket binds itself to an IP and port, and I don't want to create a new socket for every application.. especially if I need to open a new IP on my firewall every time ... two) firewall... yes, I need to find a way to perform http tunneling, or to detect that it was blocked on run time to shift all socket calls to Ajax.

I know it's not crystal clear, but I wanted to get it out there and get people thinking ... I'll try to document it better this week before the conference.

ajaxCFC: DWR AddRows function improvement

I just released a small modification, but largely requested by the community: cell Renderers....

As the matter of fact, Kenton Gray came back to the rescue, he modified utils.js and wddx.js, so if you're upgrading, you only need to load those two files. You can check the new use with the same Query Example I posted before, but this time it adds some custom cell functions. Now you can send queries back from CF and easily populate tables with any custom code.

This is the true spirit of open source. Thanks Kenton! if anyone else has any suggestions or contributions, do not hesitate to drop me an email.

ajaxCFC significant update: named arguments

I just uploaded a new release of ajaxCFC, and this one carries a rather significant update. I modified the way you pass arguments from JavaScript to your ColdFusion function. Before, due to that you were passing unnamed arguments, you were receiving them in a ColdFusion arguments array; Thanks to Kenton Gray's contribution now you receive all arguments as separate named arguments. The main seller was that you could have built-in validations ... I’m using metadata to retrieve the names of the declared arguments, and if you’re passing more arguments than you declare, they come in as ‘unkwnownXX’, xx being a counter or unknowns. I tested the code in CFMX6, 6.1, and 7, but not yet in Blue Dragon. If any of you could do that for me, it would be greatly appreciated.

Your old code WILL NOT WORK with the new ajax.cfc. You can make it work by one of two methods:
1)    name your arguments and their names in your CF Function. This method is the most advisable.
2)    2 :: the quick method) Remove the args declaration and use the arguments scope as an array by simple removing the args var… use arguments[1] instead of args[1].

Canvas: open source ColdFusion wiki

Canvas initially was part of a Macromedia DRK, but today it went open source. It's a nice and simple ColdFusion Wiki, but just like any other Ray's projects, expect it to grow exponentially now that it went OS.

ajaxCFC will be using this Wiki, and I know it's missing some functionality right now, but I truly believe that it will be a great product in no time.

I set up the Wiki today and it's mostly empty :) but feel free to start contributing with anything you want: faq's, examples, docs, etc.

CFUnited Preconference Classes posted

CFUnited just posted the list of pre-conference classes. I will be teaching an Ajax Intensive For ColdFusion Developers. If you have a chance, do not miss this hot topic! The session will teach you to implement Ajax from the ground up, providing you all the fundations to successfully deploy secure and robust Ajax sites/components.

CU214 - Ajax intensive for ColdFusion Developers
Ajax, Web 2.0, RIAs, single-page-applications are just a few buzzwords that every developer needs to know in 2006. Learn the history of Ajax, what it means to you, why you should pay attention, who is using it, what is available, and how to implement it. This session will get you up to speed with Ajax, compare the different existing frameworks, and provide you helpful tips of do’s and do not’s with Ajax.

Learn how to enrich your users experience by the use of AJAX. Examples start at --hello world-- and build up all the way to object oriented MVC applications. By the end of this session, you will know how to enhance your site through simple AJAX widgets or build full AJAX application including enhanced security and debugging techniques. Learn common mistakes such as delegating business logic to the client side, and learn to avoid them by keeping your logic in the server and loading scripts on-demand.

Find below the full list of classes:

CU210
Leader of the Pack (strategies for building better software) - Simon Horwith - Monday 6/26
CU211 Fundamentals of Relational Database - Kurtis D. Leatham - Monday 6/26
CU212 ColdFusion Server Administration: JRun J2EE Deployment - Adam Wayne Lehman - Monday 6/26
CU213 Testing ColdFusion - John Paul Ashenfelter - Monday 6/26

CU214 Ajax intensive for ColdFusion Developers - Rob Gonda - Tuesday 6/27
CU215 XML, XPath, and XSLT for ColdFusion Developers - Jeff Peters - Tuesday 6/27
CU216 Domain Modeling - Hal Helms - Tuesday 6/27
CU217 Beyond Basic SQL for CF - Nate Nelson - Tuesday 6/27

help: coldfusion+soap

ColdFusion has a nice integration with web services when a WSDL is present, and it's great with REST web services too. However, it's extremely difficult to integrate with regular soap, why?!

I tried using cfx_soap and it just doesn't work. I also found a way to 'trick' cf by creating a local web services and then add soap headers to it... but it's too complicated, and only works for cfmx6.1. Of course I could manually code all the xml envelop and use regular cfhttp calls, but who wants to do that?

Has anyone successfully implemented any soap integration with CF? If so, could so share it with the community? Just to think that perl can use soap::lite modules and CF can't... how depressing.

Thanks.

ColdFusion Open Source list now using ajaxCFC

The ColdFusion community open source projects list is growing, and there are several individuals helping the cause. Brian Rinaldi put together a very nice list of open source projects. After I changed my license, he chose to incorporate it to the site and use it for category filtering, and as expected, it's much faster than page reloads. Read how difficult was the experience from download to deploy on a very useful beginner's review of ajaxCFC.

CFUG Ajax Presentation Files

I really enjoyed speaking last night at the cfug, and I had a great audience. I met a couple of the attendees, which actually may incline me to attend to more meetings :)

As promised, I'm providing here the presentation files I used (enclosed). If you need me to elaborate on any slide, please do not hesitate to ask.

For those of you who didn't make it for any reason, the presentation covers ajax101; I kept it basic and universal. Starts with definition, story, advantages, who's using it, gets a little into the xmlHttpRequest, mention some available frameworks, and provide a simple example using ajaxCFC.

Enjoy.

p.s. I also emails the presentation to Ron, so it will get posted at the South Florida CFUG site too.

* updated. Download the PDF version here if you don't have PPT 2003 installed.

CFunited Marriott sold-out, and alternatives

I already booked my CFUnited room, but for those who haven't check the following information that was provided by Joshua Cyr

It turns out that Marriott is booked solid. Doh! I just did some research. There is a very close hotell called Park Inn Rockville, but it is being closed permenantly next week.

The two others that seem within walking distance are the DoubleTree and Ramada Inn. The Ramada in is only $125 a night (give or take), where the Doubletree was about $225.
Joshua, thanks for looking out.

More Entries

This blog is running version 5.9.003. Contact Blog Owner