Wednesday, November 30, 2011

Setting Tab Preferences for ColdFusion Files in SublimeText 2 on OSX

Ever since I started using Indy's ColdFusion SublimeText 2 Bundle on OSX I've had issues with Sublime ignoring my "User File Settings" for tab behavior.  I like to keep my tabs as tabs and not have them be spaces, and no matter what I added to my user file settings tabs were being interpreted as two spaces.

The only way I was able to override this behavior is to open a .cfm file and gointo Preferneces -> File Settings  - More -> Syntax Specific - User and add the following JSON string:

 {"tab_size": 4, "translate_tabs_to_spaces": false}

Lastly save the file by going to File -> Save As and make sure its saved as:

/Users/username/Library/Sublime Text 2/Packages/User/ColdFusion.sublime-settings

According to the SublimeText Documentation (http://www.sublimetext.com/docs/2/indentation.html) the order preferences are applied is:
  1. Packages/Default/Base File.sublime-settings
  2. Packages/Default/Base File (<platform>).sublime-settings
  3. Packages/User/Base File.sublime-settings
  4. Packages/<syntax>/<syntax>.sublime-settings
  5. Packages/User/<syntax>.sublime-settings
Since the Packages/User/.sublime-settings file is processed last hence will override any other settings.  The strange thing was that I could not find any tab preferences stored in any of the other 4 files that were processed before the language specific ones.   

Monday, November 28, 2011

Catch Me On the Latest CFHour Podcast.

I was extremely honored and humbled to be asked to appear on the CFHour podcast to talk about the ColdFusion Koans project.  You can listen to it here: http://www.cfhour.com/post.cfm/show-123-coldfusion-koans-with-ryan-anklam.

Thursday, November 10, 2011

Watch Me on BoltTalks Talking About the ColdFusion Koans

Yesterday I had the privilege of being on Tim Cunningham's BoltTalks to talk about the ColdFusion Koans project. BoltTalks are a quick ~15 minute video interviews that are perfect for those of use who suffer from ADD.   Head on over to http://cfmumbojumbo.com/cf/index.cfm/bolttalks/coldfusion-koans-with-ryan-anklam/ and check it out and let me know how I did.

Thursday, November 3, 2011

Screencast: Getting Started With The ColdFusion Koans

I put together this little screencast that will walk you through getting started with the Koans project.  If you haven't read my introductory post yet, read about it here. As you'll see its extremely easy, and its pretty fun too, especially if this is your first journey into unit testing.

Unable to display content. Adobe Flash is required.

As always, if after watching this and working on the Koans you have some good ideas for some additional tests to add to the project please send me a pull request on GitHub.  If you are really limited on time and just want to share your idea you can always go to the README.md page, click on the "Edit" link, and add your ideas to the "Suggested Topics" section.

Tuesday, October 25, 2011

Introducing the ColdFusion Koans - Learn ColdFusion Through Unit Tests

What are the ColdFusion Koans?

The ColdFusion Koans project is intended to teach ColdFusion syntax, techniques, structure, and tips and tricks through unit tests.  Even if you are a seasoned ColdFusion developer the Koans can be a fun exercise to keep your skills sharpened.  The Koans concept is nothing new, in fact, the Ruby Koans project is quite mature.  Recently other languages, such as JavaScript, have also implement the technique.

What is great about the Koans concept is that not only do they teach the language but they also help promote a culture of unit testing.  By teaching the language through a series of unit tests developers will hopefully develop good habits early into their ColdFusion programming careers.  In a recent blog entry, I called out the community to help promote better practices in the ColdFusion community.  This project is my attempt at doing something to help.   

How Do They Work?

**If you don't want to read all this you can watch a short screencast (4 min) here.**

Getting started is simple. First and foremost you must have a development environment running ColdFusion 9 or newer (if anyone has a Railo or OpenBD server running and would like to test the Koans on them I'd love to hear if the project works on those servers as well).  Once you have your development environment setup the next step is to download the Koans from GitHub at https://github.com/bittersweetryan/ColdFusion-Koans and copy the unzipped ColdFusion-Koans folder into your webroot.  **Note, even if you have already mxunit installed its important to use the one that is packaged with the Koans project as it will run the test suites in the proper order.  This custom mxunit does require the ability to create Java objects!**  Once the Koans are in your webroot the next step is to open your browser and goto http://localhost/ColdFusion-Koans (this is assuming you are running a local development environment).  If you are using a remote ColdFusion development environment then you'll want to go to http://yoururl/ColdFusion-Koans.  

When you first load the Koans page all of the unit tests will fail.  Your job is to go into the Koans/About___.cfc files and make those tests pass.  This is typically done by filling in a value in a unit test assertion.  For example, in the following test is in the AboutAsserts.cfc file:



In this case you'd replace the "__" with "Foo" in the assertEquals() function.

In some cases you'll have to modify some code in the function itself to make the test pass.  If you see an assertEquals() statement without a blank value ("__") that typically means that you'll have to modify some code in order to make the test pass.  I've tried to add comments in the code to help you along the way.

Please Contribute!

I strongly urge anyone who has an idea for a test to please fork the Koans project, add your tests, and send me a pull request.  I'd like to see some more intermediate to advanced concepts introduced so if you have an idea please don't hesitate to add it!  The Ruby Koans project has been so successful because it has had a lot of community involvement.  I've even seen a number of Ruby user groups devote talks on working through the Koans.  
Fork me on GitHub