Adding a Google Search Web Element to a Wordpress theme

The newly released Google Web element: custom search is awesome. To add it to my wordpress theme (which doesn’t have a top sidebar for widgets) I had to edit (Appearance ⇒ Editor) the header.php file and add the snippet I got from Google there, at just at the end of the header.php. So the search web element is show right after the banner and before the posts. ...

September 16, 2009

Passing configuration parameter to Axis2 services

One way to pass parameters to you Axis2 service: write a tag inside your services.xml <?xml version="1.0" encoding="UTF-8"?> <!-- This file was auto-generated from WSDL --> <!-- by the Apache Axis2 version: 1.3 Built on : Aug 10, 2007 (04:45:47 LKT) --> <serviceGroup> <service name="xxxxxxx" class="MyServiceLifeCycleImpl"> .... <parameter name="jdbcConnectionString">jdbc:derby:c:/demoderby2b;create=true;user=a;password=b;</parameter> <parameter name="jdbcDriver">org.apache.derby.jdbc.EmbeddedDriver</parameter> ... </service> </serviceGroup> Write a ServiceLifeCycle class public class MyServiceLifeCycleImpl implements ServiceLifeCycle { private Log log = LogFactory.getLog(MyServiceLifeCycleImpl.class); public void startUp(ConfigurationContext confCtx, AxisService axisService) { try { String jdbcConnectionString = (String) axisService.getParameterValue("jdbcConnectionString"); String jdbcDriver = (String) axisService.getParameterValue("jdbcDriver"); Class.forName(jdbcDriver).newInstance(); Connection connection = DriverManager .getConnection(jdbcConnectionString); axisService.addParameter("jdbcConnection", connection); } catch (Exception e) { throw new RuntimeException(e); } } .... Add init method to your service .... private ServiceContext serviceContext; public void init(ServiceContext serviceContext) { this.serviceContext = serviceContext; } .... Access the parameter jdbcConnection from your service through serviceContext .... Connection conn = (Connection) serviceContext.getAxisService() .getParameterValue("jdbcConnection"); ....

October 16, 2007

Two web applications sharing the same Derby database

I just realized that to be able to open/share the same Derby database from two different web applications running in the same Tomcat instance (same JVM) you’ll need to put derby.jar in the $TOMCAT_HOME/common/lib and remove it from your applications WEB-INF/lib. I got the clue from this RIFE web page the jarfiles you need are derby.jar and derbytools.jar . Due to classloader peculiarities, don’t copy them to your application’s web/WEB-INF/lib/ subdirectory, or to Tomcat’s shared/lib/ directory. Tomcat’s common/lib/ directory works, and probably common/endorsed/ does too. ...

October 15, 2007

How to redirect your root web directory to a subfolder with .htaccess

If you tried (like me) to redirect your / (root) web directory to a subfolder (like /wp/) modifying .htaccess in this way: Redirect 301 / http://rubenlaguna.com/wp/ You probably found that it didn’t work. The browser will end up in an endless loop of redirections. Firefox will complain with this error message: The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. This problem can sometimes be caused by disabling or refusing to accept cookies. The right way to accomplish the root to subfolder redirection is the following: ...

September 6, 2007