Category: java

Android ResizeAnimation with a starting height

Posted by – December 13, 2011

I recently found a a way to resize a view in a way to make it open/collaspse in a Android activity, this kind of animation gives some charm when showing some interface elements like a toolbar or a navigator to the user, you can make it show on screen completelly or have a small piece visible and disclose all the hidden portion.

This animation is based on some code that can be found on stackoverlow, but I made few changes to add extra features to it like start the animation from specific height instead of 0.

Here’s the full code:

More

Share

Why not use RESTeasy to create REST services?

Posted by – February 9, 2009

After few days using RESTeasy in my project I found a very annoying issue related with its Spring support, please consider the bean declaration below:

1
2
3
4
5
6
<bean id="remoteAuthenticationService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
    <property name="serviceUrl"
            value="http://${host}:${port}/adminserver/remoteAuthenticationService.esp"/>
    <property name="serviceInterface" value="com.fastsearch.esp.admin.RemoteAuthenticationService"/>
    <property name="httpInvokerRequestExecutor" ref="executor"/>
</bean>

For some reason the RESTeasy ContextLoaderListener implementation is unable to resolve property placeholders used by some properties of beans at singleton scope, when I read these properties from my bean logic I see all properties placeholders there as they weren’t resolved.

So I decided to try Jersey since it uses the standard implementation of ContextLoaderListener that comes with Spring, now my application works as expected, all properties placeholders are being correctly resolved on my Spring singleton beans.

Share

Rational Application Developer and Websphere Portal Express

Posted by – January 8, 2009

I just started to use IBM RAD and IBM Websphere Portal few weeks back, IBM RAD is a very complete tool built on top of Eclipse, it has a lot of features that facilitates the work on portlet development, you can create in a few minutes a portlet using Struts or JSF as framework. Once a portlet is created you can build and package this portlet as WAR file to deploy on Websphere Portal.

Websphere Portal is completely updated portal solution, you can run JSR 168 and JSR 286 compliant portlets, you also have the option to create portlets using the IBM specific implementation that contains a lot of additional features.

The entire portal is fully customizable, you can change the portal appearance by adding new themes, all portlets can be added to a portal page by just drag and drop then on a page, access control can be easily done via deep integration with LDAP. You can even use google gadgets on your portal page!

Are you worried about scalability? Don’t worry, you can put several websphere portal instances running on a cluster mode.

Share

Creating a EL function to return browser name

Posted by – January 7, 2009

There are some situations where we need know the browser name to perform some changes on page code, the java code below defines a EL function to help on retrieve the browser name.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package br.eti.faces.el;

import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

public final class Browser {

    public static String name() {
        FacesContext context=FacesContext.getCurrentInstance();
        HttpServletRequest request=
           (HttpServletRequest)context.getExternalContext().
               getRequest();
        String useragent= request.getHeader("user-agent");
        useragent=useragent.toLowerCase();
        if (useragent.indexOf("opera")!=-1)
            return "opera";
        if (useragent.indexOf("netscape")!=-1)
            return "netscape";
        if (useragent.indexOf("msie")!=-1)
            return "ie";
        if (useragent.indexOf("firefox")!=-1)
            return "firefox";
    return "";
    }
}

More

Share

JBoss Seam and Richfaces

Posted by – December 25, 2008

Yesterday I started a small application using JBoss Seam and Richfaces, after some hours fixing configuration issues and incompatibilities I could finally get a simple crud working.

One of the problems that I had while trying to get the application running was a redirect loop when using seam with myfaces tomahawk, once I removed myfaces tomahawk libs and configuration entries in web.xml the error gone.

Now I have another problem related with Richfaces calendar component, the popup button image isn’t displayed and the javascript for calendar component isn’t loaded too.

Share