Category: CFML

May 30 2013

Implementing ETag with Railo ReST Web Services

Posted by AJ Mercer at 1:07 PM - Categories: CFML | Railo

Apr 9 2013

CFML unit test runner for AngularJS

I am working my way through the AngularJS tutorials again, this time paying more attention to the testing side of AngularJS.

In the test suites, there is a runner for End 2 End testing, but not the unit test. To run those the tutorial links off to how to install node.js and Karma (formally testacular). This is extremely cool for the Continuous Intergration side of things, but I am not quite there yet.

So I have created myself a unit test runner with CFML. I am only up to step 5, so may add more to this as I work my way through the rest of the tutorial. You will need to download Jasmine. Drop this code in test/unit/runner.cfm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>Jasmine Spec Unit Runner</title>

  <link rel="shortcut icon" type="image/png" href="/jasmine/images/jasmine_favicon.png">
  <link rel="stylesheet" type="text/css" href="/jasmine/lib/jasmine-1.3.1/jasmine.css">
  <script type="text/javascript" src="/jasmine/lib/jasmine-1.3.1/jasmine.js"></script>
  <script type="text/javascript" src="/jasmine/lib/jasmine-1.3.1/jasmine-html.js"></script>

  <!-- AngularJS files -->
  <script src="/lib/angular-1.0.5/angular.js" ></script>
  <script src="/lib/angular-1.0.5/angular-mocks.js" ></script>

  <!-- include source files here... -->
  <cfdirectory directory="../../app/js/" action="list" filter="*.js" name="qryJS" >
  <cfoutput query="qryJS">
  <script type="text/javascript" src="../../app/js/#qryJS.name#"></script>
  </cfoutput>

  <!-- include spec files here... -->
  <cfdirectory directory="." action="list" filter="*.js" name="qrySpecs" >
  <cfoutput query="qrySpecs">
  <script type="text/javascript" src="#qrySpecs.name#"></script>
  </cfoutput>

  <script type="text/javascript">
    (function() {
      var jasmineEnv = jasmine.getEnv();
      jasmineEnv.updateInterval = 1000;

      var htmlReporter = new jasmine.HtmlReporter();

      jasmineEnv.addReporter(htmlReporter);

      jasmineEnv.specFilter = function(spec) {
        return htmlReporter.specFilter(spec);
      };

      var currentWindowOnload = window.onload;

      window.onload = function() {
        if (currentWindowOnload) {
          currentWindowOnload();
        }
        execJasmine();
      };

      function execJasmine() {
        jasmineEnv.execute();
      }

    })();
  </script>

</head>

<body>
</body>
</html>
 

Posted by AJ Mercer at 3:02 PM - Categories: AngularJS | CFML | ColdFusion | Railo

Feb 10 2013

Perth CFML Web Developers

I have started a group on 'Group Spaces' : Perth CFML Web Developers

Join fellow CFML (Adobe ColdFusion, Railo & openBD) developers to share ideas about building modern day web applications and development best practices.

I was going to put it on meetup.com, but that is a paid services now. Google has not from the group on Group Spaces :-( Maybe I should bite the bullet and create a facebook group??

Posted by AJ Mercer at 7:23 AM - Categories: CFML | ColdFusion | Railo

Jan 24 2012

Railo running JAVA version of less.js

At Work, we are giving one of our sites a make over which was done by an external company. They have delivered some working HTML, but very quickly that I discovered that I am going to have to tweak the CSS - lots of hard coded height and widths for mega menu; not so good for a CMS.

After a bit of a look around it seems to me that it was generated with less.js. So I have asked if they could provide me with the less files.

While waiting for that I did a bit of Googling and found that Railo can run a JAVA version of less.js. A bit of downloading some JARS and cut and paste coding I had it working - first time!

Next I tweaked it a bit forther to create something that would output CSS content with something like:

<link rel='stylesheet' href='/less/index.cfm?src=/css/global-styles.less' />

Code:

<cfsetting enablecfoutputonly="true">
<cfparam name="URL.src" type="string">
<cfset variables.javajs = createObject("java","org.mozilla.javascript.tools.shell.Main",
"/labs/less-js/cfelements/jars/js.jar")>
<cfset variables.javaless = createObject("java","com.asual.lesscss.LessEngine",
"/labs/less-js/cfelements/jars/lesscss-engine-1.1.4.jar")>
<cfcontent type="text/css" reset="true">
<cfoutput>#variables.javaless.compile(fileRead(URL.src))#</cfoutput>
<cfsetting enablecfoutputonly="false">

Thanks to Cfelement, Nathan Strutz and Asual - Oh, and those wonderful folks over at Railo ;-)

Posted by AJ Mercer at 3:14 PM - Categories: CFML | Railo

Jan 5 2012

CFML Study Group - Perth AU

At the start of last year, Chris Bauer and I got together to take a look at the CFWheels framework in what we refered to as a 'study group'. We are going to kick this off again in the new year.

We have also been discussing running CFML classes. The recently released Railo 3 Beginners Guide book would make an excellent text book. I am sure I could get a good price for bulk order.

So if you would like to learn the ColdFusion Markup Language, or would like to extend your skills, please leave a comment.

 

Posted by AJ Mercer at 2:16 PM - Categories: CFML | Railo

Dec 20 2011

Railo 3 Beginner’s Guide

Posted by AJ Mercer at 8:52 AM - Categories: CFML | Railo

Sep 26 2011

CFML Image Place holder Custom Tag

Posted by AJ Mercer at 3:09 PM - Categories: CFML | ColdFusion | Railo