Friday, September 21, 2012

Activating users using a script

This is usually a problem with a lot of sites where due to a security password policy, users are deactivated after a certain number of unsuccessful attempts in trying to log in. It could be frustrating for support folks to manually activate the users.

A cron job can be created with a script to activate users deactivated in the last day. There is 2 things required one to run the script below and second to refresh the customer profile cache registry.


update userreg
set status=1,passwordinvalid=null
where trunc(passwordinvalid) >= sysdate-1 and status=0;

Refresh Customer profile Cache Registry

Tuesday, September 18, 2012

Installing RAD SQL Profiler in WebSphere Commerce Developer 7

The IBM SQL profiler is a great tool to find database related performance problems.
However, the current guide only covers how to install it on WCS 6.

Here is an updated list of steps for those of you that need to install it in WCS developer 7.

Sunday, September 16, 2012

Dynacache Tip: Dynamically skip cache for a page

The usual way most people diagnose DynaCache problems is by commenting out or removing the cache-entry or cache-id snippet in cachespec.xml. Since cachespec.xml changes are loaded without restarting, this works pretty well.

While this works fine, sometimes I want to be able to see what the page looks like without caching quickly, without having to edit cachespec.xml. Sometimes the changes to cachespec.xml would require creating a support ticket to modify a QA or DEV environment.

A more dynamic solution is to use a servlet filter to disable caching for a top level page without touching DynaCache.

Here is code for such a servlet filter:

This filter will disable caching when the URL contains the parameter "nocache" with value "true".
Example: http://localhost/webapp/wcs/stores/servlet/StoreCatalogDisplay?langId=-1&storeId=10151&catalogId=10551&nocache=true

Keep in mind that this only disables caching for the URL you are hitting in your browser and does not affect caching of child fragments which are not consumed by that URL.

This filter should only be used in DEV or QA environments.

Wednesday, September 5, 2012

Dynacache Tip: Exclude JSP fragment from cache


1. You are caching a JSP in cachespec.xml, lets call it "parent.jsp".
2. You have configured "parent.jsp" to consume sub-fragments.
3. There is a JSP being included by parent.jsp, lets call it "child.jsp"
4. The file is being included using the <c:import> tag
5. You don't want to cache child.jsp at all
6. You don't want parent.jsp to consume child.jsp into its cache


Add the following line in child.jsp:

<% ((; %>

This way gets around having to add child.jsp to cachespec.xml and setting do-not-consume=true.