Recent Notes

Displaying keyword search results 1 - 10
Created by freyo on February 06, 2013 21:10:47    Last update: February 06, 2013 21:12:18
I have an old Samung phone to be used as a toy. After restoring back to factory image and power on, I was stuck at the activate service screen. Unfortunately, the four corner magic touch did not work. So I did quite a bit of digging and this is what worked on my Samsung Continuum: Press emergency call button, then at the dialer, press * # 8 3 7 8 6 6 3 3 , press the Home key From the home screen, tap phone icon, Dial * # 2 2 7 4 5 9 2 7 Enter SPC code: ______ displays tap in white box to show virtual keyboard, enter 6 digit code (default: 000000), tap OK Select “Hidden menu Enable”, tap OK From...
Created by Fang on January 04, 2012 09:54:05    Last update: January 04, 2012 09:54:05
There are two ways to validate a form with JSF: jsf validation on the page with <f:validate...> tags (for example: <f:validateLength> , <f:validateRegex> , etc.), or JSR303 bean validation. This note is about how to customize messages for JSR303 bean validation. The validation message is specified in the message attribute for each validation annotation type. The mesage attribute is not a literal string, but a string that is interpolated in various ways. For example, the default validation message for AssertFalse is {javax.validation.constraints.AssertFalse.message} , which is replaced with the corresponding string in ValidationMessages.properties (or ValidationMessages_tr.properties , ValidationMessages_es.properties , depending on the locale). This is the contents of ValidationMessages.properties in the hibernate validator reference implementation: javax.validation.constraints.AssertFalse.message =... To customize the messages, just provide the new value in...
Created by magnum on September 11, 2011 19:46:09    Last update: September 11, 2011 19:46:09
A pair of C functions convert between an Internet address and a string (ASCII): #include <arpa/inet.h> /* * Returns a poin... However , these functions do not support IPv6. The new pair is: #include <arpa/inet.h> /* Convert a Internet ad... Examples: #include <sys/socket.h> #include <netinet/in.h>...
Created by Dr. Xi on February 17, 2011 12:34:58    Last update: August 10, 2011 09:04:32
String comparison operators: Operator Meaning -n str the length of str is nonzero. -z str the length of str is zero (0). str1 = str2 str1 and str2 are the same (note one equal sign, not two!). str1 != str2 str1 and str2 are not the same. str str is not a null string Examples: # empty string is not null if [ '' ]; then ... Numerical comparisons ( integer expressions only! ): Operator Meaning int1 -eq int2 int1 and int2 are numerically equal int1 -ne int2 int1 and int2 are numerically NOT equal int1 -gt int2 int1 is greater than int2 int1 -ge int2 int1 is greater than or equal to int2 int1 -lt int2 int1 is less than int2 int1 -le...
Created by alfa on April 11, 2011 21:40:51    Last update: April 11, 2011 21:40:51
Integer.bitCount counts the number of one-bits in the two's complement binary representation of the specified int value. Example code: public class CountOnes { public static void... For long , there's Long.bitCount()
Created by Dr. Xi on March 29, 2011 16:06:57    Last update: April 01, 2011 12:33:52
This utility class retrieves SSL certificates from the server and print them out to the stdout. The output can be saved to a file and imported to a Java keystore. This is useful in your test environment where the SSL certificate is self-signed. import java.io.InputStream; import java.io.Outp... Retrieve and import the a certificate: E:\test>java RetrieveSSLCert 192.168.69.144 8081 >...
Created by Dr. Xi on March 30, 2011 13:43:05    Last update: March 30, 2011 13:45:27
Method 1 - use javap with verbose flag: $ javap HelloWorld -verbose | head Compiled fro... Method 2 - use a utility class: import java.io.*; import java.nio.ByteBuffer; ... According to the VM Spec , a Java class file has this structure: ClassFile { u4 magic; ...
Created by woolf on February 10, 2011 13:16:34    Last update: February 10, 2011 13:16:49
%PATH:str1=str2% would expand the PATH environment variable, substituting each occurrence of " str1 " in the expanded result with " str2 ". " str2 " can be the empty string to effectively delete all occurrences of " str1 " from the expanded output. " str1 " can begin with an asterisk, in which case it will match everything from the beginning of the expanded output to the first occurrence of the remaining portion of str1. %PATH:~10,5% would expand the PATH environment variable, and then use only the 5 characters that begin at the 11th (offset 10) character of the expanded result. If the length is not specified, then it defaults to the remainder of the variable value. If either number (offset or length) is negative,...
Created by nogeek on November 04, 2010 20:00:15    Last update: November 05, 2010 14:38:43
Following are some bugs in the Xalan jar shipped with JBoss 5.1.0 GA and JBoss 6.0. The Xalan jar file is located in jboss-5.1.0.GA/lib/endorsed ( %JBOSS_HOME%/common/lib for JBoss 6.0). Test xml: <?xml version="1.0" encoding="ISO-8859-1"?> ... Test xsl: <?xml version="1.0" encoding="ISO-8859-1"?> <xs... XSLT Java code: import org.w3c.dom.*; import javax.xml.parsers.... DateUtil.java import java.util.Date; public class DateUti... XSLT output: Transformer Factory class: class org.apache.xalan.... Apparently, the output is wrong. The string "A test event" should not have been displayed.
Created by Fang on August 23, 2010 22:55:58    Last update: August 24, 2010 15:45:04
The tags XML flow control tags are exactly the same as their Core flow control equivalents, except that the test condition with a boolean EL expression is replaced by the select condition with an XPath expression. In the case of the forEach tag, the items attribute is replaced with the select attribute. In a test condition, the XPath expression is evaluated to a boolean value by the rules of the XPath boolean() function, which converts its argument to a boolean as follows: a number is true if and only if it is neither positive or negative zero nor NaN. a node-set is true if and only if it is non-empty. a string is true if and only if its length is non-zero. an object of...
Previous  1 2 Next