Recent Notes

Displaying keyword search results 101 - 110
Created by alfa on May 27, 2011 15:46:44    Last update: May 27, 2011 15:46:44
Example code: import java.lang.reflect.*; public class Co...
Created by alfa on May 26, 2011 20:20:50    Last update: May 26, 2011 20:20:50
You would never have guessed it. The test is: Modifier.isStatic(method.getModifiers()) ! Example code: import java.lang.reflect.Method; import java.la...
Created by alfa on May 24, 2011 14:52:53    Last update: May 26, 2011 19:52:12
import java.lang.reflect.Method; public cla...
Created by alfa on May 25, 2011 21:17:18    Last update: May 25, 2011 21:18:04
The Java regex expression \B matches a non-word boundary, which is anything other than a word boundary. import java.util.regex.*; public class NonW... Output: p1 match: word at 40 p1 match: word at 83 ...
Created by alfa on May 25, 2011 20:56:16    Last update: May 25, 2011 20:57:31
The general construct of a non-capturing group is: (?:X) , i.e., add ?: after the opening bracket of an otherwise capturing group. Example code: import java.util.regex.*; public class NonC... Output: Matched: a capturing Subgroup 1: a Subgroup ...
Created by alfa on May 25, 2011 20:17:52    Last update: May 25, 2011 20:39:35
In Java regex, by default, the dot character does not match the newline character ( \n ). It matches a newline character only when the DOTALL flag is set. Example: import java.util.regex.*; public class Dota...
Created by alfa on May 25, 2011 20:08:21    Last update: May 25, 2011 20:08:21
In MULTILINE mode, ^ matches the begging of the string as well as the beginning of a new line; $ matches the end-of-string as well as the newline character. In normal (non- MULTILINE mode), ^ only matches the begging of the string; $ only matches the end-of-string. Example: import java.util.regex.*; public class ...
Created by alfa on May 25, 2011 15:22:08    Last update: May 25, 2011 15:25:05
Use Matcher.find() to find the next regex match until all matches are exhausted. import java.util.regex.*; public class RegE... To get case insensitive match, use: Pattern p = Pattern.compile("(?i)\\b(m|c)\\w*(n|r|...
Created by alfa on May 24, 2011 15:59:41    Last update: May 24, 2011 15:59:41
Java reflection with Apache beanutils example. import org.apache.commons.beanutils.MethodUtils; ...
Created by freyo on May 24, 2011 09:15:14    Last update: May 24, 2011 09:15:14
Java built-in X.509 certificate factory reads CertPath objects encoded in PkiPath or PKCS7 formats. The META-INF/<key_alias>.RSA file generated by Java jarsigner is in PKCS7 format. Example code: import java.util.*; import java.io.*; import... PKCS7 files can also be generated by openssl from certificate file(s): openssl crl2pkcs7 -nocrl -certfile Certs.pem -out ... Convert PKCS7 from DER to PEM: openssl pkcs7 -in certs.pk7 -inform DER -out certs... Sample PKCS7 file: -----BEGIN PKCS7----- MIIERwYJKoZIhvcNAQcCoIIEO...
Previous  6 7 8 9 10 11 12 13 14 15 Next