So you want to install ModelGlue:Unity

ModelGlue:Unity is a ColdFusion framework that comes with a lot of of functionality and power right out of the box. In this tutorial, we will download all of the files needed to install ModelGlue:Unity, set up the framework and test our configuration.

ModelGlue:Unity requires the ModelGlue framework as well as the ColdSpring framework. We begin by downloading each part then placing them under our webroot.

You can find the latest builds in zip file format at of ModelGlue:Unity at http://svn.model-glue.com/trunk/modelgluebuilds. Select the most recent build and save it in a folder.

Update: Make sure the version of the ModelGlue:Unity framework is at LEAST version 284.

You will run into errors if you use an earlier version of the ModelGlue:Unity framework.

You can find version 284 here. A complete list of builds is here. Note the builds are sorted alphabetically so if you want the most recent, pay attention to the LAST decimal number. I.E. modelglue_2.0.284.zip is a later version then modelglue_2.0.52.zip even though it appears above in the list.

Next, download Coldspring 1.0 into the same directory.

Update: These instructions assume you will have both frameworks in webroot.

Placing frameworks in webroot is standard and preferred practice. If for some reason you MUST place the frameworks in a directory apart from webroot, you will need ColdFusion mappings for ModelGlue and for ColdSpring. There are few good reasons to install the frameworks in a directory other than webroot. If you have a good reason to do this, then you know who you are and what to do about it.

Now, unzip the contents of modelglue_2.0.xxx.zip underneath your webroot. When complete, you should have 4 directories direct children of your webroot.

  1. documentation
  2. modelglue
  3. modelglueapplicationtemplate
  4. modelgluesamples

Next, unzip the contents of the coldspring.zip file underneath your webroot. When complete you should have a directory called ColdSpring as a direct child of your webroot.

Verify the directories were created properly then run http://localhost/modelglueapplicationtemplate

If everything has been installed correctly, you will see:

Model-Glue 2.0: Unity

Model-Glue is up and running! Now Rejoice and tune in to the next tutorial.

Script Tags and how not to use them

The script tag should not be used in short-tag form. I found this out while playing with JQuery.

JQuery has underwent a lot of changes to the API as of late. Lots of useful functionality,a much simpler API, Guaranteed to be 100 times more fun than your favorite javascript / ajax library or your money back. <cf_salespitch /> While adding some functionality and refactoring, I hit a snag. All of a sudden my JQuery code stopped working. I figured I'd called something incorrectly and went poking around in the docs.

Finding nothing amiss, I started placing alerts all through my code looking for some sign of life in my Javascript.

Nothing.

Eventually I got everything happy again. It turns out I was using the script tag incorrectly. The script tag should be only used in the long form. If the short form is used, it can cause other scripts on the page to fail.

Example 1

This is an example of the short form of the script tag. The code will not alert.

view plain print about
1<script type="text/javascript" src="js/jquery-1.1.js" />
2 <script>
3 alert( 'hi' );
4 </script>

Example 2

This is an example of the long form of the script tag. This code will alert.

view plain print about
1<script type="text/javascript" src="js/jquery-1.1.js"></script>
2<script>
3 alert( 'hi' );
4</script>

I am sure I've run across this before but I didn't think of it first off. Seems since the body of the tag is empty, it shouldn't matter which form of the script tag is used. Curious, I tried a few more tests:

Example 3

This code will alert: (Note the use of the short form in the first script tag. The second tag is in long form.

view plain print about
1<script type="text/javascript" src="js/jquery-1.1.js" />
2<script type="text/javascript" src="js/tablesort.js"></script>
3<script>
4 alert( 'hi' );
5</script>

Disclaimer: I tested this code on Firefox 1.5 and IE 6.

AOP in the database

A good friend of mine is an excellent Oracle Trainer / Consultant. I noticed an article on his blog about rewriting queries on the fly. Quite interesting stuff. Similar to method interception in Aspect Oriented Programming, a query can be substituted over another in real time.

Like it or not, there are millions upon millions of lines of software code where values and rules are hardcoded. Using DBMS_ADVANCED_REWRITE isn't for the feint of heart. If a system had embedded or hard coded rules and needed to change over to a new set of rules, this technique could help ensure compliance and speed up the development time.

Should a system be built around this method? Certainly not, but if a legacy system needs to be updated quickly and accurately, this technique is gold in the right hands.

Steve Karam explains: Trick 2 Rewrite a Query At Runtime

5151 Views Print Print Comments (2) Wow

Field is a reserved word in cfqueryparam

A workflow application I recently worked on tracks workflow between two groups, a legal group and a group working in the field. I aptly named the groups "legal" and "field".

This turned out to cause problems when using cfqueryparam. The column was a varchar column so I would imagine the text 'FIELD' would be just another string of text

Instead:

view plain print about
1Macromedia][SQLServer JDBC Driver]Unsupported data conversion.
2
3SELECT TOP 1 TimeCardID, ObjectID, UserID,
4UserType, DateTimeIn, DateTimeOut, DateCreated FROM
5TimeCard WHERE ObjectID = (param 1) AND UserType =
6(param 2) ORDER BY DateCreated
7
8
9(param 1) = [type='IN', class='java.lang.String',
10value='72FAE9F0-16D4-3001-353F84B2E749664D', sqltype='cf_sql_varchar']
11, (param 2) = [type='IN', class='java.lang.String', value='FIELD',
12sqltype='cf_sql_varchar']

