Thursday, August 16, 2012

No repository found containing: Error while updating ADT

If you come across the following errors while updating Android ADT

No repository found containing: org.eclipse.update.feature,org.eclipse.datatools.enablement.oda.feature,1.10.0.v201201161512-7A7T7CDZRDKHF_HnGjOX



Disable all the update sites except ADT and the go for Check for update one more time. It will work.



Tuesday, May 29, 2012

Adding and Removing Spring initialized beans from Container

Yesterday one of my friend shoot a question on Spring bean management on runtime. His requirement is to remove bean for container and register it back after doing some operation.
The idea is straight, We might run into these situations depending on our business use cases complexities.

Here is a test case code snippet to remove bean and register it again to the spring container

Spring Context XML


        
	
		
			Shinu
		
	


JUnit Test class



package com.shinu.demo;

import javax.servlet.ServletContext;

import junit.framework.TestCase;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.FileSystemResourceLoader;
import org.springframework.mock.web.MockServletContext;
import org.springframework.web.context.ConfigurableWebApplicationContext;
import org.springframework.web.context.support.XmlWebApplicationContext;

public class SpringWebDynamicCreationTest extends TestCase {

	final static Log logger = LogFactory
			.getLog(SpringWebDynamicCreationTest.class);

	protected static ConfigurableWebApplicationContext context;

	ServletContext mockServletContext;

	@Override
	protected void setUp() throws Exception {
		mockServletContext = new MockServletContext("/WebContent",
				new FileSystemResourceLoader());
		context = new XmlWebApplicationContext();
		context.setConfigLocations(new String[] { "/WEB-INF/config/springContext.xml" });
		context.setServletContext(mockServletContext);
		context.refresh();
		context.registerShutdownHook();
	}

	public void testAddAndRemoveObjects() throws ClassNotFoundException {
		Demo demo = getBean(context);
		assertEquals("Shinu", demo.getName());

		ConfigurableListableBeanFactory configurableListableBeanFactory = context
				.getBeanFactory();

		BeanDefinitionRegistry beanDefinitionRegistry = (BeanDefinitionRegistry) configurableListableBeanFactory;
		// Removing the bean from container
		beanDefinitionRegistry.removeBeanDefinition("demo");
		
		// Trying to obtains bean again from container. This will throw a null		
		demo = getBean(context);
		//demo object will be null here
		assertNull(demo);
		
		// Creating and registering bean to the container		
		BeanDefinition beanDefinition = new RootBeanDefinition(Demo.class);
		beanDefinition.setAttribute("name", "Shinu");

		beanDefinitionRegistry.registerBeanDefinition("demo", beanDefinition);
		context.refresh();
	
		//Obtaining from container again
		demo = getBean(context);
		assertEquals("Shinu", demo.getName());

	}

	private static Demo getBean(ApplicationContext applicationContext) {		
		try{
			return (Demo) applicationContext.getBean("demo");
		}catch(NoSuchBeanDefinitionException e){
			return null;
		}
	}

}


Tuesday, December 27, 2011

Nokia N900 and GPS

After installing Community SSU in my Nokia N900, i found a strange issue that my GPS stopped working. My GPS apps always failed in looking for a GPS fix. 
After a few googling and work around, I finally made it work.

Here is that you need to do if you run across the same issue.

1. Edit the "Location Settings" in Settings and change the "Network Position" server to "supl.google.com" (Looks like supl.nokia.com is not working after SSU update)
2. Install location-gui deb package and start a test to figure out the GPS availability and usage.


Link to download location-gui  

wget http://repository.maemo.org/pool/maemo5.0/non-free/l/location-test-gui/location-test-gui_0.92-1+0m5_armel.deb

dpkg -i location-test-gui_0.92-1+0m5_armel.deb 
 

3. Run location-test and start looking for GPS.

Voila, it worked.

Saturday, November 19, 2011

Friday, November 11, 2011

Beautiful - Malayalam movie

Beautiful - New movie by Anoop Menon
I came to know about this movie from a fb share, one song "Mazhaneer Thullikal" is shared; at the very first watch itself, the song, lyrics and cinematography strikes me. 
A 20 times i heard the song "Mazhaneer thullikal" from this new movie so far. That forces me to blog about this movie a bit.


Song - Mazhaneer Thillikal

Song: Moovanthiyay


The movie is directed by one of the malayalam director veteran V.K Prakash
Story and lyrics by Anoop himself, and music by Ratheesh Vegha; an upcoming music director. He proved his talent in "Cocktail" movie; his first movie as music director 
Singer: Unni Menon
Cast: Jayasurya, Anoop Menon, Meghna Raj, Aparna, Parvathy Nair, Jayan, Nandu, Thesni Khan, Kishore
Here is the official website for more information - http://www.beautifulthemovie.in/

Lastly my friend Lloyd Chandran had a question after seeing the preview. Is this a remake of "The Diving Bell and the Butterfly"
Even if it is like Anoop's last movie "Cocktail" I won't be surprised. He has got talent. I always feel, this guys picks the right talent always.

Wednesday, November 9, 2011

JavaFX 2.0 in Chrome

I was trying out the new Ensemble sample apps of JavaFX 2.0 in my Google chrome browser running on a 64bit windows 7. I soon realized that the app is not loading complaining that i don't have a FX 2.0 runtime. In fact i do have a SDK installed running fine. Then i tried downloading a 64 bit Fx 2.0 runtime from FX Runtime download; even that did'nt.
How ever everything thing seems to be perfect, where in my browser was showing i have the required JRE, and I have installed the FX runtime.
Finally i decided to went for a shot of downloading 32bit FX runtime setup. Voila that did worked, after installation I was able to see the app loading fine.
So folks out there facing issue with 64bit runtime, go ahead and install the 32 bit one which will fix the issue.

Thursday, November 3, 2011

Getting VM name and hostname from JBoss JMX

JBoss JMX exposes all information about the server as MBean's.
Here is a simple way if you need get the JVM name and the host name in your application.
For getting the JVM name 
ServerConfigImplMBean serverConfigMbean = 
MBeanProxyExt.create( ServerConfigImplMBean.class,
“jboss.system:type=ServerConfig”, 
MBeanServerLocator.locateJBoss()); 

serverConfigMbean. getServerName(); 

For getting the Host name 
ServerInfoMBean serverInfoMbean = 
MBeanProxyExt.create( ServerInfoMBean.class, 
“jboss.system:type=ServerInfo”, 
MBeanServerLocator.locateJBoss());  

serverInfoMbean.getHostName(); 

From the JMX Browser we can get the complete list of Server level exposed MBeans under "jboss.system"