The Knapsack problem

I found the Knapsack problem tricky and interesting at the same time. I am sure if you are visiting this page, you already know the problem statement but just for the sake of completion : Problem : Given a Knapsack of a maximum capacity of W and N items each with its…

Camel CXF Service with Multiple Query Parameters

While the awesome Apache Camel team is busy fixing the handling of the multiple parameters in the query, here's a workaround. Hopefully, this post will become obsolete with the next versions of Camel. (Currently, I use 2.7.5) Problem Query parameters more than 1 is passed as a null…

SLF4J binding for ADFLogger - the missing piece

For reasons best left untold, in my day job, I was expected to provide an SLF4J [http://slf4j.org] Adapter for ADF Logger Oracle ADF [http://www.oracle.com/technetwork/developer-tools/adf/overview/index.html]. Not surprisingly, slf4j does not have an adapter for ADFLogger but since ADFLogger was just…

Building CXF REST Service in OSGi for Karaf

I'll leave it to the experts to tell how awesome OSGi is [http://www.osgi.org/Technology/WhyOSGi]. Among the many benefits, I could tell you why we picked up OSGi for a pet project - Modularity, avoiding JAR hell and dynamic updates (hey, why not?) We chose Apache Felix…

Quicksorting - 3-way and Dual Pivot

It's no news that Quicksort is considered one of the most important algorithms of the century and that it is the defacto system sort for many languages, including the Arrays.sort in Java. So, what's new about quicksort? Well, nothing except that I figured just now (after 2 damn years…

Your's deeply - Why Arrays.deepEquals when we have Arrays.equals

While everybody would naturally accept the following lines of code on grounds of reference equality and value equality and that String and wrappers override the equals method, it takes some effort at first to accept the behavior of Arrays.equals and Arrays.deepEquals Object obj1=new Object(); Object obj2=new…

Evaluating Infix expression - multiple digits

If you are looking for evaluating an infix expression with parantheses, don't waste your time here. Visit my other fresh write up here [http://rerun.me/2012/10/17/evaluating-infix-expression-with-parentheses-in-groovy-multiple-digits/] These images have been running around Facebook for a while now. Though it is eye-damaging primary level arithmetic [http://www.…