All posts by ajohnson

.NET code generation

Short article on .NET code generators: .NET code generators enable rapid application development. Only one tool is covered, “DeKlarit”, which you can view a nifty Flash demo on here.

I used the wsdl tool yesterday to generate a C# web service client stub, how handy is that tool? The command line switches allow you to customize the namespace, the generated file name, the name of the key to retrieve from the config file for the webservice endpoint, and the language (C#, VB.NET)… etc…

> wsdl /urlkey:name_of_my_key /n:com.mypackage /o:FileName.cs /l:CS http://hostname/path/mywebservice.asmx

You can then start using the generated class in your code immediately. Very cool.

Lucene Index Browser

From the lucene-user list today: Lucene Index Browser: Luke is a handy development and diagnostic tool, which accesses already existing Lucene indexes and allows you to display their contents in several ways:
· browse by document number, or by term
· view documents / copy to clipboard
· retrieve a ranked list of most frequent terms
· execute a search, and browse the results
· selectively delete documents from the index
and more…

Jakarta Latka

I have a peculiar interest in testing tools… I’ve mentioned JMeter (which is more of a stress testing tool) a couple times before, I just found a new one on the Jakarta site call Latka, which “… is a functional (end-to-end) testing tool. It is implemented in Java, and uses an XML syntax to define a series of HTTP (or HTTPS) requests and a set of validations used to verify that the request was processed correctly.

The cool thing about Latka is the non Java part… anyone that understands a little XML can create and/or edit an xml document that defines an ‘test’ and then run it using the Latka engine. So for instance, here at Mindseye our QA team is composed of invididuals with a small amount of programming experience. They could easily create a Lakta test using the xml syntax and then automate the testing of various applications using Latka. Still not convinced, here’s a sample test:

<?xml version=”1.0″ standalone=”no”?>
<!DOCTYPE suite PUBLIC “-//Apache Software Foundation/DTD Latka Test Suite 1.0/EN”
   “http://jakarta.apache.org/commons/latka/dtds/1.0/suite.dtd”>
<suite defaultHost=”http://www.mindseye.com” label=”mindseye”>
   <request path=”/whymindseye/default.cfm” label=”why you should choose mindseye” method=”get” secure=”false” followRedirects=”true”>
      <validate>
      <statusCode code=”200″ />
      <regexp pattern=”What drives landmark companies” />
      </validate>
   </request>
</suite>

Save this to a file and then type:

latka file:PATH_TO_FILE

from the command line. It should check that the page http://www.mindseye.com/whymindseye/default.cfm returns an HTTP status code 200 and that it contains the phrase “What drives landmark companies”.

Unfortunately, Latka doesn’t appear that anyone is working on it (at least since last July).

On a related note, I also found this Slashdot discussion on “Testing Products for Web Applications?“.

100 New Java Performance Tuning Tips

Java Performance Tuning author Jack Shirazi attended 8 J1 performance sessions and published a big bulleted list with 100 new insights gained from these talks, from trivial stuff like ‘use lazy loading’ to cool stuff like ‘Chose optimistic concurrency for CMPs with read-mostly access’ and ‘in servlets, set content length; for JSP pages, set UseOutputStreamSize’.” Read about here. [via theserverside.com]

Calling Java Constructors with ColdFusion

I mentioned yesterday that Sam posted some great code that lets you upload files to ColdFusion without using CFFILE. His code can be shortened considerably with the use of the init() method:

<cfscript>
fileAsString = “”;
fileReader = createObject(“java”, “java.io.FileReader”);
fileReader.init(form.upFile);
bufferedReader = createObject(“java”, “java.io.BufferedReader”);
bufferedReader.init(fileReader);
try {
   do {
      fileAsString = bufferedReader.readLine();
      processLine(fileAsString);
   } while (true);
} catch (coldfusion.runtime.UndefinedVariableException e) {
// this indicates end of file, ok to ignore error
}
</cfscript>

Basically, you use the CreateObject() function to get a Java object. At that point, you can call static methods on the object or you can use the init() method to call the constructor of the Java object, which I’ve done above, ie:

// get a FileReader object
fileReader = createObject(“java”, “java.io.FileReader”);
// call the FileReader object constructor
fileReader.init(form.upFile);

If you’re curious about this kind of stuff, you should check out the article on Java, ColdFusion MX and Lucene integration I wrote for the July issue of ColdFusion Developer’s Journal, due to hit the stands anytime now.