Entries for month: June 2012

Mach-II & Shared Hosting - They Can Play Nice

ColdFusion , Mach-II 4 Comments »

If you're blessed (or rich) enough to have your own servers, using frameworks like Mach-II is pretty easy. Pop it on the server, do a mapping, good to go for all your sites. In a shared hosting environment, however, you will find there are some quirks and gotchas to using Mach-II that make installing it just a bit different.

If you just throw up Mach-II in the default folder name with a basic config, you may find yourself getting some downright wacky results, like a random Arabic language template wrapping your website, or errors about broken files when those files don't even exist in your site. So what's going on? ColdFusion and Mach-II are getting all kinds of confused, that's what. Fixing this is a multi-step process:

  1. Give your Mach-II folder a unique name! I generally do a play on my site's name, so if I had Mach-II running on this site, I might do CFBeyMachII or the like. Easy enough to type, unique enough no one else is likely to be using it. Now you might already be thinking, "it doesn't matter, I can just do an Application.cfc" mapping for my version. True enough, except the Application.cfc can't extend off a custom mapping you are setting in said Application.cfc!
  2. In your Application.cfc, change your CFCOMPONENT's extends attribute from MachII.mach-ii to CUSTOMNAME.mach-ii - this makes sure it is extending your installation of Mach-II.
  3. Now you can do a this.mappings for your Mach-II folder. It can be the same name as your folder, if you like. Also do a mapping for your site root. I usually do something like this to simplify it:
    <cfset this.mappings["/SITENAME"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) />
    <cfset this.mappings["/SITENAMEMachII"] = GetDirectoryFromPath( GetCurrentTemplatePath() ) & "/SITENAMEMachII" />
  4. In your mach-ii.xml config, you need to change your Mach-II prefixes to match your new Mach-II mapping. You might also want to prefix the type attributes for your listeners, filters, and properties with your new site root map, again to prevent potential bleed over. So:
    <property name="applicationProperty" type="properties.ApplicationProperty" />
    <listener name="someListener" type="model.someModel.someListener" />	
    
    	
    BECOMES
    
    <property name="applicationProperty" type="SITENAME.properties.ApplicationProperty" />
    <listener name="someListener" type="SITENAME.model.someModel.someListener" />	
  5. Now comes the big, messy pain part - within your actual framework code, i.e. if you have CFBeyMachII in our example above, you need to replace all MachII. instances with AEWMachII so that it all matches its actual folder structure

With all that done, you should be good to go to use Mach-II on your site! Well, maybe with one caveat. Mach-II's documentation currently indicates that if you want to upgrade your framework, such as going from 1.6 to 1.8, you have to be able to restart your ColdFusion server, or it won't work. Obviously you can't do that in a hosted environment...but the document in question is also very dated so it may not hold true anymore. I'll be finding out myself eventually, as An Eclectic World v7 was built on 1.6, but the upgrade I'm working on will be using 1.8. Weee!

cf.Objective() 2012 - Day Three Sessions

Conferences , ColdFusion 1 Comment »

The final day of cf.Objective() 2012 offers five slots of sessions plus the closing remarks. Often times with conferences, it feels like the last day gets a bit of the shaft, with the least favorite sessions pushed there because so many folks bail out before the conference ends. I was therefore happy to find that other than the pre-lunch slot, I was able to find something to go to throughout the day and, for the most part, it was all useful info. Yay!

Less CSS, Meet ColdFusion - Nathan Strutz
This session was alternately frustrating and very interesting. On the whole, I walked away feeling like LESS CSS might be worth looking into and could do some cool things, but it was an aggravating journey. It was clear Nathan knew his topic but he kind of forgot to explain what LESS CSS was. He did give lots of code examples, though they were at the start (which were interest piquing for sure) before he explained how you actually use this stuff. I was able to follow along and eventually figured it out, though I'm still not sure I really understood about how to compile it all. Still the basic idea sounds interesting (pseudo-programmable CSS!) so I'll be looking into it more.
Authentication Made Easy Using Twitter, Facebook, Google, and More - Billy Cravens
Billy certainly wasn't kidding when he talked about making it look easy. Wow! I always figured such stuff would be ridiculously complicated. He gave a great overview of the various options with OpenID and oAuth, along with demonstrations. The only minor negative for me is I have no particular real world application for it myself, but at least now if the need arises I'll be much more ready to go for it :)
Enterprise Search with ColdFusion Solr - Dan Sirucek
Dear Dan, thank you for making me love Solr :) Seriously, we have a few apps using Verity so of course we were excited to hear about Solr, but actually getting to see how to do it and how to go way beyond just what ColdFusion ships with was very useful, as was his details on how to set up master/slaves.
Making High-Performance Caching Easy with ColdFusion - Brian Klass
I was a bit leery of this one after the second day's similar session, but I'm so so glad I went! Besides actually explaining what EhCache was, Brian went through how to use the new caching features of CF 9 (as well as some CF10 stuff), how to avoid misusing them, and ways to help decide when and what to cache. This session had me so excited not only because it will of great use in our work applications once we finish migrating to CF9, but because it solved a problem I'd be wrestling with that was delaying the launch of the redo of my personal site, An Eclectic World. That night I put what I'd learned into practice and danced around my hotel in giddiness at the crazy performance boost. I suspect if I'd been to this one before the second day's caching one, I might have understood the second day one's just a little bit better.

