Recent Notes

Displaying keyword search results 31 - 40
Created by Dr. Xi on April 27, 2011 11:57:36    Last update: April 27, 2011 11:58:35
This is a sample struts-config.xml file for Struts 1.x . <?xml version="1.0" encoding="UTF-8"?> <!DO...
Created by freyo on April 18, 2011 15:08:21    Last update: April 18, 2011 15:12:20
Generate android project $ ~/android-sdk-linux_86/tools/android create proj... Create XML file res/xml/books.xml : <?xml version="1.0"?> <catalog> <book id=... Edit layout ( res/layout/main.xml ): <?xml version="1.0" encoding="utf-8"?> <Lin... Edit code ( src/com/android/xmlres/XMLResource.java ): package com.android.xmlres; import java.io.... Change activity label from app_name to booklist ( AndroidManifest.xml ): <?xml version="1.0" encoding="utf-8"?> <manifes... Add value for string resource ( res/values/string.xml ): <?xml version="1.0" encoding="utf-8"?> <resourc... Deploy and test: ant install
Created by alfa on April 06, 2011 13:23:40    Last update: April 06, 2011 13:23:40
A file can be read as URL with the java.net package. You must provide absolute path after the URI scheme name file:// . package com.demo.io; import java.io.*; i...
Created by Dr. Xi on April 01, 2011 12:59:10    Last update: April 04, 2011 14:14:17
To configure Tomcat HTTP Basic Authentication with SSL: Configure web app for basic authentication (add these in web.xml ): <security-constraint> <web-resource-collec... Three elements are needed for this to work: security-constraint with the url-pattern to protect, login-config for the type of authentication method to use, and security-role for the role name(s) used in the security-constraint . Add login info to conf/tomcat-users.xml : <tomcat-users> <role rolename="testUserRole... Turn on SSL in conf/server.xml : <Connector port="8443" protocol="HTTP/1.1" SSLEnab... For default keystore file ${user.home}/.keystore , the keystoreFile attribute can be omitted. Otherwise, add keystoreFile="/path/to/keystore/file" . The setup is different if you are using APR .
Created by Dr. Xi on December 24, 2009 22:25:38    Last update: April 04, 2011 13:48:24
Use the urlparse module to parse a URL into parts. The urlparse function parses a URL into six components, returning a 6-tuple. This corresponds to the general structure of a URL: scheme://netloc/path;parameters?query#fragment >>> from urlparse import urlparse >>> parts = u...
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 February 09, 2011 13:47:50    Last update: February 09, 2011 13:47:50
This note demonstrates a technique to load a module generated at runtime, whose name is pre-determined but path is created at runtime. Sample module code: # DO NOT EDIT! # This module is generated at ru... Method one (use require ): C:\>perl $rpath = 'runtimepath'; require "${... Method two (use use with eval ): C:\>perl $rpath = 'runtimepath'; eval("use l...
Created by nogeek on December 31, 2010 13:02:23    Last update: December 31, 2010 13:03:27
The JBoss Microcontainer provides three StructureDeployer implementations out-of-the-box, with relativeOrder values defined for each: DeclaredStructure: relativeOrder 0 JARStructure: relativeOrder 10000 FileStructure: relativeOrder Integer.MAX_VALUE At deployment time, the StructureDeployer with lower relativeOrder will be consulted first to determine the structure of a deployment. This means that DeclaredStructure is always called first followed by JARStructure and finally FileStructure . DeclaredStructure allows you to specify the structure of a deployment, including any nested deployments, using an XML file named jboss-structure.xml placed in the deployment's META-INF directory. For example, the following is jboss-structure.xml for jbossweb.sar , the JBoss Tomcat service: <?xml version="1.0" encoding="UTF-8"?> <structu...
Created by freyo on October 28, 2010 16:26:25    Last update: October 28, 2010 16:26:25
Android emulator needs the name of an AVD (android virtual device) to get started. Use android list avd to see a list of available AVDs. C:\local\android-sdk-windows>tools\android list av...
Created by Fang on August 16, 2010 22:00:05    Last update: August 16, 2010 22:12:25
The tags <sql:update> Executes SQL INSERT , UPDATE , DELETE statements, or SQL DDL statements. Syntax: <sql:update sql="sqlUpdate" [dataSource="d... or, put the SQL within the element body: <sql:update [dataSource="dataSource"] [v... Attributes: Name Dynamic? Type Description sql true String SQL update statement. dataSource true javax.sql.DataSource or String Data source associated with the database to update. A String value represents a relative path to a JNDI resource or the parameters for the JDBC DriverManager class. var false String Name of the exported scoped variable for the result of the database update. The type of the scoped variable is java.lang.Integer . scope false String Scope of var. Defaults to "page". <sql:transaction> Establishes a transaction context for <sql:query> and <sql:update> subtags. Syntax: <sql:transaction [dataSource="dataSource"] ... where...
Previous  1 2 3 4 5 6 7 Next