Archive for the Category Programming

 
 

Test Faster

Sometimes its good to take a step back and look at what’s going on. I think this week that’s what I needed to do. I know that I need to get working on the file transfer feature but in finding it hard to get fired up about it. Part of the problem is that debugging and testing are becoming a nightmare. The code has stayed fairly well organized and I can still fix bugs quickly once I can reproduce them. The problem lies more with the amount of time it takes to build the client, setup a test environment, get the clients connected etc. You can do ruthless testing without some automation.

My first move was to add a configuration option to have the client act as an rdv-server. This stops the client from running any services. It loads the groups and becomes an RDV in each. Then I had some more ideas about automation:

  • It would be nice to launch one or more peers (say up to 4) from within Eclipse. I could do this either with Eclipse or with Ant. It would also be nice if the files for these clients didn’t clutter up the main development directory.
  • It would be nice if each client would remember its position on screen. (sometimes its the simple things)
  • I still don’t have a good idea of how to write JUnit tests that use the client when its online. JUnit seems naturally useful for simple things but for network interaction testing I’m not sure how it should be used. I think at least the client would have to be headless (no GUI).
  • Restart JXTA from within the application, optionally erasing the config data. There may be issues with this, i see developers having trouble doing this on the dev list.
  • Have the client display what version it is, and write that to the log file at startup. I’m not sure where that should be stored. The version numbers are generated by Ant at build time. It would be nice if I could retrieve it as a property of the mindshare.jar file.
  • Peer initialization times aren’t consistent, mainly in joining the NetPG. If only there was something I could do in code to ‘encourage’ each peer to find an RDV. Starting my own NetPG is an option, perhaps just on my LAN using multicast. I don’t like testing things on the LAN though, multicast hides problems that don’t crop up till you use the program across the internet.

Other stuff unrelated to testing:

  • RDV timeouts are 2 minutes! That’s way too long for a real world application. The JXTA guys need to remember that people will hardly sit still for 7 seconds while a web page loads. It would be nice if I could get more fined grained control of the RDV service and perhaps speed things up. Empirical evidence seems to indicate that 15 seconds might be as fast as the current implementation can manage.
  • It would be nice to have a bug tracking database to testers could report bugs. Either as a forum of a dedicated bug tool. (Bugzilla perhaps?)
  • It would be nice to have source control. I have the history in Eclipse at the moment which is all I have needed so far but source control would be better. Subversion has been suggested as an alternative to CVS, but Eclipse has nice CVS integration.
  • I need to update this website. Its not nice to look at and it needs a better description of the project.

Questions about JXTA

JXTA is a standard (and accompanying reference implementation in Java) for P2P nodes to connect, form groups and ‘advertise services’. I’m currently looking at JXTA for the core networking technology in my project. Several things have struck me about JXTA’s design as overly presumptuous and are deal breakers for me.

All peers belong to the “World Peer Group”. I presume this means that all peers can communicate with each other because they belong to this group. Furthermore all peers are encouraged to rout traffic for each other. As a peer I would not be inclined to rout traffic unless it directly benefited me or other peers in my group. The last thing I want to be doing is routing traffic for some file sharing service when I’m trying to commit to changes to the group. My traffic comes first, preferable exclusively. The only thing I would agree to route for other peers would be discovery messages. Using the network at large to help people find each other is a fair exchange in value for traffic.

I’m aiming for a secure network. It seams peers can join my group without authenticating with one of the group members first. I want to have a custom authentication protocol with public key encryption.

There dost seam to be clear answers to these questions on the JXTA website either. I guess its time to dig into the protocol spec to find out.

Spam Spam Spam

It occured to me that spambots or e-mail harvesters might vacume these pages for my e-mail address. Now nobody wants to get spam, least of all me. A quick look around the web reveals 2 commin strategies for avoiding the spambots.

One is the convert your e-mail address to an HTML Unicode sequence. this is cumbersom and anoying unless its a single address youare doing this for. The seccond method uses JavaScript’s document.write() function to output your e-mail addresses from code. I found several script solutions online but none were general enough for me. I wrote my own, HideMail, and you can see the source here.

Obviously if you dont have JavaScript enabled in your browser you wont see the mailto: links. Too bad, you must not want to bad enough, or your a SpamBot. Either way Im not too concerned.

While i was writing HideMail and testing it on the links page I couldnt understand why the links.html file was not changing when I rebuilt that weblog. In desperation I wiped the template source hoping MT would pick it up from the file again. Oops, i didnt compleatly wipe the source from the input box and the file was emptied. Then i noticed why it wasnt updating int he first place, i hadn’t copied it localy and made the necessary changes.

So someone please fix MT so that in ‘link template to file’ mode you cant edit the template. Period. Always use the file, dont even show the text box, simple.