The closing remarks were, well, closing remarks LOL. Adorable little girl recruited to help give away raffle goodies (we won nothing) and then cf.Objective() 2012 was officially over. We did make an attempt at being social this day, with my partner trying to recruit folks on Twitter to join us for dinner but no one seemed to respond (and Twitter really sucks for actual conversation, IMHO). With that, this year's conference was done for us. We left for home the next morning and bid Minneapolis a fond fair thee well. Hopefully we'll be visiting again next year!

cf.Objective() 2012 - Day Two Sessions

Conferences , ColdFusion No Comments »

The second day of cf.Objective() 2012 is the big day for sessions, with six slots of sessions spanning from 9-5, followed by a dinner break and the birds of a feather (BoF) stuff. I'll go ahead and note, we didn't go to any of the BoF stuff. I'm not a social person by nature, so that part had no appeal and none of the topics seemed like something that would be of interest to me. I was also still a bit annoyed that the submissions and voting for BoF all required Twitter accounts. I don't tweet, I don't have an account, and I refuse to sign up just for that. Should have used FaceBook, way way way more users (as I learned in one of the second day's sessions).

Managing Your Software Development Life Cycle - Jason Delmore
Although we are a development "shop" of two + a manager (who isn't a coder), we are still trying to find ways to deal with our software development life cycle. We are way further along than we were a few years ago, when we basically had nothing. It was a free for all with our clients of whoever got to their pet developer first (we also had four developers back then). These days we do have a basic "contract" even though all of our clients are internal and we've been working on having set life cycles. Jason gave a great overview of some development methodologies and, even better, how to go about deciding which one might work for your situation. He threw out a lot of tools and showed some examples of their work flow. It wouldn't all work in our shop, but it gave some starting points for suggestions on ways we can improve our system, particularly if we ever get more developers.
10 Steps to Move Use of Caching Beyond Basics - Rob Brooks-Bilson
Unfortunately, this session ended up being a complete waste of time for me other than giving me some time to work on stuff from work. It really didn't match its session description at all, which said it would explore "10 steps you can take to move your use of caching beyond what ColdFusion provides out of the box". In reality, it was all about using ehcache and I guess the "10 steps" were the ways he talked about using it. Unfortunately, he didn't bother opening by explaining what ehcache was and seemed to presume you already had pretty advanced knowledge of it. Since I didn't, most of it just went over my head.
ESAPI and ColdFusion: "Security, Authentication, and Encoding, oh my!" - Matt Gifford
One of the best sessions of the conference for sure! Both my partner and I went to this one and I think I can say we both thought it worth our time. I'd seen the letters "ESAPI" but had no idea what it was or why I should care. Matt did a great job of explaining what it was, how to use it, and most importantly why to use (and the cons of using it). Like Pete from the day one presentation, Matt didn't waste time focusing on SQL injection attacks that can be handled by CFQUERYPARAM. We both came away with the beginnings of our plans to get this implemented in our shop with our next project.
CFML Mythbusters: 10 Coding Myths Put to the Test - Mark Drew
This was a fun presentation mostly because Mark is kind of nuts and the audience seemed to have fun having random arguments over the results of his testing. Using the Mythbusters model, Mark went through a few commonly repeated "truths" about ColdFusion and tested them on both Railo and ColdFusion 10 instances. Some were kind of "oh" things but they did at least disprove some silly statements made. A few had surprising results, and I was really surprised as how many folks seemed to hate the IsDefined() function. He did debunk some ideas about its performance, but still called it bad to use which I didn't quite get. Was nice to see that the idea of "minifying" ColdFusion code would improve performance was completely debunked - it just makes the code hard to read.
How to Pimp Our Your Model - Scott Stroz
OMG, where was this session when we first got started using frameworks??? Seriously, if you are like we were two years ago, having no idea what a framework is, why you'd use it, and what the heck a model-view-controller session is, you need to go to this if it is offered next year or at another conference. Not only did Scott do a great job explaining it all in an easy to understand manner, but he also gave us permission to take it slow and not try to do it all at once!

We skipped the last set of sessions for the day. None of the ones available in that slot were of interest, so we went to dinner early instead. Other than that though, only the one session noted above felt like a waste of time. All the rest I definitely walked away from with some good info, so a great day overall.

Powered by Mango Blog. Based on the Glossy Blue mango template design and utilizing the Icons of N.Design Studio
RSS Feeds