Obfuscate JavaScript using Java (Primer) - 2004-12-08 17:53 Just delete all block comments and line comment and all line blank space, and also change the filename to meaningless name. package js; import java.io.File; import java.io.FileInputStream; import java ...
Differences of File.getCanonicalPath() and File.getAbsolutePath() - 2004-12-06 13:56 When the file is under a linked folder or is a linked file in Linux, new File(path).getCanonicalPath()? will get the physical path of the file, while new File(path).getAbsolutePath() will just get the ...
Replace all links' names with other names - 2004-12-02 11:18 import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.Reader; /** ?* @a ...
Check the system is Windows or not in Java - 2004-11-26 11:59 ?? ???? boolean win32 = ((System.getProperty("os.name").indexOf("Windows") != -1) || (System.getProperty("os.name").indexOf("windows") != -1)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ ...
Simple JNI: Calling C/C++ From Java - 2004-11-17 21:13 1. Write Sample1.java: /** ?* @author Janyckee Jozz ?*/ public class Sample1 { ?public native int getNumber(); ? ?public static void main(String[] args) { ??System.loadLibrary("Sample1"); ??Sample1 s ...
Sending email using Java Mail - 2004-11-14 13:39 ?/* ?*Source File Name:?? SMTPClient.java ?*@author : takecare@etang.com ?*/ //the content is too large, the following is part one: import java.io.File; import java.util.Date; import java.util.Propert ...
Encoding between GB2312 and UTF-8 - 2004-11-12 09:10 Transform GB2312 bytes to UTF-8 bytes, and then UTF-8 bytes to GB2312 bytes, now the GB2312 bytes is not the same as the original GB2312 bytes. But GB2312 bytes to ISO-8859-1 bytes, and then ISO-8859- ...
JavaWorld Java Tips - 2004-11-09 11:01 Good tips: http://www.javaworld.com/columns/jw-tips-index.shtml ...
Java 理论和实践:我必须对那些内容进行文档编制吗? - 2004-10-29 20:40 Java 语言按照 Javadoc 注释约定采用了一种集成的方法来进行 API 文档编制。Javadoc 工具可以帮助生成好的 API 文档,然而大多数 Java API 文档却很糟糕。因为它是源代码的一部分,所以 API 的文档编制职责最终还是落到了工程师身上。在本文中,Brian 对 Java 文档编制实践的当前状态进行了严厉的批评,同时提供了一些关于如何编写更有用的 Javadoc 的准则。 ...
Copy Folder - 2004-10-29 14:04 ??? public static void copyFolder(String srcPath, String destPath) { ??????? File srcFolder = new File(srcPath); ??????? if (srcFolder.exists() && srcFolder.isDirectory()) { ??????????? File destFolde ...
Java Interface and Class Hierarchy - 2004-08-11 21:22 public interface IClassUpA { ??? public void sayA(); } public interface IClassUpB { ??? public void sayB(); } public interface IClassUp extends IClassUpA, IClassUpB { ??? public void say(); } // Do NO ...
Comments and the Quality of Code - 2004-08-11 21:19 Note:The frequency of comments sometimes reflects poor quality of code. When you feel compelled to add a comment, consider rewriting the code to make it clearer. http://java.sun.com/docs/codeconv/html ...
Null Pointer and Cast Exception - 2004-08-11 21:18 Always try to test null pointer and test casting available in the codes. If null, or failed to cast, simply printing out some error message would be much better than the runtime exception thrown by JV ...
Always Try to Refactoring Rather Than Rewriting Codes - 2004-08-11 21:18 Rewriting codes is something of work while refactoring codes will be something of art. Do not always try to rewrite codes. Refactoring codes helps you working efficiently if you get the spirit of the ...
Always override Object.equals() and Object.hashCode() in the same time - 2004-08-11 21:18 Always override Object.equals() and Object.hashCode() in the same time. I had met with such bugs serveral times and it was a hard time for me to figure out such bug. Quotes: http://www-106.ibm.com/dev ...