Recent Notes
Displaying keyword search results 1 - 10
Created by Dr. Xi on February 13, 2013 19:40:08
Last update: February 13, 2013 19:40:08
According to MSDN : On Windows 7 and on Windows Server 2008 R2 with the Wireless LAN Service installed, the operating system installs a virtual device if a Hosted Network capable wireless adapter is present on the machine. This virtual device normally shows up in the "Network Connections Folder" as "Wireless Network Connection 2" with a Device Name of "Microsoft Virtual WiFi Miniport adapter" if the computer has a single wireless network adapter. This virtual device is used exclusively for performing software access point (SoftAP) connections. The lifetime of this virtual device is tied to the physical wireless adapter. If the physical wireless adapter is disabled, this virtual device will be removed as well. On Windows 7, there's no UI to start or stop SoftAP....
Created by Fang on April 16, 2012 13:18:40
Last update: April 16, 2012 13:18:40
Simply call pageContext.setAttribute() to export a variable from within a JSP custom tag:
public class MyCustomVarTag extends TagSupport {
...
The availability of the exported variable can be limited in the TLD:
<tag>
<name>setVar</name>
<tag-class...
The availability scopes are:
Value Availability
NESTED Between the start tag and the end tag.
AT_BEGIN From the start tag until the scope of any enclosing tag. If there’s no enclosing tag, then to the end of the page.
AT_END After the end tag until the scope of any enclosing tag. If there’s no enclosing tag, then to the end of the page.
Created by nogeek on December 29, 2011 13:31:44
Last update: December 29, 2011 14:29:13
Tomcat allows you to create multiple server instances for the same installation. The installation directory is identified as CATALINA_HOME , the instance directory is identified as CATALINA_BASE . Here are the steps: Create a base directory for the new instance, for example: /home/nogeek/tomcat1 . Create the subdirectories:
mkdir -p /home/nogeek/tomcat/{bin,conf,logs,temp,w... Copy web.xml from the installation directory: cp $CATALINA_HOME/conf/web.xml /home/nogeek/tomcat... Copy logging.properties from the installation directory: cp $CATALINA_HOME/conf/logging.properties /home/no... Create server.xml under tomcat1/conf : <?xml version='1.0' encoding='utf-8'?> <Server ... Create script setenv.sh under tomcat1/bin : # Edit this file to set custom options # Tomcat... Copy startup.sh and shutdown.sh from the installation directory. Add the following two lines to the beginning of each: CATALINA_BASE=/home/nogeek/tomcat1 export CATAL... Create a soft link for catalina.sh in tomcat1/bin : $ ln -s ~/apache-tomcat-7.0.22/bin/catalina.sh cat...
Created by Fang on December 05, 2011 14:56:47
Last update: December 05, 2011 14:57:09
This works for Tomcat. It may or may not work for other servlet containers. As far as I know it's not in the standards spec.
In web.xml:
<context-param>
<param-name>env</param-name>
...
If you start Tomcat without defining env , then #{initParam['env']} is ${env} . If you start Tomcat with -Denv=dev in JAVA_OPTS , then #{initParam['env']} is dev
Created by Fang on December 05, 2011 13:04:11
Last update: December 05, 2011 13:04:11
Facelet requires strict XML syntax, so unmatched tags (start with no end, etc) generate errors. This is a trick to workaround that. The following code generates a row for every three items and for each row assigns a row id:
<!-- using ui:repeat -->
<ui:repeat var="name" ...
Created by Dr. Xi on November 11, 2011 10:05:22
Last update: November 11, 2011 10:12:01
This is an HTML image tag filter using Java regex. It takes a string, finds the img tags, replaces the src attribute with one provided by the filter, then adds a class name to the class attribute.
import java.util.regex.*;
import java.io.*;
...
Test file:
<div id="HTML snippet">
<img src="img/big/txt-m...
Created by Fang on November 10, 2011 09:26:12
Last update: November 10, 2011 09:26:12
Syntax highlighted XML schema for JSF 2.0 Application Configuration Resource File ( faces-config.xml ). Almost 3000 lines!
<?xml version="1.0" encoding="UTF-8"?>
<xsd:sch...
Created by Fang on September 07, 2009 20:44:15
Last update: November 03, 2011 14:43:19
Step 1: Repackage a web app as EAR A Java EE application is a multimodule Maven project. At the very least you'll need to package a WAR and an EAR. To get started, I'll simply re-package the simple webapp as an EAR. Create a directory named javaee-app Copy the webapp from here to javaee-app . Rename struts1app to webapp . Create pom.xml under javaee-app :
<project> <modelVersion>4.0.0</modelVersion>... Create a directory named ear under javaee-app . Create pom.xml under ear : <project> <modelVersion>4.0.0</modelVersion>... Modify pom.xml in the webapp directory so that it looks like this: <project> <modelVersion>4.0.0</modelVersion> ... Build with " mvn package " in the javaee-app directory. You can see that ear-1.0.ear is successfully generated in javaee-app/ear/target . Maven successfully resolves dependencies between the sub-projects....
Created by Fang on October 28, 2011 14:49:53
Last update: October 28, 2011 14:52:19
Facelet templates can be nested, for example, a page can use a template which inherits from another template. To demonstrate this, let's start from the simple example and make these additions:
Add a place holder for CSS style sheets in WEB-INF/templates/default.xhtml :
<h:head>
<title>Facelets Template Demo</tit...
Add a derivative template ( WEB-INF/templates/default-style.xhtml ) which provides CSS:
<?xml version="1.0" encoding="UTF-8"?>
<ui:comp...
Add a page that uses the styled template ( home-style.xhtml ):
<?xml version="1.0" encoding="UTF-8"?>
<ui:comp...
The only difference between this file and home.xhtml is the template being used.
Compare the display of the pages home.xhtml and home-style.xhtml .
Created by balu on October 14, 2011 10:21:08
Last update: October 14, 2011 10:21:08
Got this error while trying to start vFabric tc server :
C:\Apps\vfabric-tc-server-standard-2.6.1.RELEASE>t...
It's a UAC error. Need to start the command prompt with Administrator privileges: right click the shortcut and select Run as administrator .
Or enable administrator rights for the shortcut:
Bring up the cmd shortcut properties
Select the Shortcut tab, click the Advanced button.
Check Run as administrator .