Speaking at cfCamp

Pleased to say I’ll be speaking on CFWheels 2.x and the new CLI at CFCamp, 20-21 October 2016. Would be great to catch up with people – do come and say hello (and indeed, come to my session!)

Session Details:

CFWheels 2.x and the new CLI

CFWheels is an open source CFML framework inspired by Ruby on Rails that provides fast application development, a great organisation system for your code, and is just plain fun to use. One of our biggest goals is for you to be able to get up and running with CFWheels quickly.

We want for you to be able to learn it as rapidly as it is to write applications with it. CFWheels has a long history, with the first commit over 10 years ago. Over 3000 commits later, this talk will take a look at what’s new in CFWheels 2.x, which brings huge leaps forward with tonnes of new features integrated into the core.

Along with 2.x comes the new CLI commands for CommandBox, which allow real “rails-style” scaffolding, complete with database migrations, controller, model and view templating, ability to run test suites from the command line, and much, much more.

Even if you’re not familiar with CFWheels, this talk will aim to give you enough to get going on your first app at breakneck speed!

Using Oracle 12c in Lucee – ORA-28040: No matching authentication protocol

Disclaimer: I don’t use Oracle, ever, and this was just to get a local testing environment setup.

I’d installed Oracle 12c, and when trying to add a datasource in the Lucee admin, kept on getting “ORA-28040: No matching authentication protocol”.

According to StackOverflow there’s a bug, where’s the simple fix is to add the line:

SQLNET.ALLOWED_LOGON_VERSION=8

To

C:\app\Oracle\product\12.1.0\dbhome_1\NETWORK\ADMIN\sqlnet.ora

CFWheels CLI for Commandbox (Alpha Test)

Ok.. so this is what I’m working on at the moment. Work in progress! It’s the beginning of a port of the Rails CLI, but for CFWheels using Commandbox.

Adding Markdown to CFWheels

I needed to do this the other day, so thought I might as well document quite how easy it is! The following was done on Lucee, so if you use ACF your mileage may vary. This uses MarkdownJ, a Java port of Markdown written by Pete Bevin.

Download markdownj.jar (I’ve included a copy here, as it can be a little tricky to track down these days). The attached is zipped, so unzip into your miscellaneous folder, so you have markdownj.jar in there.

In /config/app.cfm, add a mapping to your miscellaneous folder so we can load .jar files easily.

this.javaSettings = {
LoadPaths = ["/miscellaneous"]
};

In /events/onapplicationstart.cfm, add the createObject call:

application.m = CreateObject( "java", "com.petebevin.markdown.MarkdownProcessor" ).init();

Now, after an application restart, you can just do application.m.markdown(myContent) to parse.

Testing for cfheader in cfwheels

In the process of trying to write a plugin for cfwheels, I can across the issue of trying to test to see if “cfheader” had been set.

So, if you had:

<cfheader name="foo" value="foo">

How do you test for this in rocketunit? Specifically, I had a function, setCustomHeader() which literally calls wheels’s internal $header() function (which in turn sets cfheader);

Turns out there’s a solution by looking directly at the page context:

// Set a custom header and check it's in the response
function Test_Set_Custom_Header_Foo(){
  setCustomHeader(name="foo", value="bar");
  loc.headers=getPageContext().getResponse().getHeaderNames();
  loc.headerValue=getPageContext().getResponse().getHeader('foo');
  assert("loc.headers.toString() CONTAINS 'foo'");
  assert("loc.headerValue EQ 'bar'");
}

In this example, using getReponse().getHeader() returns a java.util.hashSet, where we can just convert to a string and look for the value we’ve set. Nifty!