Skip to main content

Posts

java code if and return

I have seen code that looks like this public void static fn(boolean someCondition){ if(someCondition) { return error(); } return success(); } Although there is nothing wrong in this, conventions suggest that this be written in a readable way like return someCondition ? error() : success(); but lets say we have some more statements like this public void static fn(boolean someCondition){ if(someCondition) { statement1; statement2; return error(); } statement2; statement4; return success(); } I would consider it will be more readable to put it as public void static fn(boolean someCondition){ if(someCondition) { statement1; statement2; return error(); }else{ statement2; statement4; return success(); } }

Bush administration's final straw: The new US dollor proposed!

One of the witty forwards I recieved in the recent past :)

Back to business

Hello all, I am back. I am glad to come back and to have my father recover well to the treament. He was diagnosed with Neuro Endocrine Carcinoma of Rectum (something related to colorectal cancer). I am planning on writing about his diagnosis and what he(and we) went through all this time. But good heavens, and wishes from a lot of friends and relatives - He is doing very well now.

Stepping out.

I am stepping off from professional chores for some more time. I am not following Olympics either. I have to visit India to take care of my father, who is undergoing a diagnosis for a tumor. Thanks for all those who have given me thier support. I shall start writing again soon.

Abhinav Bhindra - The First Individial Olympics Gold medalist for India

I am off until olympics, I will catch up later.. And I am blogging this Historical moment.. Thanks to Abhinav Bindra who did India proud

Using Spring XML Schema based bean definitions

Spring's bean definitions (and configuration files) may go very verbose after your projects goes two or three iterations old. By verbose I mean, too many bean definitions, and complex injection graph. And many a times, these xml files go fat because of common definition types - props, lists, etc. These beans are generally configured using FactoryBean s. To reduce this verbatim Spring provides XML schema based configuration, for various types of FactoryBeans. There are some shortcuts presented in that appendix, I frequently use. I recomend those to others too. Here are some of those. <!-- creates a java.util.Properties instance with values loaded from the supplied location --> <bean id="jdbcConfiguration" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> <property name="location" value="classpath:com/foo/jdbc-production.properties"/> </bean> Could be written as <!-- creates a java.uti...

Moving on to Ivy.

Maven has its share of success, at the same time it has some shortcomings. Many felt the Idea was right, the implementation was not. There were a few rants too. Project Ivy was started on that note . Today, Everyone is talking about Ivy and How Ivy can fix your woes from maven . So, I began to test drive Ivy. Ivy has got pretty good documentation. And the edge over maven is, that you dont have to adapt your project to it (like maven). You can make ivy adapt to your project. All you need to start is a jar to put in your ant lib folder. The examples list a mighty hard way of starting with ivy - So I modified a little bit to get it easy and install ivy automatically. Also this can be used as a template build.xml file for starting from scratch :) <!-- Use namespace even before bootstrap --> <project xmlns:ivy="antlib:org.apache.ivy.ant" default="build" name="SarathPOC"> <property file="build.properties" /> <path id=...