Saturday, May 24, 2008

Moved ...

Its been a while that I've moved to a new location on the web. My latest (or rather current) blog website is at http://nagiworld.net

Tuesday, February 21, 2006

JSE 6 Mustang

After ages we finally have a solution for path length > 255 on Windows. This is pure joy for all serious users of java on windows. Its such a legacy that we started coding around it.. catching this exception and detecting "ooh rats! the path length is too long..., go another route..."

More details here http://java.sun.com/developer/technicalArticles/J2SE/Desktop/Mustang_build39.html#Libraries

Feature: java.io.File does not support long paths on Windows.
Bug ID: 4403166
Status: Delivered in b19
Description: Another longtime bugaboo for many developers, the issue with paths with more than 255 characters on the Microsoft Windows operating system has finally been resolved.

I'm really glad to see this fixed!

Saturday, January 14, 2006

TML

All I wanted was to write a useful document on how to use AppGen. Since I had to publish this on to my website at nagesh.net, it had to be html. Now I really am not big with WYSIWYG-editors so I was looking around for a very clean and easy to use html generator which just let me worry about the content rather than the presentation. After a little searching, I found TML which does pretty much everything that I need and in a clean way.

You just have to write your *.tml files in wiki like syntax and run the tml tool i.e. org.antlr.tml.Tool , which has the ability to generate either Lout or HTML. I was just interested in the html part and it works pretty well. Infact the entire antlr and stringtemplate site is based on TML which is pretty neat.

Two small things :
  • If you are writing your *.tml files on Windows then you have to convert the '\r\n' s to '\n' before you pass it on to the TML tool. (Small little quirk) You can rewrite your tml.sh to look like
#/bin/sh!
cat $1 | tr '\r\n' '\n' | java org.antlr.tml.Tool > $2
  • Each line in the <pre> comments gets an extra newline on Windows, so if I have
<<
output foo
output bar
>>

I get:

<pre>

output foo

output bar

</pre>
I haven't been able to figure out a workaround for this. But since the source code is posted on the site, it should'nt be hard to find and fix this.

Other than that TML is just great for my needs. Finally the search for an easy mark up language is successful. You can check out the file generated at http://www.nagesh.net/appgen to see how the output html looks like.

AppGen

Finally, I've uploaded an initial cut at appgen. The current version is 0.1 and links and documentation can be found at http://www.nagesh.net/appgen/
The initial release can be used to generate webapp artifacts namely
  • Filters
  • Servlets
  • Listeners
  • web.xml and weblogic.xml descriptors
  • build.xml
It extensively uses StringTemplate for all the code generation. In addition to all the above features , it can also generate empty implementations for any arbitrary java interface in its classpath. I haven't exposed that feature yet but intend to do it in a future release.

Read more on http://www.nagesh.net/appgen

Sunday, January 08, 2006

Occasional

No, I'm not apologizing for not blogging for so long. Infact after looking at my long history of blogging, I decided to update the description on my blog to add "Very occasional blogger" :-) Its exactly a year since I last blogged and by some divine call I decided it was time to write another short note this year. I hope my next blog is atleast on 8th Jan 2007.
Happy New year

Code generation using StringTemplate

I've been using StringTemplate (http://www.stringtemplate.org) for some cool code generation for some time and its ease has really impressed me. I first used it to generate some templates to send email and got hooked on. The simplicity is just awesome. After reading some codegen articles by Terence listed here, I decided to use it to generate java files.

Update: Here is a link one should read to understand code generation with StringTemplate.
http://www.codegeneration.net/tiki-read_article.php?articleId=65

What I like about StringTemplate:
  • Strict MVC which is very important IMO. I've fallen into traps using other engines where the model can be modified from within the view. As soon as I wanted to add a new view, I was totally lost. I had to go into the old view and find all places where I set some magic value into the model. I like StringTemplate's policy of just disallowing it instead of giving you an option :-)
  • Flexibility of using various delimiters such as '<' or '$' is nice.
  • StringTemplateGroups: I find this very helpful since its very natural to the way one generates code. Group all the templates belonging to a certain action into a group (now doesnt that make sense)
  • Pretty printing is turned on by default. Now all the new lines are exactly where you put them in your template.
(There as many other features which I haven't yet used but I'll update on as I do)

Lately I've been using it to generate a template for my entire app. I call it appgen (short for app generator) which takes a few options and spits out neatly intended java code such as filters, servlets, listeners and the standard web.xml and weblogic.xml descriptors in any given directory.
Before I wrote this tool, I have some qwerty little script which copied empty war files into a directory. I'd call this tool and then modify all the classnames/ xml descriptors to suit my needs and then fire up my deployer to deploy this war to the server. The tool now lets me specify a set of properties and point it to a dir and I get an entire war all done up. More on appgen soon...

Saturday, January 08, 2005

Article on WebLogic JSP Container

My article on avoiding unnecessary recompilation of JSP's in WebLogic has just been published on dev2dev.bea.com. It describes the entire stale checking mechanism used by the WebLogic compiler and I hope it helps people in taking the right steps to prevent recompilation and also provides a little insight into the container.

Sunday, July 18, 2004

J2EE Performance Profiling tools:

The last few days, I've spent most of my time profiling my code and trying to see where I can improve the performance. I played around with some tools and here is what i liked in them:

JProfiler 3
I should say that the JProfiler 3.0 tool looks refreshingly new. It has a great UI and its very well integrated with the IDE's such as IDEA. If you like new UI's like me and also want to get some serious performance profile done then give JProfiler a spin.
More information on the JProfiler tool can be found here

Optimize It 6.0
Cool thing in Optimize it is the new Quality Analyzer. It catches all kinds of exceptions, shows you if there is abnormal/inefficient growth in a StringBuffer/ HashMap etc. I really liked this feature. Its one way to catch errors early on in your project and keep your code sane.

Monday, July 12, 2004

Yet another Java Blog

I've tried creating blogs many a times, but never had the consistency to follow up on maintaining and regularly updating them. This is yet another attempt at writing about something I do for my living. Yes you guessed it right Java. I work for BEA Systems on WebLogic and try to learn about the latest advances in linux.