Today I started doing some research on ANTLR (http://www.antlr.org/), a very powerful parser generator. It compiles language grammars into source code for a number of languages (I am working with C# output mostly, but it primarily creates Java). I am currently learning about Abstract Syntax Trees (http://en.wikipedia.org/wiki/Abstract_syntax_tree) and how I could use one of those instead of a Parse Tree (http://en.wikipedia.org/wiki/Parse_tree), which is what I have previously been working with when parsing languages. The major difference is I need to modify whatever language grammar I am using so that it produces an AST. I am hoping this isn’t too difficult, but we will see how things go over the next few days after I get up to speed on ANTLR. So far it looks promising though. I am impressed with how powerful ANTLR is – because it produces source code, you can embed code in the language specification itself. It looks like it is going to be a bit of fun figuring this all out :-)

 

Today I registered for GST using the online form at the IRD website (https://www.ird.govt.nz/cgi-bin/form.cgi?form=ir360) after calling the IRD the other day and asking for a bit more information (they sent me some booklets). This was relatively painless, but necessitated by the fact that I am collecting GST from Slyce on my invoices. The good thing is you can apply to file every six months, which means I don’t have to worry about it for a while. They also say they might get in touch with you to give you a bit of advice on how to file a GST return. Which sounds pretty good to me.

Another thing I thought about today is ACC. It seems as a self employed person they calculate my ACC levies from my IR3 tax return at the end of the year. So I get stung with more bills around tax time. One thing I need to ring them and ask about is what happens if I stop being self employed half way through the year. Hopefully this should be just a case of ringing them and telling them when the time comes.

 

Today I was offered a contracting position with Slyce (http://www.slyce.com), a start up working on an amazing looking code generation tool. It allows the use of generated code without interfering with the ability to modify these files. Each file can be modified at will, and ArchAngel (http://www.slyce.com/ArchAngel/) will be able to reconcile those changes with any that it makes should the project be regenerated. I encourage you to read more about it – there’s not a lot of information about it on the website currently but that should change soon.

Expect to see a few posts dealing with the issues related to working as a contractor – I have to pay my own taxes and what not so I will try to detail how I went about the process in the hope that it proves useful to someone else.

 

I went along to the Sylvia Park Architecture Chat (http://wiki.bittercoder.com/Default.aspx?Page=SylviaParkArchitectureChats) yesterday in order to have a chat with some of the guys. It was great, I love talking (and listening) to other developers in a social setting. The chat is basically a way of getting a bunch of developers together to talk about things they have experienced lately, and discuss issues with like minded people. They have a focus on .Net, but some of the topics are applicable to other spaces as well. I highly encourage everyone to go along, it is well worth the time!

 

Today I started writing the message exchange beans for my ServiceMix/virtualisation benchmark. I have previously used Netbeans to develop these, but it usually requires manually adding the library JARs from the ServiceMix directory (plus any others it depends on) which is a bit of a pain.

Not so anymore! I installed the Maven plugin for Netbeans when I first installed it, with the intention of trying it out. While I was trying to add the java source directory of the bean service unit I am developing I noticed that the directory was showing up as a Netbeans project (they have a different icon to regular directories in the Netbeans file dialogs). I opened it up as a project instead, and it gave me a project with all of the library files added, the ability to modify parts of the POM using a form, easy access to sub-projects (if you open the root project up first), easy access to resources, the works. I am so impressed with this.

It even gives you the ability to execute any Maven goal from within Netbeans. This is great – usually when developing things for ServiceMix I have a number of windows open (Netbeans, a few command lines, explorer, notepad++, etc) and things get very cluttered. Now I can set up Maven actions in Netbeans that clean, install and deploy my service assemblies, without needing to switch between windows.

 

My previous problem where the XSLT processor was outputting an unclosed meta tag has been solved. The W3C XSLT spec specifies that the processor should not output a new meta tag if there is one already present. Thus the way to fix the output so it did not add a meta tag was to insert one myself. However there are a few things to note. It will only do it within an html element that has the xhtml namespace. Also, if you do not have a trailing space before the closing / it will not work. See my example below (note I tried to use include-content-type=”no” which may or may not have worked. It takes a while to recompile and deploy the service-unit so I haven’t tried it):


<xsl:output method="xhtml" include-content-type="no"/>
<xsl:template match="result">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />
...

 

The tutorial app I wrote is now working. There were a few different problems. Firstly, I had removed some information about the secured broker in servicemix.xml and replaced it with a single flow name in a container attribute. I had forgotten about this until I reloaded the config from the distribution. Secondly, I needed to set up multiple static network connectors in activemq.xml, not a single one with multiple I.P. addresses. If put multiple I.P. addresses in a single static() block it will pick one at random and try to connect to it, doing this until it finds a working one then stopping. What is needed is multiple networkConnector elements with a single I.P. address in each static() block. I didn’t initially know how to do this because if I put two in it would give me an error. This leads to the next point. Thirdly, each networkConnector element needs a unique name (within the broker). So I gave them a name attribute corresponding to the ServiceMix instance they were connecting to. Fourthly, messages from the HTTP consumer service unit cannot be delivered to an endpoint on another ServiceMix instance (at least in my experience). I will post this to the mailing list later to see if there is a reason for this. Fifthly, and most importantly, ServiceMix 3.1.2 just plain does not work in my configuration. Upgrading to 3.2.1 fixed this and everything finally works. Well, except for my XSL transformation. They must have upgraded to a newer version of the XSLT processor (or used a different one), because it now ignores the directives I gave it telling it not to put unclosed <META> tags in because it does that now, even in XML output mode. My root element is an <html> so it may be overriding the xsl:ouput element (which it shouldn’t). If the XSL transformation does not output valid XML (which requires all tags to be closed) then ServiceMix cannot pass the HTML back to jetty to display to the user. This is my next task.

 

Our flat has been playing Resident Evil 4 on the Wii together (well, one flatmate plays and we all watch and ‘advise’). Said flatmate dropped the nunchuck on the ground mid game and somehow broke the motion sensor in the remote. This resulted in the character constantly swiping their knife, making the game unplayable (you couldn’t even move). After a quick google search I came across a forum thread where someone had also broken their remote, and one person suggested tapping it quite hard on the back. This fixed mine, and after playing Wii Sports for a bit I can safely say it is fully functioning. That saved me $100, so I thought I would post it here on the off chance that it helps someone else out.

Update:

Just in case anyone was wondering if I ran into problems with this later, the controller is still fine.

 

I’m still having major issues with ServiceMix. The ServiceMix instances will not connect to each other at all. I’ve tried everything I can find to configure ActiveMQ to allow message passing between them, but nothing has come of it yet. There are a few tcp connections between the two instances that I can see with netstat, but it doesn’t show up in jconsole. It has to be an issue with connecting ActiveMQ instances on separate machines, as it seems to work just fine when the ServiceMix instances are both on the same machine. Another puzzling aspect is that the cluster example that ships with ServiceMix works fine across machines, but if I hot deploy components to it instead of using static deployment then they cannot be seen by the other ServiceMix instance. I may have to re-write the config for my application to a static deployment, but I would like to know how to get it working dynamically. This should keep me busy for the week.

 

I’ve spent most of today trying to discover why my ServiceMix tutorial application won’t work when I split the service units across multiple ServiceMix instances. Although I have specified that I am using the JMS message flow and the ActiveMQ brokers seem to be talking, the messages are not getting delivered. The message sent into the HTTP BC just gives back an exception about not being able to write a non xml fault to a non soap request. I have eliminated the virtual machines as the source of the error – this happens between instances running on separate windows machines within our home LAN as well. I have made sure that it is possible to have ServiceMix instances auto-discover each other by running the Cluster example on two separate machines. I have also checked that the Cluster example works between virtual machines. I can only assume that there is a problem in how ServiceMix is set up by default – something I will have to check by trying to create a simple example that is deployed rather than uses a stand-alone ServiceMix instance. Another option is to upgrade to the latest version of ServiceMix and see if they have changed the configuration (I didn’t want to upgrade as I’ve written and tested the tutorial on 3.1.2).

© 2011 Jamie's Space Suffusion theme by Sayontan Sinha