ITeye博客

willpower

willpower · 共 68 篇文章

Java cleanup code

Java shutdown hook guarantee that clean-up code is always run, regardless of how the user terminates the application. Here is an example from Hadoop: java 代码 /** * A class to track the list of DFS clients, so that they can be closed * on exit. * @author Owen O'Malley */ private static class ClientF…

2007-04-03 12:20 · Study 学习 · 评论(0)

Java performance tunning

http://www.javaperformancetuning.com/ A quite useful website which contains everything on java performance tunning.

2007-04-03 11:37 · Study 学习 · 评论(0)

Running IE from command line

Here's a simple way you can run Internet Explorer from the command line: Create a new text file that contains the following line: @start "" /b "C:\Program Files\Internet Explorer\iexplore.exe" %* Rename the file e.bat Copy this file to your profile folder C:\Documents and Settings\your_account_name…

2007-04-03 10:58 · Study 学习 · 评论(0)

Unicode and UTF8

What is Unicode? Unicode provides a unique number for every character, no matter what the platform, no matter what the program, no matter what the language. Fundamentally, computers just deal with numbers. They store letters and other characters by assigning a number for each one. Before Unicode wa…

2007-04-03 10:27 · Study 学习 · 评论(0)

Daemon Thread Notes

1. 只要程式中的non-Daemon thread都結束了.. 就算有Daemon Thread仍在執行中... 程式一樣會被強制結束... 最簡單的例子就是garbage collector thread.. 2. 如果某個 Thread 是 daemon thread,則它所產生的所有 threads 天生就 具有 daemon 的特性 3. A daemon thread should be used for some background task that might provide a service to the applications. e.g. a Server thr…

2007-04-03 09:16 · Study 学习 · 评论(0)

How to know the main class of a jar file?

Easy. Here is an implementation from Hadoop. java 代码 /** * A micro-application that prints the main class name out of a jar file. * @author Owen O'Malley */ public class PrintJarMainClass { /** * @param args */ public static void main(String[] args) { try { JarFile jar_file = new JarFile(args[0]); …

2007-04-02 15:18 · Study 学习 · 评论(0)

The best chinese BAT tutorial(from www.boofee.net/bigfee/)

如何创建批处理文件? 不要听了批处理文件就感到很神气,其实这东西很简单的.你用过记事本没有?用过? 好的.将记事本打开,什么都不用写,然后选择文件,保存.保存类型选择所有文件,文件名则命名为 *.bat 这个*代表是文件名,你可以随便的起.保存好之后,看看你保存的地方,会出现一个白色窗口里有个黄色齿轮的图标.这东西就是你创建的批处理文件,双击他就可以运行,但他现在由于里面没有输入任何命令,所以他运行了并不会做任何事情.当我们想往这个*.bat文件中添加东西时,只要右键选择他,然后选择编辑,就可以打开记事本往内输入命令了. 批处理文件中的命令是什么? 批处理文件中的命令暂时先可以理解为dos命…

2007-03-27 11:58 · Study 学习 · 评论(0)

Basics - Binary search

java 代码 public class BinarySearch { public static int search(int element, int[] sortedArray) { int length = sortedArray.length; int left = 0; int right = length - 1; while (left <= right) { int mid = (left + right) / 2; if (sortedArray[mid]==element) { return mid; } else if (sortedArray[mid] > elem…

2007-03-26 15:53 · Study 学习 · 评论(0)

MergeSort

MergeSort is a sample solution from the idea Dive - and - Conquer. I show my code below: java 代码 public class MergeSort { public static void sort(int[] array, int i, int j) { if (j-i == 1) { if (array[i]>array[j]) { int tmp = array[i]; array[i] = array[j]; array[j] = tmp; } } else { int mid = (i + …

2007-03-23 17:26 · Study 学习 · 评论(0)

Graph data structure

1. adjacent matrix good for border scan, bad for space O(n*n), spare matrix mostly java 代码 public class GraphMatrix { private int[][] nodeMatrix; private int matrixSize; public GraphMatrix(int matrixSize) { this.matrixSize = matrixSize; nodeMatrix = new int[matrixSize][matrixSize]; init(); } privat…

2007-03-23 12:04 · Study 学习 · 评论(0)

Functional Programming For The Rest of Us

I like connect beautiful articles since I am afraid of losing them. This is a good one. So, I do it. And I think for those who are looking for some intro matrial on FP and cannot find a good one, this is for u. From: coffeemug@gmail.com Functional Programming For The Rest of Us Monday, June 19, 200…

2007-03-23 10:39 · Study 学习 · 评论(0)

Functional Programming For The Rest of Us

I like connect beautiful articles since I am afraid of losing them. This is a good one. So, I do it. And I think for those who are looking for some intro matrial on FP and cannot find a good one, this is for u. From: coffeemug@gmail.com Functional Programming For The Rest of Us Monday, June 19, 200…

2007-03-23 10:24 · Study 学习 · 评论(0)

Functional Programming For The Rest of Us

I like connect beautiful articles since I am afraid of losing them. This is a good one. So, I do it. And I think for those who are looking for some intro matrial on FP and cannot find a good one, this is for u. From: coffeemug@gmail.com Functional Programming For The Rest of Us Monday, June 19, 200…

2007-03-23 10:24 · Study 学习 · 评论(0)

Replica Selection/Propogate Strategy

Choose sequence: local node -> local rack -> remote rack a selected replica node should be a good node: 1> if the node is (being) decommissed 2> the remaining capacity of the target machine 3> the communication traffic of the target machine based on current connection of that machine, if current co…

2007-03-22 18:11 · 评论(0)

Requirements

System requirements: 1> performance 2> reliability 3> security 4> availability 5> scalability 6> extensibility Functional requirements: 1> basic File operations 2> backup/restore 3> clusters administration 4> data analysis and visualization support (future) 5> easy parallel programming support (fut…

2007-03-22 10:38 · 评论(2)