Archive for August, 2003

[Osjava] [ANN] XmlWriter 2.0

Sunday, August 31st, 2003

Announcing the release of XmlWriter 2.0. Major changes being:

  • Migration from the xmlwriter.sf.net location. Need to get a redirect in still.
  • Rework of the system so it is very adaptable/pluggable. There are two underlying core writers, one on top of xmlenc and the other an xmlwriter version. On top there are multiple decorator pattern implementations.

These include:

  • On the fly schema checking.
  • Pretty printing.
  • Number/Date formatting.
  • Various empty element options.

NullPointerException….

Sunday, August 24th, 2003

Why oh why can’t the NPException message tell me which variable the NPE was called upon?

That one simple change would be worthy of all of JDK1.5 for me.

Linux Magazine UK: 10 dollars for 3 issues

Saturday, August 23rd, 2003

http://www.linux-magazine.com/CustomerService/SpecialOffer is a special offer of 3 issues for 10 dollars [or 9 euros, or 4 quid]. At the end they push you on to the yearly subscription.

I like this magazine. I liked it when I left the UK two years ago, and have liked it when I’ve looked at it since. It has a very broad domain of high level subjects. Linux Journal by contrast tends to focus more on the lower level aspects of Linux itself. Linux Magazine [US and UK/DE] focuses on what you can do on Linux. They really should just rename it ‘Open Source Magazine’.

[Osjava] [ANN] Norbert 0.1

Friday, August 22nd, 2003

Announcing the release of Norbert version 0.1.

Norbert is a parser/handler for the norobots rfc. It parses a site’s
robots.txt file for a particular user-agent and then answers questions on
whether a url is allowed or not according to http://www.robotstxt.org/wc/norobots-rfc.html.

robots.txt in the real world

Friday, August 22nd, 2003

In the course of my playing with robots.txt, I spent a short while wgetting robots.txt files from popular sites.

The most amusing one is IBM’s, with the historic comment of:

# $l1- 19950130 epc finally understood what the file was for!

Sun’s was also amusing with a refute to an article of Bertrand Meyer’s.

Whitehouse.gov give a nice sitemap as such with theirs, and to show that it’s not just big companies, my workplace’s robots.txt is going to be a good test as it has a comment on a rule line. Something very few people seem to do.

Some people seem quite hopeful with their entries. For example Sun have:

