Posts

Binary tree post order traverse without recursion in Java

Image
Post order traversal   In PostOrder traversal, the left node is processed first, the right node (subtree), then the node. Steps for post order are:    1. Process left subtree.    2. Process right subtree.    3. Process the node. I will consider processing the node is just printing out its value on screen. Consider the below binary tree Processing the above tree in post order should result the following:                         1, 4, 6, 2, 12, 45, 40, 10, 75, 60, 50 The recursive solution is very straight forward by following the above steps:     public void postOrderTravesalRecursion(){         postOrderTravesalRecursion(this.root);     }         private void postOrderTravesalRecursion(Node node){                   if(node==null){                return;            }            postOrderTravesalRecursion(node.getLeft());            postOrderTravesalRecursion(node.getRight());            System.out.println(node);     } Doing the same without usi

Spring 4 Security - Authorization with Roles and Rights

First of all, spring security doesn't support roles/rights security approach. It has two basic security approaches: Simple, role-based security without rights. Complex ACL based security that defines permissions at the domain object level.  I will not go through ACL based security because most applications need a way less than the complex approach. I will show you how to tweak the simple approach to implement roles/rights security. 1. Configuring spring security filter in web.xml <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> We must configure spring to load spring-secuirty.xml for security configurations <context-pa