自訂的 Java File 排序 (Sort the File class in Java)
import java.util.Comparator;import java.io.File;
public class FileComparator implements Comparator{ public static final int NAME = 1; public static final int SIZE = 2; public static final int TYPE = 3; public static final int MODIFY = 4; public static final char ASCENDING = 'A'; public static final char DESCENDING = 'D'; private int method; private char order; public FileComparator(){ this.setMethod(FileComparator.NAME); this.setOrder
The impact of single-disk slow writes on mirrors (and other RAID arrays)
We had a performance problem today that we fairly rapidly determinedcame from our mail spool filesystem somehow being too slow. This waspretty impressive, because our mail spool sits on a four-way mirror on our fileservers and we could easilysee that our IO rate on its fileserver wasn't particularly large, wellbelow what we knew things could manage.
(Using NFS with a single interface makes IO rate easy to measuredirectly, no matter how complex your IO system; just look at the networktraffic volume.)
東坡和兩種豁達
昨天翻看《全宋詞》,見到一首蘇東坡填的〈南歌子〉,從前應該讀過,但沒有特別深刻的印象,現在讀來,卻十分喜歡:
帶酒衝山雨,和衣睡晚睛。不知鐘鼓報天明。夢裏栩然蝴蝶、一身輕。
老去才都盡,歸來計未成。求田問
毛孩 (+資料更正)
中學時代,就讀女校,沒男生可看,一眾女孩子異常苦悶,唯有日日夜夜對其他女生評頭品足。
任何一個同學有肉眼可見的唇毛、手毛、或腳毛,大件事啦~「毛孩」、「猿人」或「長毛象」任選其一,從此成為她的花名。
然後![]()
利用 Java 複製與删除檔案及目錄 (Use Java to copy and delete a file or a directory)
import java.io.File;import java.io.IOException;import java.io.FileNotFoundException;import java.io.FileInputStream;import java.io.FileOutputStream;import java.util.Arrays;
public static void copy(File source, File destination) throws IOException, FileNotFoundException{ if (source. exists() && !source.equals(destination)){ if (source.isFile()){ FileInputStream fis = new FileInputStream(source); FileOutputStream fos = new FileOutputStream(
Guru Dutt的故事 (五) : 喜劇報捷
![]()
《Aar Paar》的成功, Guru Dutt穩步上揚, 有信心製作下一部作品《 Mr & Mrs '55 / 55年的夫妻》. 這部喜劇加入更具爭議性的社會議題: 離婚. 1954年, 印度通過離婚法案, 女性有權提出離婚. 有人認為《Mr & Mrs '55》反對西
The importance of figuring out low-level symptoms of problems
Suppose that you have an IMAPserver; it has mirrored local system disks, a bunch of memory, and adata filesystem (where the mailboxes are) in a RAID-10 array provided bya SAN. One day, it starts falling over unpredictably; the load averagegoes to the many hundreds, IMAP service times go into the toilet,and eventually the machine has to be force-booted. But this isn'tconsistent, and when it happens it happens very rapidly, going from anormal tiny
兩次險死
生平有過兩次險死的經驗,都是駕車時發生的,雖然事隔多年,現在想起來,當時驚險的情景還歷歷在目。
到美國後的第二年,有兩個朋友從香港飛過來探望我們。雖然當時我只有一年多的駕駛經驗,卻大膽決定載朋友到遠處遊Menu
![]()