[Looking for Charlie's main web site?]

Need to know how long your ColdFusion instance has been up?

Note: This blog post is from 2006. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
If you've ever needed to know how long your CF instance has been running, did you know there's an incredibly simple solution? It's not really obvious, and in fact it may not work on trial editions of ColdFusion (for reasons explained below), but it's worked on the Enterprise and Developer editions that I and others have tested it.

Some may have noticed that there is a server.coldfusion.expiration variable (one of many read-only variables in the server scope, within the coldfusion structure). According to the docs, it's supposed to represent the date on which a trial edition of CF will expire.

But some have found (and I've confirmed) that on non-trial editions it instead reports the time that the server started. Try it youself:

<cfoutput>CF start time: #server.coldfusion.expiration#</cfoutput>

It'll be a date, but is it in the future? or the past? Assuming it's the past, and you're not running on a trial edition, then it's likely the time your server had started. If you could restart your server and test again, you'll know for sure. :-)

Better formatting of the result

Now, if you want to easily determine how long the server has been up, just use the datediff function to report how many minutes there are between the time reported and the current time:

<cfoutput>CF uptime: #datediff("n",server.coldfusion.expiration,now())#</cfoutput>
Now, that number will be in the thousands after only one day. If you just want to better format the number of minutes, you could use the numberformat function which (without any formatstring) simply adds commas where they would be appropriate:

<cfset uptime = datediff("n",server.coldfusion.expiration,now())>
<cfoutput>CF uptime: #numberformat(uptime)#</cfoutput>

But even better, you could use one of the nifty functions available at the cflib.org that could help present the result minutes in terms of days, hours, and minutes (duration()). Assuming you included the latter in your page, you could then output the value as:

<!--- assuming you have included or pasted the duration UDF --->

<cfset uptime = duration(server.coldfusion.expiration,now())><br>
<cfoutput>CF uptime: #uptime.days# Day(s) #uptime.hours# Hour(s) #uptime.minutes# Minute(s)
<br>CF started on #dateformat(server.coldfusion.expiration)# at #timeformat(server.coldfusion.expiration)#
</cfoutput>

I may put together a UDF to submit to the cflib to pull all this together, and which also checks if indeed the server being checked is a trial edition, etc. But I'll look forward to hearing people's feedback first.

Other options

Of course, it's worth pointing out that there are of course many tools that will monitor a server's uptime by watching it externally. It may also be possible to ask the operating system to report how long a given process or service has been running. I'll leave that for others to investigate.

Finally, I'll point out that there is indeed a tag in the Adobe Developers Exchange, CF_UpTimeMonger, that purports to help detect server uptime and says it works even for CF 4 and CF5. I have not explored it.

Tool for converting your HTML/CFML (or ASP.NET, PHP, JSP, or XML) for display in browser

Note: This blog post is from 2006. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
Have you ever been annoyed when some web form (feedback page, blog comment field, or webforum) fails to properly convert your CFML or HTML so that it's displayed? Does it just disappear? Many know the solution is to convert the tag brackets to their equivalent character entities, > and <), but it's a hassle to do that manually! Last year I wrote about a free web-based tool in another blog of mine, tipicalcharlie.com, and as the challenge came up today on a CF list, I thought I'd point it out here:

http://www.tipicalcharlie.com/convert_markup_for_display.htm (Update: tipicalcharlie domain is no more, but page recovered using Archive.org.)

Note that this is not a tool you need to download and install; it's a hosted tool, just a simple but useful web form that converts whatever code you paste! You can then just copy the result and paste it into your desired form. Enjoy!

Don't miss out on the many powers of the Google Toolbar (some hidden buttons, some new context menu

Note: This blog post is from 2006. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
Here's a blog entry from another site on a topic that I think some of you may enjoy very much:

"Don't miss out on the many powers of the Google Toolbar (some hidden buttons, some new context menu options, and more)"

http://www.tipicalcharlie.com/google_toolbar_1.htm (Update: tipicalcharlie domain is no more, but page recovered using Archive.org.)

Now, if you look closely at the URL, you'll see it's got my name in it. :-) And indeed, it's mine. I started the blog long before this one and in it I share all manner of tips related to computing (not CF-specifically).

I'm always torn about whether to post some topics here or there. I try not to cross-post much at all (and not even to blogs of other folks) unless it's something that I think you might really appreciate and otherwise miss. Such is the case here.

If you like the stuff there (see the categories, as there may be past entries you'd not want to miss), be sure to signup to receive new entries by email (as you can do here), or add it to your RSS reader of course. Not everyone uses them yet. Indeed, see the entry I did there on how to get notification by email of new entries from any blogger who may not offer their own email subscription feature.

(Update: Sadly, squeet (a tool to send RSS feeds by email) is no more. But there are other alternatives, that I track in a category of my CF411 site: http://www.cf411.com/rss_email.)

I-Spry 8: Spry 1.3 Released: Here's my take on what's new

Note: This blog post is from 2006. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
Exactly one month after releasing Spry 1.2, the Adobe Spry team has responded to user feedback and also slipped in some new features in a new 1.3 preview release.

As part of my ongoing series on Spry, here's my take on what's new. The primary new feature set is "Spry Effects, for introducing animations and color effects to your pages." While it may sound like just eye candy, there are some useful things. More on that below.

There is also an interesting new 2-selects related demo (more below) and various new features to existing things, like new methods to manipulate the accordion, fixes to various aspects of the Ajax (SpryData.js) functionality, as well as support for new setup/finish callbacks for the effects. See the site/docs for more on those. Here, I want to highlight the 2-selects related demo and a brief discussion of the effects.

Nifty 2-selects related demo

One thing that's easily missed (not highlighted anywhere) which may appeal especially to CF developers is a new 2-selects-related demo, though they call it a "master detail" demo instead. It shows how to make 2 selects relates data between 2 datasets. The code is remarkably easy, as explained in the one paragraph there and shown in the few lines of code which you can see doing a "view source" there. Again, this is the beauty of Spry: those few lines of code in the browser are indeed all that you need to write, and all that the browser needs to execute.

For those new to Spry, note that the data can come from any file of XML data or template that generates it, as requested in a line of Javascript (the only javascript code you need to write on the page):

I'll also remind those new to Spry to check out all the entries in this series on Spry, as well as my Spry Compendium of resources to help get you started.

The new effect library

The Spry Effects are the following:

  • Appear/Fade Makes an element appear or fade away
  • Highlight Flashes a color as the background of an element
  • BlindUp/BlindDown Simulates a window blind, up or down, where the contents of the affected elements stay in place
  • SlideUp/SlideDown Simulates a window blind, where the contents of the affected element scroll accordingly
  • Grow/Shrink Increases/reduces the size of the element
  • Shake Moves the element slightly to the left, then to the right, repeatedly
  • Squish Reduces the element to its top-left corner and disappears

Some will find more value in various aspects than others. Let's keep in mind that the focus for Spry is on non-technical HTML developers, to ease access to not just Ajax-style development but also the DHTML-based (CSS, Javascript, and HTML) visual components that often go along with those. A key point is that these changes in screen appearance happen without a browser refresh. An interesting point they make is the following:

As with previously-released Spry datasets and their accompanying widgets, we designed Spry effects to be easy to implement on the page while letting the framework do the real work. No new tags or strange syntaxes are required. Designers with a rudimentary understanding of JavaScript can easily implement any of these effects. More advanced users can combine base effects to create more complex and sophisticated effects.

The following shows an example of a basic effect :

onClick="Spry.Effect.AppearFade('target',{duration: 1000,from: 0,to: 100, toggle: true;});"

You can apply an effect to almost any page element, and the code is easy to understand and edit. With the trio of Spry framework features--datasets, widgets, and effects--Adobe hopes to provide designers and developers the tools they need to easily create Ajax-enabled pages.

Why Is Adobe Re-inventing the wheel on effects? Why not just use an existing library?

Sure, there are other libraries that do more, but at least Adobe is working to add more and more. In fact, some may wonder why they are bothering to create their own when there are those other packages. They now specifically address the question of why they don't just integrate with some existing library, like Scriptaculous, and instead are using them as a model while keeping focused on their own vision.

All that said, I could even see CFML folks taking ready advantage of things like the blind, shrink/grow, slide, and squish, such as to add online help on a page that appears and disappears. Again, sure, if you know how to do CSS and/or javascript yourself, you can do it yourself.

I must admit that when shown on this combo page, I'm left wondering how the slide and blind differ from each other (and even the accordion). :-) If you view the demo that works with images instead, the difference becomes more apparent.

The effects are enabled in a new .js file (SpryEffects.js), but beyond that and 3 others it's still quite a light-weight framework.

Other Comments

Note that they indicate in the readme that they've removed the docs from the download, and they are available now only online. Still, it seems most of it has just moved to an articles directory, and there are of course still the reamdme, changelog, and other HTML files in the download.

Finally, they do clarify (frequently) that this is pre-release software, so jump on board and be a part of making it happen--but have patience that things will change as they learn and evolve the product.

Using the Flex Builder CF Wizard when deploying on a remote server

Note: This blog post is from 2006. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
If you try to use the Flex Builder CF Wizard, you may get tripped up by trying to deploy the resulting SWF (with its communication back to the CF Server) on a remote box (where that CF Server would live). It's easy enough to do, but it may fail to work, if you're not careful about how you configure things while running the wizard, to indicate that remote server URL. It was causing quite a bit of consternation for some, and finally Ken Reiss has observed the solution and blogged about it:

http://www.kenreiss.com/blog/index.cfm/2006/8/10/Flex-20-with-CFMX-702--SUCCESS

I just think this is something that others may trip over in the future and not find readily, so I want to point it out to those that I can.

Using SeeFusion and FusionReactor with BlueDragon

Note: This blog post is from 2006. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
Folks often ask me whether I know if BlueDragon can run either of the two performance analysis tools, SeeFusion and FusionReactor. The answer is a qualified "yes". They will run (currently) on the J2EE edition of BlueDragon, but not the standalone editons, BlueDragon Server and Server JX.

Both SeeFusion and FusionReactor are based on an underlying java-based mechanism called Servlet filters. On the surface, it might seem that things should work since the standalone versions of BD are built atop ServletExec (just as CFMX standard and enterprise standalone editions are built atop JRun).

Sadly, the edition of ServletExec that New Atlanta chose to bundle under BD (a choice made a few years ago) does not support servlet filters. ServletExec itself has indeed supported servlet filters for a few years; it's just that New Atlanta never had any motivation to update the version that was underlying BlueDragon. Who knows if that may change in the upcoming BD 7.

The good news is that it seems you can indeed use both SeeFusion and FR with BD/J2EE. I've previously done the former, and my reading of the FR docs for now suggest it would work fine. The installer guide for FR has a section on "manually installing FR", and where it discusses the directories to be updated for working with Tomcat and Jboss, it's really the same info that would apply to BlueDragon deployed on those servers (or any like them). (I've tried it tonight and hit a snag, and the guys from FR are working with me to get through it. I'll update with a comment here whatever I find.)

Finally, of course, BD.NET doesn't support servlet filters at all, so you can't use SeeFusion or FusionReactor on that product.

Flex 2 / CF Presentation by Ben Forta, now online

Note: This blog post is from 2006. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
If you're looking for yet another avenue of introduction to Flex and its intergration with CF, particularly a free one-hour Breeze session, check out the recording of BEn's presentation from a couple weeks ago:

http://www.adobe.com/cfusion/event/index.cfm?event=list&type=ondemand_seminar&loc=en_us

On that page, select ColdFusion or Flex from the product list on the right, and on the resulting page, don't be thrown off by the title, "Government: Building Rich Internet Applications". It's of value to all viewers.

As Ben is wont to do, he avoids being powerpoint-centric and jumps right into some generic Flex demos first, and then 20 minutes into it starts to really talk about Flex/CF integration. There's about 5 minutes of discussion after that and then he jumps into code-centric demos, showing the CF-related integration in some flex code and in the Flex Builder, including the wizard. By about 45 minutes he instead starts coding Flex/CF integration manually within the builder, which some may find compelling. There is Q&A throughout (which as always in Breezo's is a bit of a struggle, torn between answering questions and staying on topic) and a lot of Q & A at the end, which many may especially enjoy.

Determining Your JDBC Driver Version: Pick from a couple of ways

Note: This blog post is from 2006. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
Following onto my 2 previous entries related to updating JDBC drivers in CFMX 6 and 7, some readers may appreciate a little more help on the matter of determining just what version of the drivers they do now have installed.

This news has been shared in various blog entries over the past couple of years. I'd like to reprise them here for your edification. (Note that while they may show how to look at some particular driver, like SQL Server, you can--and would need--to change what they show to look at whichever driver you are interested in. More on that below.):

So a couple more thoughts on all this.

And about the last two options above

First, in the case of the second two options above, note two things:

  • Those last two links are versions of each page as recovered using the good 'ol internet archive/wayback machine. For more on the value of this wonderful tool, see my post on that.
  • Note that those last two links make reference to files or folders under C:\CFusionMX\ or C:\CFusionMX7\ folders, reflecting the time they were written. For those on CF10 and above, you would look now instead under [yourcf]\cfusion\, or if using instances, [yourcf]\[yourinstance]\.

Finding the version of the driver YOU are using

Second, I said above that you would need to use the name of the driver you really mean to look at, which may be different than what their example show. For instance, Pete's code shows looking at the SQL Server driver, macromedia.jdbc.sqlserver.SQLServerDriver. So what if you're using the Adobe-provided Oracle driver? Or any other?

Well, some good news if you use an "other" driver type (where you choose that in the CF Admin DSN page), then you must provide the driver classname yourself. That would be the name to use.

But what if you one of the several other kinds of drivers listed on that page? CF doesn't show you the classnames it uses for that. (And I could not find it in several places I looked. More below.)

But again see Steven Erat's code above that listed several of the class names known at the time (and which still seem fairly accurate more recently).

And while there are still other places that clever readers may want to point out that may hold them, I could not find them in these places:

  • The DSN classname is not listed in the CF Admin page where you add/edit a DSN
  • The DSN classname is not not listed in the CF Admin "settings summary" page, even though that does offer useful additional info, like the underlying jdbc URL that CF builds, when using its built-in DB drivers
  • They classname is also not listed in the XML within the neo-datasources.xml or neo-drivers.xml files, if you know about them. There ARE classnames there, but you will see that if you look, for instance, at the SQLServer one, it does show a classname (in the "class" xml element). But it's just macromedia.jdbc.MacromediaDriver, not the macromedia.jdbc.sqlserver.SQLServerDriver used in the examples above.
  • They're also not listed in the "system information" page in the CF admin--the "i" icon in the top right--which shows the "CF Server Java Class Path". That does not list the class names for the Adobe-provided DB drivers, because they are instead all embedded in one jar, called macromedia_drivers.jar. Really determined folks may know you can unzip that and dig around and determine class names and paths, but I won't elaborate that here.

So it seems that for the built-in CF-provided drivers, you're best off just using the variations offered in those examples above (especially Steven's).

Hope all that help others as much as they have me over the years.

More charting power in CFMX 7 than you may have thought (old news to some, new to others)

Note: This blog post is from 2006. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
Did you know there's a nifty Chart Designer built into CFMX 7? While Webcharts has sat under CFMX's charting since 6.0, this designer tool is newly available in CF7 only, as the webcharts.bat file in the cfusionmx7/charting subdirectory. It allows you to create still more useful and attractive charts than are built into CFCHART, and then you can leverage them using CFCHART. For those who've followed CF7 closely, this is old news, but for those who are still getting up to speed in CF7, it may be quite newsworthy.

I'd like to point you below to a few references to learn more. First, here's a screenshot of what the tool looks like:

And here are some of the resources to help guide you, from blog entries to articles to the docs to podcasts. I'd also like to thank Dale Fraser of the CFAussie mailing list whose note today first clued me into this stuff. Enjoy:

Note as well that there is a pdf in that charting directory, a 35 page Designer User's Guide. And pay special attention to the available options in the designer under file>setup, in particular the 2 tabs, designer and server.

There is a more complete (125 page) WebChart Developer's Guide.

Finally, some other useful CF charting tips are available in a blog that was devoted to the subject, http://cfchart.blogspot.com/ . Though he only made entries June and July 2005, it's worth a look.

More on the new SpyAttributes feature of the"new" 3.5 JDBC drivers for CFMX

Note: This blog post is from 2006. Some content may be outdated--though not necessarily. Same with links and subsequent comments from myself or others. Corrections are welcome, in the comments. And I may revise the content as necessary.
In my last entry, I mentioned briefly the new "JDBC Spy" feature that's available in the new 3.5 JDBC drivers for CFMX. I want to point out some more info for those interested in investigating the Spy feature further.

First, notice that there is a site at the DataDirect site (from whom Adobe purchases the JDBC drivers):

http://media.datadirect.com/download/docs/jdbc/alljdbc/reference/spy.html

It discusses some additional attributes. And still more useful info is offered at another page on their site:

http://media.datadirect.com/download/docs/jdbc/alljdbc/reference/diagnostics2.html

This actually shows what the log of info would look like, if you want to decide first if its info is worth the bother setting up.

This other page also talks about ways to turn the spy logging on and off at runtime, using Java method calls. Perhaps someone with more familiarity with the underlying Java classes for these drivers can translate the code there into something we can use in CFML. (It's late, and I don't have the energy.)

As such, be aware that the spy feature could generate a lot of data, so you may want to consider creating two datasource for each DB you may want to monitor. Either rename them to enable whichever you want to be in effect, or change if your code lets you specify a DSN via a variable, you can change the value to the "spying" version when you need it.

I did test and determined that also you can just add/remove the connection string from the end of the JDBC URL (see the technote for more), and immediately the logging stopped against the datasource. As a trick, I stuck the connectionstring value into the "description" field of the datasource definition, to keep it readily accessible if I wanted to add it back. (See my previous entry for a warning about putting it into the ConnectionString field instead.)

Finally, I should clarify that this Spy feature is not to be confused with the much older (and more powerful) p6Spy project, which has gone from open source to commercial to kind of stagnant. It still has great use, and in fact has a useful related SQL Profiler that's worth looking at. Still more at http://www.p6spy.com/, and maybe I'll write more about it later.

More Entries

Copyright ©2025 Charlie Arehart
Carehart Logo
BlogCFC was created by Raymond Camden. This blog is running version 5.005.
(Want to validate the HTML in this page?)

Managed Hosting Services provided by
Managed Dedicated Hosting