Saturday, July 10, 2010

tomcat 7.0 - serve content from files outside of war

If your webapp needs to serve static content (large video files or images) you would want to serve them directly from a file system folder instead of bundling it with the war file. This is now possible to do with Tomcat, in the recently released 7.0 version a new feature (aliases) to support webapps to refer to content outside of the war file has been added.

Configuring this is straight forward. You will need to create an application specific content.xml file. This can either be placed inside the webapp (META-INF/context.xml) or setup under tomcat (conf/Catalina/localhost/YourApp.xml).

Add the aliases attribute to the Context element

Now all requests starting with /content will be server directly by local by looking for the files under /var/local/app/content. You can add multiple aliases separated by commas (not sure why they choose attribute instead of nested element for this configuration)

This will help make the war files leaner, as well as enable putting the static files on shared storage to ease deployment.

More details on this attribute can be found in the context configuration reference

Thursday, August 27, 2009

MySql query to create a sequence of integers

The following sql query would generate a sequence of integers. This can be combined with other sql queries as a subquery.

select @rownum:=@rownum+1 as seq from (select @rownum:=-1) seed, SomTable t1,SomeTable limit

SomeTable can be any table that has enough rows so that the cross product is greater than the upper bound.

Tuesday, July 7, 2009

grails plugins eclipse class path settings

Grails 1.1 the plugin files are not part of the source tree, instead they are exploded under user.home\.grails\{version}\projects\{project}\plugins

In case your classes are referring to any classes / interfaces that are defined in the plugin you can add the code under the above path as a source path.

I did the following for Taggable plugin -
Added a variable GRAILS_PLUGIN_DIR & pointed it to user.home\.grails\projects\plugins
Added a source path by using "Link Source" option, extended the above variable GRAILS_PLUGIN_DIR\taggable-{version}\src\groovy

With this change eclipse is able to find the Taggable interface and stop's complaining about missing imports.

Wednesday, August 27, 2008

Grils jbpm plugin

We recently contributed a Jbpm plugin to the grails plugin project.

Here is a brief overview of what it does

Jbpm is an open source workflow / BPM solution. It helps coordinate business processes involving multiple people or services. The goal of this plugin is to make it easier to use Jbpm in a grails application


  • Easy integration with jbpm (handles all the configuration changes required)
  • Manage processes - deploy, update process definitions
  • Worklist application to quickly prototype new business processes
You can read more about it here

setting svn ignore property

I was trying to configure svn to ignore changes to certain files and directories. I have been mostly using either Smart SVN or Subeclipse to work with SVN before. But recently I am trying to work with the command line version.

It took me a while to figure how to do this on the command line. Here is want I did
svn pe svn:ignore direcotry-name

This will open up the default editor (you will get an error if one is not set with the instructions on how to set it up)

Type in the list of files / direcotries one entry per line, save the file and exit. That will do the job.
svn status
will now not report those files as modified / added

I need to figure out how to specify multiple entries on the command line directly instead of having to open up an editor.

Thursday, February 7, 2008

jarnal - java tool to annotate pdfs

Jarnal - is tool that can be used annotate PDF documents. It is java based. It also has support for collaboration. One person can start it in server mode and another can connect.

One thing that it is useful is to highlight text in a PDF. You can also add small notes to the margin. If would have been good if there was an option to hyperlink some portion and add annotation as a tool tip.

It does allow you to do a lot more stuff, but pretty difficult to use with a mouse. Maybe it would be more useful with a tablet.

Saturday, February 2, 2008

Taare Zameen Par - truly inspiring

A very well made movie. It makes an attempt to highlight the issues with the current education system in India. It breaks away from mainstream Hindi movies in many ways. It shows that you can make a commercially successful movie , one that appeals to the common movie going public, and at the same time convey a message.

I like movies that make me think, linger around in my thoughts long after I have watched them. This is one such movie.

Education is an area that India needs to do a lot if it has to realize the dream of becoming a developed country. We would need more than just doctors, engineers and MBAs to take us there. People need to be prepared to think & act on their own instead of following instructions, they need to have the confidence to think differently. Fortunately we have some people today who are leading the way, most of them have reached there inspite of the system not because of it. We will need a lot more. Is privatization a possible solution? Or will it change only when the demand changes, can we afford waiting that long? Is there anything that we can do pro actively?

One thing that is in my control is not force things on my kids, let them pursue their interests. Not make them bear the burden of our ambitions. 15-20 years from now the world will most probably be quite different. I am pretty sure that the traits that have made people successful today will not last that long.