Monday, 28 November 2011

Andriod App

kid
1.AniWorld Lite
2.HomeWork
3.Pineapple Studio Jigsaw Puzzles
4.iStory Books
5.Ant Smasher
6.TomnJerry Tube
7.Steamy Window - make picture
8.Classic Simon
++++++++++
1.Science360
2.HowStuffWorks
3.Google Sky Map
4.beebPlayer -radio

iPad app

1.Adobe Ideas
2.Bloomberg
3.Dictionary.com
4.Dropbox (universal)
5.Evernote (universal) online service for saving ideas – text documents, images and web clips
6.The Guardian Eyewitness - showcase for engaging photography
7.PaperDesk Lite for iPad
8.Reuters News Pro for iPad
9.Wikipanion for iPad
10.Google Earth
11.Explore Flickr (universal)
12.BBC News (universal)
13.Epicurious (universal) - ens of thousands of recipes
14.Adobe Photoshop Express
15.Find my iPhone
16.Read It Later Free
17.TED - talks by remarkable people
18.Virtuoso Piano Free 2 HD
19.BBC iPlayer
20.Sky News for iPad
21.Fotopedia Heritage - beautiful locations worldwide
22.Yell - unfamiliar place or travelling somewhere new
23.XE Currency for iPad
24.Classical Guitar

++++++++phone
1.iHandy Level Free
2.TVGuide.co.uk
3.Zoopla Property Search
4.Virtuoso Piano Free 3
5.TuneIn Radio - Don't bother buying a DAB radio
6.Google Translate
++++++++game
1.Air Hockey Gold (universal)
2.Bub - Wider
3.Checkers Free HD
4.GodFinger All-Stars for iPad
5.Hole-in-a-wall HD
6.Pocket Legends for iPad
7.Pilgrim's Punch-Out (universal)
8.New York 3D Rollercoaster Rush HD Free
9.SLS AMG HD - car stun
10.Drop7 Free (universal) -puzzle game
11.TinkerBox - construction
12.Doodle Jump: HOP The Movie (universal)
13.Paper Toss: World Tour HD
14.NinJump - HD - ninja
15.AlexPanda (universal)

Wednesday, 26 October 2011

First Cup

Architecture
4 components:
1.DukesAgeResource - JAX-RS RESTful web service;
2.DukesBirthdayBean - enterprise bean;
3.FirstcupUser - JPA entity;
4.firstcup, web app created with JSF Facelets technology

Monday, 10 October 2011

GWT + Dynamic Web Project

[ERROR] Unexpected
java.lang.NoSuchFieldError: reportUnusedDeclaredThrownExceptionIncludeDocCommentReference

To fix:
- Right-click project > Properties
- Java Build Path > Order and Export
- Move the GWT SDK above the Server Library (Apache Tomcat)

Tuesday, 27 September 2011

Ant

In the root directory with build.xml & build.properties file.
Run "ant build hosted"

If directory not have .classpath or .project file:
Run 'ant eclipse.generate'

Sunday, 25 September 2011

GWT Tut - RPC

To use RPC, write 3 components:

1.Define (ClientService interface) extends RemoteService & lists all RPC method.
2.Create (ServerServiceImpl class) extends RemoteServiceServlet & implements methods.
3.Define (ClientServiceAsync interface) to be called from client-side code.

