Opening a url in the default browser with Ant

posted by Chris on Jan 04, 2012 at 18:15

Been playing with Ant, Jenkins and MXUnit recently and when I run the build in eclipse i thought it would be nice if it could open up the test results for me.

cfparam broken in cfscript

posted by Chris on Sep 06, 2011 at 10:49

I just ran into an issue with <cfparam>or at least the implementation of it inside a <cfscript> block.

To ensure a variable is defined using the <cfparam> tag you wold do

<cfparam name="url.id" />

If you hit this page without providing an id on the url you would get an error from ColdFusion, eg.

The required parameter URL.ID was not provided

However in cfscript there are two ways to write this

<cfscript>
param url.id;
// or 
param name="url.id";
</cfscript>

The first behaves exactly the same as its tag counter-part, but the second fails to throw an error if the variable is undefined.

I can't find any docs for cfparam in cfscript on adobe.com, but the second syntax is supported by ColdFusion builder, in fact it auto-suggests the name attribute when you type in param. So both should be supported, which means this is a bug.

I've posted a bug report here

I completely forgot my anniversary

posted by Chris on Aug 05, 2011 at 11:45

Luckily it wasn't my wedding anniversary! My 35th birthday marked the 10 year anniversary of me quiting smoking. My lungs should now have returned to their pre-smoking capacity.

When is an array not an array

posted by Chris on May 11, 2011 at 14:00

Coldfusion 9.0.1 added for-in looping over arrays, which is great, it's much simpler and a lot less verbose than having to iterate over with an index.  

<cfscript>
for(item in myarray) {
  doSomething(item);
}
</cfscript>

Listing Coldfusion ORM entities programatically

posted by Chris on Apr 11, 2011 at 12:20

When you write an application It's a fair to assume you know what entities your dealing with, after all you've either written them yourself or your coding to extend an existing application. Recently though i've been mentally tossing about an idea for a library that can automatically create some services for your orm entites, with the idea that you can just drop it into an orm enbaled ColdFusion application and it will create them for you with a minimum of configuration.

Scanning barcodes from your mobile web apps

posted by Chris on Mar 22, 2011 at 17:00

Barcodes have been around for a very long time, but their still pretty cool.  Especially if you have a smarthpone with a camera that can read them. Products like RedLaser allow you to do all kinds of interesting stuff with barcodes like compare prices or find a nearby store with the product in stock

ModelGlue FireBug Panel

posted by Chris on Feb 02, 2011 at 14:30

The admin for this blog is written using Ext, which i love, but it doesn't play well with the standard debug output from a ModelGlue application which is a html table appended to the end of your template. I wanted to find a way to seperate the debug output from the page layout and as i do most of my development using Firefox (because i can't do anything without Firebug) i thought a Firefox plugin would be a good option and while researching how to build one i found that Firebug had its own plugin api that allows you to add new tabs to the Firebug interface.

Testing for Equality in ColdFusion

posted by Chris on Dec 15, 2010 at 22:45

I had a long chat with Bob Silverberg last night about how to test for equality between objects in ColdFusion and just noticed that Ben Nadel mentioned a very similar issue in his post on creating proxy components where he wanted to test for object reference equality, ie two variables pointing to the same object in memory. So i thought i'd write up what we discovered. The problem I was discussing with Bob was how to test if the value of two objects was the same, the objects would typically be a ColdFusion Component of which we would have no knowledge of the properties or methods.

Splitting a string every nth character with regex

posted by Chris on Nov 30, 2010 at 22:00

For a project I'm working on I needed to split a string into an array after a given number of characters, with the last item in the array containing any remainder. Theres lots of ways to handle this, you could for example use a while() loop and the mid() function to extract the chunks you need from the string. However, there is a much easier way: regular expressions and reMatch()

Disabling secureJson prefix at runtime

posted by Chris on Nov 18, 2010 at 12:30

If you've ever used the really useful service HackMyCF by Foundeo you may have been told that you need to turn on the secure JSON Prefix in your ColdFusion administrator. An explanation of the issue can be found on Pete Freitag's blog. But as Pete points out there is an issue with this; that the JSON prefix will also be appended to the value returned from the serializeJson() function and theres no argument to alter this behaviour.