Monday, May 18, 2009

P4WSAD hang up (freezes) in Eclipse

While developing in Windows, I've found that simple operations like checkout (Open for Edit) would hang up if the p4 client spec is too general (for example //depot/... which basically covering all the depot).

I believe it has to do with p4 inner working that tries to do something weird besides checking out the source I want. So the solution was to limit the client spec to only the part of the depot I need, for example:

//depot/project_a/module_a/... //perforce-clients/project_a/module_a/...
//depot/project_a/module_b/... //perforce-clients/project_a/module_b/...

After this has been done. I've been able to checkout a file without any problems.

Note: the same behavior has been observed in P4Win, so it must have to do with p4 command line client, not the eclipse plugin.

Thursday, April 16, 2009

How to make Alfresco lucene index store the time part of a datetime field

Due to Alfresco bug [#1791] Lucene indexes contain only date not time, the lucene index in Alfresco only stores the date part of a datetime field. Thought it is fixed from 2.1.1E on, the time is not stored by default in order to maintain backwards compatibility with old indexes.

To solve this problem you should:
  1. Update your (located under WEB-INF/classes/alfresco/model or config/alfresco/model if you are using AMP module)

  2. Rebuild your Lucene indexes by adding the following line to /tomcat/shared/classes/alfresco/extension/


    Once the rebuild process finishes (look at your log file), remember to remove the line added so you don't rebuild your indexes every time you restart your webapp

Sunday, April 5, 2009

How to avoid WTP restart Tomcat after code hotswap

This is not really a topic about frameworks rather than a tip while developing in Eclipse WTP. Since the time of Sysdeo Tomcat plugin, Java developers knew that one could change code on the fly and have the code hot-swapped, without having to restart the Tomcat. In the time of WTP, this is not longer true by default but you can re-enable this feature as follows:

Open Server Tab -> Select your app server and right click "Open" -> Publishing, and choose "Never publish automatically"

We have to do this since the default context.xml that WTP generates forces context reload whenever it detecs changes in WEB-INF/classes. You can check out the server.xml at:


Where you will see reloadable="false" now
reloadable="false" source="org.eclipse.jst.j2ee.server:sample"/>

Tuesday, March 10, 2009

XSD Schema validation

There are some stuffs that one often configure once and just use it later on. But then it's hard to recall what has been done for it to work. One such example is setting the XSD schema for validation in XML files so this post is my cheat-sheet to avoid wasting my time looking on the Internet.

The main source can be found in

Dependent on using namespaces, the link will be either:


Or, as below (noting the syntax with a URI for the namespace and the URI of the schema, separated by whitespace in the same attribute):

" file:library.xsd">
Note that the "file:" has no triple slash