<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
<channel>
<title>n42 Designs</title>
<link>http://www.n42designs.com/blog/index.cfm</link>
<description>n42 Designs Blog</description>
<language>en-us</language>
<pubDate>Sun, 05 Sep 2010 05:01:37 -0400</pubDate>
<lastBuildDate>Mon, 30 Nov 2009 13:01:00 -0400</lastBuildDate>
<generator>BlogCFC</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<managingEditor>sean@n42designs.com</managingEditor>
<webMaster>sean@n42designs.com</webMaster>
<itunes:subtitle></itunes:subtitle>
<itunes:summary></itunes:summary>
<itunes:category text="Technology" />
<itunes:category text="Technology">
<itunes:category text="Podcasting" />
</itunes:category>
<itunes:category text="Technology">
<itunes:category text="Tech News" />
</itunes:category>
<itunes:keywords></itunes:keywords>
<itunes:author></itunes:author>
<itunes:owner>
<itunes:email>sean@n42designs.com</itunes:email>
<itunes:name></itunes:name>
</itunes:owner>
<itunes:image href="" />
<image>
<url></url>
<title>n42 Designs</title>
<link>http://www.n42designs.com/blog/index.cfm</link>
</image>
<itunes:explicit>no</itunes:explicit>
<item>
<title>SVN, Apache, and mod_caucho, oh my</title>
<link>http://www.n42designs.com/blog/index.cfm/2009/11/30/SVN-Apache-and-modcaucho-oh-my</link>
<description>
I recently set up a new &lt;a href=&quot;http://www.viviotech.net/?rid=n42designs&quot;&gt;Viviotech&lt;/a&gt; VPS and ran into an issue that was easy to fix once I realized what was happening, but difficult to debug.
I set up Railo running on the Resin server using Apache as a front end with mod_caucho.
In my httpd.conf file I had the following lines:
&lt;code&gt;
LoadModule caucho_module /usr/lib/httpd/modules/mod_caucho.so
ResinConfigServer localhost 6800
CauchoConfigCacheDirectory /tmp
CauchoStatus yes
&lt;/code&gt;
This causes Resin to handle all requests from apache. The resin configuration files tell resin which URLs to handle.
I also had an SVN server set up so I had a configuration file in /etc/httpd/conf.d/ to set up subversion.
All my SVN repositories are under the location /svn.
So reading SVN repositories worked fine, but I kept getting &quot;path not found&quot; errors when committing new files. After debugging this for quite a while using Fiddler, and other means, I finally realized that Resin was actually handling the PUT http request and, finding no file, returned a 404.
So to fix this, and simply have Apache handle any request to /svn/ I modifed my httpd.conf file as follows:
&lt;code&gt;
LoadModule caucho_module /usr/lib/httpd/modules/mod_caucho.so
&lt;LocationMatch ^((?!/svn/).)*$&gt;
ResinConfigServer localhost 6800
CauchoConfigCacheDirectory /tmp
CauchoStatus yes
&lt;/LocationMatch&gt;
&lt;/code&gt;
then restarted Apache.
Now apache handles any requests to /svn/* and Resin handles all other requests. Hopefully this helps future Googlers in need.
</description>
<category>Subversion</category>
<category>Apache</category>
<category>Railo</category>
<pubDate>Mon, 30 Nov 2009 13:01:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2009/11/30/SVN-Apache-and-modcaucho-oh-my</guid>
</item>
<item>
<title>Filtering a CFGrid</title>
<link>http://www.n42designs.com/blog/index.cfm/2009/8/12/Filtering-a-CFGrid</link>
<description>
&lt;p&gt;So you
want to filter a CFGrid huh? ColdFusion makes this
easy!&lt;/p&gt;
&lt;p&gt;First you need a CFC method that will return the
query used to populate the grid. This method should take the cfgrid
parameters and the value you want to filter
on.&lt;/p&gt;
&lt;p&gt;data.cfc:&lt;/p&gt;
&lt;code&gt;
&lt;cfcomponent&gt;
&lt;cffunction name=&quot;getdata&quot; access=&quot;remote&quot; output=&quot;false&quot;
returntype=&quot;Any&quot;&gt;
&lt;cfargument name=&quot;page&quot;
required=&quot;false&quot; default=&quot;1&quot; type=&quot;Numeric&quot; /&gt;
&lt;cfargument name=&quot;pagesize&quot; required=&quot;false&quot; default=&quot;10&quot; type=&quot;Numeric&quot;
/&gt;
&lt;cfargument name=&quot;sortcolumn&quot; required=&quot;false&quot;
default=&quot;&quot; type=&quot;string&quot; /&gt;
&lt;cfargument name=&quot;sortdir&quot;
required=&quot;false&quot; default=&quot;ASC&quot; type=&quot;string&quot; /&gt;
&lt;cfargument name=&quot;filter&quot; required=&quot;false&quot; default=&quot;&quot; type=&quot;String&quot;
/&gt;&gt;
&lt;cfset q =
queryNew(&apos;id,name&apos;,&apos;integer,varchar&apos;) /&gt;
&lt;cfset queryaddrow(q,1) /&gt;
&lt;cfset querysetcell(q,&apos;id&apos;,1)
/&gt;
&lt;cfset querysetcell(q,&apos;name&apos;,&apos;sean&apos;) /&gt;
&lt;cfset queryaddrow(q,1) /&gt;
&lt;cfset
querysetcell(q,&apos;id&apos;,2) /&gt;
&lt;cfset
querysetcell(q,&apos;name&apos;,&apos;phillip&apos;) /&gt;
&lt;cfset queryaddrow(q,1) /&gt;
&lt;cfset querysetcell(q,&apos;id&apos;,3)
/&gt;
&lt;cfset querysetcell(q,&apos;name&apos;,&apos;steve&apos;) /&gt;
&lt;cfquery name=&quot;q&quot; dbtype=&quot;query&quot;&gt;
select * from q
&lt;cfif
len(trim(arguments.filter))&gt;
where name like &lt;cfqueryparam cfsqltype=&quot;cf_sql_varchar&quot;
value=&quot;%#arguments.filter#%&quot; /&gt;
&lt;/cfif&gt;
&lt;cfif
len(trim(arguments.sortcolumn)) or len(trim(arguments.sortdir))&gt;
order by #arguments.sortcolumn# #arguments.sortdir#
&lt;/cfif&gt;
&lt;/cfquery&gt;
&lt;cfreturn
queryConvertForGrid(q,arguments.page,arguments.pageSize) /&gt;
&lt;/cffunction&gt;
&lt;/cfcomponent&gt;
&lt;/code&gt;
&lt;p&gt;You can see here that I am just
hard coding the query in, you would replace this with your cfquery call
to your database or a call to your service layer, etc. Once you have
your query results, you want to use the queryConvertForGrid method to
format the result to a value that CFGrid can work
with.&lt;/p&gt;
&lt;p&gt;You then need a cfgrid! The trick here is how to
get the grid to refresh as the user types a value in the filter box.
ColdFusion Ajax UI tools have bind expressions that let us bind one
control to another, and to react to events.
&lt;/p&gt;
&lt;p&gt;index.cfm:&lt;/p&gt;
&lt;code&gt;
&lt;cfform&gt;
&lt;p&gt;&lt;label for=&quot;filter&quot;&gt;&lt;cfinput type=&quot;text&quot; name=&quot;filter&quot;
id=&quot;filter&quot; /&gt;&lt;/p&gt;
&lt;cfgrid format=&quot;html&quot;
bind=&quot;cfc:data.getData({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgridsortdirection},{filter@keyup})&quot;
name=&quot;grd&quot; bindonload=&quot;true&quot;&gt;
&lt;cfgridcolumn name=&quot;id&quot; /&gt;
&lt;cfgridcolumn name=&quot;name&quot; /&gt;
&lt;/cfgrid&gt;
&lt;/cfform&gt;
&lt;/code&gt;
&lt;p&gt;You can see my bind expression in the
cf grid. It will call the getData method of my data.cfc and pass in the
value from the &quot;filter&quot; input box whenever the key is released.
ColdFusion provides other events you can react to as well, check the
docs for details.&lt;/p&gt;
&lt;p&gt;So now if you run index.cfm you will see
a simple form with a text input and a grid. the grid will load when the
page is run (bindonload=&quot;true&quot;) and as you type in the text box, the
results are filtered.&lt;/p&gt;
&lt;p&gt;EDIT: removed the example link as I have moved this blog to &lt;a href=&quot;http://www.getrailo.org/&quot;&gt;Railo&lt;/a&gt;&lt;/p&gt;
</description>
<category>Web Development</category>
<category>ColdFusion</category>
<pubDate>Wed, 12 Aug 2009 11:23:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2009/8/12/Filtering-a-CFGrid</guid>
</item>
<item>
<title>ValidatorCFC Update</title>
<link>http://www.n42designs.com/blog/index.cfm/2009/8/3/ValidatorCFC-Update</link>
<description>
Just a
quick note, thanks again to &lt;a
href=&quot;http://www.aarongreenlee.com/&quot;&gt;Aaron Greenlee&lt;/a&gt; I have some
small modifications to &lt;a
href=&quot;http://validatorcfc.riaforge.org/&quot;&gt;ValidatorCFC&lt;/a&gt;.
The
modifications allow you to return a struct where the key is the name of
the field in your object, and the value is true/false indicating if it
passed validation.
This is useful if you prefer more control when
showing informative messages to the user.
The zip file is
attached to this entry as well as at &lt;a
href=&quot;http://validatorcfc.riaforge.org/&quot;&gt;RIAForge&lt;/a&gt;.
</description>
<category>ValidatorCFC</category>
<category>ColdFusion</category>
<pubDate>Mon, 03 Aug 2009 13:56:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2009/8/3/ValidatorCFC-Update</guid>
<enclosure url="http://www.n42designs.com/blog/enclosures/validatorCFC.0.3.zip" length="27082" type="application/zip"/>
</item>
<item>
<title>Adobe releases hotfix for
FCKEditor issue</title>
<link>http://www.n42designs.com/blog/index.cfm/2009/7/8/Adobe-releases-hotfix-for-FCKEditor-issue</link>
<description>
Adobe has released a hotfix for the FCKeditor issue.
You can find it &lt;a
href=&quot;http://www.adobe.com/support/security/bulletins/apsb09-09.html&quot;&gt;here&lt;/a&gt;.
Take
notice that it says to first stop the CF service and then access the CF
administrator. This is impossible. Simple open the administrator first
and apply the hot fix on the system info screen.
Also,
Mac
(linux too??) users should know that if you unzip the cfide.zip file to
the cfide folder it will replace the folder not merge the files like on
windows. You will be left without a working CFIDE folder. You should
manually merge the files.
</description>
<category>ColdFusion</category>
<pubDate>Wed, 08 Jul 2009 17:02:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2009/7/8/Adobe-releases-hotfix-for-FCKEditor-issue</guid>
</item>
<item>
<title>Quick Note</title>
<link>http://www.n42designs.com/blog/index.cfm/2009/5/28/Quick-Note</link>
<description>
Just a quick note
to say that the zip file on RiaForge for ValidatorCFC (&lt;a
href=&quot;http://validatorcfc.riaforge.org/&quot;&gt;http://validatorcfc.riaforge.org/&lt;/a&gt;)
was incorrect. Thanks to Bill D (&lt;a
href=&quot;http://brainbox.tv/&quot;&gt;http://brainbox.tv&lt;/a&gt;) for the head&apos;s up.
I also attached it to this post. Use the download link below.
</description>
<category>ValidatorCFC</category>
<category>ColdFusion</category>
<pubDate>Thu, 28 May 2009 12:35:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2009/5/28/Quick-Note</guid>
<enclosure url="http://www.n42designs.com/blog/enclosures/validatorCFC.0.2.71.zip" length="20867" type="application/x-zip-compressed"/>
</item>
<item>
<title>Follow me on Twitter</title>
<link>http://www.n42designs.com/blog/index.cfm/2009/4/22/Follow-me-on-Twitter</link>
<description>
&lt;a
href=&quot;http://twitter.com/nickel4242&quot;&gt;http://twitter.com/nickel4242&lt;/a&gt;
</description>
<category>ColdFusion</category>
<pubDate>Wed, 22 Apr 2009 16:48:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2009/4/22/Follow-me-on-Twitter</guid>
</item>
<item>
<title>Update to ValidatorCFC</title>
<link>http://www.n42designs.com/blog/index.cfm/2009/2/28/Update-to-ValidatorCFC</link>
<description>
I
released a new version of ValidatorCFC. Aaron Greenlee (&lt;a
href=&quot;http://www.aarongreenlee.com&quot;&gt;http://www.aarongreenlee.com&lt;/a&gt;)
sent me some changes. With his changes, you can now specify which
properties you want validated. So even if in your object you say that
last name and first name are required, if you pass in only the last name
property, only that field will be validated. There is more info within
the CFC itself, and in the test files in the zip. You can download the
zip file using the download link on this entry, or from &lt;a
href=&quot;http://validatorcfc.riaforge.org/&quot;&gt;RIAForge&lt;/a&gt;.
</description>
<category>ValidatorCFC</category>
<category>ColdFusion</category>
<pubDate>Sat, 28 Feb 2009 11:53:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2009/2/28/Update-to-ValidatorCFC</guid>
<enclosure url="http://www.n42designs.com/blog/enclosures/validatorCFC.0.2.7.zip" length="1622" type="application/x-zip-compressed"/>
</item>
<item>
<title>Transfer Error when using ntext
or text and a ManyToMany Relationship</title>
<link>http://www.n42designs.com/blog/index.cfm/2009/2/17/Transfer-Error-when-using-ntext-or-text-and-a-ManyToMany-Relationship</link>
<description>
When you set Transfer to use a
table that has an ntext or text column on SQL Server 2000 (and perhaps
later versions) and also a many to many relationship you may receive the
following error when you attempt to retreive the collection for the many
to many:
&lt;code&gt;[Macromedia][SQLServer JDBC Driver][SQLServer]Only
text pointers are
allowed in work tables, never text, ntext, or image
columns. The query
processor produced a query plan that required a
text, ntext, or image
column in a work table.&lt;/code&gt;
For
example I have the following tables set up
&lt;code&gt;Table Name:
Table1
id	char(35)	primary key
title
varchar(255)
description	ntext
Table Name: Table2
id
char(35)	primary key
description
varchar(255)
Table Name: Table1_Table2
table1_id	char(35)
composite key
table2_id	char(35)	composite
key&lt;/code&gt;
And the following transfer
configuration:
&lt;code&gt;&lt;transfer&gt;
&lt;objectDefinitions&gt;
&lt;object name=&quot;Table1&quot; table=&quot;table1&quot;&gt;
&lt;id
name=&quot;id&quot; type=&quot;UUID&quot; generate=&quot;true&quot; /&gt;
&lt;property name=&quot;title&quot; type=&quot;string&quot; nullable=&quot;false&quot; /&gt;
&lt;property name=&quot;description&quot; type=&quot;string&quot; nullable=&quot;true&quot; /&gt;
&lt;manytomany name=&quot;Relation&quot; table=&quot;Table1_Table2&quot; lazy=&quot;true&quot;&gt;
&lt;link to=&quot;Table1&quot; column=&quot;table1_id&quot; /&gt;
&lt;link to=&quot;Table2&quot; column=&quot;table2_id&quot; /&gt;
&lt;collection type=&quot;array&quot;&gt;
&lt;order
property=&quot;description&quot; order=&quot;asc&quot; /&gt;
&lt;/collection&gt;
&lt;/manytomany&gt;
&lt;/object&gt;
&lt;object name=&quot;Table2&quot; table=&quot;Table2&quot;&gt;
&lt;id name=&quot;id&quot; type=&quot;UUID&quot; generate=&quot;true&quot; /&gt;
&lt;property name=&quot;description&quot; type=&quot;string&quot; nullable=&quot;false&quot; /&gt;
&lt;/object&gt;
&lt;/objectDefinitions&gt;
&lt;/transfer&gt;&lt;/code&gt;
So
when you call getRelationArray() on a Table1 object. You will receive
the error. To correct this I took the following steps:
Create a
for table 1 with the ntext column casted to varchar:
select
id,title,cast(description as varchar(8000)) as description from
table1
Save this as vwTable1.
Change your transfer config
to point to the view instead of table one so
&lt;code&gt;&lt;object
name=&quot;Table1&quot; table=&quot;table1&quot;&gt;&lt;/code&gt;
becomes
&lt;code&gt;&lt;object
name=&quot;Table1&quot; table=&quot;vwTable1&quot;&gt;&lt;/code&gt;
Now, you wont be able to
run it yet because the view is not updatable since you used the casted
field. To overcome this we are going to use an INSTEAD OF
trigger.
You need to create 2 triggers. One will be called
whenever UPDATE is called on the vwTable1 and the other will be called
when INSERT INTO is called on vwTable1
You can create the
triggers as follows, obviously change it to suit your table&apos;s
needs:
&lt;code&gt;CREATE trigger io_trigger_insert_vwTable1 on
vwTable1
instead of insert
as
begin
set nocount
on
if (not exists (select t.[id] from table1 t, inserted i where
t.[id] = i.[id]))
insert into table1
select
[id],
[title],
[description]
from
inserted
end&lt;/code&gt;
&lt;code&gt;create
trigger io_trigger_update_vwAd on vwAd
instead of update
as
begin
set nocount on
if (exists (select t.[id] from table1 t,
inserted i where t.[id] = i.[id]))
update
table1
set
title = i.title,
[description] = i.[description]
from
table1
t, inserted i
where
t.[id] =
i.[id]
end&lt;/code&gt;
Once you have created these triggers you
should be able to use Transfer as you normally would. Using the casted
column in the view will allow you to call the getRelationArray(). The
SQL that Transfer creates will no longer be invalid.
You may run
into a couple of other items though. First, your ntext field is now
limited to 8000 characters since you are casting it to varchar. You may
be able to increase this, but I haven&apos;t tried. Your mileage may vary,
but be sure before the value is passed to transfer that it is validated
as less than 8000 characters (perhaps in your decorator). Next, if you
have any non-null, defaulted columns in your base table (a created date
perhaps) you HAVE to provide a value when you call insert into vwTable1.
Since Transfer is creating this SQL you have to ensure that Transfer
includes that column. This means that you cannot use the
ignore-insert=&quot;true&quot; option in the transfer configuration. SQL Server
will still respect your default value, as long as you provide that
column in the sql statement pointed at the view.
You can find
more information about &lt;a
href=&quot;http://msdn.microsoft.com/en-us/library/aa214478(SQL.80).aspx&quot;&gt;INSTEAD
OF INSERT&lt;/a&gt; and &lt;a
href=&quot;http://msdn.microsoft.com/en-us/library/aa214430(SQL.80).aspx&quot;&gt;INSTEAD
OF UPDATE&lt;/a&gt; triggers on the MSDN site.
I have only used this in
a simple application with two base tables and one relationship table, so
if your setup is more complex it may not work out for you.
</description>
<category>Transfer</category>
<category>ColdFusion</category>
<pubDate>Tue, 17 Feb 2009 10:43:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2009/2/17/Transfer-Error-when-using-ntext-or-text-and-a-ManyToMany-Relationship</guid>
</item>
<item>
<title>Webservices Change in CF
8.0.1</title>
<link>http://www.n42designs.com/blog/index.cfm/2008/4/17/Webservices-Change-in-CF-801</link>
<description>
It seems with the change to 8.0.1 there is a difference in the
way CF generates the stubs for a CFC called as a web service. I had a
CFC called webservices.cfc and on 8.0 it was working fine calling the
methods, but with the 8.0.1 it started throwing a &quot;duplicate file name&quot;
error. This seems to be because CF creates its own stub file
Webservices.java and also a [cfcname].java file. CF couldn&apos;t create
both so it threw an error. The solution was to rename my CFC. The
stubs can be found in C:\ColdFusion8\stubs\ on windows, and if I
remember correctly /Applications/ColdFusion8/stubs/ on Mac OS X.
</description>
<category>Web Development</category>
<category>ColdFusion</category>
<pubDate>Thu, 17 Apr 2008 06:50:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2008/4/17/Webservices-Change-in-CF-801</guid>
</item>
<item>
<title>Issue w/ Eclipse Resource
Bundle Editor Plugin and Leopard</title>
<link>http://www.n42designs.com/blog/index.cfm/2008/1/17/Resource-Bundle-Editor-Plugin-and-Leopard</link>
<description>
There seems to be an issue with the
Resource Bundle Editor Plugin for Eclipse.
(http://sourceforge.net/projects/eclipse-rbe/)
I installed
version 0.7.7 into a fresh install of the Eclipse 3.3 SDK and was unable
to open a resource file. I would get the following
error:
&lt;code&gt;
Can&apos;t start the AWT because Java was started on
the first thread. Make sure StartOnFirstThread is not specified in your
application&apos;s Info.plist or on the command line
&lt;/code&gt;
To
fix it I edited the eclipse.ini file
(/Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini by
default) to add the following
line:
&lt;code&gt;
-Djava.awt.headless=true
&lt;/code&gt;
Once I
did that it was fine and I was able to edit the resource
bundles.
Hope this helps someone searching for the issue!
</description>
<category>Eclipse</category>
<category>Web Development</category>
<pubDate>Thu, 17 Jan 2008 18:18:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2008/1/17/Resource-Bundle-Editor-Plugin-and-Leopard</guid>
</item>
<item>
<title>ColdFusion ORM - Developing the
Business Objects First</title>
<link>http://www.n42designs.com/blog/index.cfm/2007/9/14/ColdFusion-ORM--Developing-the-Business-Objects-First</link>
<description>
Since I have transitioned from a world of
spaghetti code through the land of the uber-cfc, and finally onto some
OO concepts, I have tried to figure out what the best way to create the
business objects and persist them to the database. For nearly ever
application I have developed, I have created the database first, since,
in my mind, understanding the data is the first step to understanding
the way the application will function.
However, in the OO world,
the primary step is to design the business objects. In my latest
project I decided to take one step deeper into the OO world and develop
all my business objects forgetting all about how the database would be
laid out. I had no problems with this, authoring complex objects
containing arrays or instances of other objects without
issue.
Then I needed to figure out how to persist them. In the
past, each of my business objects directly mapped to a table in my
database. This made it easy to build a code generator, read in the DB
metadata and, in the words of John Madden, &quot;Boom&quot;, I had my beans, DAOs,
and Gateways.
Now, I see what Sean Corfield refers to as the &quot;5:1
Syndrome&quot;. I have a dumb bean object, a DAO, a Gateway, a Service and,
if using Model-Glue, a Controller for nearly every object, and in turn
every table in the database. This always seemed like code bloat to me,
so I was very happy to see other, like Sean, refer to it as such. There
must be a better way!
Trying to avoid this I decided, OK I&apos;ll
use Reactor. Active Record, generated code, sounds good. Then I
realized that I have to create the database first. Back to square
one.
Should business objects reflect the organization of the
database? They can, but if it doesn&apos;t fit the way the business object
is used in the application, then no, it shouldn&apos;t. Also, from the
other way, the best way to organized the business objects is probably
not the best way to organize the database. The database should be in
3NF, avoid duplication whereever possible, etc, etc.
Not wanting
to trash all the BOs I created already, I decided I would write all the
persistance stuff myself. So now that I have some beans, I created a
service for each and wired them up in ColdSpring. I put all the methods
that would normally go in my DAO (save, new, and CRUD) in my service as
well as some getAll() calls.
As a side note, I don&apos;t return
query objects since, even though they are faster than creating an array
of objects, I cant call a complex getter, such as a calculated value
easily, and this allows me to use the same calls to get the data for one
instance of an object as I do for a collection.
Now I have a BO
and a service that is completely separate from the DB. Persisting
complex objects is a bit more complicated than using the 1:1 BO to DB
mapping, but it works. The only issue is, I don&apos;t want to have to
maintain all this manually. I wish we had a mapping tool to handle
persistance from BO to DB without requiring that the DB reflect the BO
or vice versa.
Java has &lt;a href=&quot;http://www.hibernate.org/&quot;
target=&quot;_blank&quot;&gt;Hibernate&lt;/a&gt; to handle this issue. With CF8 &lt;a
href=&quot;http://www.firemoss.com/blog/index.cfm?mode=entry&amp;entry=E3BB2C56-3048-55C9-439841683FDAA4D3&quot;&gt;we
can now use Hibernate&lt;/a&gt; with a Java model, but what if we want to
model using CFCs? &lt;a
href=&quot;http://www.mattwoodward.com/blog/index.cfm?event=showEntry&amp;entryID=0192EC2E-A75D-7689-3A0C5ABFB71258AC&quot;&gt;cfHibernate&lt;/a&gt;
attempted to do this and seems to have run into some issues. Can we use
Hibernate to map CF objects to the DB? I am going to attempt to find an
answer for this in the next few weeks for my current project. Hopefully
I can find a solution.
</description>
<category>ColdFusion</category>
<pubDate>Fri, 14 Sep 2007 09:12:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2007/9/14/ColdFusion-ORM--Developing-the-Business-Objects-First</guid>
</item>
<item>
<title>ColdFusion 8 Released!</title>
<link>http://www.n42designs.com/blog/index.cfm/2007/7/30/ColdFusion-8-Released</link>
<description>
Just
a quick note that CF8 has been &lt;a
href=&quot;http://www.adobe.com/products/coldfusion/&quot;&gt;released&lt;/a&gt; by Adobe.
If you haven&apos;t seen the new features, download a copy and see for
yourself.
</description>
<category>ColdFusion</category>
<pubDate>Mon, 30 Jul 2007 07:13:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2007/7/30/ColdFusion-8-Released</guid>
</item>
<item>
<title>ValidatorCFC</title>
<link>http://www.n42designs.com/blog/index.cfm/2007/7/21/ValidatorCFC</link>
<description>
&lt;p&gt;This
component validates the data in an object according to custom rules you
set up. It is especially created to determine data validity for a data
store (DBMS, etc) rather than for business rules, but you can set up
your own complex rules. Some may be out of its scope,
however.&lt;/p&gt;
&lt;p&gt;I just uploaded version 0.1.000. It is very much a
work in progress and I welcome feedback.&lt;/p&gt;
&lt;p&gt;Take a look and let
me know what you think. You can find it at &lt;a
href=&quot;http://validatorcfc.riaforge.org&quot;&gt;http://validatorCFC.riaforge.org&lt;/a&gt;
or at the download link below.&lt;/p&gt;
&lt;p&gt;Here is a rundown of an example
usage:&lt;/p&gt;
[More]
</description>
<category>ValidatorCFC</category>
<pubDate>Sat, 21 Jul 2007 01:30:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2007/7/21/ValidatorCFC</guid>
<enclosure url="http://www.n42designs.com/blog/enclosures/validatorCFC.0.1.000.zip" length="1" type="application/zip"/>
</item>
<item>
<title>Technorati</title>
<link>http://www.n42designs.com/blog/index.cfm/2007/7/21/Technorati</link>
<description>
Look for me on
Technorati!
&lt;a href=&quot;http://technorati.com/claim/nb5epizsnt&quot;
rel=&quot;me&quot;&gt;My Technorati Profile&lt;/a&gt;
</description>
<category>Technorati</category>
<pubDate>Sat, 21 Jul 2007 01:19:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2007/7/21/Technorati</guid>
</item>
<item>
<title>Integrate a Model-Glue
Application into FarCry</title>
<link>http://www.n42designs.com/blog/index.cfm/2007/7/20/Integrate-a-ModelGlue-Application-into-FarCry</link>
<description>
I&apos;m sure there are other ways to do this but
this is how I was able to integrate an existing Model-Glue application
into a FarCry site. I am using ModelGlue 2.0, the latest ColdSpring BER
as of this posting, and the latest beta of reactor.
My MG app in
question is a events calendar. Its a pretty simple application using
MG, Reactor, and ColdSpring.
Because I don&apos;t want to use ColdFusion
mappings (and its running on CF7 so no per application mappings) I
copied modelglue, reactor, and coldspring into
{farcry_root}/projects/{site_name}/www as www/modelglue, www/reactor,
and www/coldspring.
If you are using mappings you can skip that
step.
Next, I created a simple include file called _mgCal.cfm in
{farcry_root}/projects/{site_name}/includedObj.
The code for this is
as follows:
&lt;code&gt;
&lt;!--- @@displayname: Calendar ---&gt;
&lt;cfsetting
enablecfoutputonly=&quot;no&quot;&gt;
&lt;cfinclude template=&quot;/mg/mgCal/index.cfm&quot;
/&gt;
&lt;cfsetting enablecfoutputonly=&quot;no&quot;&gt;
&lt;/code&gt;
Now, in the FarCry
webtop, under the site tab, navigate to the root node, and under
utility, create a new navigation node called &quot;Calendar&quot; and under that,
a new include called &quot;Calendar&quot;.
Publish both. The friendly URL
should be /go/calendar, but it can be whatever you like.
Now we have
to copy our MG application into the site tree. Create a new folder
called &quot;mg&quot; under the www folder. This is where all my MG apps will
live. So I copy my &quot;mgCal&quot; folder from my test site into the &quot;mg&quot;
folder I just created giving me a directory structure like
so:
&lt;pre&gt;
/www/mg/mgCal/
/www/mg/mgCal/config
/www/mg/mgCal/controller
/www/mg/mgCal/model
/www/mg/mgCal/views
/www/mg/mgCal/Application.cfm
/www/mg/mgCal/index.cfm
etc
&lt;/pre&gt;
Now
we have a few modifications to make to the MG app to get it to run from
this location. Depending on how you first created the MG app, your
settings may be different.
In your MG App&apos;s index.cfm file add the
following line above the &amp;lt;cfinclude&amp;gt; that calls
Model-Glue.
&lt;code&gt;
&lt;cfset ModelGlue_LOCAL_COLDSPRING_PATH =
getDirectoryFromPath(getCurrentTemplatePath()) &amp;
&quot;/config/ColdSpring.xml&quot; /&gt;
&lt;/code&gt;
Now MG can find your ColdSpring
configuration file.
In your ColdSpring configuration file edit the
following properties:
In your modelGlueConfiguration bean:
The
paths should be straight forward, but your defaultTemplate property must
be set to the FriendlyURL of your include.
&lt;code&gt;
&lt;property
name=&quot;viewMappings&quot;&gt;&lt;value&gt;/mg/mgCal/views&lt;/value&gt;&lt;/property&gt;
&lt;property
name=&quot;generatedViewMapping&quot;&gt;&lt;value&gt;/mg/mgCal/views/generated&lt;/value&gt;&lt;/property&gt;
&lt;property
name=&quot;configurationPath&quot;&gt;&lt;value&gt;/mg/mgCal/config/ModelGlue.xml&lt;/value&gt;&lt;/property&gt;
&lt;property
name=&quot;scaffoldPath&quot;&gt;&lt;value&gt;/mg/mgCal/config/scaffolds/Scaffolds.xml&lt;/value&gt;&lt;/property&gt;
&lt;property
name=&quot;defaultTemplate&quot;&gt;&lt;value&gt;/go/calendar&lt;/value&gt;&lt;/property&gt;
&lt;/code&gt;
In
your reactorConfiguration bean:
&lt;code&gt;
&lt;constructor-arg
name=&quot;pathToConfigXml&quot;&gt;&lt;value&gt;/mg/mgCal/config/reactor/Reactor.xml&lt;/value&gt;&lt;/constructor-arg&gt;
&lt;property
name=&quot;mapping&quot;&gt;&lt;value&gt;/mg/mgCal/model/data/reactor&lt;/value&gt;&lt;/property&gt;
&lt;/code&gt;
You
will want the paths to match those you set up in the previous
steps.
Now for the tedious part. This was easy for me since I only
have a few views, but a complex app with a large number of views will
probably be a bit more work.
In each view that calls
#viewState.getValue(&apos;myself&apos;)# you will have to, prior to any of those
calls run the following statement:
&lt;code&gt;
&lt;cfset
viewState.setValue(&apos;myself&apos;,replace(viewState.getValue(&apos;myself&apos;),&apos;?&apos;,&apos;&amp;amp;&apos;,&apos;ALL&apos;))
/&gt;
&lt;/code&gt;
This is to prevent a url like
/go/calendar?event=some.mgEvent from happening. The friendlyURL is
hiding some other FarCry
URL variables. So there is already a ? in
the URL. This will replace the ? that MG creates with an ampersand so
you can attach the MG url variables. easily.
Thats all it took to get
my simple calendar MG app running under FarCry. A more complex app may
need more to get running, but at least this will get you started.
If
any one has any suggestions on a better way to handle this, I am all
ears. I tried to find another instance of someone doing this in both
the &lt;a href=&quot;http://groups.google.com/group/farcry-dev&quot;&gt;FarCry&lt;/a&gt; and
&lt;a href=&quot;http://groups.google.com/group/Model-Glue&quot;&gt;Model-Glue&lt;/a&gt; lists
to no avail.
</description>
<category>Model-Glue</category>
<category>FarCry</category>
<pubDate>Fri, 20 Jul 2007 15:04:00 -0400</pubDate>
<guid>http://www.n42designs.com/blog/index.cfm/2007/7/20/Integrate-a-ModelGlue-Application-into-FarCry</guid>
</item>
</channel></rss>