Our First Breezo

Our user's group had our first Breeze presentation this week. Not having any experience with Breeze (other than attending several Breeze presentations), I was a little nervous about what trouble we would run into.

As it turned out, the set up was really easy and the presentation went off without a hitch.

More significantly, however, Peter Farrell did a really good presentation. He presented on source control software (mostly on subversion - but the presentation was a good overview of available options). He has a good voice for presenting and his pace and demeanor were perfect for an online presentation.

I have not been using a version control system and even after the presentation I am not sure that I will. I am sure, however, that I will at least look into it and weigh my options very seriously. Before hearing the presentation, I wasn't really sure where to get started on making that decision. Now I feel like I have a good starting point for investigating the possibilities.

If you are in a users group that is in a smaller market (Tulsa isn't quite Dallas or NYC), a Breeze presentation is a great way to get presenters and presentations that you might not otherwise be able to get.

Charlie Arehart just covered Breezos for user's groups in his blog , so you might want to read more about it there if you are interested.

Since I work at home and don't have an iPod (the shame!), I have only listened to one or two episodes of ColdFusion Weekly . After this presentation, I will be sure to find a way to listen to more of them. 

 

Database Synchronization

In order to test some code for a recent project, I needed to have the data from the live site on my local computer. Of course, the live site is running MySQL which I don't have on my local computer.

By happenstance, I had just read a blog entry on transfering data from an Access to a MySQL database. It looked like a good solution (it uses DataMgr, it must be good!). Unfortunately, the solution listed only works if both databases have datasources on the same computer - not the case for me (though in retrospect I may have been able to set up a datasource on my local computer that pointed to the remote MySQL database).

In any event, I ended up building a tool to handle database synchronization. It will copy a database structure (and data unless you opt not to copy that) from one datasource to another.

This can be done one of two ways.

One: 

  1. Load the DataSynch.cfc and pass in the DataMgr for the source database.
  2. run the getXml() method of DataSynch on the desired tables.
  3. Take the resulting XML and pass it into the loadXML() of another DataMgr (this can be on another server running another database)

Two:

  1.  Load the DataSynch.cfc and pass in the DataMgr for the source database.
  2. Call the addDataMgr() to pass in a DataMgrto which structure (and data) should be copied (this can be done multiple times, creating multiple recievers for structure anddata)
  3. Call the synchTables() method of DataSynch on the desired tables to synchronize the database structure and data with the datasources of each DataMgr pass in via addDataMgr()

Note that this approach won't update any existing data. The synchronization is one-way only (from the source datasource outward).

One other advantage to this approach is that DataSynch will do its best to figure out foreign keys. Instead of copying foreign keys by value, it will copy them by look-up (making sure that the value matches the primary key of the related record with the same data).

So, if you have a "categories" table with a catid field as an identity primary key field, the values created in the new table may not match the value in the old table. DataSynch will create the table so that it uses the new value for the catid field of your products table (assuming both are being synchronized) instead of the old value.

To borrow Michael's example. Here is how it could be implemented usign DataSynch:

<!--- Create datamgr objects for each datasource --->
<cfset dmaccess = createobject("component","datamgr.DataMgr_Access").init("mydb_access")>
<cfset dmmysql = createobject("component","datamgr.DataMgr_MYSQL").init("mydb_mysql")>
<!--- Create the Synchronizer --->
<cfset synch = createobject("component","datamgr.DataSynch").init(dmaccess)>
<!--- Add the receiving datamgr --->
<cfset synch.addDataMgr(dmmysql)>
<!--- Synchronize the tables --->
<cfset synch.synchTables("contact,address,country,order,orderline,product,price")>

Because of the nature of DataMgr, any new tables or columns will automatically be created in receiving datasources. 

DataSynch is free and open-source. It requires DataMgr , which can be downloaded from the same page.

Sharpen the Axe

While busy with several urgent projects, I spent most of yesterday improving my tool set. This might seem like a bad time, but I think it will pay of well.

I found that I was performing several tasks several times. My general rule is that on the third time I perform the same task, I try to automate it. I found that I had several tasks that I had performed more than three times and that I would need to perform more times very soon for my urgent problems.

Abraham Lincoln said "Give me eight hours to chop down a tree and I will spend the first six sharpening the axe." I think this is a valuable (which has been discussed as Sharpening the Saw). 

I think that time spent improving your tool set is time well spent. Be careful, however, not to try to wait until your tool set it perfect before you start your work.

I find it is valuable to improve my processes and tool set a little bit every project. I find that in the long run, the time a save as a result more than makes up for the investment of time in improving your tools. 

In this case, DataMgr received some major improvements. I was planning to make these upgrades a 1.5 release, but they have already had such a major impact on my coding, that I might rename the release 2.0 (still plenty of testing before it is ready though).

According to his quote, Abraham Lincoln would spend two thirds of his time improving his tools. I suspect he was exagerating a bit. I spend about a sixth of my time improving my tools.

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