I had no problem using the value 'FIELD' in the same column without cfqueryparam. It would seem something inside cfqueryparam must gets unhappy with the text string 'FIELD'

view plain print about
1SELECT TOP 1 TimeCardID, ObjectID, UserID,
2UserType, DateTimeIn, DateTimeOut, DateCreated FROM
3TimeCard WHERE ObjectID = (param 1) AND UserType =
4'FIELD' ORDER BY DateCreated
5
6
7(param 1) = [type='IN', class='java.lang.String',
8value='72FAE9F0-16D4-3001-353F84B2E749664D', sqltype='cf_sql_varchar']

Note: The word 'field' doesn't appear in the MSSQL Reserved word list nor in the SQL Reserved words checker by the illustrious Pete Freitag. Thusly, I believe this is specific to cfqueryparam only.

Flex Mouse Events, Effects and functions

While adding some effects to a flex application, I noticed some strange behaviour. All of a sudden I noticed a function I had set to fire on the click event of a button was no longer firing.

I originally thought the effect intercepted the call in some way, but it turns out I had the effect set to fire on the mouseDownEffect. Changing the effect to fire on the mouseUpEffect brought the function back in to play.

A mouseDownEffect apparently changes the button before the click event fires. Hope this helps someone.

This is bad

view plain print about
1<mx:WipeLeft id="aWipeEffect" duration="1000" />
2<mx:Button label="Change More Text" click="changeText();" mouseDownEffect="aWipeEffect" />

This is good

view plain print about
1<mx:WipeLeft id="aWipeEffect" duration="1000" />
2<mx:Button label="Change More Text" click="changeText();" mouseUpEffect="aWipeEffect" />

4825 Views Print Print Comments (0) Flex

Flex Builder and CFMX RDS

Just a public service announcement for those using Flex Builder. Flex Builder really enjoyes defaulting to port 8500 at all possible turns. I was playing with the RDS extentions and couldn't get the server to connect. RDS was ( in fact ) enabled in the CFadmin. I changed the RDS password a few times and still had no connection. Turns out the default connection was to our friend port 8500. I found the configuration information in the helpful Flex Builder docs. The RDS configuration was tucked away in window/preferences. When creating a Flex project the docs say:

view plain print about
1To configure any ColdFusion servers that you want to connect to using RDS:
2In Flex Builder or Eclipse, select Window - Preferences - RDS Configuration.
3To configure the default localhost server, select localhost and specify the following:
4Description
5Host name (127.0.0.1)
6Port number (8500 if you are using the built-in web server)
7Context root, if necessary

Once the port was switched to port 80, I was in business. I want to do a full evaluation of the wizards available in Flex Builder. Dean Harmon has published three Adobe Connect sessions on Flex / CF wizards. I am going to give them a go and post my experiences later on this weekend.

Why I love Flex

Over the last 10 or so years, web based applications have used HTML. HTML describes the look and feel of the application to the web browser, a piece of software on your local computer. The web browser then interprets the description into a usable ( you hope ) application capable of interacting with users.

This process has worked extremely well, mostly for lack of viable alternatives.

[More]

AjaxCFC + JQuery

Rob Gonda has incorporated one of the top ajax libraries in AjaxCFC. For developers who appreciate the concise power of JQuery this is a big plus. If you haven't had a look at JQuery yet, this site is a great place to start.

I personally don't hate writing javascript, I just don't like the signal to noise ratio. It seems like I write many lines of code for a simple bit of functionality. The fine folks at JQuery have a tremendous amount of functionality in their library and in just a few lines, you can add some nice flair to your web applications.

So, a big thanks to Rob Gonda for pushing out the newest (alpha) release of AjaxCFC. We appreciate your efforts

Step 3: Client work takes over

Rather than work on my personal application this week, i've been thinking. I feel like I don't have any blocks of time to work on my side project. You know, the one i've been blogging about. Most all my time is on my current work assignments. I am wrapping up a phase of a project and have all the final wiring to complete. Rather than post on what I did ( or in this case, didn't do ) i'll just post a collection of thoughts on personal productivity. I reserve the right to change and refine these thoughts later.

[More]

Go Microsoft

I am not a fan of advertising. In fact, I hate it. So it gives me great pleasure to denounce the worst advertising of the week.

[More]