Recent Notes
Displaying keyword search results 1 - 10
Created by voodoo on August 03, 2012 08:42:38
Last update: August 03, 2012 09:31:25
The C function getsockopt lets you get the error codes with the option SO_ERROR . The possible error numbers are defined in the global errno.h . The relevant values are:
#define ETIMEDOUT 110 /* Connection timed out */
...
But here's the whole list on my Linux system ( /usr/include/asm-generic/errno.h ):
#ifndef _ASM_GENERIC_ERRNO_H
#define _ASM_GENER...
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 September 14, 2011 16:30:03
Last update: September 14, 2011 16:30:03
Select from the system table:
$ android-sdk-linux_86/platform-tools/adb shell
...
Other useful commands:
sqlite> .databases
seq name file ...
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 December 12, 2007 22:57:22
Last update: March 25, 2011 15:05:40
1. Install windows resource kit .
2. Install srvany as a service:
C:\tools\putty>instsrv ssh_tunnel "C:\Program File...
3. Edit the following registry template to suite your environment:
Windows Registry Editor Version 5.00
[H...
4. Import the registry entry.
5. Start the service with "net start ssh_tunnel" or from the services applet.
You may choose to use a batch file for srvany (instead of plink.exe ), but you won't be able to shut down the tunnel when you stop the service.
Also, if the Windows SYSTEM user cannot see the host key for SSH connection, the tunnel cannot be established.
Created by voodoo on March 04, 2011 12:46:58
Last update: March 04, 2011 12:47:35
According to SELinux Trouble Shooting Tool AVC AVC stands for Access Vector Cache .
SELinux Denials are reported in the logging system as AVC 's with the denied key word.
Created by Dr. Xi on November 08, 2010 20:44:12
Last update: November 08, 2010 20:44:12
Key points:
Java String.matches() matches the entire string, not a partial string. Use java.util.regex.Matcher.find() to match a partial String.
For case insensitive match, use Pattern.compile with case insensitive flags:
// Case insensitive for ASCII
Pattern p = P...
Use (?i) or (?iu) (for unicode) to inline case-insensitive flag:
boolean b = "StringToMatchAgainst".matches("(?...
Test code:
import java.util.regex.*;
public class Test...
Created by Dr. Xi on October 26, 2010 16:07:40
Last update: October 26, 2010 16:07:40
This is a more generic version, which can be expanded to accommodate additional file signatures.
import java.io.*;
import java.util.*;
pu...