All posts by ajohnson

HTTP Testing Tools

After Ray mentioned the CFUnit Testing Components from the DRK today in our development meeting, we got around to talking about automated testing of websites. David mentioned httpunit as one option (you can see a couple examples of how it might be used here). Looks like Cactus might also be an option, althought it appears to be Java specific and aimed more at the testing of the components of a website (EJBs, Taglibs, Servlets) rather than the end result (HTML). Does anyone have any experience with these tools? Do you use other tools?

CFX_LUCENE

I mentioned Lindex (described as a “… high performance, full-featured text search engine that allows developers to create document collections for easy indexing and quick searching” two days ago. After inspecting it a bit further, it looks like it offers an interface for developers to create and maintain Lucene indexes using ColdFusion (and I’m guessing allows them to search indexes as well), which is a nice feature.. I’d love to see it.

Anyway, inspired by Lindex, tonight I hacked together a Java CFX tag that closely mimics the the <cfsearch> tag using Lucene as the search engine. You can download the Java source here [ update 11/04/2003: Nick Burch from torchbox.com sent me an updated version that “behaves better under error conditions and … the command line debug now works“, thanks Nick!, clicking on the ‘lucene.java’ link above will download the updated version ].

To compile it, you’ll have to add both the cfx.jar file (usually in \CFusionMX\lib\cfx.jar) and the lucene.jar (get yours here) file to your classpath manually or specify them at compile time. If you’re compiling from the command line, it might look something like this:

$ javac -classpath c:\cfusionmx\lib\cfx.jar;c:\lucene\lucene.jar lucene.java

After you compile the class, you’ll need to

a) copy it to a directory that ColdFusion is aware of (ie: /cfide/administrator/ –> Java and JVM –> Class Path)

b) add the lucene.jar to the Class Path mentioned in ‘a’

c) register the CFX in the ColdFusion Administrator (/cfide/administrator/ –> Extensions –> CFX Tags. Click on ‘Register Java CFX’. The tag name should be ‘cfx_lucene’, the class name should be ‘lucene’.

d) restart CFMX.

e) and finally, create a .cfm page and add this script:

<cfx_lucene
  query=”r_query”
  indexName=”C:\hosts\cephas.net\wwwroot\blog\index”
  startIndex=”1″
  maxPage=”10″
  queryString=”java”>

The above script presumes that you have a Lucene index already created in the directory ‘C:\hosts\cephas.net\wwwroot\blog\index’, is looking for the keyword ‘java’, and will return a ColdFusion query object to the template with the columns ‘title’, ‘url’, and ‘summary’.

To see the results, you can dump the CFDUMP tag:

<cfdump var=”#r_query#”>

Caveat: It’s 1:42amEST so I’ve done no testing on it and it has no interface (like I’m sure Lindex does). Use at your own risk. If you do use it, please keep my name/email in the source somewhere and remember to thank Joe for the idea. Enjoy!

Biological Computing

Jason Kottke and a couple other people blogged Eric Bonabeau’s talk on Biological Computing using Hydra. Biological computing is an amazing concept. Seems like we programmers spend 99% of our time creating ‘palaces of abstraction’; (to steal a phrase from Josh), reducing the world to manageable bits. Biological computing lets all that loose… Build it so that you don’t have control. Add two parts of this and three of that and see what happens. Fascinating.

The Day I Turned Uncool

Finished “The Day I Turned Uncool” [official site] [amazon]by Dan Zevin last night. Dan is from Jersey, now resides in Cambridge. 192 pages of fun. Read it if you’re starting to realize you’re not 21 anymore.

On another (completely and totally unrelated) note, I started reading “Ghandi’s Truth: On The Origins Of Militant Nonviolence” [amazon] tonight, a book by Erik Erikson (a resident of Stockbridge here in MA for a time). It is described aptly in an Amazon review as “…an introduction to the challenges of poverty, religious difference, and ethnic tensions we all must accept and try to deal with as we head into the everchanging 21st century.

All this and I’m cognizant of Geoff’s post a couple days ago about Goog and off-topic posts. I really enjoy reading Goog and I think it’s a great tool (one obviously not written in a short weekend). I was not one of the people who emailed him complaining that there were too many posts not related to MX technology. With that said, I think that Goog’s primary benefit is not that I can see what things other people are doing with MX technology… Go subscribe to an email list if you want announcements, bug fixes and people talking about the nuances of the ‘this’ scope versus the variables scope or go get yourself a RSS reader and compile your own list of interesting blogs. I for one enjoy pseudo off-topic posts. Anywho…

lindex

The new DevNet Resource Kit on Macromedia.com contains a utility called lindex (supposedly short for Lucene Index), allowing developers to create full text searching applications using ColdFusion on any platform that supports Java… very cool.

I’m relatively certain it’s been discussed to death before, but why charge for this kind of stuff? The lindex component above wouldn’t be that hard to do and was probably hacked by Christian Cantrell in his spare time for fun… give it away. Macromedia isn’t in the business of selling tutorials and snippets. They sell boxed product last time I checked. Anyway…