August 30, 2002

More Google API hacks for Movable Type

I must try this some time a title related Google search appended after each blog post.

Posted by stuartcw at 06:35 PM | Comments (0)

Regedt32.exe

If Regedit is not working for you, try Regedt32.exe it has more options.

Posted by stuartcw at 04:25 PM | Comments (0)

August 29, 2002

GoogleShell

I got David Watson's GoogleShell working but I had to make a few changes. I removed the proxy settings as I don't need a proxy. I made the Google key a parameter, so that I could safely publish the working code and referenced the wsdl file from googe's site as I think the one included with the code is a beta version, at least that was what the error message told me. OK, I'm sold on SOAP being easy to use with Java now.
import electric.registry.Registry;
import electric.util.Context;

public class GoogleShell {

	public static void main( String[] args ) throws Exception{

		String key = args[0];

		// set proxy location and authentication credentials
		Context context = new Context();
		/* Set proxy if necessary..
		context.setProperty( "proxyHost", "your.proxy.here" );
		context.setProperty( "proxyPort", "8080" );
		*/

		// bind to web service whose WSDL is at the specified URL
		String url = "http://api.google.com/GoogleSearch.wsdl";

		IGoogleSearchService google = ( IGoogleSearchService ) Registry.bind(
			url, IGoogleSearchService.class, context
		);

		// invoke the web service as if it was a local java object
		String ret = google.doSpellingSuggestion( key, "Britney Spars" );
		System.out.println( "Spelling = " + ret );

		GoogleSearchResult result = google.doGoogleSearch(
			key, "Stuart Woodward", 0, 10, false, "", false, "lang_en", "latin1", "latin1"
		);
		for ( int i = 0; i < result.endIndex; i++ )
			System.out.println( result.resultElements[i].URL );

	}
}
Output was:
Spelling = Britney Spears http://www2.gol.com/users/stuart/ http://www2.gol.com/users/stuart/celtihs.html http://www.natural-metrics.freeserve.co.uk/ http://www.stuartwoodward.com/history.html http://www.stuartwoodward.com/ http://www.stuartwoodward.com/resume/ http://stuartcw.livejournal.com/ http://stuartcw.livejournal.com/calendar http://lists.w3.org/Archives/Public/www-international/1998JulSep/0052.html http://www.tokyopc.org/tpc/officers.html
Posted by stuartcw at 01:24 PM | Comments (0)

Postcards

BBC Written on a pre-text

By 1908-9, 860 million postcards were sent through the post in the UK each week. That's more than double the number of text messages sent today.
That's an amazing amount of postcards considering the population. But then again, as Tim said, the mail was delivered 4 times a day then..

Posted by stuartcw at 09:48 AM | Comments (0)

August 28, 2002

Clover : Code coverage tool for Java

I must try this..I must try this...I must try this

Clover is a code coverage tool for Java. It discovers sections of code that are not being executed. This is used to determine where tests are not adequately exercising the code.

Posted by stuartcw at 11:13 AM | Comments (1)

August 27, 2002

Java Cannery

Java Cannery fixes all that. It's a pure-Java application that decompiles and recursively scans a target class for all its dependencies and packages them up into a jar file for you.
Posted by stuartcw at 05:30 PM | Comments (0)

Mysterious IOException

A java servlet on machine A could not connect to a web server on machine B. It could however connect to a web server on machine C and it was possible to connected from A to B from the command line and brower so we know that A can see B but somehow the Java process couldn't.

In the end the problem was that Java internally caches the DNS lookups and the host file had changed since the program had started running. The solution was to reset the JVM. (Thanks to DanL for figuring this one out.)

Posted by stuartcw at 05:29 PM | Comments (0)

550 : Access Is Denied"

If you get this error message "550 : Access Is Denied" When Attempting FTP PUT Command. Click the link to find MS knowlege base articleQ201779.

This is not the first time that this setting has had me stumped while trying to set up FTP to access to a Microsoft IIS server. The required setting is hidden a level or two down and is not some that you remember after six months.

Posted by stuartcw at 04:08 PM | Comments (0)

DATA MODEL PATTERNS

To read: DATA MODEL PATTERNS: Conventions of Thought a database modelling book.

Posted by stuartcw at 03:25 PM | Comments (0)

Open Source

Found a mention of ProGuard, an open source code obfuscator and shrinker, on Rebelutionary

Posted by stuartcw at 01:24 PM | Comments (0)

August 26, 2002

