Introspect your database with ColdFusion

I just knocked up this quick demo of how to introspect - or examine - your database tables and columns using <cfdbinfo>

<cfset dsn = "cfartgallery"> <cfoutput><h1>Introspection for #dsn#</h1></cfoutput> <cfdbinfo datasource="#dsn#" name="getTables" type="tables" /> <h2>Tables</h2> <!--- using query of query to scrap any sys tables ---> <cfquery name="getNonSysTables" dbtype="query"> SELECT REMARKS, TABLE_NAME, TABLE_TYPE FROM getTables WHERE TABLE_TYPE <> 'SYSTEM TABLE' </cfquery> <cfdump var="#getNonSysTables#" />

<cfoutput query="getNonSysTables"> <h3>#getNonSysTables.TABLE_NAME#</h3> <cfdbinfo datasource="#dsn#" name="getCols" type="columns" table="#getNonSysTables.TABLE_NAME#"> <cfdump var="#getCols#"> </cfoutput>

I'll wrap this up into a CFC at some point and add some nice formatting and drill-down navigation.

Enjoy!

My Experience With Verity

I have recently started exploring verity search, so I just thought I'd share my experiences and views.

So to start, getting the thing working in the first place was a pain! After much googling I find that verity doesn't run on a Mac. Not hugely problematic since I have Windows XP installed in parallel with Mac OS. I could simply tap into the verity server on my Windows OS. It would mean running Windows everytime I needed it, which tends to slow my laptop when I'm going at full steam, but needs must.

However, while I indeed had verity installed on Windows, the version that comes in-built with ColdFusion doesn't allow remote connection (due to licensing restrictions). And to make things worse, it seems Verity is no longer a supported product, and is currently being redeveloped by another company. Still, considering the huge price for the software, this was never a viable option.

I played around with Lucene, an open-source project provided by Apache. This was simple to install and indexed files much faster than verity, and while it isn't directly accessible through ColdFusion, Ray Camden has built a great wrapper for it.

Whilst this worked, it had drawbacks. Firstly, Lucene doesn't return a context like verity, so keyword highlighting is out of the question. Then there's the CustomTags. Since there is no way to make the built-in ColdFusion tags run on a different engine, you have to use customTags; which is fine, if your going to use it in production. When my site goes live it will need to use verity, as Lucene is not installed on my production server.

So while Lucene and Seeker got me going with searching, I still needed to tap into verity, and I CRAVED for those contexts! I finally gave in and decided to do any verity-based work on my virtual machine.

And whilst doing so, I've noticed a little glitch with it. This could not be an issue to anyone else - but when I tap refresh multiple times in my browser whilst on the search results page, I get duplicate entries being returned. I'd love to know if anyone else can see this, otherwise I'll need to start debugging.

As an overall opinion, I love being able to search documents with ColdFusion, but the search engine is far too outdated, far too slow, and lacking in functionality (for example, it doesn't render CF variables when its indexing, which means variable names are returned). It would be great to see CF9 dump verity and get a spanking new engine. This whole searching websites could have great potential ;)

Abstracting The Database Layer And Reducing Execution Time

"Only a very bright person could make this mistake: to let the database drive the model. You couldn't find a more non-OO approach. I have enormous respect for Dr. Codd, who came up with the relational model. But databases make great servants and horrible masters. When you're asking the databases to drive the application, you're asking for problems. Databases are great for expressing the properties of entities: data, in other words." - Hal Helm

I never really understood what Hal meant by this comment. How can an application that relies so heavily on data access not be so reliant on the database that serves it?

I was running over some of the source code in Mango Blog, and started to become clear. The code below is a simpler example that I knocked up.

[More]

Create an Origami CD Sleeve

Recession hits web industry

funny captions welcome

Let Your Clients Reload Their Fusebox Application

At some point you might need to give your client the ability to reload their fusebox application (for example, if they have the ability to add new content).

Try using this in your code:

<cfset xfa.reinit = "&fusebox.loadclean=true&fusebox.parseall=false&fusebox.execute=true&fusebox.password=" & FUSEBOX_PARAMETERS.password>

Admittedly this is nothing new, but I like the fact that it calls in the password parameter from the fusebox config file. This will obviously help with code management.

Should I Iterate over a Transfer Object?

I'm faced with a challenge; I'm using the list() function in transfer to return a query of all items, in this case comments, for display. These comments belong to parent objects - blog entries - which I need to retrieve and display in the list.

This is the solution I've managed to come up with so far :

<cfset commentList = application.transfer.list("blogComment", "posted", "false")>
<cfoutput query="commentList">
<cfset thisComment = application.transfer.get("blogComment", commentId) />
#thisComment.getParentBlogEntry().getTitle()#
</cfoutput>

What this does is return all comments as a query list, which is then looped over to get and display the related blog entry title.

My concern is that when the application scales, and there could potentially be thousands of comments, will this repetition cause a performance issue? is there a better way to get a parent object through a transfer list?

Take screenshots on your Iphone / iPod Touch

Not quite sure how or why this is useful, but included in the 2.2 update for the iPhone/iPod is the ability to take screen captures of your iPhone/pod.

To take advantage of this feature, press both the hold and menu button whilst your device is active. You will hear a familiar click (if you use iSight) and the picture will be saved into your photos area

Any suggestions for usage are welcome. The only one I've come up with so far is sharing / storing maps via google maps

[More]

Set Up Your Web Development Environment on Mac OS X Leopard

First off, a massive thanks to Nick Tong for helping me with my transition to a Mac, and answering some seemingly dumb questions.

If you're new to a Mac, you're probably feeling the "parralell dimension" syndrome. Getting to grips with general tasks seems daunting enough, and even touching on your local development environment is a far off dream. Here are a few tips for setting up your dev environment that I wish I'd known before :

[More]

Stop / Start / Restart ColdFusion on Mac OS X Leopard

Standalone server :

sudo /Applications/Coldfusion8/bin/coldfusion start
sudo /Applications/Coldfusion8/bin/coldfusion stop
sudo /Applications/Coldfusion8/bin/coldfusion restart

JRUN server :

sudo /Applications/JRun4/bin/jrun -start cfusion
sudo /Applications/JRun4/bin/jrun -stop cfusion
sudo /Applications/JRun4/bin/jrun -restart cfusion

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner