Our third entry in the Best of ColdFusion 10 contest comes from Ben Dalton. It mixes quite a few ColdFusion features including REST, Web Sockets, and ORM/Solr. On top of that, it is also one of the first uses I've seen of ESRI's mapping service. Most people use Google Maps but it certainly isn't the only option. Ben also mixed in HTML5 geolocation for good measure.

Because this application could be used for evil spammy/troll purposes, I will not be hosting a live version. Instead, I'll simply show some screenshots and at the end tell you how to grab the code yourself.

The application allows folks to send messages (shout outs) to other users. Because geolocation is used we know where you are when you make the shout out. When you first hit the application, any previous shout outs are loaded and displayed on the map.

Clicking the shout icon lets you create a new message:

Any connected users automatically see the new shoutout due to the use of websockets.

Let's look at some of the code. First - check out the ORM CFC used for shoutouts. I absolutely love how easy it is to enable Solr-based indexing:

Basically one attribute in the component tag turns it on (and adds autoindexing, which you could do in Application.cfc at a global level) and another argument to the content property tells Solr which data to actually index. I don't think he is actually using a search yet in the application (in my copy he just gets them all), but his REST service supports a find operation so it is ready to be used.

Another interesting issue is the need to set up REST support for an application. I like how he used a simple URL hook to automate this - as well as handling ORM indexing. You can trigger both in one request. But the important one is the REST call. It must be done before you use any REST based application in ColdFusion 10. This isn't a big deal I guess - you just don't want to forget it. Here is Ben's Application.cfc:

Want to see more? Ben set up a screencast here and you can download the bits at - of course - Github: https://github.com/bendalton/cfshoutout