My SOTR 2011 Presentation : AJAX Longpolling with BlazeDS

I'm rubbish I know... Takes me forever to actually post anything on my blog. Let me throw you a small bone.

Scotch on the Rocks 2011 was a marvelous event, even if I did manage to trash my ankle stepping off the train on the Wednesday night. Not that you care, but if you saw me hopping around, it turns out that I actually chipped a bit of bone off my ankle when I twisted my ankle. I'm sure you'll be ecstatic to know that after two and a half month I'm finally back to biking to work again. Anyway....


AJAX Longpolling with ColdFusion and BlazeDS - Connecting and Messaging

In my last post on long polling I went through the basic set up of ColdFusion and BlazeDS before getting into too much code.

This part I want to get a basic connection and a couple of simple messages being sent and received.


AJAX Longpolling with ColdFusion and BlazeDS - Getting set up

I've spent some of my week this week fighting with JavaScript, BlazeDS and ColdFusion to get a working model for some ExtJS functionality that I'm currently building at work.

One of several pieces of functionality we'd like is to have is real time notifications of workflow changes. The way it was described was "we want to push alerts to the users".

I decided to have a look at how we actually addressed this "problem". We didn't really need to "push" alerts to users, so the solution was traditional polling or long polling.


XML to Javascript Object

I've been using ColdFusion since umm... 1996?, a long time anyway, so you'd think I'd know everything that there is to know about CF, its tags and functions. ;)

I jest, of course. There is always something new to learn that's exactly what I found out the other day.

I've just written a simple AJAX widget to go on a client's site to enable them to have a simple question/action work flow on their site. You know, the "Have you done this? Y/N" "If Yes do this, If No ask next question" kind of thing. It was pretty small workflow and I was contemplating simply hardcoding the whole thing. After a chat with a colleague to try and straighten some ideas out in my mind I decided to have an XML config file that contained the steps in the workflow.

Because the workflow is pretty simple I didn't really want to be requesting back to the server on each step, so I wanted to get my XML into javascript. Historically I've done this using CFWDDX, but my colleague pointed me to ToScript! I love all the CF tags, but functions are so much cleaner, especially when you're somewhere in the middle of a component and ToScript is no exception.

The only flaw in the plan was that ToScript takes a structure and doesn't see an XML object as a structure. Fortunately, without too much hassle I found Anuj Gakhar's XMLToStruct function and in 4 lines of neat code I go from XML file to javascript object. probably nothing new to most of you, but its always fun to use functions you haven't used before or forgot existed.

Scotch on the Rocks : Early Bird coming to the end

Seven days left!  Thats all there is before the early bird discount ends.

We're into April now, so your boss should be now have budgets opened up for the new financial year.  Make him really happy by persuading him to buy your tickets to Scotch on the Rocks (probably the best conference you'll attend in the UK this year) NOW!  Right now!!  Before the end of the month, while the ticket prices are still at the early bird price.

Here's what you'll be missing out on if you don't get your tickets now.

Ticket Type Before After Saving
1 Day Conference Ticket £99 + VAT £149 + VAT £50 + VAT
2 Day Conference Ticket £149 + VAT £199 + VAT £50 + VAT
3 Day Conference Ticket £199 + VAT £299 + VAT £100 + VAT
FlexiPass £299 + VAT £399 + VAT £100 + VAT

