Skip to main content

Posts

Gear 2 and Gear 2 Neo working with Nexus 5

Gear 2 and Gear 2 Neo are working perfectly with Nexus 5. Please go to the following URL: http://forum.xda-developers.com/showthread.php?t=2677686 and download the " Galaxy Gear Manager " app on your phone. Launch the gear manager app and select your gear device and you are good to go. For receiving additional notifications, goto Gear Manager and select Notification item and select from the list of apps you want to receive notification from.

Simplest iterative algorithm Post order traversal

package com.test; import java.util.Stack; public class PostOrderTraversal { static class Node { int data ; Node left , right ; Node( int item ) { data = item ; left = right ; } } private void pfIterate(Node root ) { Node prev = null ; Stack stack = new Stack<>(); stack .push( root ); while (! stack .isEmpty()) { root = stack .pop(); if ( root . left == null && root . right == null ) { System. out .print( root . data + " " ); prev = root ; } else if ( prev == root . left || prev == root . right ) { System. out .print( root . data + " " ); prev = root ; } else { stack .push( root ); if ( root . right != null ) stack .push( root . right ); if ( root . left != null ) stack .push( root . left ); } } } public static void main(String[] args ) { // Let u...

How to inject multiple endpoint in SEI using Camel's @EndpointInject

By default you can inject annotation on single method of an interface like: public interface MyListener {   @EndpointInject(uri="activemq:foo.bar")     String sayHello(String name); } what if you need multiple methods like this with @EndpointInjection happening over them for each endpoint e.g.: public interface MyListener {   @EndpointInject(uri="direct:foo")     String sayHelloFoo(String name); @EndpointInject(uri="direct:bar")     String sayHelloBar(String name); } The simple solution i have working involved spring's FactoryBean implementation. It need following steps: <!-- Define route for which you need injection to happen --> <bean id="r" class="MyListener" /> <!-- Define producer template having that route  -->   <camelContext  xmlns="http://camel.apache.org/schema/spring">         <template id="producerTemp...

Use recipientList for dynamic routes

I was writing the route in which "to" endpoint was need to be configured dynamically with the URL coming in the body. I was trying to use simple expression language (e.g. ${in.header.test} where test is the property set in the in-message header) also with header method (e.g. header(test)). The routes for the same were: from("direct:test").to("${in.header.test}"); &  from("direct:test").to(header("test"));   after literally every thing i could have. I figured out recipientlist can do the trick e.g. from("direct:test").recipientList("${in.header.test}"); &  from("direct:test").recipientList(header("test")); Hope this works for you too.

Spring: implements interface not working in @Controller

Guys,  I had a @Controller in which I was trying to implement an interface. But i was getting the following error message: PageNotFound WARN  No mapping found for HTTP request with URI [/test/form] in DispatcherServlet with name 'Spring MVC Dispatcher Servlet' where "/test" (at class level) and "/form" (at method level) where my @RequestMapping args.  The issue is described at following link: http://forum.springsource.org/showthread.php?92303-Spring-Servlet-MVC-RequestMapping-breaks-with-AOP-Advice Now you may not find anything wrong with your spring.xml but should check all the xml used by used in the project in out case metrics was causing the problem.  The aop config was overridden by metrics here: https://github.com/ryantenney/metrics-spring#xml-config  By default JDK proxy are created using interface and if controller implements an interface the RequestMapping annotation gets ignored as the targetClass is not being using. http://static.spr...

60 days at expedia India

About to complete 60 days at Expedia, Gurgaon and till now the ride has been a rollercoaster. I joined Expedia hoping for challenging work, participating in building a good team and workplace full of amazing people. To be frank, everything is as close to reality as I imagined. The experience is amazing, people are awesome, the new office is great, the parties are crazy, but the most important thing is the freedom to express yourself and asking questions. And people around you listen (even leaders) and have enough patience to make you feel comfortable. Work-wise finishing user-stories (part of the onboarding process), building a team by interviewing the brightest mind in the industry and ideating about the new ideas to make it a better workplace and best technology platform. It's a great learning opportunity to contribute to one of the fastest-growing company's in the technology and travel industry. I hope this answers some of your initial questions about joining Expedia. Looki...

Java references in nutshell

Java developers struggle to use java references and i don't blame them. The topic seldom covered by text books and even code reviews rarely give emphasis on usage of references. Why the topic is important at all? and if everybody (atleast people i have come across) is coding without it why the hell you need it? Since you are reading this, either you are already aware of them or for the interview. Anyways, knowing references helps you manage memory better because you are able to define the behavior of the object when GC (garbage collector)  is run. Type of references: 1. Strong R eference : The normal reference in the java code is strong reference and the object referenced by strong reference is eligible for GC as soon as scope ends or reference started pointing to null in the code. E.g.  Person p = new Person();                 p = null; // will make object initialized...