Friday, March 9, 2012

TED favorite videos

Louie Schwartzberg : Nature,Beauty and Gratitude







Susan Cain - The Power of Introverts



Bryan Stevenson : We need to talk about an injustice


Vijay Kumar: Robots that fly ... and cooperate



Larry Smith : Why you will fail to have a great career


Robots playing James Bond Theme

Saturday, November 13, 2010

Mind Maps

About Mind Maps from  Tony Buzan himself

http://www.youtube.com/watch?v=HyJrrUIocUI&feature=fvw

Read More

Saturday, October 30, 2010

spring3 flex4 Integration with BlazeDS

Courtesy(dzone refcards)

Starting from scratch and configuring everything by hand for a simple application.


Needed stuff
• An Eclipse 3.5 Distribution. Y ou may choose either the standar d
distribution: Eclipse 3.5 (Galileo) for Java EE Develop ers (On Mac use
the Eclipse Carbon version): http://www.eclipse.org/downloads/
Or, for enhanced Spring support you might consider using the
SpringSource Tool Suite:
http://www.springsource.com/products/springsource-tool-suite-download/
• Flash Builder 4 (60 day T rial) installed as a plug-in for the
Java EE Eclipse distribution: http://www.adobe.com/go/try_flashbuilder
• Tomcat 6: http://tomcat.apache.org/
• BlazeDS 4 (Binary Distribution):
http://opensource.adobe.com/wiki/display/blazeds/BlazeDS/
• Spring Framework 3.0.2 (vanilla r elease):
http://www.springsource.org/download
• Spring BlazeDS Integration 1.0.3 (vanilla r elease):
http://www.springsource.org/spring-flex
• AOP Alliance 1.0: http://sourceforge.net/projects/aopalliance/files/
• backport-util-concurr ent 3.1 for the Java version you’r e using:
http://sourceforge.net/projects/backport-jsr166/files/backport-jsr166/
• cglib 2.2 http://sourceforge.net/projects/cglib/files/
• asm 3.2 http://forge.ow2.org/projects/asm/
Manually downloading the dependencies is one way to get everything
you need. Alternatively, you can use Maven or the SpringSource Tool
Suite to automatically handle dependencies for you.




Steps
First install your chosen Eclipse distribution and then install Flash
Builder 4 as a plug-in to the Eclipse distribution you just ins talled. Also
extract the ZIP files for the other dependencies specified above. When
you’ve completed these steps, run Eclipse. In Eclipse create a server
that will run the application:
1. Choose File > New > Other
2. Select Server > Server
3. Click Next
4. Select Apache > Tomcat v6.0 Server
5. Click Next
6. Specify the location wher e Tomcat is installed and select the JRE
(version 5 or higher) to use
7. Click Finish


Eclipse select File > Import and select the Existing P rojects Into
Workspace option. Using the Select Archive File option and Browse
button, locate the flexspring.zip file, and then click Finish.
Alternatively to start from scratch, set up the server-side Java web
project in Eclipse by creating a web application from the blazeds.war file
(found inside the BlazeDS zip file).
In Eclipse, import the blazeds.war file to create the project:
1. Choose File > Import
2. Select the WAR file option. Specify the location of the blazeds.war file.
For the name of the web project, type flexspring
3. Click Finish
First remove the xalan.jar file from the WebContent/WEB-INF/lib
folder. Next, go into the pr oject properties. One way to get ther e is
by right-clicking on the project and selecting Properties. In the project
properties, select Java Build Path and then click the Source tab. Set the Default Output Folder to be the following (you will need to create the classes folder):


flexspring/WebContent/WEB-INF/classes


This causes all Java classes that are created in the project to be deployed in the web application.
In the WebContent/WEB-INF/flex folder update the services-config.xml file with the following contents:




<?xml version=”1.0” encoding=”UTF-8”?>
<services-config>
<channels>
<channel-definition id=”my-amf” class=”mx.messaging.channels.AMFChannel”>
<endpoint url=”http://{server.name}:{server.port}/{context.root}/messagebroker/amf” class=”flex.messaging.endpoints.AMFEndpoint”/>
</channel-definition>
<channel-definition id=”my-streaming-amf” class=”mx.messaging.channels.StreamingAMFChannel”>
<endpoint url=”http://{server.name}:{server.port}/{context.root}/messagebroker/streamingamf” class=”flex.messaging.endpoints.StreamingAMFEndpoint”/>
</channel-definition>
<channel-definition id=”my-polling-amf” class=”mx.messaging.channels.AMFChannel”>
<endpoint url=”http://{server.name}:{server.port}/{context.root}/messagebroker/amfpolling” class=”flex.messaging.endpoints.AMFEndpoint”/>
</channel-definition>
</channels>
</services-config>