That's right!  If you're coming to the full conference, paying for your ticket now will save your boss (or you) £100! (£117.50 if you can't claim the VAT back)

You know you want to!  You really don't want to miss out on a 3 day conference with a speaker list like this at these incredible prices!

  • Adobe Consulting EMEA
  • Charlie Arehart (Everyone's favourite CF expert)
  • Sanjeev Kumar (From the ColdFusion Engineering team)
  • Jason Delmore (ColdFusion Product Manager)
  • Amir Shoval (From RADView)
  • Nick Watson (Adobe's EuropeanTechnical Account Manager for ColdFusion, Flex and LiveCycle Data Services ES)
  • Luca Mezzalira (Italian Flash Platform Developer)
  • Neil Webb (Flash platform developer / flower arranger / erotic dance)
  • Toby Tremayne (CF and Flex Developer based in Melbourne Australia)
  • Andrew Shorten (Adobe Platform Evangalist)
  • Adam Lehman (Adobe CF Specialist)
  • Kai Koenig (Adobe Certified Master Instructor based in New Zealand)
  • Ben Forta (No idea who this guy is)
  • Peter Elst (ACE, Flash Instructor, Belgium AUG Manager)
  • David Rutter (CTO Tag Worldwide)
  • Duncan Jack (Openworld)
  • Ian Bale (Celtic Internet)
  • Simon Gladman (Development Director, Tag Worldwide)
  • Neil Middleton (The man behind Feed-Squirrel)
  • Gert Franz (Railo)
  • Matt Woodward (ColdFusion Weekly Podcast)
  • Sean Corfield
  • Peter Bell (Application Generation)
  • Scott Stroz (Alagad, CFSilence, CFSnippets)
  • Joe Rhinehart (Model-Glue)
  • Mark Drew (CFEclipse)

I'm absolutely sure I've missed some! And of course there's Jatin Nanda, Big Mad Kev, myself and, the man in the skirt, Andy Allan, who will be working working hard to make sure that this conference is everything you want it to be and more!

Visit the website to find out more about the speaker, the agenda, location and to BUY YOUR TICKETS while they are still cheap as chips! ;)

Rob Gonda on CF and AJAX Recording

A big thank you to Rob Gonda for last nights mammoth presentation and to everyone that attended. It was an excellent and very enlightening presentation with loads of code examples.

If you missed out on the meeting you can watch all 2 hours and 17 minutes here :

UPDATE: Whoops - sorry forgot to get the permissions on both my presentation from last week and Rob's from last night. You should now be able to see the presentations.

Ajax photo Album

I was looking for an Ajax Image zoomer, but found this instead : courtesy of Ajaxian.

It uses the combination effects in to good effect allowing you to pick an image and zoom in and out of that image.

Must remember to grab the files and pull it apart to find out exactly how it works.

Using Fiddler with Firefox

Once in a while I really should read documentation - the "hidden" features I might find on all the applications I use.

For some reason Fiddler stopped working with Internet Explorer, so I was actually reading the few doc and faqs that are on the Fiddler website (

If you don't know what Fiddler is, its an HTTP Debugging proxy. It logs all the traffic between your browser and the outside world. Its particularly useful when you're doing Flash remoting or remoting with AJAX.

Anyway... looking at the FAQs I noticed that it is possible to use Fiddler with any browser!! I decided to try it out with Firefox and it was really really easy to do.

  1. Install and Run Fiddler once. This will create some files, one of which you'll need.
  2. In "My Documents" you will now see that there is folder for Fiddler. Inside there you'll find a Scripts folder. Grab a copy of the full path to this Scripts folder. For me that would be : C:\Documents and Settings\Stephen\My Documents\Fiddler\Scripts
  3. Open up Firefox, go to Options under the Tools menu and then click on the Connection Setting button.
  4. Down the bottom of the connection settings is "Automatic proxy configuration URL:" Select this option and in the box put the file path to the Scripts folder followed by BrowserPAC.js which is a file in the Scripts folder. So my full path is : C:\Documents and Settings\Stephen\My Documents\Fiddler\Scripts\BrowserPAC.js
  5. Hit the Reload button, then OK, close the options window and you are set!
You will need Fiddler to be open in order to access the internet now, but its easy to switch between your normal settings and automatic proxy when you don't need Fiddler's assistance.

Google Mail - keyboard controls.

When I was at Concept Personnel last week, Gillian, the young lady I met up with to talk about my CV and what kinds of job I would like to apply for, mentioned Matt Cutts when we were talking about SEO stuff. The name was familliar but I've never been and read his blog.

If you don't know who Matt Cutts is, he's an employee of Google who blogs about all sorts of stuff including SEO and Google products. I found an interesting little blog which made me realise that you can use keyboard shortcuts in GMail Personally, I've got a mouse grafted to the palm of my hand, but its nice to know that if I wanted to I could access, reply and send google mail using keyboard short cuts. This is a neat trick with event listening with AJAX.