ContentBox RSS Feedhttp://stg.ortussolutions.com/
Blog RSS Feed by ContentBoxOrtus Solutions, Corp (www.ortussolutions.com)http://www.rssboard.org/rss-specificationFeedGeneratorThu, 24 May 2018 17:51:07 GMTThu, 24 May 2018 17:51:07 GMTSubmit Your First Pull Request to an Open Source ProjectUpdate 10/10/2015 -- New tickets added!
Perhaps you're using open source projects with your work. You've heard about how Git works, and maybe you even attended one of my sessions on how to submit pull requests. You've never actually tried to do one before though. You were brave one day and clicked the "Fork" button in GitHub but were left staring at your keyboard wondering what the heck you could do to help out a project that wouldn't sink your entire weekend.
The Wait is Over
Ladies and gentlemen, boys and girls of all ages: your time has come. Today we're breaking down all the walls keeping from being a productive member in the open source community. Everything you need is documented and laid out in front of you. Heck, for this to be any easier, I'd just have to do it for you! If you've been waiting for just the right chance to come along to submit your first pull request, please keep reading.
Today we are announcing a special program where we've createda handful of super-duper easy tickets for an assortment of Box products. These are already entered into our ticket tracker and approved. All we need is someone to complete them! You don't even need to know how our products work to help out. Each ticket spells out what amounts to a one-line change to get your feet wet and experience the process of submitting something that will release to the world in the next version of our product. We'll even make sure to include your names in the release notes :)
You. Yes, you!
There's a little bit of a catch. These special tickets are ONLY for people who have never submitted a pull request via GitHub before. You know who you are. If you've contributed before, we thank you so much but please step aside so someone who's never been a part of this process can give it a spin. Please only take one of these tickets too. If you really love this and want to help more in the future, don't worry-- we'll have lots of other opportunities to put your newly learned Git skillz to good use.
What You Need to Do
Ok, we've made this super easy. The tickets already exist in JIRA, but I would recommend creating a quick JIRA account so you can assign yourself to the ticket. That way, we won't have two people trying to work on the same thing at once. Here is our guide that covers signing up for a free JIRA account.
How To Create A JIRA Account And Enter ColdBox Tickets
Next, choose one of these simple tickets and assign it to yourself:
COLDBOX-472 (Update the documentation URL in box.json)
WIREBOX-45 (Update the documentation URL in box.json)
CACHEBOX-31 (Update the documentation URL in box.json)
LOGBOX-19 (Update the documentation URL in box.json)
CACHEBOX-33(Convert CacheBox's FIFO policy to script)
CACHEBOX-34(Convert CacheBox's LFU policy to script)
CACHEBOX-35(Convert CacheBox's LIFO policy to script)
CACHEBOX-36(Convert CacheBox's LRU policy to script)
Next, follow the step-by-step guide here that will walk you through getting a copy of the code, making the change, and submitting that change back to us.
How To Submit Pull Requests to the ColdBox Platform
If you get stuck or have questions, no worries! Just jump on the CFML Slack team and give a shout out in the #box-products channel. Or you can shoot an E-mail off to our Google Group.
Thank You
You did it! Today you have become part of something bigger than yourself. You contributed to an open source project and it really wasn't that bad. A new world of opportunity and collaboration has just opened up to you. Go ahead and kick back while you revel in your new found meaning. In fact, take the rest of the day off-- I've already cleared it with your boss.
If you happen across this post and the 4 tickets above have already been gobbled up, please give a holler. I will gladly create more easy-grab changes for first timers to try out. This is important to CFML and at Ortus we understand that as much as anyone does. We want CFML to succeed, and for that the CFML community needs to be engaged.
http://stg.ortussolutions.com/blog/submit-your-first-pull-request-to-an-open-source-project
Thu, 24 Sep 2015 04:21:00 GMTbrad@ortussolutions.com (Brad Wood)ColdBox Community Tutorials Walkthroughshttp://stg.ortussolutions.com/blog/submit-your-first-pull-request-to-an-open-source-projectHow To Submit Pull Requests to the ColdBox PlatformThe best part about open source projects is you! Many hands make light work and at Ortus we love getting input from the many smart community members out there. The first way you can help is to report bugs or enhancements in our ticket tracking system. You can read our guide for that here:
http://blog.coldbox.org/blog/how-to-create-a-jira-account-and-enter-coldbox-tickets
The second thing you can do is to actually submit fixes yourself! This may seem scary, but it's a pretty straight forward process once you've done it once. We can never have too many people willing to help. Let's jump in and cover the steps it takes to submit some code to the ColdBox Platform.
http://stg.ortussolutions.com/blog/how-to-submit-pull-requests-to-the-coldbox-platform
Fri, 28 Aug 2015 17:13:00 GMTbrad@ortussolutions.com (Brad Wood)Bugs ColdBox Community Tips &#x26; Tricks Walkthroughshttp://stg.ortussolutions.com/blog/how-to-submit-pull-requests-to-the-coldbox-platformConverting Fusebox 5.1 Sample App to ColdBox MVC - Part 2This is the second half of our two-part conversion of a FuseBox 5.1 sample app to ColdBox MVC. If you haven't been following our blog series on converting your legacy FuseBox apps over to ColdBox MVC you may want to back up and read the previous post first.. In that post we took a look at the different files in each version of the app. We talked about how each framework bootstraps itself up, as well as settings and circuits/handlers. We'll pick up right were we left off in this post and finish off the code by looking at how we converted the views, models, and error handling.
The finished ColdBox code is here: https://github.com/bdw429s/FuseBox-5.1-Sample-App-Conversion
The original Fusebox code is in the root of the above repo in a zip called "getmymail.zip"
Views
ColdBox will automatically look for a view file named after your action in a folder named after your handler. Of course, all this happens in our "/views" convention folder. You are free to name your view files whatever you want though. Just use the following code to tell the framework what view to include:
// Include /views/randomFolder/randomFile.cfm
event.setView( "randomFolder/randomFile" );
Our views are almost identical. There are two main differences. The first is that our views "get" data from the handler by accessing the readily-available rc (request collection) and prc (private request collection) scopes. rc is used for any input from the user via FORM or URL scopes. prc is for any other data the handler wants to pass along to the view. The second is in how we build links.
/view/listEmails.cfm
&lt;a href="#self##xfa.conform#"&#x26;gt;Return to Connect Form&lt;/a&#x26;gt;
/views/list.cfm
&lt;a href="#event.buildLink( prc.xeh.conform )#"&#x26;gt;Return to Connect Form&lt;/a&#x26;gt;
ColdBox gives you a nice helper method in the event object to build links for you. It automatically handles HTTPS, the base domain, app mapping, and query string. event.buildLink() can also generate SES URLs with no changes when you have it enabled.
Layouts
ColdBox layouts are placed in a folder called /layouts by default and unless you've specified something else, will look for a file called Main.cfm.
/layouts/Main.cfm
&lt;cfoutput&#x26;gt;
&lt;html&#x26;gt;
&lt;head&#x26;gt;
&lt;link href="/includes/getmymail.css" rel="stylesheet" type="text/css" /&#x26;gt;
&lt;/head&#x26;gt;
&lt;body&#x26;gt;
#renderView()#
&lt;/body&#x26;gt;
&lt;/html&#x26;gt;
&lt;/cfoutput&#x26;gt;
The renderView() call is where the output from the view will be placed.
Model
Your models are your services, beans, and DAO that represent the business logic in your application. In ColdBox, these go under a folder called /model. I created a MailService.cfc which encapsulates getting a list of messages and getting a single message.
/model/MailService.cfc
component singleton {
property name="attachmentPath" inject="coldbox:setting:attachmentPath";
property name='sessionStorage' inject='coldbox:plugin:sessionStorage';
function getAllMessages( required numeric start ) {
// Get connection Info
var connectionInfo = sessionStorage.getVar( 'connectionInfo' );
return new pop().getHeaderOnly(
server = connectionInfo.serverName,
username = connectionInfo.userName,
password = connectionInfo.password,
port = connectionInfo.serverPort,
maxrows = connectionInfo.msgsPerPage,
startrow = arguments.start
);
}
function getMessage( required string uid ) {
// Get connection Info
var connectionInfo = sessionStorage.getVar( 'connectionInfo' );
return new pop().getAll(
server = connectionInfo.serverName,
username = connectionInfo.userName,
password = connectionInfo.password,
port = connectionInfo.serverPort,
uid = arguments.uid,
attachmentpath = attachmentPath,
generateuniquefilenames = true
);
}
}
Note the singleton annotation at the top in the component definition. This tells WireBox to only create one instance of this service that the entire application shares. I'm also using properties to inject a reference to my attachmentPath setting as well as the sessionStorage plugin again. No configuration is necessary for WireBox to find the MailService CFC since we've placed it in the /model convention folder. Unfortunately, I found that Railo doesn't support the same script syntax for the CFPOP tag so I also created a RailoMailService.cfc file in the /model folder and created the following WireBox configuration file.
/config/WireBox.cfc
component extends='coldbox.system.ioc.config.Binder' {
function configure() {
// Use this to detect the CFML engine
var CFMLEngine = new coldbox.system.core.util.CFMLEngine();
// Railo uses a different script syntax
if( CFMLEngine.getEngine() == CFMLEngine.RAILO ) {
// This will override the default MailService mappings
map( 'MailService' ).to( 'model.RailoMailService' );
}
// No "else" needed for Adobe CF. WireBox will simply "find" the
// "MailService" CFC in the "/model" folder automatically.
}
}
This file uses a utility built into ColdBox called CFMLEngine to detect the engine in use and conditionally overwrite the MailService mapping to point to the Railo version.
Error Handling
In the FuseBox code, there are try/catches around a lot of code in the "model" files. If an error occurs, a custom error page is included.
&lt;cftry&#x26;gt;
&lt;cfpop .../&#x26;gt;
&lt;cfcatch&#x26;gt;
&lt;cfinclude template="../view/error/connectionError.cfm" /&#x26;gt;
&lt;/cfcatch&#x26;gt;
&lt;/cftry&#x26;gt;
What if an error occurs somewhere else in the request though? What if you add new code and forget to wrap it in a try/catch. Even worse, what if you decide to rename your error template after it's referenced everywhere? In ColdBox, error handling is built in. All of your code is run in a try/catch at the framework level, and there's a nice default error template that displays. In your production settings though, you'll want to override this to a more secure page that doesn't divulge information with the customErrorTemplate setting.
customErrorTemplate = "includes/templates/oops_sorry.cfm"
You can read more about the exception handling provided to you in ColdBox here.
Conclusion
To see all the code, please visit this repo on GitHub:https://github.com/bdw429s/FuseBox-5.1-Sample-App-Conversion
This sample app was a little more involved than the last one, and hopefully everything makes sense even though I included a lot more code. If clone the Git repo you can unzip the FuseBox code and open them side by side. Please comment below if you have any questions or suggestions, and here's our list of handy resources:
Check out our bite-sized PDF reference cards here:http://wiki.coldbox.org/wiki/Dashboard.cfm#PDF_Ref_Cards
Play with the framework right inside your browser with these samples:http://runnable.com/ColdBox
Join our Google Group. We're friendly, active, and love to help with ANY kind of CF question:https://groups.google.com/forum/?hl=en#!forum/coldbox
Check out our video library of webinars and presentations:http://www.coldbox.org/media
Look up answers in our comprehensive docs:http://wiki.coldbox.org/
http://stg.ortussolutions.com/blog/converting-fusebox-51-sample-app-to-coldbox-mvc-part-2
Tue, 12 Aug 2014 14:00:00 GMTbrad@ortussolutions.com (Brad Wood)ColdBox Sample Apps Tips &#x26; Tricks Tutorials Walkthroughshttp://stg.ortussolutions.com/blog/converting-fusebox-51-sample-app-to-coldbox-mvc-part-2Converting Fusebox 5.1 Sample App to ColdBox MVCWelcome back to our blog series on converting your legacy FuseBox apps over to ColdBox MVC. In our last post we converted the sample app for FuseBox 3 to ColdBox. In this post we'll be taking the FuseBox 5.1 sample app from fusebox.org and converting it over to ColdBox MVC. This is a later version of FuseBox that relies on XML controllers so it may be a bit more familiar. Let's get started!
The finished ColdBox code is here: https://github.com/bdw429s/FuseBox-5.1-Sample-App-Conversion
The original Fusebox code is in the root of the above repo in a zip called "getmymail.zip"
To run the FuseBox sample app, I downloaded the FuseBox 5.1 core files from fusebox.org. I had issues getting the code to run on Railo 4.2 due to component creation paths and relative file directories not agreeing with the framework so I switched over to ColdFusion 9. The ColdBox code, however, will run on CF9+ or Railo. I had to put in a some code to handle Adobe and Railo's different script implementations, but I'll cover that later.
Overview
This sample app is called "Get My Mail' and is a simple POP3 client that will list out all the messages in your inbox. It only has three screens-- the connection information form, the E-mail list, and viewing a single message. To use the app, you'll need to have the server and login info for a POP3 server handy. I'll also note that I wrote the ColdBox code all in CFScript except for views and layouts, of course. This is simply my preference. You are free to use tags with the ColdBox Platform.
Here's a screenshot of the files in the Fusebox and ColdBox code side-by-side. There are fewer ColdBox files, but not quite as few as the image might imply. Several of the files on the FuseBox side are auto-generated or empty. I'll cover each of them as we go.
FuseBox 5.1 has no inherent MVC patterns per se, but this sample app was structured with MVC in mind which help the conversion. The controller and model folders are basically FuseBox circuits that roughly represent those breakdowns. The first thing you might notice is that ColdBox has NO XML! We believe CFML programmers should use what they're most familiar with to describe their app-- CFML!The parsed folder in FuseBox is where .cfm files are automatically generated by the framework from the XML controllers. Since ColdBox has you write your code in CFML, there's no need for an equivalent. You'll also notice that the FuseBox "models" are just .cfm files. I went ahead to moved the equivalent code into an actual CFC in the ColdBox example.
circuit.dtd and fusebox.dtd are just the XML definition for each of the circuits and the fusebox.xml file. Naturally there is no equivalent file in ColdBox. If you want to know what options you have in a ColdBox handler or config file, the easiest thing to do would be look in the docs, or use one of our application templates as an example. Handler Docs Config Docs
fusebox.init.cfm is included at the start of each FuseBox request. One way to do that in ColdBox would be to register arequestStartHandler settingin /config/ColdBox.cfc to run before every request. Another way would be to register a preProcess interceptor. Since thefusebox.init.cfm file in this sample app doesn't do anything, I didn't bother creating an equivalent in the ColdBox app.
fusebox.appinit.cfm is included every time the framework reloads. Again, this can be easily duplicated in ColdBox by registering an applicationStartHandler in the config file. There are also several interception points you can listen to as well.
Core Framework
The FuseBox framework is self-contained within the fusebox5folder. The ColdBox framework is in the coldbox folder. The easiest place for the coldbox folder to live is in your web root so CF will automatically resolve CFC paths that start with "coldbox" there. For the security-minded, you can also move the folder elsewhere and create a server or app-specific mapping that points to it. This is especially handy if you have multiple ColdBox site and want to only maintain one copy of the framework.
Bootstrap
ColdBox bootstraps itself up by being the super class to the Application.cfc and leeching off the application and request lifecycle methods within.
component extends='coldbox.system.Coldbox' {
this.name = 'FuseBoxSampleConversion';
this.sessionmanagement = "true";
}
FuseBox on the other hand has a bit of code in the index.cfm file that invokes the framework. It's worth noting the ColdBox app has an index.cfm, but is a blank placeholder just there to satisfy the CF engine.
&lt;cfinclude template="fusebox5/fusebox5.cfm" /&#x26;gt;
The FuseBox app has a CFApplication tag in the index.cfm, but since the ColdBox app uses Application.cfc, that information is stored there. If you ever need to add methods to Application.cfc, make sure you continue to call the super-scoped method as well. If you want to use an app-specific mapping for "/coldbox", you'll need to use our non-inheritance template. Read more about this here.
Settings
The Fusebox app uses a fusebox.xml.cfm file that contains settings for the app. In ColdBox, we have a "/config" convention folder where we place all our configuration. The ColdBox.cfc file contains general configuration for the app. The WireBox.cfc file is optional but we used it to map a special model for Railo that I'll talk about under Models. The only requirements of /config/ColdBox.cfc is that it contains a method called configure() and defines a variable called coldbox.appName. There are a number of optional settings you can define here as well additional methods for environment control that override settings for you automatically on your development or staging servers. You can read about this here.
fusebox.xml.cfm
&lt;?xml version="1.0" encoding="utf-8"?&#x26;gt;
&lt;!DOCTYPE fusebox SYSTEM "fusebox.dtd"&#x26;gt;
&lt;fusebox&#x26;gt;
&lt;circuits&#x26;gt;
&lt;circuit alias="m" path="model" /&#x26;gt;
&lt;circuit alias="v" path="view"/&#x26;gt;
&lt;circuit alias="mail" path="controller"/&#x26;gt;
&lt;/circuits&#x26;gt;
&lt;parameters&#x26;gt;
&lt;parameter name="fuseactionVariable" value="view" /&#x26;gt;
&lt;parameter name="defaultFuseaction" value="mail.home" /&#x26;gt;
&lt;parameter name="precedenceFormOrUrl" value="form"/&#x26;gt;
&lt;parameter name="debug" value="true"/&#x26;gt;
&lt;parameter name="mode" value="development-full-load"/&#x26;gt;
&lt;parameter name="password" value=""/&#x26;gt;
&lt;parameter name="parseWithComments" value="true" /&#x26;gt;
&lt;parameter name="conditionalParse" value="true" /&#x26;gt;
&lt;parameter name="scriptlanguage" value="cfmx" /&#x26;gt;
&lt;parameter name="scriptFileDelimiter" value="cfm"/&#x26;gt;
&lt;parameter name="maskedFileDelimiters" value="htm,cfm,cfml,php,php4,asp,aspx"/&#x26;gt;
&lt;parameter name="characterEncoding" value="utf-8"/&#x26;gt;
&lt;/parameters&#x26;gt;
&lt;globalfuseactions&#x26;gt;
&lt;appinit /&#x26;gt;
&lt;preprocess&#x26;gt;
&lt;do action="m.setup"/&#x26;gt;
&lt;/preprocess&#x26;gt;
&lt;postprocess /&#x26;gt;
&lt;/globalfuseactions&#x26;gt;
&lt;/fusebox&#x26;gt;
/config/ColdBox.cfc
component {
function configure(){
coldbox = {
appName = "getMyMail",
reinitPassword = "",
defaultEvent = "mail.home",
handlersIndexAutoReload = true,
debugMode = true
};
settings = {
attachmentPath = expandPath('/attachments/')
};
}
}
In fusebox.xml.cfm, the &lt;circuits&#x26;gt; defines the main areas of the application: "m" (model), "v" (views), and "mail" (controller). ColdBox handles each of these by convention so there's not need for configuration. The ColdBox models will all go in the "/model" folder, the views in the "/views" folder, and the controllers in the "/handlers" folder.
ThedefaultFuseaction setting is done in ColdBox with the defaultEvent setting. I've created a "mail" handler with a "home" action, so the value is still "mail.home". The debug setting becomes debugMode and pretty much as the same purpose. Additional framework-specific debugging information is appended to the end of every request. Password becomes reinitPassword and is required to reload the application from the URL with ?fwreinit=password(or ?fwreinit=1 if no password is set). On your production servers you'll want to specify a password to use in the URL so only you can reload your site. Mode set todevelopment-full-load is partially covered byhandlersIndexAutoReload which reloads the handlers on each request. The rest of the settings don't apply to ColdBox or don't appear to be used.
The &lt;globalfuseactions&#x26;gt; and &lt;preprocess&#x26;gt; tags specify a fuseaction that is run before each request. This can be done with arequestStartHandler settingin /config/ColdBox.cfc or apreProcessinterceptor. In this app, there is only one handler, so I put that logic in a preHandler method in my mail handler which the framework automatically runs before each action in mail. You'll see I also created a setting for the location of the attachments folder which I'll inject into my model later.
Circuits and Handlers
Fusebox breaks a site up into circuits, and ColdBox breaks it up via handlers. Circuits are divided into fuseactions, and handlers, are divided into actions. Instead of using an XMl file to define this, ColdBox handlers are defined by convention by a CFC in your /handlers directory. The name of the CFC determines the name of the handler. Actions are simply methods in your CFC, and the names of the methods are the names of the actions. ColdBox also allows for very powerful routes to be defined ad hoc by you to make up nice descriptive URLs that don't have to match your file/method names. Read more about that here.
The Fusebox site has circuits called "m" and "v" but ColdBox treats models and views as first-class conventions we'll cover shortly.
/controller/circuit.xml
&lt;?xml version="1.0" encoding="utf-8"?&#x26;gt;
&lt;!DOCTYPE circuit SYSTEM "../circuit.dtd"&#x26;gt;
&lt;!-- Controller Circuit --&#x26;gt;
&lt;circuit access="public"&#x26;gt;
...
&lt;/circuit&#x26;gt;
/handlers/Mail.cfc
component {
property name='sessionStorage' inject='coldbox:plugin:sessionStorage';
property name='mailService' inject='MailService';
...
}
Our circuit definition is an XML file, but our handler is just a CFC. The name of the handler is derived from the file name by default. The properties in the CFC represent other objects that the code in the handler is dependant upon. When WireBox creates the handler, it will inspect it for any properties containing an inject attribute and inject a reference to them in the variables scope (by default) using the name specified in the name attribute. coldbox:plugin:sessionStorage refers to the sessionStorage plugin which is a wrapper for the session scope. If you want to use the session scope directly, there's NOTHING STOPPING YOU! However, there are benefits to abstracting it. Namely, encapsulating external dependencies, being able to change where the storage plugin points easily (client, cookie, etc) and the ability to mock the session scope access in a unit test. MailService by default will load the MailService.cfc file in our /models directory.
/model/circuit.xml
&lt;fuseaction name="setupXfa"&#x26;gt;
&lt;set name="xfa.conform" value="mail.connectform" /&#x26;gt;
&lt;set name="xfa.msglist" value="mail.list" /&#x26;gt;
&lt;set name="xfa.msgdetail" value="mail.showmessage" /&#x26;gt;
&lt;/fuseaction&#x26;gt;
/controller/circuit.xml
&lt;prefuseaction&#x26;gt;
&lt;!-- This could be a &lt;do /&#x26;gt; or an include, but the verbs keep it all right here, easy to see. --&#x26;gt;
&lt;if condition="myFusebox.thisFuseaction IS 'connectform'"&#x26;gt;
&lt;true /&#x26;gt;
&lt;false&#x26;gt;
&lt;if condition="structKeyExists(session,'connectionInfo') AND structCount(session.connectionInfo) GT 0"&#x26;gt;
&lt;false&#x26;gt;
&lt;relocate xfa="conform" /&#x26;gt;
&lt;/false&#x26;gt;
&lt;/if&#x26;gt;
&lt;/false&#x26;gt;
&lt;/if&#x26;gt;
&lt;/prefuseaction&#x26;gt;
/handlers/Mail.cfc
// Runs before every action
function preHandler( event, action, eventArguments ) {
var prc = event.getCollection( private=true );
// Exit event handlers
prc.xeh = {};
prc.xeh.conform = 'mail.connectform';
prc.xeh.conformSave = 'mail.connectformSave';
prc.xeh.msglist = 'mail.list';
prc.xeh.msgdetail = 'mail.showmessage';
// If they're on any action OTHER than the connection form and there isn't cached connection info...
if( arguments.action != 'connectform' &amp;&amp; arguments.action != 'connectformSave'
&amp;&amp; !sessionStorage.exists( 'connectionInfo' ) ) {
// Send them back to the connection form
setnextEvent( prc.xeh.conform );
}
}
Here we're combining both setupXfa fuseaction in the m circuit as well as the &lt;prefusionaction&#x26;gt; tag in the mail circuit into the preHandler method of our mail handler. preHandler is a special method name and will be run by convention before any other action in that handler. Xfa stands for "exit fuseaction" and is basically a list of outgoing paths that the user can navigate away with. Typically, I see this as needless bit of misdirection, but I copied it for old time's sake in a struct called xeh or "exit event handler". The condition statement in the XML file is a clumsy mix of CFML and XML that we replaced in our handler as a concise bit of pure code. Basically, if you're hitting any page other than the connection form and you don't have connection details in your session, redirect back to the session form.
/controller/circuit.xml
&lt;fuseaction name="home"&#x26;gt;
&lt;do action="list" /&#x26;gt;
&lt;/fuseaction&#x26;gt;
/handlers/Mail.cfc
// Default event, just redirects to list.
function home( event, rc, prc ){
setNextEvent( prc.xeh.msglist );
}
Here's the home fuseaction and action. All it does is redirect to the list action. Generally this things falls in my "needless misdirection" category as we might as well have just set the default event to mail.list and been done with it. Nevertheless, I included the equivalent in the ColdBox code.
/controller/circuit.xml
&lt;fuseaction name="connectform"&#x26;gt;
&lt;do action="v.connectform" /&#x26;gt;
&lt;/fuseaction&#x26;gt;
/views/setupForm.cfc
&lt;cfparam name="form.serverName" default="" /&#x26;gt;
&lt;cfparam name="form.serverPort" default="110" /&#x26;gt;
&lt;cfparam name="form.userName" default="" /&#x26;gt;
&lt;cfparam name="form.password" default="" /&#x26;gt;
&lt;cfparam name="form.msgsPerPage" default="30" /&#x26;gt;
&lt;cfif structKeyExists(session,'connectionInfo') AND structCount(session.connectionInfo) GT 0&#x26;gt;
&lt;cfset form.serverName = session.connectionInfo.serverName&#x26;gt;
&lt;cfset form.serverPort = session.connectionInfo.serverPort&#x26;gt;
&lt;cfset form.userName = session.connectionInfo.userName&#x26;gt;
&lt;cfset form.password = session.connectionInfo.password&#x26;gt;
&lt;cfset form.msgsPerPage = session.connectionInfo.msgsPerPage&#x26;gt;
&lt;/cfif&#x26;gt;
/handlers/Mail.cfc
function connectform( event, rc, prc ){
// default values
rc.serverName = '';
rc.serverPort = '110';
rc.userName = '';
rc.password = '';
rc.msgsPerPage = '30';
// Overwrite with stored values if they exist
if( sessionStorage.exists( 'connectionInfo' ) ) {
structAppend( rc, sessionStorage.getVar( 'connectionInfo' ) );
}
}
I didn't agree with the defaulting of variables in the view, so I moved them into the handler since that's where it feels like they belong. The reason why I don't need to set the view in my action is because I have placed by view file in the appropriate place with the correct name to be automatically run by convention. The FuseBox app ran the code to save the form on every request but I chose to create an additional connectFormSave action to do that.
/controller/circuit.xml
&lt;fuseaction name="list"&#x26;gt;
&lt;set name="attributes.start" value="1" overwrite="false" /&#x26;gt;
&lt;set name="attributes.listVarName" value="qMailList" /&#x26;gt;
&lt;do action="m.getListOfEmails" /&#x26;gt;
&lt;do action="v.listmail" /&#x26;gt;
&lt;/fuseaction&#x26;gt;
/handlers/Mail.cfc
function list( event, rc, prc ){
// Param start to 1
event.paramValue( 'start', 1 );
// The view needs this for previous/next links
prc.msgsPerPage = sessionStorage.getVar( 'connectionInfo' ).msgsPerPage;
// Get E-mails
prc.emails = mailService.getAllMessages( rc.start );
}
And here's our list action. You can see the set tag for attributes.start is replaced with event.paramValue(). We don't need to be as explicit about the name of the variable we're passing to the view. We just place the results of our service call into the prc scope (private request collection) and it will automatically be available in the view. Again, our view will be called by convention.
I won't show the remainder of the handler since it's pretty well covered already. You can check out the code in the repo to read the entire file yourself.
But wait, there's more!
We've split this sample app conversion into two halves so you have time to soak each part in. Here's the other half where we cover views, models, and error handling. And of course,you can see all the completed code here on GitHub:https://github.com/bdw429s/FuseBox-5.1-Sample-App-Conversion
Please comment below if you have any questions or suggestions, and as usual, here's our list of handy resources:
Check out our bite-sized PDF reference cards here:http://wiki.coldbox.org/wiki/Dashboard.cfm#PDF_Ref_Cards
Play with the framework right inside your browser with these samples:http://runnable.com/ColdBox
Join our Google Group. We're friendly, active, and love to help with ANY kind of CF question:https://groups.google.com/forum/?hl=en#!forum/coldbox
Check out our video library of webinars and presentations:http://www.coldbox.org/media
Look up answers in our comprehensive docs:http://wiki.coldbox.org/
http://stg.ortussolutions.com/blog/converting-fusebox-51-sample-app-to-coldbox-mvc
Tue, 05 Aug 2014 14:00:00 GMTbrad@ortussolutions.com (Brad Wood)ColdBox Sample Apps Tips &#x26; Tricks Training Walkthroughshttp://stg.ortussolutions.com/blog/converting-fusebox-51-sample-app-to-coldbox-mvcConverting Fusebox 3 Sample App to ColdBox MVCIn ourlast installment, we talked about the benefits of converting legacy FuseBox applications over to ColdBox MVC. In this entry we'll actually convert theFusebox 3 sample appavailable fromfusebox.orgto show you the similiarities and differences between the two frameworks.
The finished ColdBox code is here:https://github.com/bdw429s/Fusebox-3-Sample-App-Conversion/
The original Fusebox code is in the root of the above repo in a zip called "FB3SimpleApp.zip"
Overview
Here's a screenshot of the files in the Fusebox and ColdBox code side-by-side. Both are pretty self-explanatory, so we'll work our way through the contents of each file as we go.
http://stg.ortussolutions.com/blog/converting-fusebox-3-sample-app-to-coldbox-mvc
Mon, 14 Jul 2014 12:00:00 GMTbrad@ortussolutions.com (Brad Wood)ColdBox Sample Apps Tips &#x26; Tricks Tutorials Walkthroughshttp://stg.ortussolutions.com/blog/converting-fusebox-3-sample-app-to-coldbox-mvcConverting Fusebox to ColdBox MVCFuseboxis one of the oldest frameworks for ColdFusion. My first real ColdFusion job was working on a large intranet site built upon Fusebox. The framework has changed hands several times and though it has now gone cold in terms of new development but it is still used by 1 in 3 ColdFusion developers according to theState of the CF Union survey resultsfrom 2014.
Party like it's 1999
There's a lot of legacy code out there still running on FuseBox, but that doesn't mean it has to stay that way. The Internet has moved on to design patterns like MVC and more-object oriented approaches for code reuse and testing. The thought of reworking your old codebase might seem scary, especially if you're not familiar with MVC and you aren't using any OO principles. Don't despair though, it's often timesbetter to make incremental improvements to code instead of trying to throw it outand rewrite it from scratch. The old adage says, how do you eat an elephant? "One bite at a time!"
http://stg.ortussolutions.com/blog/converting-fusebox-to-coldbox-mvc
Thu, 03 Jul 2014 20:35:00 GMTbrad@ortussolutions.com (Brad Wood)ColdBox Sample Apps Tips &#x26; Tricks Tutorials Walkthroughshttp://stg.ortussolutions.com/blog/converting-fusebox-to-coldbox-mvcHow To Create A JIRA Account And Enter ColdBox TicketsAfter using the ColdBox MVC Platform or any of the Box libraries you might think of an enhancement or new feature you'd like to see. Or perhaps you found an issue, and after posting it to ourGoogle Group, we asked you to put in a ticket. Well, today is you day because here is a step by step guide for getting set up in our bug tracker so you can enter tickets, as well as comment, vote, or watch other people's tickets. Out open source libraries are developed out in the open for full transparency and to encourage the public to join in and be part of the exciting process.
AtlassianJIRA
Atlassian has created a number of development workflow tools like BitBucket, SourceTree, and Bamboo. JIRA (pronounced Jeer-ah) is their popular system for bug tracking and does lots of cool stuff with agile plugins. The URL for the Ortus JIRA bug tracker is (We'll wait while you bookmark it):
https://ortussolutions.atlassian.net/browse/COLDBOX/
When you first visit, you'll see something like this. From a non-logged in state you can still view tickets and read comments but you can't create tickets or interact with existing ones. Start by hitting the green "Log In" button in the upper right hand corner of the screen.
Not logged in(click to enlarge)
On the log in form, click the "Create an account" link on the right hand column under the username and password fields. Don't be tempted to use the "Log in using Google" option. That only works if your E-mail address ends in @ortussolutions.com!
http://stg.ortussolutions.com/blog/how-to-create-a-jira-account-and-enter-coldbox-tickets
Fri, 27 Jun 2014 18:45:00 GMTlmajano@ortussolutions.com (Luis Majano)ColdBox Community Tips &#x26; Tricks Tutorials Walkthroughshttp://stg.ortussolutions.com/blog/how-to-create-a-jira-account-and-enter-coldbox-ticketsNew WireBox Ref Card Released&#x200b;We have just released the latest installment in our series of getting started reference cards for all our *Box open source projects. For anyone who's been waiting to jump into the WireBox AOP/DI engine, today is your day. Here is your 6-page, full-color introduction to CFML's most handy and productive dependency injection library. To those of you already using WireBox, this guide only covers the basics but I bet it will still teach you something you didn't know.
WireBox Ref Card
Download it, print it, read it, and sleep with it under your pillow. Also, keep an eye on the horizon for our next ref card coming soon-- CacheBox!
http://stg.ortussolutions.com/blog/new-wirebox-ref-card-released
Wed, 09 Oct 2013 22:16:00 GMTbrad@ortussolutions.com (Brad Wood)ColdBox Ref Card Walkthroughs WireBoxhttp://stg.ortussolutions.com/blog/new-wirebox-ref-card-releasedNew ColdBox LITE Ref Card ReleasedWe are pleased to announce our release of the ColdBox LITERef Card. It is available in PDF form so you can view it in the browser, or download it to any mobile/reader device for later reference. Of course, it's only a few pages long so you can print it out and keep it at your desk.
Download Here!
We have several more Ref Cards planned over the next few months. They aim to be 4-6 page introductions to the family of ColdBox libraries that give you a high-level overview of what that library doesand how to get started using it. We won't cover every feature-- just the basics to get you started. The ColdBox LITERef Card covers what an MVC framework is, how to download and install ColdBox LITE and gets you started creating your first app.
The ref cards are available freely to downloadand are hosted on our official GitHub repo and we encourage you to share them with any coworkers or friends who you think might benefit from an intro to ColdBox LITE. If you have any questions or suggestions, feel free toE-mail us. Also, a special shout-out to Richard McKenna for designing the layout for us.
Keep your eyes open for these additional Ref Cards coming soon:
WireBox Ref Card
WireBox AOPRef Card
CacheBoxRef Card
LogBoxRef Card
MockBoxRef Card
ColdBox ORMRef Card
ContentBoxRef Card
http://stg.ortussolutions.com/blog/new-coldbox-lite-ref-card-released
Tue, 13 Aug 2013 12:57:00 GMTlmajano@ortussolutions.com (Luis Majano)ColdBox Ref Card Tips &#x26; Tricks Walkthroughshttp://stg.ortussolutions.com/blog/new-coldbox-lite-ref-card-releasedUsing Couchbase for Your Hibernate Secondary Cache
In our first two posts, we covered how to install Couchbase server and get a cluster up and running. In this post we are going to put that cluster of yours to use and show you how to configure it as an ORM secondary cache provider for your ColdFusion applications.
If your &#x201c;cluster&#x201d; is still just a single server, don&#x2019;t worry. The size and configuration of a Couchbase cluster is seamlessly invisible to the connecting client. Meaning you can grow and scale your cluster withoutchangingyour setup/connection code.
At this point in time, there is noCouchbase-specific library for a Hibernate secondary cache, but luckilyfor us, Couchbase is compatible with the memcached protocol, so we can use the memcached library. The only drawback is thatif you are connecting on the standard port of 11211 to Couchbase, the library will only be able to connect to the &#x201c;default&#x201d; bucket. To use a named bucket for your ORM Secondary cache, you will need to assign the Couchbase bucket you create toa unique port number with NO password when you create it in Couchbase Administrator application.
To read the full post, pleaseclick here to view it onthe Ortus blog.
http://stg.ortussolutions.com/blog/using-couchbase-for-your-hibernate-secondary-cache
Thu, 08 Aug 2013 07:19:00 GMTbrad@ortussolutions.com (Brad Wood)ColdBox ColdBox Lite ContentBox Couchbase Tips &#x26; Tricks Tutorials Walkthroughshttp://stg.ortussolutions.com/blog/using-couchbase-for-your-hibernate-secondary-cacheNew ColdBox Platform Ref Card ReleasedWe are pleased to announce our release of the ColdBox Platform Ref Card. It is available in PDF form so you can view it in the browser, or download it to any mobile/reader device for later reference. Of course, it's only a few pages long so you can print it out and keep it at your desk.
Download Here!
We have several more Ref Cards planned over the next few months. They aim to be 4-6 page introductions to the family of ColdBox libraries that give you a high-level overview of what that library doesand how to get started using it. We won't cover every feature-- just the basics to get you started. The ColdBox Platform Ref Card covers what an MVC framework is, how to download and install ColdBox and gets you started creating your first app.
The ref cards are available freely to downloadand are hosted on our official GitHub repo and we encourage you to share them with any coworkers or friends who you think might benefit from an intro to ColdBox. If you have any questions or suggestions, feel free to E-mail me. Also, a special shout-out to Richard McKenna for designing the layout for us.
Keep your eyes open for these additional Ref Cards coming soon:
WireBox Ref Card
WireBox AOPRef Card
CacheBoxRef Card
LogBoxRef Card
MockBoxRef Card
ColdBox ORMRef Card
ContentBoxRef Card
http://stg.ortussolutions.com/blog/new-coldbox-platform-ref-card-released
Mon, 22 Jul 2013 21:10:00 GMTbrad@ortussolutions.com (Brad Wood)ColdBox Ref Card Tips &#x26; Tricks Walkthroughshttp://stg.ortussolutions.com/blog/new-coldbox-platform-ref-card-releasedColdBox Developer Week Recordings and WINNERS!Today was the final day of our second annual week of free ColdBox/ContentBox training. We are very pleased with the success of the event and want to thank each of our wonderful speakers as well as all you attendees who showed up and had a great time with us while learning about our platform. This year we had almost 250 people registered from 15 countries around the world including Germany, Brazil, India, Ukraine, and Pakistan.
This year was sponsored by Ortus Solutions, Adobe, and Computer Know How and included brand new content from skinning ContentBox websites, to Nginx web server, and the brand-new ColdBox Koans. Every session was recorded and is available along with the slide decks and sample code on our Official Recording Page. Please watch any sessions you missed or just want to see again and pass the recordings on to anyone who you think will benefit from free training. If you have any feedback on how to make ColdBox Developer Week better next year, please contact me at brad@coldbox.org and share your thoughts.
Lastly, ColdBox and ContentBox are profession open source, so if you ever need custom development or support beyond what our free training provides, please contact Ortus Solutions and we will be happy to work with you in any way that you need.
Now finally, the moment many of you have been waiting for--here are our winners from this week
Weekly Prizes
ColdFusion Builder License:Nathan Stanford
Sublime Text License:Brooks Layton
$50 Amazon Gift Card:Kalyan Vangapalli
$50 Amazon Gift Card:Jim Abas
Daily Prizes
DataBoss Standard (Dynamic ORM Administrator) Licenses
Ken Peterson
John Barnes
George Neisler
Patrick Flynn
Misha Mishyn
Session Prizes
CacheBox eBook:
Rus Russell
Matthew Tracey
Jae Chung
Edward Dolber-Smith
Stephen Schletty
Christopher Keeler
Donald Young
John Farrar
Micah Knox
Nolan Dubeau
Diego Benitez
Francisco Carmona
Andrew Scott
Miguel Ulloa
Don Bellenger
Jade Cady
Benjamin Knox
Henry Ho
Michael Sewell
Brian Miner
http://stg.ortussolutions.com/blog/coldbox-developer-week-recordings-and-winners
Sat, 22 Jun 2013 10:25:00 GMTbrad@ortussolutions.com (Brad Wood)ColdBox ColdBox Developer Week Community Training Tutorials Walkthroughshttp://stg.ortussolutions.com/blog/coldbox-developer-week-recordings-and-winnersHQL Query to Criteria Query Example
I have been using criteria queries in favor of HQL queries quite a bit latley, so I thought I would do a quick post of what a query would look like in HQL and then the same query written as a criteria query.
Some of the reasons I like to use criteria queries are
Readablity
No building up query strings andconcatenatingthem to build a complex query
Powerful Object Oriented API
You can learn more about using criteria queries on our wiki athttp://wiki.coldbox.org/wiki/Extras:CriteriaBuilder.cfm
OK, on to the example.
First, the HQL version of the query
HQL Query
var qs = &#x26;quot;&#x26;quot;;
qs = qs &amp; &#x26;quot;select r from Response as r INNER JOIN Activity as a&#x26;quot;;
qs = qs &amp; &#x26;quot; where r.id=:id and a.uid=:uid&#x26;quot;;
qs = qs &amp; &#x26;quot; order by a.pagenum asc&#x26;quot;;
var params = {id=rc.id,uid=userID};
var results = RService.executeQuery(query=qs,params=params,offset=0,max=25,asQuery=false);
qs = &#x26;quot;count(r.id) from Response as r INNER JOIN Activity as a&#x26;quot;;
qs = qs &amp; &#x26;quot; where r.id=:id and a.uid=:uid&#x26;quot;;
var count = RService.executeQuery(query=qs,params=params);
So, you can see, there is a lot of concatenating strings, and then we need another version of the query to get the count, so now lets look at how we can do that same thing with a criteria query
Criteria Query
var c = RService.newCriteria();
c.eq(&#39;id&#39;,rc.id)
.createAlias(&#39;Activity&#39;,&#39;a&#39;)
.and(c.restrictions.eq(&#39;a.uid&#39;,userID))
.order(&#39;a.activity&#39;,&#39;asc&#39;);
var count = c.count();
var results = c.list(max=25,offset=0);
What is nice about this is, not only is it more concise, it will make only one trip to the database to return both the count and the list. I encourage you to go tohttp://wiki.coldbox.org/wiki/Extras:CriteriaBuilder.cfmand check out what you can do with criteria queries and how you can incorporate them into your ORM enabled applications to make finding entities even easier.
http://stg.ortussolutions.com/blog/hql-query-to-criteria-query-example
Wed, 08 Feb 2012 19:41:00 GMTgratzc@compknowhow.com (Curt Gratz)Alliance ColdBox Community Tips &#x26; Tricks Tutorials Walkthroughshttp://stg.ortussolutions.com/blog/hql-query-to-criteria-query-exampleColdBox FileBrowser videoA nice short video of how to start with the ColdBox FileBrowser module:
&#xa0;
&#xa0;
&#xa0;http://stg.ortussolutions.com/blog/coldbox-filebrowser-video
Tue, 31 Jan 2012 01:51:09 GMTlmajano@ortussolutions.com (Luis Majano)CodeDepot ColdBox Walkthroughshttp://stg.ortussolutions.com/blog/coldbox-filebrowser-videoColdBox Connection: RC What??Here is the presentation in PDF format and also the source code from the ColdBox Connection yesterday on RC What? The basics differences between the Request Context and Request Collection as well as uses of the request context decorator.
Download Presentation
Download Source Code
http://stg.ortussolutions.com/blog/coldbox-connection-rc-what
Fri, 14 Oct 2011 20:30:20 GMTgratzc@compknowhow.com (Curt Gratz)Alliance ColdBox ColdBox Connection Community Training Tutorials Walkthroughshttp://stg.ortussolutions.com/blog/coldbox-connection-rc-what