Recent Notes

Displaying keyword search results 1 - 10
Created by voodoo on April 25, 2012 11:53:44    Last update: April 25, 2012 11:54:17
To find JSP files containing ' [0] ': grep -l '\[0]' src/main/webapp/WEB-INF/views/*.jsp or grep -l \\[0] src/main/webapp/WEB-INF/views/*.jsp
Created by nogeek on November 03, 2010 20:52:49    Last update: November 23, 2011 08:54:44
My problem is simple: in my XML data, a timestamp is provided as a long integer (number of milliseconds since the "the epoch"). When I do XSLT, I want to display it as a readable string, such as "Mon Nov 01 18:08:48 CDT 2010". After hours of struggle, I found: It's not so easy to get the job done with JDK 1.6 There are tons of garbage on the web in this space (suggestions, code snippets that simply don't work) Simple Xalan extension functions was the only resource that's somewhat informative. Even there some of the examples don't work. Below is a list of what worked and what didn't. This works: <xsl:stylesheet version="1.0" xmlns:xsl="h... This does not (providing long value to Date constructor): <xsl:stylesheet version="1.0" xmlns:xsl="h......
Created by Fang on October 30, 2011 20:35:17    Last update: October 30, 2011 20:37:03
This note lists some of the different behaviors I found using different JSF implementations. In the simple JSF facelet example, I used Sun's reference implementation version 2.0.0-RC: <dependency> <groupId>javax.faces</gro... With this version, the DOCTYPE declaration is dropped when the page is rendered. It doesn't matter what DOCTYPE you declare in your templates, the facelet engine simply drops it. The problem with this is, your page is always displayed in quirks mode , despite your intentions to require standards compliant mode. The DOCTYPE problem is fixed in release 2.0.2-FCS . Change the dependency in pom.xml to: <dependency> <groupId>javax.faces</gro... and test again, you'll find that DOCTYPE is faithfully passed over to the browser (view source at browser). You can delete the DOCTYPE declaration in the xhtml template...
Created by Fang on October 30, 2011 19:19:33    Last update: October 30, 2011 19:21:11
I've seen both <context-param> <param-name>javax.faces.PRO... and <context-param> <param-name>facelets.DEVE... in web.xml . But I cannot find any documentation of facelets.DEVELOPMENT in the JSF 2 spec. I cannot find any code referencing facelets.DEVELOPMENT in mojarra-2.1.3-FCS (the reference JSF implementation) either. So my guess is facelets.DEVELOPMENT is a thing of the past . About javax.faces.PROJECT_STAGE , this is what's documented in the JSF 2 spec: javax.faces.PROJECT_STAGE - A human readable string describing where this particular JSF application is in the software development lifecycle. Valid values are “ Development ”, “ UnitTest ”, “ SystemTest ”, or “ Production ”, corresponding to the enum constants of the class javax.faces.application.ProjectStage . It is also possible to set this value via JNDI. See the javadocs for Application.getProjectStage() .
Created by mee2 on October 19, 2011 20:51:04    Last update: October 19, 2011 20:51:53
From Alfresco wiki : Script Files Script files can be stored either on the ClassPath (for example, in alfresco/extension/myscripts ) or in a repository store. Scripts are generally stored in the default repository in the Company Home/Data Dictionary/Scripts location. Scripts in this location can be accessed directly by users via the Execute a script action . Scripts in any repository location can be accessed by any user via REST URL if they have the appropriate read permissions on the script document. Scripts on the ClassPath can be imported into other scripts but not executed directly in the web client.
Created by freyo on August 05, 2011 14:30:12    Last update: August 08, 2011 19:47:15
The first time you sign in with your Google Account on an Android phone, you are asked to set up "Backup & Restore". But it's somewhat scary since it doesn't tell you what's backed up and how to restore. On the phone, backup & restore is managed by Privacy Settings . According to Google, these things are backed up to Google servers: Your wifi passwords Browser bookmarks A list of applications you've installed The words you've added to the dictionary used by the onscreen keyboard Most of the settings you configure with the Settings application Third party applications may backup their data if they support this feature. You have to check each application to find out. Restoration happens automatically when you sign in with the...
Created by Dr. Xi on January 14, 2010 00:28:27    Last update: March 30, 2011 15:37:44
A task that a Java developer does so frequently is to find out where a certain class can be found - to resolve compilation errors, classpath issues, or version conflicts of the same class introduced by multiple class loaders. A long while back I wrote a simple Perl script to perform the task. Later I was informed that there are Swing based Jar Browser and Jars Browser . Then, there are a couple of shell one-liners: # one liner 1 find -name "*.jar" -print0 | xarg... But all of them share the same problem: if a class is in a jar nested in another jar, it cannot be found. Such is the case for a class inside a jar under the WEB-INF/lib directory of a...
Created by Dr. Xi on November 23, 2010 20:20:01    Last update: March 01, 2011 13:38:51
I tried to find a GZIP compression servlet filter to compress a large log file that we send down to the browser. Most of the implementations I found were overly complicated and many buggy. This is a simple implementation that worked for me. The filter: package filter.demo; import java.io.*; i... Config web.xml : <filter> <filter-name>gzipFilter</filte... The ugly anonymous inner class could have been avoided if the servlet API did not insist on ServletResponse.getOutputStream returning the bogus ServletOutputStream class (instead of the plain OutputStream ). Additional Note: In an earlier version of this filter, the gzip headers were added in doFilter , like this: // This is NOT good! if (supportsGzip) { ... It turned out that the ServletResponse methods sendError bypasses the gzip...
Created by James on February 14, 2011 12:10:19    Last update: February 14, 2011 20:22:05
I have long noticed that IE8 displays a "broken page" icon while showing my web pages, but didn't pay much attention. Since the world in general considers IE to be broken, it's not so unlogical for IE to see much of the world as broken. Until one day I noticed that the Google home page was not "broken". Then I thought may be I should fix my pages also. So I moused over the "broken page" icon, and this is what I saw: Compatibility View: websites designed for older browsers will often look better, and problems such as out-of-place menus, images, or text will be corrected. Very descriptive indeed! Older browsers? Such as Firefox 1.5? When it comes to MS products, I often had better...
Created by Dr. Xi on February 01, 2011 14:38:55    Last update: February 01, 2011 14:40:59
Create the stuff you want to manufacture with the factory: package tc.demo; public class Junk { ... Create the factory: package tc.demo; import java.util.Enumerati... Tell Tomcat to use your factory. Create file context.xml and put it under the directory META-INF of your web application: <Context> <Resource name="/find/junk/here" ... Note that beside name , type and factory , you can put any arbitrary attribute in the Resource element. Access the thing with JNDI: <%@page language="java" import="javax.naming.*,tc.... The server side log looked like this: INFO: jndiName: here INFO: name: scope, value: ... Also note that, in contrast to Tomcat documentation , resource-ref is not needed in web.xml .
Previous  1 2 Next