Standing on the feet of giants

I was saying to Tim and Dan the other day about how I thought it would be difficult for a single developer to keep up with the all the Jakata project and Java standard libraries but maybe it is very important to make the effort to do this, as this quote from Tony Bowden indicates:

A Perl programmer, for example, who has a deep knowledge of what's available on the CPAN and who has the basic competence to write the glue code that ties together 5 or 6 different modules will, for 90% of the projects in which Perl is used, be at least 10 times more productive, and produce much more maintainable and accurate code, than an 'expert' Perl programmer who knows enough to write all this himself (and so does so).

Posted by stuartcw at 11:06 AM | Comments (0)

JUnit 3.8 Released

JUnit 3.8 has been released. Download here

Posted by stuartcw at 10:53 AM | Comments (0)

August 23, 2002

weblogs.com

I just realized pinging weblogs.com is not enabled by default and that the name of this blog on their list was the really anonymous "Tech Blog".

Posted by stuartcw at 03:33 PM | Comments (0)

Blogrolling

Wow! A free blogroll site. I wonder if Americans realize how close blogroll is to bog-roll.

Posted by stuartcw at 03:25 PM | Comments (0)

Test Cases are failing!

I had a sudden panic when my JUNIT test cases failed but later figured out it was a configuration error in the test case setup. Unfortunately since it was test code it assumed the configuration would be correct. Production code tends to be more forgiving as it reports the errors more fully but the test code quick and dirty and fails nastily when it hits something it can't cope with.

Posted by stuartcw at 01:31 PM | Comments (0)

JPublish

JPublish is a powerful web publishing system which uses the Velocity template engine in combination with a content management framework to build dynamic web sites. JPublish was designed to ensure a clean separation of content, programming logic, and presentation logic.
Posted by stuartcw at 11:53 AM | Comments (0)

Coding Java is just like writing a trashy Western novel

A very amusing "java tutorial that shows you why Coding Java (or any other OOP) is just like writing a trashy Western novel."
public void tieUpDamsel (Humans damsel) { 
    this.damsel = damsel; 
    numberOfDamsels++; 
    System.out.println("The Villain has tied up " + damsel.whatIsYourName()); 
} 
Via Tony Bowden
Posted by stuartcw at 11:36 AM | Comments (0)

August 22, 2002

IP addresses

It's amazing how IP addresses still manage to get embedded in all sorts of config files. They cause no end of problems when servers change IP addresses! (Now I find that the IP addresses were in the HOSTS file because the servers were used at a demo and just connected together without DNS. Doh!). They remained there until the server was moved several months later...

Posted by stuartcw at 04:45 PM | Comments (0)

Tomcat Workers

I'm trying to figure out how to setup Tomcat Workers right now.

"A Tomcat worker is a Tomcat instance that is waiting to execute servlets on behalf of some web server. For example, we can have a web server such as Apache forwarding servlet requests to a Tomcat process (the worker) running behind it."

This Doc is the key doc for 3.2:
Tomcat - A Minimalistic User's Guide

It seems things changed a lot between 3.2 and 3.3. This is the 3.3 doc
Tomcat-Workers-HowTo.

OK, we figured it out. In the workers.properties file there are two default workers defined who happen to be named after the protocol that they use for communicating between Tomcat and Apache. So we made two more workers w1 & w2 and then changed the Apache configuration to use these two workers handle the different hosts instead of having all hosts handled by the same default worker.

The trickiest thing was the the default worker was named after it's protocol which looked like it was a protocol setting rather than a worker setting. The Tomcat configuration also had to be changed to support the extra port required by the workers.

As a result we have a much better knowledge of how the three config files work together.

Actually we didn't figure it out for several hours later. You have to make sure that the two Tomcats are really running separately by starting them up separately. If you only start one Tomcat you only have one JVM running. There is nothing automatic about this process at all, it's a matter of plugging ports together. It much lower tech than it seems at first.


Posted by stuartcw at 11:51 AM | Comments (0)

August 21, 2002

Moveable Type

Finally got Moveable Type working...phew what a struggle. I learned fast and hard about Perl, Perl Modules, cgiwrap.

Posted by stuartcw at 10:51 AM | Comments (0)

Spell Checking Web Forms

I found a quick way of adding Spell Checking to Web Forms if you use Microsoft Word and Explorer and then saw a later message that has an even better Explorer spell checking solution that doesn't open Word.

Posted by stuartcw at 02:00 AM | Comments (0)