Presenting DataMgr to ColdFusion Meetup

Last night I was able to present to the Online ColdFusion Meetup Group (if you haven't already, you should really check it out). I was a bit nervous, but I think it went pretty well overall.

I was presenting on DataMgr - a non-ORM data access layer (I always have a rough time giving a simple answer to "What is DataMgr?").

Some prominent ColdFusion programmers attended, which was a bit intimidating. I am curious now to see what people think of it now that they have seen it.

Certainly, anyone already using an ORM will be happy with that approach. For anyone who doesn't want to use an ORM (or who would like to create their own) hopefully DataMgr will be a good option. 

I did forget to cover a few things that I meant to mention, but I suppose that is to be expected. Among them:

  • You could create an ORM on top of DataMgr (one has been created already - more on that in a future entry).
  • DataMgr uses cfqueryparam extensively. All data (except booleans and dates) passed in use cfqueryparam.
  • DataMgr is open source and free for any use.
  • DataMgr doesn't create any files or components.
  • You can use XML to define tables or you can let DataMgr introspect your database instead (or do both in combination).

Here are some links from the presentation:

  • Demonstration Site: Shows some of the DataMgr functionality and the associated ColdFusion code.
  • DataMgr page: Links to blog entry, tutorials, documentation.
  • DataMgr on RIAForge: Download DataMgr or report an issue (bug/enhancement request).
  • Component Doc: Slightly formatted version of the auto-docs from the CFC.
  • CodeCop: A code checking application that also serves as an example implementation of DataMgr.
Feel free to watch the recorded presentation if you are interested and missed it (also available via Charlie Arehart's UGTV).

Thanks to Charlie and Ray for allowing me to speak to the group. It was a lot of fun!

 

Reviews:

ALA Web Design Survey

Popular web design magazine, A List Apart, is conducting a web design survey . This should help them (and the rest of us) get a better picture of the current state of the web development industry.

It is a short survey, and you can potentially win some nice prizes by participating.

They plan for this to be an annual survey. Hopefully they will get enough responses to have a good sample size for their data. 

Web Design Survey, 2007.

CodeCop 1.0 Released

Several month ago (back in June, 2006), Ray Camden held an Advanced ColdFusion Coding Contest. The idea was an extensible tool to check ColdFusion code for potential issues.

This sounded pretty fun, so I created an entry (which took much longer than I anticipated). I am pretty happy with the results. Ray liked it as well.

CodeCop will check your code and report problems. The fun part is that, although it comes with some example rules, you can create any rules that you want right in the tool. You can also share packages of rules with others.

It will run in CF6 or better on any OS using any database supported by DataMgr (and if DataMgr doesn't support the database you want, you can add support for that database to DataMgr and then use CodeCop on it).

You can run it from within the ColdFusion Administrator (and thereby gain some functionality) or on its own.

Note that, as CodeCop allows you to read any code on your server and run ColdFusion code that you enter into the tool, it should never be placed where anyone can use it.

CodeCop is free and open source.

You can view screenshots and download CodeCop from RIAForge.

PS - Thanks for the great idea, Ray! 

Self-Referential Many-To-Many Relationships

I am working on DataMgr 2.1 and I have run into an issue with which I would love some advice. This doesn't require any knowledge of DataMgr itself.

This problem deals with many-to-many joins. For example a user could be a member of multiple groups and each group could have multiple users as members. This would generally be handled by a join table. For example, if users were stored in a "users" table and groups were stored in a groups table, the relationships between them might be stored in a "users2groups" table.

A relationship could also be self-referential. For example, products (represented with a "products" table) could reference related products (also in the products) table. This could also be handled with a join table.

The question I have is how to handle the bidirectional quality of these relationships.

In the case of users and groups, if a user is a member of the group then the group has the user as a member (yes, I realize that was tautologous). This is because a row exists in "users2groups" to represent the relationship between the two. More specifically, this row represents a bidirectional relationship between the two tables.

In the case of a self-referential table, however, this is not necessarily the case. Each row of the join table only represents a unidirectional relationship between the product and the related product.

So, if "products2relatedproducts" had the fields "product_id" and "relatedproduct_id" (each referencing the "product_id" field of the "products" table) then the row would indicate that one-way relationship.  If product "A" had product "B" as a related product in this table, then the row would not show that "B" had "A" as a related product.

This scenario is inconsistent with how many-to-many relationships generally work. 

So, finally for the question:

If such a relationship is managed through DataMgr, would it make sense (and be helpful) if DataMgr enforces the bidirectional nature of the relationship (making self-referential relationships more consistent with other relationships)? Would it be better to have this as an option?

Thanks in advance for any and all thoughts. 

Running a ColdFusion Shop

Terrence Ryan, creator of Squidhead, recently add a fourth part to his great "Running a ColdFusion Shop" series. He covers a wide-range of topics related to running a ColdFusion development shop.

Despite the number of topics he covers, the series feels very tight and is an easy read full of great information.

If you haven't read it yet, I recommend that you do so.

First New ColdFusion Meetup Presentation

Last night, the newly reconstituted ColdFusion Meetup group had their first presentation. The frequency of future meetings hasn't yet been decided, but it sounds like they plan to have them at least once a month.

This presentation was titled "Attack of the Spam Bots" (about an hour) and was by Jake Munson. It was a good presentation overall and he showed some interesting approaches for fighting comment spam.

His approach emphasizes that the user should not be burdened with proving that they aren't a spammer, but that the program should bear that responsibility. His solution uses JavaScript, but will work without it.

This is due to one of my favorite aspects of his approach - it uses different factors with different weights to identify spam. I was working while watching, so I missed if it was possible to easily changing the weighting on those tests.

During the presentation one or two people mentioned that they were using his solution, CFFormProtect, and that it has resulting in a dramatic reduction in comment spam. 

If you are  having trouble with comment spam (or form spam of any kind), I would encourage you to take a look at CFFormProtect

This was certainly a good start to the newly active group and I look forward to more presentations in the future.

That Didn't Last Long

When working on DataMgr 2.0, I had several beta versions and a handful of release candidates as well. I was hoping that I would be able to keep the nice version number "2.0" for a while before I had to have a bug fix that would force an ugly version number.

Well, DataMgr 2.0 came out on Monday and today (just Thursday of the same week) a bug has already been found. So, DataMgr is now in version 2.0.1 (just the sort of ugly version number that I was hoping to avoid).

So, if you have already downloaded 2.0, you might want to grab 2.0.1. You can see a description of the issue being solved on the DataMgr page on RIAForge.

In good news, this weeks presentations on DataMgr seemed to go well. You can read Dave Shuck's review on my presentation to the Dallas group. I forgot to record that presentation, but I did remember to record the presentation to the Cleveland group.

As a bit of amusement, the code inside DataMgr that I showed during the questions portion of the presentation was the very code causing the problem that required me to post a new version of DataMgr.

The presentation is about 50 minutes long, including questions - pretty quick for me.

I noticed I had the syntax wrong for putting relational data in your seed data (something I cover correctly in the documentation). 

Mailer.cfc 1.5 is Gold

It is a big week for me in terms of open source releases. I got DataMgr 2.0 released on Monday and now Mailer.cfc 1.5 is ready today.

Mailer.cfc is, in part, an abstraction for cfmail. While cfmail is already a great encapsulation of email functionality, Mailer.cfc provides several advantages - especially if you are using CFCs.

The first advantage is that it you can pass Mailer.cfc into a component instead of several email-related settings. This is especially useful if you may or may not use a username/password to send email as it keeps you from having to code that conditional into your component.

More significantly, however, is that like DataMgr, Mailer.cfc comes with a "Sim" version that can be used for development and testing. Switching between the two requires no change to your code except on the instantiation of your component. This allows you to test your code without actually sending email.

Mailer.cfc can also log all of the email that it sends in a database table (this feature requires DataMgr, but Mailer.cfc can be used without anything else if you don't use logging).

The use of Notices in Mailer.cfc is also helpful, but beyond the scope of this entry.

Mailer.cfc is open source and free for any use. 

Presenting on DataMgr

Following on heels of the release of DataMgr 2.0, I will be giving online presentations on DataMgr to two users groups.

I will be presenting to the Dallas CFUG today and the Cleveland CFUG tomorrow. Apparently, I like to do users group presentations in pairs.

I have done a few presentations in person (one of which was recorded), but these will be my first presentations to be done purely across the internet. I am a bit nervous as I generally get a lot of feedback from watching the faces of my audience and I won't have that this time.

Hopefully it will go well and be worth the time for those who attend (always a big pressure). 

DataMgr 2.0 is Gold!

Data Access Layer, DataMgr 2.0 is finally in full release! It automates CRUD functionality without creating code and supports OO or procedural coding.

Data encompasses three major types of functionality:

  • CRUD: Database reads/writes including those of the type performed by cfinsert/cfupdate
  • ActiveSchema: The ability for your code to define your database structure. DataMgr can introspect the database structure or it can define it.
  • Prototyping: The ability to use simulated data for prototyping (much like QuerySim, but more powerful and less work).

DataMgr is different from other available options because it doesn't generate any code. It isn't an ORM solution, but you could easily build an ORM solution on top of it.

The syntax for using DataMgr is the same for any supported database and you can add support for a new database by adding a new CFC (about 250-300 lines of code, on average). DataMgr currently supports the following:

  • MS Access '97+
  • MySQL 4.1+
  • PostGreSQL 8+
  • SQL Server 2000+ 

If you want to upgrade from DataMgr 1.X, copy the new DataMgr files over the existing DataMgr files and then reload the DataMgr component and any components that use it (usually via ?reinit=1 or some such). No change in syntax is required.

DataMgr only incurs a minimal performance overhead when compared to SQL in cfquery.

Built into DataMgr's CRUD functions are better error handling (no more "String or binary data would be truncated" errors) and automatic conversion of special MS Word characters to their ASCII equivalents.

DataMgr can introspect your database or you can define your table structure and have DataMgr create it. You can even have DataMgr create tables with data.

In addition to the supported databases, you can also use a simulated database. This effectively creates QuerySim-like queries without having to type out any data (using table definitions as above).

DataMgr also include several other features (discussed in the beta release of DataMgr 2.0) which can be seen on the DataMgr demonstration site and are included in the DataMgr documentation.

DataMgr is open source an free for any use and can be downloaded from datamgr.riaforge.org.

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.