Wednesday, January 23, 2013

XStream and Circular References

I recently came across a problem when marshalling a Java object to XML using XStream was creating circular references. XStream will detect and include absolute/relative paths to circular references, which can be cumbersome when the XML is to be parsed manually (as in my case). Luckily, there is a way to turn off such references and to print each object as a tree:

     XStream xstream = new XStream();  
     xstream.setMode(XStream.NO_REFERENCES);  

Reference:
http://xstream.codehaus.org/javadoc/com/thoughtworks/xstream/XStream.html

Thursday, July 26, 2012

Why System.setProperties(Properties p) is a bad idea...

For the last day I've been debugging what I believed to be an issue with Drools and a "cannot read dialect" error. Turns out the problem was when I called System.setProperties(Properties p). After some quick investigation, I found that when you call this method (as opposed to setProperty(String key, String value)), all of the System properties get overwritten!

More information can be found in my original stackoverflow post: http://stackoverflow.com/questions/11659055/drools-dialect-nullpointerexception-running-outside-of-ide

tl;dr - Don't use System.setProperties(Properties p) unless you know what you're doing. It will cause unknown and uncontrolled side effects.

Friday, June 22, 2012

Converting a Web Faceted project back to Java project

Today I made a newbie mistake and changed a projected into a Dynamic Web Module faceted project. When I tried to revert back, I was unable to uninstall the changes I had made. Luckily I found helpful instructions here: http://vijaypm.blogspot.com/2010/12/maven-eclipse-and-tomcat.html

Despite some few slight differences (probably because I am using Eclipse Indigo EE), the steps worked perfectly. Thank you Victory's Blog!

Tuesday, June 19, 2012

Drools Rules

My first major development project at my new job is to integrate JBoss Drools (previously Rules) as our Business Rule Management System (BRMS). Drools itself is made up of several components that can be utilized for different purposes, but is essentially a business rule management system that makes it easy for non-technical folks to easily edit the business logic without having to change underlying functional code. The Drools Guvnor is a web-based BRMS and repository that allows easy access to business logic and is of particular interest in this project.

Over the next week I'll post on my experiences with Drools and also link helpful resources. As I have discovered, documentation for Drools is somewhat lacking or is written towards a more experienced audience in the business rule field. Hopefully these posts will be a helpful resource to others and that they will assist to establish my reputation as a new programmer!

Friday, January 6, 2012

Apa kabar!

Apa kabar - Indonesian for welcome! This is the first post in my blog. I'm glad you found it. It probably wasn't too difficult to find since I've never posted more than twice to any sort of blog. In any case, I hope that in a few years I'll have more than two posts in this blog to better document my everyday coding fiddlings.