Developers Corner

A small nook for storing and sharing ideas and solutions

Developers Corner

Multiple Queries of one Query or Query of Query using cfscript

March 20, 2014 · By Bill Rae · Add Comment

I was recently working with a query that was returned from a function  in a component. I wanted to do a query of query but working in Framework 1 where the controllers are in cfscript I thought it would be easier to create the query of query in cfscript.

So after some searching online I found these two good articles. One by Ben Nadel


and the other by Chris Terney

Query of Query In CFScript

Both are good articles and provide similar solutions about how to do one query of query. In my situation I wanted to get one query and then do multiple queries of the query that was returned to create drop down menus for a form.

So I took a look at both of their examples and came up with the following.

        rc.qKBoxData     = application.model.kbox.getKBoxData();

        local.getCategory    = new query();
        objQry                = local.getCategory.execute(sql="SELECT DISTINCT categoryID ID, categoryName name FROM sourceQuery ORDER BY categoryName");
        rc.qCategory         = objQry.getResult();

        local.getAssignee    = new query();
        objQry                = local.getAssignee.execute(sql="SELECT DISTINCT owner FROM sourceQuery ORDER BY owner");
        rc.qAssignee         = objQry.getResult();

Then I got to thinking. I'm creating my query parameters why repeat this process over an over when I can just reuse the parameters and just create the query object and get the results. So I changed it to this:

        rc.qKBoxData     = application.model.kbox.getKBoxData();

        local.getStuff        = new query();

        objCategory            = local.getStuff.execute(sql="SELECT DISTINCT categoryID ID, categoryName name FROM sourceQuery ORDER BY categoryName");
        rc.qCategory         = objCategory.getResult();

        objAssignee            = local.getStuff.execute(sql="SELECT DISTINCT owner FROM sourceQuery ORDER BY owner");
        rc.qAssignee         = objAssignee.getResult();

And it works. It seems pretty straight forward and as I don't like repeating steps this made me happy with the result.

I just thought I would share that. If anyone tries this or has any issues with this leave a comment.

No Comments Add   Tags: CFScript · ColdFusion · Query of Query

Migration from Bootstrap 2.x to Bootstrap 3.x - Forms and form fields

September 24, 2013 · By Bill Rae · Add Comment

I migrated my first site from Bootstrap 2.x to the latest version of Bootstrap this week. Bootstrap 3.x is offering a mobile first framework which means that it is responsive out of the box and if you want to make it un-responsive there are some adjustments that will need to be made. I'm all for responsive so I am happy with that.

My focus in this post is about forms and form fields which is where most of my effort was expended during the migration of this site.

[

No Comments Add   Tags: Bootstrap · Bootstrap 2.x · Bootstrap 3.x · FORMS · HTML

Getting FW/1 to play nicely with javascript and jQuery good practice

July 23, 2013 · By Bill Rae · 2 Comments

I have been struggling with jQuery being at the bottom of the page. Not because it isn’t good practice, but just the way the pages are put together by FW/1 when page requests are made. Initially, I had the javascript in the header until GTMetrix pointed out that it was best practice to load the javascript files after the html/page had loaded in the browser. Having JavaScript load after the body tag in FW/1 is not a big deal when using standard jQuery-latest.js, bootstrap.js etc files. However when you have the body tag being displayed before the jQuery file and then you need to include some custom jQuery/javascript for form validation etc you have a small problem. So my first response

[

2 Comments  Tags: ColdFusion · FW/1 · HTML · JavaScript · jQuery

HTML Form: radio and checkbox defaults

July 19, 2013 · By Bill Rae · Add Comment

Yesterday, I received an email from SitePoint which linked to one of their posts about radios and checkboxes which made me think. Despite being over two decades since the first browser was created, forms haven't changed much. In fact, they haven't really changed at all with the exception that today users are more willing to fill them in.

The specific problem being discussed in this post was how to pass a default value for a checkbox or radio when the checkbox or radio is not checked.

[

No Comments Add   Tags: ColdFusion · FORMS · HTML · jQuery

Shutting down Windows 8 on a PC

July 10, 2013 · By Bill Rae · Add Comment

After a recent installation and migration to Microsoft Windows 8 for a customer he came back with a very simple question...

"How do I shut down my computer? It used to be so easy and intuitive."

Of course, he was right. Not only that, it really isn't as simple as it once was.

[

No Comments Add   Tags: Microsoft · Windows · Windows 8

iPhone Email Account Setup - a pointless exercise

March 16, 2013 · By Bill Rae · Add Comment

First of all, I must admit that I do not have an iPhone and to be honest, I don't really want one. They look nice and the people using them seem smug and happy. I have a large number of clients that have iPhones, iPads and iTouch devices. For simplicity let's call these consumer electronic goods "iDevices". I don't hear from them very often regarding their iDevice except when they are setting up their  iDevice to connect to their email account.  Since our email service is not gmail, hotmail, mac or some other mainstream email service which can be automatically setup on the iDevice they often get frustrated when their attempts to add an email account fail. That's usually the point where I have to help each and every one of them setup their iDevice email.

I hear you asking, "What could the problem be? Surely the supreme iPhone cannot fail..."  Well, it's simple

[

No Comments Add   Tags: Apple · iPhone

Why I Left Everything Everywhere formerly known as Orange

March 16, 2013 · By Bill Rae · 2 Comments

For the past 15 plus years I have been an Orange (now Everything Everywhere) customer. For the most part Orange mobile phone services have been good - I had good coverage almost everywhere I go in the UK and in the last few years I have rarely been disconnected from a call. Customer service, when you can actually find your way  through the tone activated menu obstacles to speak to a real person, is very well organised and friendly. It always helps when their system isn't down but my expectations are not high when it comes to Orange and their systems.

My frustration with Orange started with their online customer service area for mobile customers many years ago. As a web application developer I like to create sites that work,

[

2 Comments  Tags: General · Mobile Phone Companies