Tuesday, May 22, 2012

Link To "JavaScript Fundamentals for ColdFusion Developers" Slides From cfObjective 2012

In case anybody comes here looking for my cfObjective presentation, here is a link to the slides:

http://bittersweetryan.github.com/javascript-for-coldfusion-devs/

The deck can be navigated by using the "left" and "right" arrows on your keyboard or by clicking on the left and right arrows on the presentation itself.

If you didn't attend my presentation, this deck contains a lot of code, and its all embedded and runnable within the presentation itself.  Clicking on the "Run" button in any of the slides will demonstrate the concepts being presented in your browsers console.

Notes From the cfObjective Sessions I Attended

I'd like to share the notes I took during this years cfObjective.  All the sessions I attended were excellent and I learned a lot listening to such smart people!

Building High Availability Services with Elliott Sprehn


https://www.evernote.com/shard/s20/sh/59782013-3b56-4e51-bfb8-20a60ebbd747/73031e9dde99bd9dff631384ad2b8ebf

HTTP for CF Developers with Nathan Mische


https://www.evernote.com/shard/s20/sh/5688f1d5-98fb-4d7f-bf80-49522f623e78/8cb5b0513343bc26ddf3ce78756c256a

Do's & Dont's Regarding Performance with Gert Franz


https://www.evernote.com/shard/s20/sh/835523f7-14dd-4d6e-9917-b5155f56337b/4012466727f0564a144f9f8c05ee2519

CFML Mythbusters with Mark Drew


https://www.evernote.com/shard/s20/sh/a266f107-2226-4c09-9bf0-59b93a70a473/f89b2ca939a6ee3c90b023c0c1a18374

Deep Dive: ColdFusion ORM with John Whish


https://www.evernote.com/shard/s20/sh/634c75cc-02bb-428a-a7a1-9fb779293d65/ca66cd5c88b68326ad29cba0eb24b1e3

Writing Secure CFML with Pete Freitag


https://www.evernote.com/shard/s20/sh/633924d8-0b74-41fb-8377-6adf3c7f388c/bc7c84f07d11dce1b9cdac8ff530f073

Production Ready JavaScript with Elliott Sprehn


https://www.evernote.com/shard/s20/sh/c6074df0-6253-4c4c-9145-f9aa0432d13d/89aa45a9e3699f4af86a91a23186c0db

Concurrency Zen with Marc Esher 


Marc must be such a compelling speaker that I was too focused to take notes because they really stink for this session.


https://www.evernote.com/shard/s20/sh/01686213-34ce-4108-948e-3fb0e9ceeb80/397ce9c7b0d83c6219d0dd2d30db4d44

Speedy Websites Through Better FrontEnd Optimizations with Peter J. Farrell


https://www.evernote.com/shard/s20/sh/d2996a7b-0048-44b6-af73-2a46371fd47a/9bedebc804b944574f3d1772c42a01d7

Tuesday, February 28, 2012

My Argument Against ColdFusion Sucks & Other Related Putdowns

While I was driving home last week I listening to the "Hearding Code" podcast with Chris Williams (the organizer of jsconf) and I had a small revelation.   Chris brought up how coders will use up one bad experience with a language to completely write it off and publicly denounce the it every chance they get.  Raise your hand if this immediately makes you of think of ColdFusion.   Me too.

Then I started thinking, JavaScript is one of the hottest languages around right now, and for good reason, it has evolved tremendously from where it was in the late 90's.  Does that remind you of anything?  If you are a ColdFusion developer it should seen very familiar to the language you use every day.  Anyone who writes modern ColdFusion code will likely cringe at the code they wrote back in the pre-MX days, just like a lot of the JavaScript developers did in the pre-jQuery/Dojo/Sencha/Prototype/MooTools days.

Next time we hear someone publicly call out ColdFusion for a one bad experience they've had with an app that was written in the late 90's early 2000's lets remind them about JavaScript and the many bad experiences we've all had with it back in its early days.  Lets also remind them how it has evolved into one of the most popular languages in the world.

