Raymond Camden's Blog Rss

Nifty little trick with fileRead and ColdFusion 10

4

Posted in ColdFusion | Posted on 05-21-2012 | 676 views

ColdFusion 10 adds a nifty little feature to the VFS (Virtual File System) - support for FTP, HTTP, and ZIP. This means you can treat remote resources and zip files as if they were simple file systems. The docs don't go into great detail on this (and instead ask you to read the Apache Commons docs instead), but I discovered a simple, but really nice, good example of this.

Because fileRead supports http, if you want to quickly grab the contents of a URL, you can use it as I've done above. All it does is save you one line of code (compared to the normal cfhttp call followed by a set to grab the file contents), but it's handy!

cfObjective 2012

4

Posted in JavaScript, HTML5, ColdFusion | Posted on 05-20-2012 | 1,046 views

Another year and another cfObjective is behind me. Every year this conference gets better and this year was no exception. The location is great (even with it under heavy remodeling), the food was great (although did they really need to feed me half a chicken on the last day!), and of course, the content continues to be very well done and very interesting. My thanks to the entire team at cfObjective for their hard work and dedication in helping create this year's conference.

While I attended many sessions, here is a short list of what I thought was interesting and my take aways from each:

  • Simeon Bateman presented on "Enterprise JavaScript Applications" and Node.js. His first presentation was a good overview of the tools that can help you build JavaScript applications. He demonstrated multiple things, including Backbone. I've seen that before but I think I'm going to play around with it a bit more. As for Node - I don't think I've been shy about my disappointment around Node. Not so much in the technology but how it is 'marketed' and presented to other developers. Sim did show the classic HTTP server example (the one I complain about), but then moved into much more interesting areas with his discussion of Connect and Express. I found these pretty interesting, but then Sim went on to discuss where he thought Node.js could be most useful - as a complement to other server-side languages (like ColdFusion) by providing highly performant network type services (like websockets) via Socket.io. He focused on the practical use cases for Node and that to me is what really made it seem better.
  • I only caught one presentation by Elliott Sprehn, but it was a good one. He talked about "Production Ready JavaScript" and some of the issues you face when you get past the 1000-line mark in your JavaScript files. I found his discussion of testing and logging of user actions in JavaScript fascinating. I plan on trying to implement, and blog, some of the things he discussed.
  • Charlie Arehart gave a great talk on ColdFusion under Tomcat. I really had no idea how much Tomcat could do.
  • Mark Mandel talked about Closures in ColdFusion 10 and blew my mind. I'm not discussing it here because it was too much. I've got another blog entry just on that for later this week.
  • I had seen Dave Ferguson talk on security before - but it is always a good idea to be reminded of just how much work is involved in creating a secure site. I especially liked his fact versus myth approach.
  • I saw Scott Stroz present on "How to Pimp Out Your Model" and PhoneGap. I've seen the first presentation before, but I really enjoy how he brings the concepts of MVC to a simpler, easier to understand level. I'm still approached by people having trouble wrapping their heads around the concept and if you can see Scott present on it - do so. Obviously I'm already familiar with PhoneGap, but Scott's presentation was very polished and has encouraged me to bring mine up to a higher level.

There were even more great presentations, but as I have to go catch the Super Shuttle I'm going to wrap it up here. I've said it before but I'll say it again. cfObjective is an incredible conference and well worth your money and time. I cannot encourage my readers enough. Whether you want to learn more about ColdFusion or JavaScript, it is a great opportunity to both learn and network.

E-Seminar on Slatwall next week

12

Posted in ColdFusion | Posted on 05-18-2012 | 990 views

While at cfObjective, Sumit Verma from Slatwall let me know that they are doing an Adobe E-Seminar next week on the product. Slatwall is a free, open source e-commerce product that plugs into Mura CMS, another good, free, open source ColdFusion product.

You can register for this e-seminar here: http://www.adobe.com/cfusion/event/index.cfm?event=detail&id=2014594&loc=en_us

By the way - I feel like we (Adobe) could do a much better job of letting you know about these e-seminars. Agreed?

Slides, code, from my HTML5 Presentation

4

Posted in Development | Posted on 05-17-2012 | 1,206 views

First off - a big thank you to everyone who attended my presentation at cfObjective today. I hope it was a useful introduction to some of the cool new stuff in HTML5. That sounds really lame, but it's honestly how I feel. The web (well the front end) is incredibly fun again. I'm hoping to do many more presentations in the future, but with a more focused topic. I'm doing a presentation soon on HTML5 Storage options and I'm planning one just on Forms. (Since, you know, forms are kind of important. Unlike other things. Looking at you Canvas.)

You can download the presentation and code from Github: https://github.com/cfjedimaster/HTML-Code-Demos

It should "just run" in your browser, but some of the demos are a bit bleeding edge.

Important note on availability of ColdFusion 9

