Sunday, February 26, 2012

Maven EAR plugin

Maven EAR plugin is a cool solution to assemble your EAR with modules, descriptors and libs.

Though it is bit hard to get info about the plug-in and its features, this tool can be used to assemble a fairly custom EAR as you do with an ANT script.

If the configurations are not enough for a custom assembly, you can use Maven assembly plugin which is as good as Apache ANT.

Architecture views

We kicked off a new project few weeks backs. This is very first project which I'm going to get hands-on experience in software architecture and design (in a formal way ;).

When we are wearing the developer hat, it is bit hard to accept that architecture and planning is the most important task and it cuts down a significant development time compared to a project without architecture and designin.

Building an enterprise application is complex and hard as building a large shopping complex or a warship. But surprisingly industries such as construction or electronic don't fail as much as software do !

The reason behind this fact is ARCHITECTURE.

But architecture is not a simple thing which can be achieved with minimum effort. It is collection of aspects which draw the boundaries for further design or implementation. These aspects are called Architecture Views.

There is a useful book architecture documentation from Software Engineering Institute of CMU.

Hopes this book helps you to gain a good knowledge on software architecture and formal documentation.   

Tuesday, February 14, 2012

Regular Expression for printable page ranges.

Last week we got a  requirement to enable printing for our student portal which was developed using Adobe Flex. And all the documents of the portal is on Flex. So our approach was to use Flex Printing.

Our print dialog box has a text box where the user can enter the range of pages to be printed (just like all other applications which has printing ;) ). I was searching for a regular expression which validates the page range pattern. While sufring web I found a cool app where you can write the regular expression and write different test cases agains that. And the interesting thing is it has been written in Flex. So if you are using Flex then you don't have to worry about platform specific stuff. (If the expression is correct in this app then it should obviously work in your Flex application.

And there is a good collection of pre-defined regular expressions which are usable in many cases. I could find one for my requirement as well. But since I needed further more restrictions I had to came up with my own one.


This is my solution :) 
/^([1-9][0-9]{0,2}|[1-9][0-9]{0,2}-[1-9][0-9]{0,2})(,([1-9][0-9]{0,2}|[1-9][0-9]{0,2}-[1-9][0-9]{0,2}))*$/
which validates a pattern like 1,2-5,6,7,12-15

You can access the aforementioned test bed using the url http://ryanswanson.com/regexp/#start