Recent Notes
Displaying keyword search results 1 - 10
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 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 freyo on May 20, 2011 09:25:20
Last update: May 23, 2011 12:11:42
The javax.xml.crypto and javax.xml.crypto.dsig packages are not available in Android (as of version 2.3). Therefore, standard Java API does not work. But you can use the Apache Santuario library to do that. Here are the steps:
Download the xml security source distribution (curently version 1.4.4).
Build with ant.
Create your own library jar (only the apache classes, no javax):
jar -cf xmlsec-1.4.4.jar -C build/classes org
Copy xmlsec-1.4.4.jar to the libs directory of your Android project.
Here's the Java code:
import java.io.*;
import javax.xml.parsers.*;
...
Created by James on March 27, 2009 03:20:58
Last update: May 08, 2011 12:32:31
Use show create table <tablename> :
mysql> show create table my_test_table;
+------...
Select from information_schema.table_constraints and information_schema.key_column_usage
mysql> select * from information_schema.table_cons...
Created by Dr. Xi on April 05, 2011 08:04:37
Last update: April 05, 2011 08:11:37
There's no difference between a Java HTTP client and a Java HTTPS client. Ignore JavaWorld Java Tip 96 , it's way too old. The following code gets an HTTP page as well as an HTTPS page.
import java.io.*;
import java.net.*;
pub...
There's one catch . If you are using the code on a test server with a self-signed certificate, it fails. In that case, I would suggest that you download the certificate from the server and import it to your keystore as a trusted key. You may also need to add a subject alternative name to the certificate if the host name does not match the certificate.
You may also choose to use a custom TrustManager and HostnameVerifier to ignore the certificate verification errors.
Created by Dr. Xi on October 16, 2008 20:45:40
Last update: March 28, 2011 20:23:22
Java's built-in classes are way too complex/flexible for a simple protocol like HTTP. This is a wrapper to simplify HTTP GET and POST.
import java.io.*;
import java.net.*;
imp...
A simple test:
import java.io.*;
import java.util.*;
...
Created by Dr. Xi on March 05, 2011 14:39:42
Last update: March 05, 2011 14:40:35
Select from information_schema :
mysql> select cc.character_set_name
-> from...
Other columns available from the information_schema tables:
mysql> desc tables;
+-----------------+--------...
Note that show create table <table_name> also works.
Created by Dr. Xi on March 05, 2011 14:31:44
Last update: March 05, 2011 14:32:21
Select from information_schema.tables :
mysql> select table_collation from information_sch...
Or,
show create table mysql.host;
CREATE TABLE `host` (
`Host` char(60) collate...
Created by Dr. Xi on July 19, 2010 21:58:34
Last update: July 23, 2010 21:37:23
Parsing XML in Java is really simple:
import java.io.*; import javax.xml.parsers.Docu... The parser implementation details are hidden behind the JAXP API. In case you want to know which parser implementation is used, this is what the JavaDoc for DocumentBuilderFactory.newInstance says: Use the javax.xml.parsers.DocumentBuilderFactory system property. Use the properties file " lib/jaxp.properties " in the JRE directory. This configuration file is in standard java.util.Properties format and contains the fully qualified name of the implementation class with the key being the system property defined above. The jaxp.properties file is read only once by the JAXP implementation and it's values are then cached for future use. If the file does not exist when the first attempt is made to read from it, no further attempts are made to...
Created by voodoo on July 12, 2010 18:44:06
Last update: July 12, 2010 18:44:06
Use the \d command to show information about a table:
postgres=# \d patchtype
Table ...