radioAe6rt

Creating signed tags in git

leave a comment »

http://www.evernote.com/shard/s57/sh/b82cdb18-d501-422b-aaa7-d6f331ab930e/de9a93a005f62aa9ad2a9c8c6aabd675

Written by radioae6rt

September 29, 2011 at 3:51 pm

Posted in Uncategorized

Tomcat7 port of distributed session manager

leave a comment »

Jon Brisbin wrote a super-clean Tomcat6 distributed session manager based on RabbitMQ. If you want to read clean code, read that stuff. It’s beautiful.

https://github.com/jbrisbin/vcloud

I ported the session manager to Tomcat7, here:

https://github.com/ae6rt/vcloud/tree/Tomcat7

Written by radioae6rt

August 20, 2011 at 10:41 am

Posted in Uncategorized

Caching Struts Tiles

leave a comment »

This is not an easy nut to crack, but if you want to cache Struts Tiles, you can clone the Tiles JSP InsertTag to suit the need. Around where doInclude(page) appears, render the referenced JSP page using an HTTPResponseWrapper, and ehcache the result before writing it to the tag pageContext writer. You might also consider augmenting the tile controller with a getCacheKey() method that returns a rich cache key in the form of a java.lang.Object with judiciously implemented overrides of equals() and hashcode(). Then, in the tag code, you can get a reference to the controller and therefore to getCacheKey() and cache the rendered-in-place content.

Written by radioae6rt

July 30, 2011 at 12:43 pm

Posted in Uncategorized

Java TimeUUID vs UUID.randomUUID()

with one comment

This is a great video of SriSatish Ambati discussing a number of useful Java garbage collection and concurrency issues

Among the many things I learned: at 38:00, use TimeUUID instead of UUID.randomUUID(). The latter is affected by SHA overhead and filesystem calls to /dev/urandom, while the former is not.

Here’s a reference to where you can find an implementation for TimeUUID:

http://wiki.apache.org/cassandra/FAQ#working_with_timeuuid_in_java

Nice.

Written by radioae6rt

June 29, 2011 at 5:24 pm

Posted in Uncategorized

EL vs. JSTL in JSP pages

leave a comment »

I recently had a chance to examine the difference between using JSTL tags and Expression Language (EL) in outputting content in JSPs.

For these two lines of JSP code that output the same content:

<body><c:out value="${header['host']}"/></body>   // JSTL

and

<body>${header["host"]}</body>   // EL

the following diff obtains in the generated JSP Java source code:
bmac:jstlvsel> diff --suppress-common-lines -y jstl_jsp.java el_jsp.java  
  private org.apache.jasper.runtime.TagHandlerPool _005fjspx_ <
							      <
    _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fno <
    _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fno <
      if (_jspx_meth_c_005fout_005f0(_jspx_page_context))     |	      out.write((java.lang.String) org.apache.jasper.runtime.
        return;						      <
							      <
  private boolean _jspx_meth_c_005fout_005f0(javax.servlet.js <
          throws java.lang.Throwable {			      <
    javax.servlet.jsp.PageContext pageContext = _jspx_page_co <
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getO <
    //  c:out						      <
    org.apache.taglibs.standard.tag.rt.core.OutTag _jspx_th_c <
    _jspx_th_c_005fout_005f0.setPageContext(_jspx_page_contex <
    _jspx_th_c_005fout_005f0.setParent(null);		      <
    // /out.jsp(4,6) name = value type = null reqTime = true  <
    _jspx_th_c_005fout_005f0.setValue((java.lang.Object) org. <
    int _jspx_eval_c_005fout_005f0 = _jspx_th_c_005fout_005f0 <
    if (_jspx_th_c_005fout_005f0.doEndTag() == javax.servlet. <
      _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005f <
      return true;					      <
    }							      <
    _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fno <
    return false;					      <
  }	

where the first file is the JSTL version and the second file the EL version.

As one can see, the JSTL version traverses the JSTL tag handling layer before output, while EL goes straight to output. It’s no secret that EL is more efficient for simple output tasks, but it’s always good to see why.

Written by radioae6rt

June 29, 2011 at 6:04 am

Posted in Uncategorized

JSTL 1.2 that GlassFish v2 uses

leave a comment »

I believe this is the JSTL 1.2 implementation that GlassFish v2 uses:

https://svn.java.net/svn/jstl~svn/tags/jstl-1.2

Written by radioae6rt

June 23, 2011 at 5:01 pm

Posted in Uncategorized

Preparing Tomcat instances with Groovy

leave a comment »

Zemian Deng has a nice set of Groovy scripts for dealing with Java webapps.  He also has a good boilerplate script for preparing Tomcat server.xml config:

http://docs.codehaus.org/download/attachments/16580630/NewTomcatInstance.groovy

Written by radioae6rt

June 23, 2011 at 6:08 am

Posted in Uncategorized

The four ways to deploy a webapp under Tomcat

with one comment

There are four different ways one can deploy a webapp to Tomcat.  If TCHOME is the Tomcat top-level directory:

  • Copy the war file foo.war or exploded war directory to TCHOME/webapps
  • Create a context file context.xml in the webapp’s META-INF/ directory that contains a <Context> fragment that describes the webapp deployment
  • Add a <Context> element to the <Host> element in Tomcat’s server.xml that describes the webapp deployment, including docBase. docBase is a <Context> attribute that locates the war file or exploded war directory in the filesystem.
  • Create a context file foo.xml in TCHOME/conf/Catalina/localhost/foo.xml that contains a <Context> fragment that describes the webapp deployment, including docBase.

The first two methods do not provide the freedom to name the servlet context independent of file system names for the war file or exploded war directory, whereas the last two do. Of the two methods that provide control over context naming, the most appealing is the use of a context file foo.xml placed in TCHOME/conf/Catalina/localhost/foo.xml, as it avoids modifying the stock server.xml file for pure context deployment purposes.  For the root context “/”, the context file name is ROOT.xml.

Written by radioae6rt

June 22, 2011 at 6:50 pm

Posted in Uncategorized

Petition to bring Iris Dement to the Mystic in Petaluma

with one comment

If you want Iris Dement to return to the Mystic Theatre in Petaluma in 2011, please leave a comment to the same effect.

Written by radioae6rt

February 5, 2011 at 10:35 am

Posted in Uncategorized

Where the hams are

with 2 comments

Plotting the license address of amateur radio operators in Petaluma, CA as a vehicle for learning a bit of Google Maps API and jQuery:

http://www.petrovic.org/content/petaham.html

Source code for porting the result to your town is here.

Written by radioae6rt

September 29, 2010 at 7:11 am

Follow

Get every new post delivered to your Inbox.