Recent Notes
Displaying keyword search results 1 - 10
Created by Dr. Xi on August 15, 2012 08:55:15
Last update: August 15, 2012 08:55:15
From Java JSSE documentation :
The generic Java dynamic debug tracing support is accessed with the system property java.security.debug , while the JSSE-specific dynamic debug tracing support is accessed with the system property javax.net.debug .
The javax.net.debug property value must specify either all or ssl , optionally followed by debug specifiers.
Examples :
To get a list of debugging options:
java -Djavax.net.debug=help MyApp
To view all debugging messages:
java -Djavax.net.debug=all MyApp
To view the hexadecimal dumps of each handshake message (the colons are optional):
java -Djavax.net.debug=ssl:handshake:data MyApp
To view the hexadecimal dumps of each handshake message, and to print trust manager tracing (the commas are optional):
java -Djavax.net.debug=SSL,handshake,data,trustman...
A detailed debugging example: Debugging SSL/TLS Connections
Created by Dr. Xi on June 06, 2009 18:31:44
Last update: June 25, 2012 12:37:35
You can use the system call from the os module to execute an external program:
>>> import os
>>> os.system(the_command_line_st...
However, the path to the executable contains a space character, the system call treats the strings after the first space as arguments, causing an error.
Python doc recommends the use of the subprocess module:
The subprocess module provides more powerful facilities for spawning new processes and retrieving their results; using that module is preferable to using this function.
For example, using wget to get the google home page:
>>> from subprocess import Popen, PIPE
>>> (out...
or
>>> import subprocess
>>> subprocess.call(['cur...
Created by Fang on April 16, 2012 12:58:35
Last update: April 16, 2012 12:58:35
To implement a JSP custom tag with dynamic attributes (for example, to pass-thru arbitrary attributes not handled by the JSP tag):
Set the dynamic-attributes element to true in the TLD:
<tag>
<name>mark</name>
<tag-class>c...
The tag handler must implement javax.servlet.jsp.tagext.DynamicAttributes :
package com.example.jsp;
import java.io.*;
...
Created by Dr. Xi on May 02, 2011 15:59:37
Last update: February 25, 2012 09:16:37
This code snippet gets the default keystore used by the Java keytool and displays the list of aliases along with the key type (certificate or private key).
import java.io.File;
import java.io.FileInputSt...
The default keystore used by the above code is: $HOME/.keystore .
Created by voodoo on January 03, 2012 08:41:21
Last update: February 16, 2012 15:50:06
This is the command to print all regular files in the src folder but excluding all files within the .svn folders:
$ find src -name .svn -prune -o -type f -print
where -o is the or operator.
Define a shortcut:
ff ()
{
find $1 -name .svn -prune -o -...
Created by voodoo on February 16, 2012 13:35:38
Last update: February 16, 2012 13:35:57
The C shell allows you to define aliases with arguments: \!^ passes the first argument, \!* passes all arguments. Examples from http://unixhelp.ed.ac.uk :
alias print 'lpr \!^ -Pps5'
alias print 'lp...
In ksh or bash you cannot define alias with arguments. Use function instead.
Created by woolf on December 11, 2011 13:38:58
Last update: December 11, 2011 13:38:58
Install usb.essentials . Package usbutils is optional.
# opkg update
# opkg install kmod-usb2
# opk...
Install usb printer support:
# opkg install kmod-usb-printer
Install p910nd print server:
# opkg install p910nd
Edit /etc/config/p910nd :
config p910nd
option device /dev...
Configure firewall to allow port 9100 ( /etc/config/firewall ):
# Allow printer
con...
If clients are connecting from wan then the first line should be:
option src wan
Enable automatic start of print server when router boots:
#/etc/init.d/p910nd enable
Restart router:
# reboot
Created by Fang on November 14, 2011 20:50:51
Last update: November 22, 2011 09:06:10
This facelet fragment will never print anything:
<ui:repeat var="person" value="#{myBean.theJTeam}"... because the test condition always returns false, even though the person var is not null. The same happens even when I define another variable with ui:param : <ui:repeat var="person" value="#{myBean.theJTeam}"... What's happening? The c:if test condition is evaluated before the ui:repeat tag had a chance to set the value! Both facelet ui tags and JSTL c tags are evaluated at the Render Response phase of the JSF lifecycle. But within the Render Response cycle, there are two sub-phases (so to speak): the first builds the UI element tree, the second renders the UI tree. The JSTL c:if tag is evaluated when the tree is built, but the facelet ui:repeat tag is evaluated when the UI...
Created by Fang on November 08, 2011 20:55:00
Last update: November 21, 2011 18:19:44
In the simple taglib example , I used a tag handler class to implement a taglib. This is an example to implement a taglib with a UI component. The purpose is to use a custom tag to split a string and print each part in a separate paragraph, i.e., print
<p>john</p> <p>steve</p> <p>mike</p> with custom tag <my:foreach> : <my:foreach var="who" value="john steve mike"> ... These are the files: pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0"... src/main/java/com/example/UIForeash.java : package com.example; import java.io.IOExcep... src/main/resources/META-INF/faces-config.xml : <?xml version="1.0" encoding="UTF-8"?> <faces-c... src/main/resources/META-INF/foreach.taglib.xml : <?xml version="1.0" encoding="UTF-8"?> <facelet... How to use: Put the JAR file generated by the above project in the WEB-INF/lib folder of the web app. If the web app is a Maven project, just add the taglib project as a dependency:...
Created by Fang on November 21, 2011 13:49:11
Last update: November 21, 2011 13:49:11
In the test for the simple taglib example , I used a literal string for the name attribute:
<my:hello name="Jack"/> What happens if the name attribute contains EL expresson? For example: <my:hello name="#{param['name']}"/> If EL works, the tag should take the value of the " name " request parameter and print it out. But the tag as implemented in the simple taglib example prints the literal string: Hello #{param['name']}! I am FaceletTag. In order to make a tag to recognize EL, we have to use TagAttribute.getValue(FaceletContext ctx) instead of TagAttribute.getValue() . The latter returns the literal value of the attribute. The HelloTagHandler should be changed to: package com.example; import java.io.IOExcep... Rebuild the taglib and test with a URL like this: http://localhost:8080/facelet-test/?name=Jack The tag will print:...