Wednesday, July 30, 2003

Validating HTML/XHTML behind a firewall

Someone asked the question on the evolt mailing list about validating XHTML behind a firewall. The most popular way to validate XHTML is using the w3c HTML validator, however the only options are to enter a url, or to upload a file. That can be cumbersome, so steve clay wrote a handy php script that crawls a url and uploads the file then displays the results. I ported his script to ColdFusion below. It works great in CFMX, but there are issues in CF5 (cfhttp is url encoding the charset). You might also want to wrap a html tags around this code.

Ported To ColdFusion by Pete Freitag
Based on
License: (GPL) 
<form action="#CGI.SCRIPT_NAME#" method="post">
	<label for="location">Validate Local URL:</label>
	<input type="text" name="location" value="http://#CGI.SERVER_NAME#/" />
	<input type="submit" value="Validate" />

<cfif IsDefined("form.location")>
	<cfset tempFile = GetTempFile(GetTempDirectory(), "validatorFile")>
	<cfhttp url="#form.location#" method="get" path="#GetTempDirectory()#"
		file="#GetFileFromPath(tempFile)#" />
	<cfhttp url="" method="post" resolveurl="yes">
		<cfhttpparam type="formfield" name="charset" value="UTF-8">
		<cfhttpparam type="formfield" name="doctype" value="Inline">
		<cfhttpparam type="formfield" name="ss" value="1"> 
		<cfhttpparam type="formfield" name="verbose" value="1">
		<cfhttpparam type="file" file="#tempFile#" name="uploaded_file">
	<cffile action="delete" file="#tempFile#">
Query of Query in CF5 bug

If you are doing a QofQ's in CF5 with an ORDER BY, the columns in the order by statement must be in the SELECT statement, otherwise it throws an exception. So if you have a column that your only using for sorting you must add it to the select statement, even if you don't need it in the resulting query.

This bug does not exist in CFMX thankfully, I found it while testing an application developed with CFMX in CF5.

Wednesday, July 23, 2003

New products at CFDEV

We have two new products at cfdev, one has already been released, the other is in beta.

The first is a spell checker for flash text boxes, it was released a few weeks ago.

The second product, which I have been working on for the past few months is a ColdFusion Code Review tool. It is a ColdFusion application that runs through your code and finds security, performance, accessibility, and other issues and then generates a report. Each rule has a document online (that anyone can use) that explains how and why to fix the issue. Check those out here: there are over 30 rules currently, and you can easily write your own (4 lines of CFML code).


I haven't had an RSS feed for a while now, I'm still figuring out what I want to do about it. The most probable action will be to setup my own site. I was going to upgrade to blogger pro, but you can't buy it now for some reason, their site has said check back in a week for the last 3 months.

We do incidentially now have a RSS feed for the news section on cfdev. It's RSS 2.0.

Wednesday, July 16, 2003