Entries for month: January 2011
To catch a shooting entityDelete()
Posted by Ryan Heldt in ColdFusion on January 30, 2011
I’ve been using ColdFusion 9’s ORM features on a couple projects recently. That coupled with Sean Corfield’s excellent FW/1 framework has made short work of a lot of time-consuming tasks. Anyway, I’ve ran into a little bit of a snag around referential integrity.
If I use entityDelete() function to delete a record and there’s a constraint violation (in this case, a song category that’s associated with a song), I get the following error:
coldfusion.orm.hibernate.HibernateSessionException: Cannot delete or update a parent row: a foreign key constraint fails (`databasename`.`songs`, CONSTRAINT `songs_ibfk_3` FOREIGN KEY (`SongCategoryID`) REFERENCES `songcategories` (`SongCategoryID`)). (Database)
That’s obviously to be expected. Constraints are put in place to prevent such things. However, for whatever reason I can’t trap this error using try/catch.
<cfscript>
transaction action="begin" {
try {
entityDelete(local.objSongCategory);
} catch (Any e) {
transaction action="rollback";
}
}
</cfscript>
I can't think of any reason why this cannot be caught. Anyone have any thoughts?
CFEclipse: Highlighting Occurrences
Posted by Ryan Heldt in ColdFusion , Tools on January 21, 2011
I always liked the occurrence highlighting featured in a number of text editors, including Notepad++. Double-click on a word somewhere and the editor highlights other places in the same file where that word appears. Needless to say, I was pleasantly surprised to find this was something CFElipse has offered for some time and it's been under my nose the whole time.
On the toolbar is a non-descript 'forward arrow' looking button. Click it and occurrence highlighting is on. Alternatively, you can use ALT+SHIFT+O to toggle.

I didn't care for the default gray highlight color -- wanted something that stands out a bit more. After a bit more poking around, I found this could be changed in the Eclipse Preferences window under General > Editors > Text Editors > Annotations. In the annotation types list, you'll find a 'CFEclipse Mark Occurrence' option. Change the display options to your liking.

Awesome Free Mock-up Software
Posted by Ryan Heldt in Tools on January 11, 2011
During the software development process, I've found most clients have a hard time visualizing what you're planning on building them -- even with extremely detailed specifications. In the past, I've used slick product called Balsamiq for building mock-ups of the user interface and business processes. Including these visual aids along with the specs made things a lot clearer for the client as to what they were getting. If something wasn't quite how they wanted it, everything could be quickly modified, long before a line of code was written. The amount of time saved on one project alone could easily justify it's $80 price tag.
As luck would have it, I've run across something even better. Evolus has a similar prototyping tool called Pencil which has the fast majority of the features Balsamiq offers, and then some. Among these are the ability to have more than one mock-up per document (I remember having a whole folder of mock-ups per project when I used Balsamiq). Pencil also offers native interface widgets, in addition to the sketchy style. While Balsamiq offers sketchy only, they do have a lot more widgets.
Pencil is built on the Mozilla Framework, and although I prefer the standalone version, it's also available as a Firefox plug-in. Best part is its price tag: free! Licensed under the GPL (version 2), it's available under Windows and several flavors of Linux. Sounds like a Mac version is also in the works. Overall, I love the software and look forward to using it more.
