Posts

Engineering Leader: How to make a difference?

Being an engineering leader is not an easy task, especially when you are stepping into this role as a first-timer. Seldom you go through a training, however in most situations you are expected to figure it out yourself with little or no guidance. Often leadership demands you to play following roles:
People ManagerProduct/Business knowledgeArchitect/Senior DeveloperVision for technology I will be writing separate blogs to cover the first two roles. For a beginner, last two roles are very important to gain credibility of the team which is the most important factor in succeeding at your job.
As a technical leader, you will be facing the challenges from all the directions like decision making, improving team efficiency and choosing the technology roadmap for your team. However, I hope adopting following patterns can help you sail through these challenges.

Decision Making: When hit with the problem, as a techie you rely on your technical skills and often start suggesting solutions immedia…

Play framework 1.2.x excel export with I18n and custom filename

play-excel is very well written plugin of Play-framework for exporting excel from java objects.

I used this plugin for my requirement of generating the I18n supported xls with custom names. This blog will explain this in details so that I can use it later :).

Line# 4: will basically make the play-excel to take the render functionality in play. (you can also use xlsx instead of "xls")

Line# 5: Will set the exported filename to given name i.e. "downloadUsers.xls"

Line# 6&7: pick up the template from views//users_.xls.

2. public static void users() { 3. List users = User.findAll(); 4. request.format = "xls"; 5. renderArgs.put("__FILE_NAME__", "downloadUsers.xls"); 6. String template = "users-" + Lang.get() + ".xls"; 7. renderTemplate(template, users); 8. } That's it you are done. Happy coding :).

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 "Galaxy Gear Manager" app on your phone.

Launch 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

publicclass POIterateSimple {
publicstaticvoid main(String[] args) {
    pfIterate(PFIterate.NODE);
}
privatestaticvoid 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;
        } elseif (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);
        }
    }
 }
}

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="producerTemplate" />

        <routeBuilder ref="r"/>

    </ca…

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.springsource.org/sp…