Disallow: /*_print.html$

which I believe is not legal [wildcards are not a part of the robots.txt spec, except for a User-agent].

Regardless of other uses, a simple program to print out the rules a robots.txt is stating would be useful for a lot of companies. One must exist out there…

robots.txt

Friday, August 22nd, 2003

While the wife is away, the husband will….

…implement a robots.txt handler in Java. Apparantly.

It’s pretty fun to do. Simple enough RFC that any moron [meaning me] can grokk it, with a clear set of examples and enough subtle surprise that it’s easy to screw up. It’s also a perfect task for a class I think.

At first I assumed that just having:

User-agent: *
Disallow:

meant disallow all user agents [as have my wife’s company I notice]. Instead it means, allow all user agents.

I also realised I’ve had one of my robots.txt files wrong all this time, not having leading slashes on the entries.

What’s coolest about implementing a robots.txt handler is that it’s perfectly designed to unit-test first code. I admit that my initial roll out of code was being ‘unit tested’ by a main method. However, once that single method was working, I upgraded to a unit test and added in every entry in the rfc. Lots of failures, lots of digging, and things slowly got developed/fixed.

I still think there are two potential problems with unit tests:

1) They force you to open up your API sometimes. If an API only allows ‘http://…’ urls, and you want to test locally without a web server, you have to have some way of getting a file:/// under the radar. Assuming you put tests in the same package as the code, it’s not a major security problem, but I do still feel hesitant about the fact that unit tests are forcing me to create units, and I’m not sure if a unit is always the best choice. I don’t like the test forcing me to be less defensive.

2) You can code without thinking. By creating a large amount of unit tests, then slowly fixing one at a time, I would be able to evolve the code and not understand it. I worry that some developers will try to solve bugs by random modification until the unit test works. The problem there is that there is a 50/50 chance that the unit test is wrong. In fact, I had this occur once when the data for my unit test turned out to be illegal.

Still, a fun evening of hackery. Anyone want a robots.txt handler? Was written for my site-scraping engine, Scabies.

Unit Tests make good Units?

Friday, August 22nd, 2003

[In reply to Mark Mascolino’s comment]

Yep. Many of the changes that switching to a testable Unit forces you to make are good long term decision ideas.

The problem is that it’s hypocritical. If we take extreme programming for example, it tells us to not overdesign and just to code what we need now, and yet we have to design more than we need just to make the unit tests work.

I end up making many of the design decisions I would have made in a ‘guess the future’ situation, to satisfy the unit tests. The only way to solve this is to say that Unit Tests create Units which are implicitly good, and yet I think this is a very bad assumption to just accept. How do I prove that the changes a Unit Test enforces on a Unit are good for the Unit?

A Unit Test should be a Watcher on a Unit, and not affect it in any way. Maybe there is an Uncertainty Principle for Unit Tests, it is impossible to test a prepubescent Unit without affecting the design of a Unit.

This leads to the fact that Test Driven Development affects the design of an application. While it might be easier to code TDD, and safer to code TDD, is it necessarily better? Or more efficient?

[Also, I wonder how much of this is just JUnit’s implementation].

Open Communities

Sunday, August 17th, 2003

In this months JDJ, Alan Williamson pointed out that the term ‘open-source’ does not match why most of us use it. In the same issue, a guest editorial by Kirk Pepperdine wondered why we are not allowed to see the discussions that went on behind the creation of the Tiger 1.5 release.

Alan suggests that ‘nominal licensing’ is the reason why we choose the particular products we choose. I contend that this is wrong as a) (L)GPL is not nominal and b) it’s not the real reason why we choose it. Harsh licensing is a reason not to choose a product, but as long as the licensing doesn’t hurt us it’s not a +ve reason.

I believe the reason why I always look for an ‘open-source’ product first is because I want products with an open community. Today I looked at two product sites, JIRA and Crystal Reports. They are a fine example….

JIRA is a great tool: the code is I’m sure a big mess, the features are not quite what I want, and some things are not quite as obvious as I want them to be, but the community behind it is great. This makes it a great tool. I use JIRA because their mail lists are populated by the developers of JIRA, and because they are friendly to other open communities, understanding that many open communities are also non-profit communities and offering licensing to match. I also use JIRA at work, because of the trust their openness has created.

Crystal are a different type of company though. Their website and the pitiful excuse for forums linked from there show that they are a closed community. The community is a resource from which they pull money and push new products out to. Questions on their forums sometimes go unanswered [even when repeated every few months it seems] and the information on their site is a marketing tool rather than a customer tool. I’m not going to like using Crystal I suspect.

So the trick isn’t open-source, that’s just an early 80s grumble that Stallman is still having. It’s open-communities [and I’m pretty sure people have said this all before].

The JCP need to get this. Companies need to get this. I don’t want to take part in your community if you’re turning me into a minion.

JPE on the Z-C760 working..

Sunday, August 17th, 2003

Spent the day messing with the Zaurus. First I got ZTailGunner and Java-Othello running on the c760. The speed of ZTailGunner has to be adjusted so it is playable. It pauses for 50 ms currently, moving to 150 or so seems to make it usable. Faster chip I guess. Java-Othello worked well enough.

I kind have a script for porting these things, but it needs to handle more types of java-install scripts to be of use.

Then I tried to get it all working on the Z itself. My script worked nicely, but the ipkg-build script doesn’t. ‘tar’ doesn’t have -z and the -C feature behaves differently, this is all under busybox. I think I have it working, but the ipk file it creates doesn’t show under the install screen after it’s clicked on. Still unsure why that occurs.

So next I moved onto JPE, the Java Psion Editor that got me into open source. I tried to use the Eclipse plugin to build ipk’s, but it’s weak. It doesn’t include dependencies, and of course it doesn’t know that I need the evm2 hack. So I ended up using to part of the work then setting the rest up by hand. Transfered it over with a jpe.properties [first task is to put that in the jar and look up on the classpath (the psion used to have a bug there)].

And it works! Running on the cmd line is best as the Z doesn’t try to force it into PDA mode. Unsure exactly what it is that makes it do that on old apps. Still, parts work well :)

The compiler doesn’t. Time to integrate a few command line compiler names in and let the user choose in the options. Also need to finish swapping any remaining hard-coded backslashes [another psion bug I think]. It doesn’t compile, it doesn’t run, but at least it edits happily.

Java on Z documents…

Saturday, August 16th, 2003

Wandered the japanese c7×0 site. Must learn to read japanese.
Found this:

http://more.sbc.co.jp/slj/doc/jeode/jeode_tips.asp

and of course the main old ones:

http://java.sun.com/products/personaljava/javacheck.html

http://www.zaurus.com/dev/support/jaav.htm which has some interesting PDFs, most especiallyt a 5500 to 5600 changes file, which I suspect will shed some light on a few questions of mine

I suspect most things will be learned either by learning to converse in japanese [could take a while I suspect] or by learning the Z’s filesystem utterly and using the existing programs as examples.

As a sidenote, thekompany.rom has add-on ipk’s of Opera and the Hancom software, so very tempting to find out why they won’t run on OpenZaurus [I’m sure there’s some kind of security].