Posted in ColdFusion | Posted on 05-17-2012 | 1,119 views

Just passing along this important information about the availability of ColdFusion 9: Availability of ColdFusion 9

Some thoughts on organizing a large jQuery Mobile project

6

Posted in Mobile, Development, jQuery, JavaScript, HTML5 | Posted on 05-16-2012 | 1,488 views

Ben Forta pinged me with an interesting question (and when the Forta pings you, you respond) that I thought I'd share here. It's one of those "best practices" questions that really has no best answer, so as always, I'm very eager to hear what my readers have to say. Don't feel afraid to tell me I'm completely off my rocker - that makes for fun conversation. Ok, so the question:

I have a JQ+jQM=PG app. It started off as 2 small pages and 50 lines of code, and is now 10 pages and over 1000 lines of code (excluding lots of .js libraries, some my own and some downloaded, that are all included).

My question simply is how would you go about organizing the code? Each "page" in its own HTML file? Would you put page supporting event handlers with those pages? What about handlers that use JQ to manipulate other pages? Separate all JavaScript in included files? And actually, how the heck do you even use JQ to manipulate controls in another page?

I know there is no right or wrong answer, but I am about to start refactoring this entire mess, so ... any thoughts you'd like to share?

ColdFusion 10 Released

4

Posted in ColdFusion | Posted on 05-14-2012 | 1,704 views

Title says it all. You can now download the final release of ColdFusion 10. There's been a lot of press/blog entries/presentations/videos already on this release so I won't repeat the feature list, but you can see even more new videos on Adobe TV.

Adding "Filter as you type" support to IndexedDB

Posted in Development, jQuery, JavaScript, HTML5 | Posted on 05-14-2012 | 1,329 views

One truly disappointing aspect of IndexedDB is that there is no (simple) support for search across your data. It is very much based on the idea of knowing your keys and fetching data based on those keys. You can easily retrieve the "Ray" user object, but you can't search for user objects that have an age within a certain range and a skill property of so and so. That's not to imply you can't do some sorting and filtering though.

IndexedDB supports the idea of key range objects. As you can probably guess, these allow you return objects based on a range of values that match with a particular index. Remember that IndexedDB objects can have any number of properties, but you have to specify which are indexed. And now you know a good reason why - it gives you a chance to filter later on.

Ranges can go in either direction and can be inclusive or exclusive. By that I mean, you can say "Anything object with a name 'above' and including Barry" or "Anything object with a name 'below' Zelda but not including that name." You can also combine both and get a single object too.

For my use-case, I wanted to use a range filter so that I could support 'filter as you type'. My data consists of notes that include a title, body, and created property. I'm not going to go through the steps of setting that up as my previous blog entries (linked at the bottom) went over most of the detail there. Instead, let's focus on how I built in the 'filter as you type' metaphor.

To begin with, I had a function that handled "get all" and displaying the data. It worked by opening a cursor and looping while data existed. Here's how that version looked:

In order to support a bound range, you have to change how you open your object store (remember, think of this like a database table). When we just get everything, we run openCursor on the objectStore (line 18 above). When we want a bound list of data, we get an index first (this is the property we said we wanted to be able to filter on), create the range, and then open a cursor on that. So with a small amount of work, we can update our displayNotes function to take an optional filter. (Note that I also switched to a table display. The change in HTML isn't terribly important here so I won't cover it.)

Focus on lines 31 to 40. You can see the different ways to open the cursor. Note specifically we do our binding based on an input string, like "ra" and append "z" to give an end to the range. So typing in "ra" means we want all notes with a title from "raa" to "raz".

Outside of that - the code is identical. I moved the success portion into a new inner function (handleResult), but it works the same no matter how I get the cursor itself.

You can demo this yourself by hitting the demo button below, but as before, this is Firefox only due to - what I believe - is a bad implementation in Chrome. (I think it could be made to work in Chrome, but as I'm building these examples to help me learn more about IndexedDB, I'm fine supporting the most compatible browser.)

You can find the complete source by .... viewing source. ;)

Example of invokeAndPublish with WebSockets and ColdFusion 10

Posted in jQuery, JavaScript, HTML5, ColdFusion | Posted on 05-11-2012 | 1,599 views

While preparing for my presentation earlier this week on WebSockets and ColdFusion 10, I ran into an issue trying to wrap my head around one of the features: invokeAndPublish. The docs describe it like so:

Using CFC data with Handlebars

11

Posted in jQuery, JavaScript, HTML5, ColdFusion | Posted on 05-11-2012 | 1,799 views

Earlier this week Steve wrote to me asking how to use data retrieved in a ColdFusion Component in a Handlebars template. While ColdFusion makes it trivial to serve up query data via JSON, the result format isn't always easy to use in JavaScript utilities. Here's a quick example I wrote that demonstrates how to work around this.