Recent Notes

Displaying keyword search results 81 - 90
Created by alfa on April 08, 2011 12:33:08    Last update: April 08, 2011 12:33:08
This example captures the screen of the current Java application window, instead of the full screen. import java.io.*; import java.awt.*; import ...
Created by freyo on April 06, 2011 14:50:01    Last update: April 06, 2011 15:00:03
C:\tmp>keytool -printcert -file CERT.pem keytoo...
Created by alfa on April 06, 2011 13:13:34    Last update: April 06, 2011 13:13:34
This error happens when the class exists but it does not match the package name. In the screen capture below, the class Nothing exists but it doesn't reside in the com.demo.io package. $ java com.demo.io.Nothing Exception in thread ... A much shorter error message displays if the class does not exist at all: $ java com.demo.io.Nothing2 Exception in thread...
Created by jinx on April 05, 2011 09:32:34    Last update: April 05, 2011 09:33:49
It's easy to parse xml in PHP using SimpleXML . <?php $xml_string = <<<XML <?xml version="1.... Dealing with errors: <?php libxml_use_internal_errors(true); $sxe...
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 Fang on March 30, 2011 15:31:24    Last update: March 30, 2011 15:31:24
You get this error when you are trying to compile with JDK 1.5 (class version 49), but your dependency was compiled by JDK 1.6 (class version 50). Check the JAVA_HOME setting, and make sure it's pointing to JDK 1.6. On Unix, use set | grep -i java_home On Windows, just set JAVA_HOME
Created by Dr. Xi on March 28, 2011 11:11:33    Last update: March 28, 2011 11:13:21
grep is a versatile command with many variations (grep, egrep, fgrep, then various implementations). It uses a regula expression (regex) pattern to filter input. But then there are basic and extended flavors of regex - leading to even more confusion. And, beware that there are lots of bad examples of regex in the wild... There are two critical questions to ask when you use grep: which grep implementation are you using? what is the flavor of the regex? Here are some examples for gnu grep v2.7: # Find all numbers (no decimal point), basic regex... Use the -o flag to show only the matching part instead of the whole matching line: grep -o -E '\b[0-9]{2}\b' The good thing about the gnu grep is that it...
Created by voodoo on March 23, 2011 15:32:55    Last update: March 23, 2011 15:36:00
I got "Unknown SSL protocol error" when using curl to get the default page from iis 7 (of course, IE simply displayed "Internet Explorer cannot display the webpage"). The problem was that I used the default iis 7 certificate, which didn't have a name - and that caused SSL to fail. I created a new certificate with a name and that fixed the problem. # curl -v -k --dump-header - https://192.168.80.15... Other possible reasons: 3 Common Causes of Unknown SSL Protocol Errors with cURL
Created by Dr. Xi on March 02, 2011 11:39:18    Last update: March 09, 2011 12:19:30
Some peculiarities about Java PrintWriter: PrintWriter never throws any exceptions. From JavaDoc : Methods in this class never throw I/O exceptions, although some of its constructors may. The client may inquire as to whether any errors have occurred by invoking checkError(). When error occurs, you'll never know anything more than that it occured, because checkError returns boolean. When a character is out of the range of the character encoding of the PrintWriter, it prints a question mark (?). But this is not an error. Test code: import java.io.*; public class TestPrintWri... Latin1 test result: java TestPrintWriter iso-8859-1 | od -bc 000000... UTF-8 test result: java TestPrintWriter utf-8 | od -bc 0000000 141... Also, the constructor throws a FileNotFoundException when you try to write to a...
Created by alfa on March 07, 2011 16:10:11    Last update: March 07, 2011 16:10:11
Java heap space setting from command line: -Xms for initial heap size -Xmx for maximum heap size Initial heap size 128m, max heap size 256m: java -Xms128m -Xmx256m MyApp Initial heap size 256m, max heap size 256m: java -Xms128m -Xmx256m MyApp Max heap size can't be less than initial heap size: java -ms256m -mx128m MyApp Error occurred durin...
Previous  4 5 6 7 8 9 10 11 12 13 Next