ColdFusion, in my opinion,  has evolved just as much as JavaScript.  We have a great testing framework in MXUnit, lots of great MVC frameworks to chose from, and a number of other great frameworks that help us be productive such as Validate This, ColdSpring, Hoth, and Hyrule to name a few.  These are all advanced programming frameworks that weren't around in the early days.  In additon ColdFusion itself has also come a really long way as a programming language.  We can how write code in a way that many programmers consider much more elegant and terse with the script updates in ColdFusion9.   We can also use really powerful techniques like onMissingMethod, dynamic typing, and treating functions as first class citizens.  We have ORM capabilities baked right in the framework, how cool is that?!?

While agree it has taken ColdFusion a long time to get this far while languages like Ruby, Python, and even PHP have progressed at a bit faster rate its good that we have gotten where we are.  With the upcoming release of Zeus ColdFusion will take another step further with HTML5 controls built in, RESTful interfaces, closures, and a bunch more exciting features.  These are exciting times to be a ColdFusion developer and I hope that we can advocate the language moving forward by drawing parallels to other languages, like JavaScript,  that have had rough beginnings but are now considered "cool" languages.

Monday, February 20, 2012

Using ColdFusion 10's Function Data Type To Create a Map Function

In functional programming a map function is a way to create an array by passing each element of the array into a function.  Mapping functions are very commonly used in languages like Ruby, Python and JavaScript.  ColdFusion acts more like JavaScript in this respect where a Map is not a native function, however it is easy to implement.

Before I get into the code, lets take a look at how the map function works.   The method signature for map looks like this: public Array function map(Array arr, function fn). The map function takes and array and a function as parameters, and returns an array.  Each element in the array argument is passed into the function and the result is added to the result.

Without further adu, lets take a look a the code:



Running this code would produce this result:









Now this pattern can be applied anywhere you find yourself looping through an array and applying the same logic to each member of the array.

Friday, February 17, 2012

Changing the webroot of the ColdFusion 10 Beta (Zeus) Built In Web Server

If you run the ColdFusion built in web server on your local machine and want to keep your current webroot while playing with the Zeus beta here's how to change the web root:


  • Open coldfusion_install_location/cfusion/runtime/conf/server.xml
  • Scroll down to the end of the document where you see the line:  
<!-- Uncomment the line below to change the default web root or to add virtual directory
Make sure to replace <cf_home> with the absolute path to ColdFusion Home-->

  • Copy the last comment in the group of comments at the end, right before the line.  The line you want toc copy looks like (do not copy the beginning :  
<Context path="/" docBase="<cf_home>\wwwroot" WorkDir="<cf_home>\runtime\conf\Catalina\localhost\tmp" ></Context>

  •  Change the docBase attribute to your the ABSOLUTE path of the directory where you want your web root to be.  In my case it was /Applications/coldfusion9/wwwroot if you are on Windows this will start with a drive letter like c:\... or d:\...
  • Add aliases attributes to both the CFIDE directory AND the WEB-INF directory.  This step is extremely important, without it ColdFusion WILL NOT run.  To do this add a new attribute to the node called aliases.  Inside that attribute add the following text /CFIDE=/absolute_path_to_coldfusion_install_location/cfusion/wwwroot/CFIDE,/WEB-INF=/absolute_path_to_coldfusion_install_location/cfusion/wwwroot/WEB-INF  Again, if you are on Windows this will start with a drive letter like c:\ or d:\.  
  • This is what it looks like on my system (OSX):
<Context path="/" docBase="/Applications/coldfusion9/wwwroot" WorkDir="/Applications/coldfusion10/cfusion/runtime/conf/Catalina/localhost/tmp" aliases="/CFIDE=/Applications/coldfusion10/cfusion/wwwroot/CFIDE,/WEB-INF=/Applications/coldfusion10/cfusion/wwwroot/WEB-INF"></Context>

  • Restart ColdFusion10 and be happy.   
Fork me on GitHub