Listing 1: services-config.xml - Updated to contain only the channels defined.


Now select the Servers tab in Eclipse. If the tab is not visible you can make it visible by choosing Windows > Show View > Servers. Right-click the Tomcat Server and select Add and Remove. To add the flexspring web application to the server, select it in the Available list and then click Add. Finally, click Finish.
Next, you need to add the required dependencies to the flexspring web application. Copy all of the Spring Framework libraries / JAR files (located in the dist folder) to the WebContent/WEB-INF/lib folder. Also copy the Spring BlazeDS Integration library (located in the dist folder) to the lib folder. Do the same for aopalliance.jar, backport-util-concurrent.jar, cglib-2.2.jar, asm-3.2.jar.


Simple Flex Remoting


To configure the server for simple Flex Remoting first edit the web.xml file in the WebContent/WEB-INF folder. Replace its contents with:
<?xml version=”1.0” encoding=”UTF-8”?>
<web-app xmlns=”http://java.sun.com/xml/ns/javaee” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:web=”http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”
xsi:schemaLocation=”
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd”
version=”2.5”>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>flex.messaging.HttpFlexSession</listener-class>
</listener>
<servlet>
<servlet-name>flexspring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>flexspring</servlet-name>
<url-pattern>/messagebroker/*</url-pattern>
</servlet-mapping>
</web-app>


Listing 2: web.xml - Setup for simple Flex Remoting with Spring.


Eclipse may try to change the web-app version to 2.4 instead of 2.5. If this happens just manually change it back to 2.5.
Spring will now handle requests to the /messagebroker/ url.
Now configure Spring by creating an applicationContext.xml
file in the WebContent/WEB-INF folder with the following contents:


<?xml version=”1.0” encoding=”UTF-8”?>
<beans xmlns=”http://www.springframework.org/schema/beans”
xmlns:flex=”http://www.springframework.org/schema/flex”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:context=”http://www.springframework.org/schema/context”
xsi:schemaLocation=”
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/flex
http://www.springframework.org/schema/flex/spring-flex-1.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd”>
<flex:message-broker>
<flex:remoting-service default-channels=”my-amf”/>
</flex:message-broker>
<context:component-scan base-package=”flex” />
</beans>


Listing 3: The basic Spring configuration for Flex Remoting.\


Listing 3 sets up the Flex message-broker, which will enable the Flex remoting-service using the my-amf channel. The component-scan will find classes in the “flex” package that have been annotated for Remoting. Typically with Spring, the configuration files are split out into more logical pieces. The approach used in Listing 3 is a simple way to get started but does not represent the best practice for Spring config file organization.


Now create a simple Java class that will be exposed through the AMF channel to a Flex application. In the src folder create a new Java Class in the flex package with the name “HelloWorldService”. Set the contents of the HelloWorldService.java file to:


package flex;
import org.springframework.flex.remoting.RemotingDestination;
import org.springframework.flex.remoting.RemotingInclude;
import org.springframework.stereotype.Service;
@Service
@RemotingDestination
public class HelloWorldService {
@RemotingInclude
public String sayHello(String name) {
return “howdy, “ + name;
}
}


Listing 4: HelloWorldService.java - A simple Java object exposed for remoting through Spring annotations.


On the HelloWorldService class you will notice two annotations. The
@Service annotation tells Spring that the class is a Service and the
@RemotingDestination annotation exposes the class as a remoting endpoint for Flex. This class also contains a single method named sayHello, which simply takes a string and returns a slightly modified version of the string. By default all public methods on a class are available for remoting. You can keep a public method from being exposed as a remoting endpoint by using the @RemotingExclude annotation.
Listing 4: HelloWorldService.java - A simple Java object exposed for remoting through Spring annotations.


Create the Flex Application


Now you can create a Flex application that will call the sayHello method on HelloWorldService. Remember that Flex applications run on the client side so all interactions with a server must happen over some remote call. Usually (and in the case here) these calls happen over HTTP. They can use a variety of serialization options including SOAP, JSON, and RESTful XML. In this case, Flex Remoting will use the binary AMF serialization protocol inside of HTTP request / response bodies.
To begin building the Flex application, simply create a new Flex Project in Eclipse. In the New Flex Project wizard, type sayHello as the name, select Web as the Application type, and set the Flex SDK Version to Flex 4.0 (usually the default). Also select J2EE as the Application Server Type, enable Use Remote Object Access Service, and select BlazeDS. Ensure that the Create Combined Java/Flex Project Using WTP option is not checked and then click Next. Now enter the information for your flexspring project. The Root folder is the WebContent folder in your flexspring project. The Root URL should be http://localhost:8080/flexspring/. The Context root should be /flexspring.
Click Finish to create the project. You should now see the template code for the application. Replace the code with the following:


<?xml version=”1.0” encoding=”utf-8”?>
<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009”
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/mx”>
<fx:Declarations>
<s:RemoteObject id=”ro” destination=”helloWorldService”
endpoint=”http://localhost:8080/flexspring/messagebroker/amf”/>
</fx:Declarations>
<s:layout><s:VerticalLayout/></s:layout>
<s:TextInput id=”t”/>
<s:Button label=”sayHello” click=”ro.sayHello(t.text)”/>
<s:Label text=”{ro.sayHello.lastResult}”/>
</s:Application>
Listing 5: sayHello.mxml - Basic Flex application using Remoting with Spring.


When you save the file it should automatically compile. When it is
compiled it should automatically be deployed in your web application.
You are now ready to start the server and test the application. Go to
the Servers View in Eclipse and start the Tomcat server. Watch the
console and make sure that there are no startup errors.
Now run the sayHello application (one way is to right-click the sayHello.
mxml file, select Run As, and then select W eb Application). Your
browser should open the sayHello.html file that then downloads and
runs the Flex application. Type your name in the TextInput box and
click the sayHello button. This will initiate a Flex Remoting request to
the Tomcat server calling the Spring DispatcherServlet, which then will
look up the service based on the destination helloWorldService. This
destination is automatically mapped to the HelloWorldService Spring
Bean. Then the sayHello method will be invoked on the bean, passing
in the String that was specified in the RemoteObject call on the client.
The method returns a new String, which is then serialized into AMF,
inserted into the HTTP Response body, and sent back to the client. On
the client side the Flex application will parse the AMF and then set the
ro.sayHello.lastResult property to what was returned from the server.
Data binding in the Label will note the property change and refresh its
view of the data.
You now have completed a basic web application with a Flex
application communicating with Spring through BlazeDS using the
Spring BlazeDS Integration! Next you will add Hibernate into t he mix
and see how the Flash Builder 4 data-centric development featur es can
help you quickly build data-driven Flex applications.

Friday, October 29, 2010

Kerala - God's Own Country




Kerala is a state in India. It is located on the south-western region of the country. It was created on 1 November 1956, with the passing of the States Reorganisation Act bringing together the areas where Malayalam was the dominant language.
The state has an area of 38,863 km2 (15,005 sq mi) and is bordered by Karnataka to the north, Tamil Nadu to the south and the east and the Lakshadweep Sea towards the west. Thiruvananthapuram is the capital and largest city of Kerala. Kochi and Kozhikode are the other major cities. Kerala is also known for its many small towns that are scattered across the state, thus creating a higher density of population.
From as early as 3000 BC, Kerala had established itself as a major spice trade centre. A 3rd-century-BC rock inscription by emperor Asoka the Great attests to a Keralaputra.Around 1 BC the region was ruled by the Chera Dynasty, which traded with the Greeks, Romans and Arabs. The Tamil Chera dynasty, Ays and the Pandyan Empire were the traditional rulers of Kerala whose patriarchal dynasties ruled until the 14th century. The Cheras collapsed after repeated attacks from the neighboring Chola and Rashtrakuta kingdoms. Feudal Namboothiri Brahmin and Nair city-states subsequently gained control of the region. Contact with Europeans after the arrival of Vasco Da Gama in 1498 gave way to struggles between colonial and native interests. By early 16th century, the Portuguese established their domination. They were defeated by the Dutch in 1663, who in turn were forced out of the land by the British East India Company in 1795, bringing the area under British dominion. After independence, the state of Kerala was created in 1956 from the former state of Travancore-Cochin, the Malabar district of Madras State, and the Kasaragod taluk of Dakshina Kannada.
Kerala is a popular tourist destination famous for its backwaters, Ayurvedic treatments and tropical greenery. Kerala has a higher Human Development Index than all other states in India. The state has a literacy rate of 94.59 percent,the highest in India. A survey conducted in 2005 by Transparency International ranked Kerala as the least corrupt state in the country. Kerala has witnessed significant migration of its people, especially to the Persian Gulf countries during the Kerala Gulf boom, and is heavily dependent on remittances from its large Malayali expatriate community.