Tuesday, September 9, 2014

Problem in getting post parameter in Spring MVC via REST request

@RequestMapping(value = "/api/login", method = RequestMethod.POST)
    public WelcomeMessage getHelloWorld(@RequestParam(value = "username") final String username, @RequestParam(value = "password") final String password) {
            // do some thing
    }


I was having the problem to get post parameter via REST request.  Adding the header "Content-Type:application/x-www-form-urlencoded" fixed the issue

Saturday, July 26, 2014

A* Algorithm optimality proof

This video from me describes the A* algorithm optimality proof. You can also see the slides from the link provided in description.

Thursday, March 27, 2014

java.lang.IllegalArgumentException: badly formated directory string

it is based on invalid format, try to give correct name structure for instance:

new X500Name("C=DE,O=Organiztion");

Sunday, February 23, 2014

Design patterns

Design pattern are solutions to a class of problem which is proven to be good. It's like following the big guys. The attached project contains easy to learn example for Factory, observer listener and strategy design patterns. This project will be updated with further patterns. Each if the downloadable  project is an eclipse project , you can simply import it in eclipse  if you wish.
Download all Project
Description of project via sample problems:

PROBLEM 1:
 Say you want to create people in a computer game. People can be of type enemy army, friendly army or civilians (Also further more addition in future should be also possible).  In this kind of problem you can  use Factory pattern to create these game people.

PROBLEM 2:
Say in same game scenario you want to create Aeroplanes with different capability. Say 5 aeroplanes with military capability and 1 civilian  (In future you should be also able to add more capabilities like speeds, payload types). In this kind of problem you can use Strategy pattern. You can create different capabilities and inject them in aeroplane.

PROBLEM 3:
Now say you have a game window. There are different buttons. You want to do different action in your Window class based to the location of the button clicked (Say button is developed by some other developer in his own way). In this problem you can use observer listener pattern.Window can be listener of button click event. Developer of the button should define a interface to add listeners.