Calling the remote procedure call:
1.Create the proxy class
private ClientServiceAsync clientServiceSvc = GWT.create(ClientService.class);
2.Initialize proxy , set up callback object & make call to the remote method.
Initialize: clientPriceSvc = GWT.create(ClientPriceService.class);
Set up callback: AsyncCallback callback = new AsyncCallback() {public void onFailure .... onSucess....}
Call the remote method: clientServiceSvc.getToy(...

Wednesday, 14 September 2011

GWT Tut - gc

Development : in the "edit - refresh - view" cycle.

1.add the widgets to specific [div]
RootPanel rootPanel = RootPanel.get("stockList");
rootPanel.add(mainPanel);

2.Event
*Listen for mouse events on the Add button.
addStockButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {

3.Alert dialog box
Window.alert("'" + stockcode + "' not a valid code.");

4.Refer to widget value
String stockcode=newSymbolTextBox.getText().toUpperCase().trim();

5.Widget inside widget
Button removeStockButton = new Button("x");
stocksFlexTable.setWidget(row, 3, removeStockButton);

6.Timer
*Setup timer to refresh list automatically.
Timer refreshTimer = new Timer() {@Override
public void run() {

7.Generate random stock prices.
double price = Random.nextDouble() * MAX_PRICE;

8.From Double to String
String priceText = NumberFormat.getFormat("#,##0.00").format(price.getPrice());

9.Last update date and time
lastUpdatedLabel.setText("Last update : "+ DateTimeFormat.getShortDateTimeFormat().format(new Date()));

10.Debug
Run as debug. Resume, Step over, Step into.

11.Apply css style
stocksFlexTable.getRowFormatter().addStyleName(0, "watchListHeader");
stocksFlexTable.getCellFormatter().addStyleName(row, 1, "watchListNumericColumn");

12.Creat sec. styles dependent on primary style
removeStockButton.addStyleDependentName("remove");

13.Dynamic style
Label changeWidget = (Label)stocksFlexTable.getWidget(row, 2);
changeWidget.setText...
+if (price.getChangePercent() < -0.1f) +{changeStyleName = "negativeChange"; changeWidget.setStyleName(changeStyleName) 14. Generate stock data in JSON(Server). +PrintWriter out = resp.getWriter(); +out.println('['); out.println(" {"); out.print(" \"symbol\": \""); C1-Use JavaScript Native Interface (JSNI) and GWT overlay types to work with the JSON data. class StockData extends JavaScriptObject {... JSNI methods to get stock data. public final native String getSymbol() C2-Make HTTP call to retrieve the JSON data(Client). private static final String JSON_URL = GWT.getModuleBaseURL() + "stockPrices?q="; use the HTTP client classes in the com.google.gwt.http.client package [inherits name="com.google.gwt.http.HTTP" />

Thursday, 8 September 2011

GWT Applications

1.First Step
============
1.Ajax (Asynchronous JavaScript and XML)
2.Web App By a.Adobe Flash and Flex b.Microsoft Silverlight c.Java FX
3.Software Engineering for Ajax - GWT most powerful tool for creat Ajax app
4.Can include any JS libraries, & compiles down distributed as Ajax app use only web don’t require runtimes or plugins. Browser appears like Ajax app, developer like build regular desktop app & provide debug support and compile-time error check on fly.
5.desktop like web-app : fast, responsive & visually rich
6.GWT generates JavaScript code from Java code
7.webAppCreator com.gwtapps.tutorial.client.Hangman

Wednesday, 7 September 2011

Dojo

Hello
=====
1.[script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6.0/dojo/dojo.xd.js"][/script]
2.dojo.ready(function(){}
3.dojo.byId("greeting").innerHTML += ", from " + dojo.version;
4.dojo.require("dojo.fx"); //load module
5.dojo.create("li", {innerHTML: "One"}, list);
6.dojo.place(myfirst, mysecond, "last"); //for list
7.dojo.empty("mylist");

Thursday, 1 September 2011

Master Detail

Nothing more than /object1/{object1.id}/object2/{object2.id}
url="{ownerId}/pets/{petId}/edit"

[c:forEach var="pet" items="${owner.pets}">
...
[c:forEach var="visit" items="${pet.visits}">

TABLE: owners
PRIMARY KEY id

TABLE: pets
PRIMARY KEY id
FOREIGN KEY owner_id references the owners table id field

TABLE: visits
PRIMARY KEY id
FOREIGN KEY pet_id references the pets table id field


(1)Database
Like, TABLE: owners
PRIMARY KEY id

TABLE: types
PRIMARY KEY id

TABLE: pets
PRIMARY KEY id
FOREIGN KEY type_id references the types table id field
FOREIGN KEY owner_id references the owners table id field

(2)Business Layer
Like, Entity or Validation
...petclinic.Owner
...validation.OwnerValidator

(3)Business + Persistence Layer (ApplicationContext-jpa.xml)
Like, JPA Clinic Implementation
...jpa.EntityManagerClinic
JPA configuration is provided by orm.xml & persistence.xml

(4)Presentation Layer (controller)
web.xml & petclinic-servlet.xml





Wednesday, 31 August 2011

ROO Commands

Relationship
============
1.m:m use "field set"
(one Pizza can have many Toppings & one Topping can be applied to many Pizzas)
~.domain.Pizza roo> field set --fieldName toppings --type ~.domain.Topping

2.m:1 use ""field reference"
(one Pizza can have one base & one base can be applied to many Pizzas)
~.domain.Pizza roo> field reference --fieldName base --type ~.domain.Base

3.Automatic JSON support, including in Spring MVC applications
curl -v -H 'Accept: application/json' -X GET http://localhost:8080/petclinic/owners/

Thursday, 25 August 2011

JSP Custom Tags

1.Make Java public Class "MyTag"
2.Declare the "MyTag" class under file MyTag.tld
3.In JSP, define the <%@ taglib prefix="tagtool" uri="/WEB-INF/tlds/MyTag.tld" %>
& start to use it.

Wednesday, 24 August 2011

ROO project

Task 2 - point to list.jsp & delete.jsp


Task 1 - point to create.jsp & show.jsp
a.Create new Client Form
http://localhost:8080/simple/clients?form

Form:-
1.need (method = RequestMethod.GET) & (method = RequestMethod.POST)
2.POST need (@ModelAttribute("reservation") Reservation reservation,
BindingResult result, SessionStatus status) AS parameter
3.JSP need modelAttribute="reservation"

b.Show Client
http://localhost:8080/simple/clients/2
Answer :- change views.xml +

username : ${client.username}

ROO

1.
delgad9

2.
Forum

3.viralpatel Master Detail

jd showcases

Wednesday, 17 August 2011

Use H2 database

Start the bin/h2.bat

jdbc:h2:tcp://127.0.0.1/~/crm_example

Use Derby

1.For the sake of low memory consumption and easy configuration,chosen Apache Derby
as database engine.

2.For testing purposes, the client/server mode is more appropriate because it allows you to inspect and edit data with any visual database tools that support JDBC. Example, the Eclipse Data Tools Platform (DTP).

3.To start the Derby server in the client/server mode, execute the startNetworkServer script in the bin directory.

4.Under ij

5.connect 'jdbc:derby://localhost:1527/vehicle;create=true' ;

Git usage

To obtain a copy of the source:
From the bash command line, you can use the command
git clone git://git.springsource.org/spring-security/spring-security.git

Git Wiki

http://git-scm.com/download

Git-1.7.6-preview20110708.exe of msysgit (Git for Windows)

git

github

spring git

Eclipse GIT

If
git clone git://site/xxx/abc.git
having error fatal: unable to connect a socket (Invalid argument)
then use (http instead)
git clone http://site/xxx/abc.git

Maven commands

mvn –version
mvn install
mvn clean install
(remove any pre-built binaries and then install the artifact)

mvn jetty:run-exploded --from ROO GWT

mvn [plugin-name]:[command-name]
================================
mvn dependency:tree
mvn dependency:copy-dependencies

ROO
===
dependency add --groupId org.springframework.integration --artifactId spring-integration-file --version 2.0.0.RELEASE
perform package
dependency remove --groupId org.springframework.integration --artifactId spring-integration-file --version 2.0.0.RELEASE
perform command --mavenCommand install

Phase Description
validate Runs a sanity check on the project itself
compile Compiles source code
test Runs the compiled test classes (delegating to a particular unit testing plugin runner, like jUnit or TestNG)
package Produces an artifact from the compiled code and classpath resources and stores it in the target folder, at the root of the project
integration-test Process and deploy the packaged artifact into an integration testing environment
verify Run checks to confirm that the package is valid
install Installs the packaged artifact in your local repository. Your local repository is a folder where all the downloaded dependencies are kept and cached. Subsequent builds that try to resolve a dependency already in the cache will not redownload the dependency, instead using the one in the local repository. Normally, it's in your home directory, under .m2, in a folder called repository. Thus, on my system, this would be /home/jlong/.m2/repository
deploy Copies the final artifact to another environment. Typically, a shared server so that different teams can share a shared dependency.

Wednesday, 10 August 2011

Can not find the tag library descriptor for "http://java.sun.com/portlet"

To fix add pluto-taglib.jar
===========================
[!-- To solve porlet taglibs problem --]
[dependency]
[groupId]org.apache.portals.pluto[/groupId]
[artifactId]pluto-taglib[/artifactId]
[version]2.0.0[/version]
[type]jar[/type]
[scope]compile[/scope]
[/dependency]

Need Pluto
Get Pluto

cvc-complex-type.4: Attribute 'version' must appear on element 'portlet-app'.

Before
======
[portlet-app
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"]

Fix
===
[portlet-app
version="2"
xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd
http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"]

Tuesday, 9 August 2011

Fixed Costs vs Indirect Costs

Fixed costs
Fixed costs can be grouped in three types:These costs include the following expense items: Agency fee, Crew cost, Vessel depreciation, Vessel insurance, Vessel interest, Vessel’s Maintenance & repair, Oil, Canal Fee, Charter hire, Dry docking depreciation, Fleet Administration, Admin Expenses and GI

Indirect costs
Expenses that are related indirectly to the container and does not hold the container data e.g.: Shifting, Hatching

Monday, 8 August 2011

Error message: "A script on this page is causing Internet Explorer to run slowly"

To Fix
======
To change this time-out value in Internet Explorer 4.0, 5.0, 6, 7, or 8, follow these steps:

Using a Registry Editor such as Regedt32.exe, open this key:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Styles

Note If the Styles key is not present, create a new key that is called Styles.
Create a new DWORD value called "MaxScriptStatements" under this key and set the value to the desired number of script statements. If you are unsure of what value you need to set this to, you can set it to a DWORD value of 0xFFFFFFFF to completely avoid the dialog.

By default the key doesn't exist. If the key has not been added, the default threshold limit for the time-out dialog box is 5,000,000 statements for Internet Explorer 4 and later.

Because the Internet Explorer 4.0, 5.0, 6, 7, and 8 time-out is based on the number of script statements executed, the time-out dialog box will not display during ActiveX control or database-access delays. Endless loops in script will still be detected.

Sunday, 7 August 2011

Receipe (1)

Grails
======
p.471 In web app, domain classes are first things to be defined, because represent data that is saved — in permanent storage system — it interacts with
controllers - representing data displayed in views.

Thursday, 28 July 2011

java.lang.ClassNotFoundException: org.jboss.el.ExpressionFactoryImpl

Problem
=======
java.lang.ClassNotFoundException: org.jboss.el.ExpressionFactoryImpl

Solution
========
[dependency>
[groupId>org.jboss.el[/groupId]
[artifactId]com.springsource.org.jboss.el[/artifactId]
[version]2.0.0.GA[/version]
[/dependency]

java.lang.ClassNotFoundException: org.ajax4jsf.Filter

Problem
=======
java.lang.ClassNotFoundException: org.ajax4jsf.Filter

Solution
========
[dependency]
[groupId]org.richfaces.framework[/groupId]
[artifactId]richfaces-api[/artifactId]
[version]3.3.1.GA[/version]
[/dependency]
[dependency]
[groupId]org.richfaces.framework[/groupId]
[artifactId]richfaces-impl[/artifactId]
[version]3.3.1.GA[/version]
[/dependency]
[dependency]
[groupId]org.richfaces.ui[/groupId]
[artifactId]richfaces-ui[/artifactId]
[version]3.3.1.GA[/version]
[/dependency]

Tuesday, 26 July 2011

Firefox internal info

about:cache
about:config

http://kb.mozillazine.org/About:config

Monday, 25 July 2011

java.io.InvalidObjectException: Could not find a SessionFactory named: null org.hibernate.impl.SessionFactoryImpl.readResolve(SessionFactoryImpl.java:642)

Problem
=======
org.springframework.webflow.execution.repository.snapshot.SnapshotUnmarshalException: IOException thrown deserializing the flow execution stored in this snapshot -- this should not happen!
org.springframework.webflow.execution.repository.snapshot.SerializedFlowExecutionSnapshot.unmarshal(SerializedFlowExecutionSnapshot.java:100)
org.springframework.webflow.execution.repository.snapshot.SerializedFlowExecutionSnapshotFactory.restoreExecution(SerializedFlowExecutionSnapshotFactory.java:80)

java.io.InvalidObjectException: Could not find a SessionFactory named: null
org.hibernate.impl.SessionFactoryImpl.readResolve(SessionFactoryImpl.java:642)


Solution
========
???

Alternative
===========
[webflow:listener ref="hibernateFlowExecutionListener"/]

[bean id="hibernateFlowExecutionListener"
class="org.springframework.webflow.persistence.HibernateFlowExecutionListener"]
[constructor-arg ref="sessionFactory"/]
[constructor-arg ref="transactionManager"/]
[/bean]


[beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"]

[bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"]
[property name="driverClassName"
value="org.apache.derby.jdbc.ClientDriver"/]
[property name="url"
value="jdbc:derby://localhost:1527/library"/]
[property name="username" value="app"/]
[property name="password" value="app"/]
[/bean]

[bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"]
[property name="dataSource" ref="dataSource"/]
[property name="annotatedClasses"]
[list]
[value]com.apress.springrecipes.library.domain.BorrowingRecord[/value]
[/list]
[/property]
[property name="hibernateProperties"]
[props]
[prop key="hibernate.session_factory_name"]mySessionFactory[/prop]
[prop key="hibernate.dialect"]org.hibernate.dialect.DerbyDialect[/prop]
[prop key="hibernate.show_sql"]true[/prop]
[prop key="hibernate.hbm2ddl.auto"]update[/prop]
[/props]
[/property]
[/bean]

[bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager"]
[property name="sessionFactory" ref="sessionFactory"/]
[/bean]

org.hibernate.MappingException: Unknown entity:

Problem
=======
org.hibernate.MappingException: Unknown entity: com.apress.springrecipes.library.domain.BorrowingRecord
org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl.java:580)

Solution
========
[property name="annotatedClasses"]
[list]
[value]com.apress.springrecipes.library.domain.BorrowingRecord[/value]
[/list]
[/property]

java.lang.IllegalStateException: unread block data java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2376)

SWF with persistence

Problem
=======
java.lang.IllegalStateException: unread block data
java.io.ObjectInputStream$BlockDataInputStream.setBlockDataMode(ObjectInputStream.java:2376)
java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1360)


Solution
========
Under
[bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"]
Add

[property name="hibernateProperties"]
[props]
[prop key="hibernate.session_factory_name"]mySessionFactory[/prop]

base variable 'persistenceContext' spelled correctly

org.springframework.binding.expression.EvaluationException: The expression 'persistenceContext.persist(borrowingRecord)' did not resolve... is the base variable 'persistenceContext' spelled correctly?
org.springframework.binding.expression.el.ELExpression.getValue(ELExpression.java:60)

Solution
========
add the tag
[persistence-context /]

Friday, 22 July 2011

Error creating bean with name 'securityFlowExecutionListener'

Problem
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flowExecutor': Cannot create inner bean '(inner bean)' of type [org.springframework.webflow.config.FlowExecutionListenerLoaderFactoryBean] while setting bean property 'flowExecutionListenerLoader'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'securityFlowExecutionListener' while setting bean property 'listeners'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityFlowExecutionListener' defined in ServletContext resource [/WEB-INF/library-webflow.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/vote/AffirmativeBased

Need the patch : http://jira.springframework.org/browse/SWF-1182

Thursday, 21 July 2011

Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security]

Problem
=====
SEVERE: Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security]
Offending resource: ServletContext resource [/WEB-INF/library-security.xml]



Solution
=====
[dependency]
[groupId]org.springframework.security[/groupId]
[artifactId]spring-security-config[/artifactId]
[version]3.0.2.RELEASE[/version]
[/dependency]
[dependency]
[groupId]org.springframework.security[/groupId]
[artifactId]spring-security-web[/artifactId]
[version]3.0.2.RELEASE[/version]

Wednesday, 20 July 2011

Effective SME tools

Part 1 Easy Filing Systems

Part 2: Accounting & Finance Help

Part 3 Effective Time Management Tips

Mindy Lilyquist

Reuse IQOExtract

Reset 3 fields
1.Status -> EXTAP
2.StartDate -> NULL
3.LastUpdateUser -> LCCuser

To check
1. Drive R map to Build
2. Drive S map to Source
3. Grant the Security
4. Grant the Pemission

Tuesday, 19 July 2011

Web MVC & Flow maven

[packaging]war[/packaging]
[name]jackflow[/name]
[url]http://maven.apache.org[/url]
[properties]
[project.build.sourceEncoding]UTF-8[/project.build.sourceEncoding]
[spring.version]3.0.2.RELEASE[/spring.version]
[/properties]
[dependencies]
[dependency]
[groupId]org.springframework[/groupId]
[artifactId]spring-webmvc[/artifactId]
[version]${spring.version}[/version]
[/dependency]
[dependency]
[groupId]junit[/groupId]
[artifactId]junit[/artifactId]
[version]3.8.1[/version]
[scope]test[/scope]
[/dependency]
[dependency]
[groupId]org.springframework[/groupId]
[artifactId]spring-aop[/artifactId]
[version]${spring.version}[/version]
[/dependency]
[dependency]
[groupId]org.springframework[/groupId]
[artifactId]spring-web[/artifactId]
[version]${spring.version}[/version]
[/dependency]
[dependency]
[groupId]org.springframework[/groupId]
[artifactId]spring-context-support[/artifactId]
[version]${spring.version}[/version]
[/dependency]
[dependency]
[groupId]org.springframework[/groupId]
[artifactId]spring-beans[/artifactId]
[version]${spring.version}[/version]
[/dependency]
[dependency]
[groupId]org.springframework[/groupId]
[artifactId]spring-context[/artifactId]
[version]${spring.version}[/version]
[/dependency]
[dependency]
[groupId]org.springframework[/groupId]
[artifactId]spring-core[/artifactId]
[version]${spring.version}[/version]
[/dependency]
[!-- MVC --]

[dependency]
[groupId]org.springframework[/groupId]
[artifactId]spring-web[/artifactId]
[version]${spring.version}[/version]
[/dependency]
[!-- Web Flow --]
[dependency]
[groupId]org.springframework.webflow[/groupId]
[artifactId]spring-faces[/artifactId]
[version]2.0.8.RELEASE[/version]
[/dependency]
[!-- Unified EL --]
[dependency]
[groupId]org.jboss.el[/groupId]
[artifactId]com.springsource.org.jboss.el[/artifactId]
[version]2.0.0.GA[/version]
[/dependency]
[!-- [dependency] [groupId]org.jboss.seam[/groupId] [artifactId]jboss-el[/artifactId]
[version]2.0.0.GA[/version] [exclusions] [exclusion] [groupId]javax.el[/groupId]
[artifactId]el-api[/artifactId] [/exclusion] [/exclusions] [/dependency] --]
[!-- Using OGNL for EL --]
[!-- [dependency]
[groupId]ognl[/groupId]
[artifactId]ognl[/artifactId]
[version]2.6.9[/version]
[/dependency] --]
[!-- Security --]
[dependency]
[groupId]org.springframework.security[/groupId]
[artifactId]spring-security-core[/artifactId]
[version]3.0.2.RELEASE[/version]
[/dependency]
[/dependencies]
[repositories]
[repository]
[url]http://repository.jboss.org/maven2/[/url]
[id]jboss[/id]
[name]JBoss Repository[/name]
[/repository]
[/repositories]

ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

SEVERE: Error loading WebappClassLoader
context: /jackflow
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@1e63e3d
org.springframework.web.servlet.DispatcherServlet
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)

Solution
========
(1)After put the spring-webmvc to the folder lib, then resolved.
*For MAVEN, remember to check package as “war”.

Thursday, 14 July 2011

The requested resource (/city-struts/distance.do) is not available

Problem
=======
The requested resource (/city-struts/distance.do) is not available.

Solution
========
Project Facets
1.Dynamic Web
2.Java
3.Java Script

Deployment Assembly
1.Remove WebContent

Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.ContextCleanupListener

Problem
=======
Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.ContextCleanupListener

Solution
========
[dependency]
[groupid]org.springframework[/groupId]
[artifactid]spring-web[/artifactId]
[/dependency]
[dependency]
[groupid]org.springframework[/groupId]
[artifactid]spring-context-support[/artifactId]
[/dependency]
[dependency]
[groupid]org.springframework[/groupId]
[artifactid]spring-beans[/artifactId]
[/dependency]
[dependency]
[groupid]org.springframework[/groupId]
[artifactid]spring-context[/artifactId]
[/dependency]

Thursday, 7 July 2011

Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security]

Problem
=======
Context initialization failed org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security]

Solution
========
[dependency>
[groupId>org.springframework.security[/groupId]
[artifactId]spring-security-core[/artifactId]
[/dependency]
[dependency]
[groupId]org.springframework.security[/groupId]
[artifactId]spring-security-acl[/artifactId]
[/dependency]
[dependency]
[groupId]org.springframework.security[/groupId]
[artifactId]spring-security-config[/artifactId]
[/dependency]
[dependency]
[groupId]org.springframework.security[/groupId]
[artifactId]spring-security-web[/artifactId]
[/dependency]
[dependency]
[groupId]org.springframework.security[/groupId]
[artifactId]spring-security-acl[/artifactId]
[/dependency]

Wednesday, 6 July 2011

Spring AspectJ load-time weaving

Spring includes an AspectJ aspect, AnnotationBeanConfigurerAspect,
(even if these objects are created outside the IoC container).

1.Enable [context:spring-configured]
2.Enable weave domain classes at load time [context:load-timeweaver>]
3.Enable @Autowired auto-wire JDBC template into domain objects [context:annotation-config]

Declaratively Managing Transactions by @Transactional Annotation

1.Enabling [tx:annotation-driven]
2.Simply annotating the methods with @Transactional

*not recommended practice - annotation an interface
*only annotate Public methods due to the proxy-based limitations

Tuesday, 5 July 2011

Use JPA-persist objects & JPA annotations & Hibernate as Engine (II)

1.Annotate each DAO method or the entire DAO class with @Transactional to make all
methods transactional.
(ensures operations within a DAO method in same transaction by same entity manager)

2.Enable declarative transaction management - [tx:annotationdriven]

3.[context:annotation-config /] - to allow inject entity managers into properties annotated with @PersistenceContext & allow inject entity manager factory into a property with the @PersistenceUnit annotation.

4.Enable [context:component-scan] - to allow @Repository annotation.

5.Register [bean class="org.springframework.dao.annotation.PersistenceException
TranslationPostProcessor" /] - to translate the native JPA exceptions into DataAccessException

6.Remember : transaction manager is needed no matter which transaction
management strategy (programmatic or declarative).
[bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager"]
[property name="sessionFactory" ref="sessionFactory"/]

Use JPA-persist objects & JPA annotations & Hibernate as Engine (I)

JPA annotations
===============
import javax.persistence.Entity;
@Entity
@Table(name = "COURSE")
public class Course {

JPA-persist
===========
import javax.persistence.PersistenceContext;
import javax.persistence.EntityManager;
import org.springframework.transaction.annotation.Transactional;

public class JpaCourseDao implements CourseDao {

@PersistenceContext
private EntityManager entityManager;
@Transactional
public void store(Course course) {
entityManager.merge(course);

Hibernate as Engine
===================
[bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"]
[property name="persistenceUnitName" value="course"/]
[property name="dataSource" ref="dataSource"/]
[property name="jpaVendorAdapter"]
[bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"]
[property name="databasePlatform" value="org.hibernate.dialect.DerbyDialect"/]

Monday, 4 July 2011

7 Characters

1.Truthfulness
Boss asked you to tell lie? How did you handle it?

2.Work Ethic
Define for what you believe doing a good job is?
In last position, what you did a great job with?

3.Teachability
Please name some books/CDs/DVDs in personal development library.
What is the last serious book read? What did like best about it? What have you applied as a result of reading it?

4.Keeping Commitments
Under what circumstances is it acceptable to not keep a commitment?
What is the last commitment you failed? Why?

5.Forgiving Spirit
What is the hardest thing to forgive in the workplace? How did you handle it?

6.Meeting Deadlines
When was the last time you late to anything? Why?
“Being late is the arrogant choice.” Do you agree?
Do you believe late is a sign of arrogance?
Have you missed a work-related deadline?

7.Responsibility
List three factors that have prevented you from being even further along than you are now, what are they?
Note: Responsibility by blaming their own internal, or shift blame to outside conditions?)
Describe some of the bigger mistakes made in past jobs and what you learned from them.

From "How to Lead by THE BOOK: Proverbs, Parables, and Principles to Tackle Your Toughest Business Challenges"

Wednesday, 29 June 2011

have different Class objects for the type javax.el used in the signature

Problem
=======
have different Class objects for the type javax.el used in the signature

Solution
========
dependency>
groupId>javax.el/groupId>
artifactId>el-api/artifactId>
version>1.0/version>
scopeprovidedscope

JSTL-1.2.jar crash with apache-taglibs-standard-1.1.2.jar ; have different Class objects

java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/WEB_002dINF/jsp/about_jsp, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature
org.apache.jsp.WEB_002dINF.jsp.about_jsp._jspInit(about_jsp.java:22)

Tuesday, 28 June 2011

Can not find tag lib of JSTL<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

Problem of taglib can not resolve

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

Solution
========

javax.servlet
servlet-api
2.5
provided


javax.servlet.jsp
jsp-api
2.1
provided


javax.servlet
jstl

1.2

Monday, 27 June 2011

class path resource [beans.xml] cannot be opened because it does not exist

class path resource [beans.xml] cannot be opened because it does not exist

Even the beans.xml exist in resource folder, but IDE can't get it.
Solution:
(1)Try to compile it first, then run again.

(2)Go to Build path remove the ** under Excluded.

(3)Change .classpath
change .classpath





Eclipse problem

Installing 3rd party JARs to Local Repository

mvn install:install-file -Dfile= -DgroupId= \
-DartifactId= -Dversion= -Dpackaging=

Sample
======
mvn install:install-file -Dfile=jboss-jca-api.jar -DgroupId=org.jboss.javaee -DartifactId=jboss-jca-api -Dversion=1.5.0.CR2 -Dpackaging=jar

Friday, 24 June 2011

Project + Example

Project + Example

Wednesday, 22 June 2011

Session object -> set & get

HttpSession session = httpServletRequest.getSession();

Usage
=====
(1)Type object = (Type) session.getAttribute("name");

(2)session.setAttribute("name", object);

Monday, 20 June 2011

Error : java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

Problem
=======
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener

Solution
========
Checking "Automatically update dependencies" in Project Properties -> Spring -> Dependency Management.