Friday, January 03, 2003

Getting IE 6 windows to preserve status bar

This isn't so much a CF tip, but it's one that many CF developers may appreciate. In IE 6 (installed on one of my WinXP machines), I found that when I opened new windows the "status bar" (where we can see the URL of a hyperlink by mousing over it) would not be preserved. I'd have to turn it on with View>Status Bar, but had to always do that. It wouldn't preserve it.

I found a solution for it at a Univ of Wisconsin site. Hope you find it useful, too.

Tuesday, December 31, 2002

Bug in CFHTTP's FirstRowAsHeaders when COLUMNS not used

There appears to be a bug in the function of the new FirstRowAsHeaders attribute for CFHTTP. It's not working when the COLUMNS attribute is not specified, which is counter to the indication of how it should work in the docs.

CFHTTP adds a new firstrowasheaders attribute for working with reading in of text files. This is useful in case the firstrow of a text file (such as a CSV or comma-delimited file) doesn't have a list of column names. By adding the NAME attribute, CFHTTP will read the text file and turn it into a CF query result set. (The ability to read in text files and turn them into queries isn't new, of course: just the ability to indicate FirstRowAsHeaders.)

But the docs (CFML Reference) say that if it's set to "no" then 'If the columns attribute is not specified: processes as data, and generates column names; for example, "column_1"'

That would suggest that CF would create some column names automatically, which would be cool when one has a very large number of columns in the file being read. But I just tried it and simply got the error "The column name "1" is invalid." because that was the data in the first column of data in the first row.

It's as if it's ignoring the firstrowasheaders="no" attribute and trying to read the first row data as the column names. That attribute is indeed working if I add a COLUMNS attribute and give it column names, but again the point is that one shouldn't have to according to the docs.

I just reported this on the cfbughunt.org site and added a comment about it to the livedocs.macromedia.com site for that page in the reference manual.

BTW: I've found a work-around. If you know the number of columns in the file being read, you can just run a little loop to create the column names automatically, as in:

<cfset colnames="">
<cfloop from="1" to="7" index="i">
<cfset colnames = listappend(colnames,"column_"&i)>
</cfloop>

Then use that created "colnames" value in the CFHTTP as COLUMNS="#colnames#". Unfortunately, you have to know exactly how many columns to use or a failure to specify the right amount will get an error when CF tries to read the file and matches the number it finds against the number of columns you generated. It would be nice if it just did itself as it seems it's supposed to.

New Java Blueprints Application: Adventure Builder

Some may know that Sun came out some time ago with a "blueprint" application for demonstrating J2EE practices, called the Java PetStore. Many have taken it to be a model J2EE app (perhaps exceeding its real purpose as just an example), and some have even poked at it for not being scalable, etc. (which never really was its intention.) It was just an example app showing several J2EE practices. Anyway, Macromedia modelled their PetMarket after it to show how Rich Internet Apps could be built to create a better user experience for providing the same kind of pet store.

Well now Sun's coming out with another one, called the Adventure Builder. Available for download from the Java BluePrints Program, the Java Adventure Builder Sample Application v1.0 is the first release of the new Java BluePrints application. This early access release is a native J2EE 1.4 application that runs on the J2EE 1.4 Beta SDK. It showcases Servlet 2.4, JSP 2.0, JSTL, and web services. Of course, the Servlet 2.4 and JSP 2.0 specs are the next ones to come out and many servlet engines (including JRun 4.0 and therefore CFMX) don't yet support them. Also, it should be noted that the app itself is an "early access" version.

The new app is designed to be easy to understand and includes a new mini J2EE application that is even smaller and simpler, for folks really just getting started with J2EE. Download it from http://developer.java.sun.com/developer/releases/adventure/. And read the documentation at http://java.sun.com/blueprints/code/adventure/1.0/docs/index.html.

Will someone be coming up with an RIA of the Adventure Builder or the "mini application"? We shall see.

$10 computer books from APress (overstock)

Folks, some of you may know APress as a small but feisty publisher of computer books. I just noticed they're having a $10 overstock sale on 17 items, including some SQL Server, Linux, and other topics that may interest CFers. Check it out. If the link fails and/or the sale is over, still check them out at apress.com. They have some interesting books and often off-beat titles covering topics that other publishers may not.

Monday, December 30, 2002

Expecting custom tag queries in the DWMX Bindings tab

Someone recently asked me:
Do you know of any way to make cfquery/recordsets contained in a custom tag show up in the bindings panel on the calling page in DWMX?

The bindings tab in DWMX lists any queries on your current page, among other things, because DWMX looks at your CF code and pulls out the CFQUERY tags and contents and renders them in the bindings tab for various purposes.

Sadly, though, the idea of expecting it to find such queries in a custom tag won't work and if you think about it, it's technically correct that it not do so on a couple of levels.

First, the bindings are for things available in the current page. Technically, because custom tags have isolated scopes, a query in there would not really be available to this page. One could argue that if the custom tag set the query to the caller scope, it would indeed then be available to it, but that's a bit much to expect DW to figure out. :-)

But there's still more to it than that. As further proof of the challenge for DWMX, note that it also can't offer the "Open Document" option as it might if you right-clicked on a CFINCLUDE or CFMODULE. In those cases, at least you could open the file in question and see the bindings for it rather readily. But again DWMX can't even know what custom tag file to point to.

With the others, it can deduce the file name because it's provided as either a relative or absolute path/name. With a custom tag, it's really a run-time directive and so can't be determined at author time. The custom tag could exist in the current directory, the cfusion\customtags directory, or a subdirectory of that (or perhaps still another directory if the admin has setup alternative custom tag directories).

It's just impossible to expect DWMX to be able to figure it out.

PS Long time, no see to my blog fans. Just a busy holiday season with some pressing work challenges as well. Hope to be back in the swing of things now.