May 30, 2010

Progress

Added two different display types: flowing and block. Still has some hardcoded margins though. The code is pretty ugly, but for now I'm just playing with the elements I need and the logic needed to support them.

May 24, 2010

Progress

Drawing and layout test. Content was randomly generated. Images orginally from Lost Garden.

May 20, 2010

All Seam and no play make Kris go crazy.

All Seam and no play make Kris go crazy.
All Seam and no play make Kris go crazy.
All Seam and no play make Kris go crazy.
All Seam and no play make Kris go crazy.
All Seam and no play make Kris go crazy.
All Seam and no play make Kris go crazy.

So I'm still seeing problems with the previous solution. Now we're getting "transaction is closed" exceptions when persisting new objects. And then only when not having updated something else beforehand; in which case the exact same code works just fine...

Good times! Not.

May 19, 2010

The deep dark hell that can be JBoss Seam

Forgive me the tone of the title. I just spent four days at work figuring out what was going wrong with our project, and I have had quite enough. We managed to fix it though, and I wanted to share the problem and the fix for those unfortunate enough to follow our tracks.

The problem. You want to add a seam-enabled web-app on top of a pure EJB3 model. The model can't have any seam in it; so no seam annotations in the code. Why ? Because we want to reuse the model in non-seam contexts. But we do want to take advantage of seam in the web-app. To me that sounds reasonable.

The idea. Enable the entity beans and session beans as seam components by defining them in a components.xml in the war. Define a seam entity manager in the conversation scope. Inject the seam entity manager wherever an EJB expects an entity manager which would otherwise get injected by @PersistenceContext. Inject other beans wherever an EJB expects something injected by @EJB. Simple enough right ?

The problem I wasted four days on. Constant exceptions related to "entityManager is closed". Tracing the cause of these took a long time, in part because it's hard to see what happens to the entity manager at run-time, in part because you also get secondary exceptions which hide the real problem (such as "entity not managed"). I also lost time to some side issues which muddied the waters (duplicate jar in the deployment); so I won't blame seam for all of the lost time.

The cause. Our sessions beans were stateless, yet they retained the same entity manager over the course of their lifetime. The first time that's ok; the entity manager is open and usable. The second time is less fun: the entity manager is now closed, and a new one was not injected. So when you try to use it: kablammo! Exception! See if you can figure out this fun stack trace, why don't ya!

A solution. Not sure if this is the best way to do it, but after four days I'm just happy it's working: make your beans stateful. Yeah, that's not quit ideal from an EJB point of view, but it's either that or redoing the front-end without seam.

Parting thoughts. For all the publicity about the flexibility of seam and how easy to use it is, I find it very strange that seemingly no one has tried to add seam on top of pure EJBs. Does everyone just give up and add annotations to the source code (seam top-to-bottom) ? If so, do they then have two versions of their EJBs lying around ? If not, what other solution is there ?

Feel free to make fun of my noob Seam skills, but if you do please give me a better solution. If not, I'll feel free to delete your comment. :-)

May 17, 2010

Biomanufactured Brick

This is something I want to see more of: making bricks at room temperature using bacteria and sand. No more furnices needed; no more heat, beat and treat. A good example of what biomimicry can do.

May 06, 2010

Koopa 1up

I just updated the Koopa Cobol Parser with a new version. I have been updating the grammar a bit (it now covers ADD, SUBTRACT, MULTIPLY and DIVIDE), but the really new feature is the XPath querying in the GUI.

The XPath support was already in the code, but you couldn't access it in an easy way. With this new release you can now open up a dialog in the code visualiser and perform XPath queries on the full syntax tree. All results link back to the source code with a simple double click. So you can now, for instance, search for all string literals, all paragraphs, all tokens on line 100, the first four data definitions, the last section, etc.

On a totally unrelated note: today marks the two-year anniversary of if-false-panic. Yay! I may not have stuck with that 3D engine in Lisp, but I did stick with this blog, and I have gotten at least one project to the point where it's usable by the public (as a hint: see this post's title).

May 05, 2010

Infinity

Ysaneya posted another "tech-demo" of the Infinity engine. You might remember Ysaneya from a previous post ? Well, he seems to have moved along quite a bit since June of last year:

Remember: this is not a commercial game being produced by a big studio. This is just Ysaneya and some enthousiasts... To call this amazing would be an understatement.

Keep up the amazing work!