- Control Panel > All Control Panel Items > Power Options > Edit Plan Settings(Choose when to turn off the display)
change the 'Put the computer to sleep' setting to a longer time or Never. - Control Panel > All Control Panel Items > Network and Sharing Center > (Change adapter settings)
2.1 right click on 'Wireless Network Connection' then 'Properties'
2.2 Configure...
2.3 switch to 'Power Management' page, uncheck 'Allow the computer to turn off this device to save power' option, OK
Keep Wifi Connection When Close Laptop Lid
7:59:00 AM | Filed Under win7 | 0 Comments
Quickly delete tons of files in Linux
Ref: [SteveKamerman.com]deleting-tons-of-files-in-linux-argument-list-too-long
6:36:00 PM | Filed Under linux | 0 Comments
[ORACLE] Get size in BYTE of a column
5:18:00 PM | Filed Under oracle | 0 Comments
Change File Permission via ftpd
In Windows command line:
Invalid command.
Command line to send site chmod 666 filename.txt
200 CHMOD command successful.
FTP裡下chmod指令無法使用萬用字元(*, wildcard),也無法使用 -R flag。
好不容易知道怎麼透過FTP下chmod了... 不實用
Using Apache Commons Net 3.2 API in java:
1: //using public int sendCommand(String command, String args)
2: //實在不知道那些字要放在command, 哪些字要放在args, try了好幾次
3: //TEST#1:
4: FTPClient.sendCommand("quote", "site chmod 666 *");
5: //command result=500 'QUOTE site chmod 666 *': command not understood.
6:
7: //TEST#2:
8: FTPClient.sendCommand("quote site chmod", "666 *");
9: //command result=500 'QUOTE site chmod 666 *': command not understood.
還有error message回傳的指令都寫大寫也很奇怪.. unix大小寫有差啊,我要小寫!!
最後讀了public int sendCommand(int command, String args)方法才知道他根本就沒提供quote這個指令OTZ||| 從FTPCommand看起來,"SITE"是最有可能會動的指令:
1: //TEST#3:
2: FTPClient.sendCommand("site", "chmod 666 *");
3: //command result=550 *: A file or directory in the path name does not exist.
1: //TEST#4:
2: FTPClient.sendCommand("site", "chmod 666 filename.txt");
3: //command result=200 CHMOD command successful.
方案二,登入FTP後先下umask指令來控制檔案權限
In Windows command line:
Command line to send site umask 000
200 UMASK set to 000 (was 007)
Using Apache Commons Net 3.2 API in java:
1: //TEST#5:
2: FTPClient.sendCommand("site", "umask 002");
3: //command result=200 UMASK set to 002 (was 007)
又是另一項作業..
Ref:
2:43:00 PM | Filed Under java | 0 Comments
Using Editable JComboBox with KeyEvent
//The following code wont’t work
JComboBox jcb1 = new JComboBox();
jcb1.setEditable(true);
jcb1.addKeyListener(aKeyEventObject);
//Correct: KeyEvent should be added to JComboBox.getEditor().getEditorComponent()
JComboBox jcb2 = new JComboBox();
jcb2.setEditable(true);
jcb2.getEditor().getEditorComponent().addListerer(aKeyEventObject);
Calling to JComboBox.getEditor().getEditorComponent() will return a JTextField that is used for editing the comboBox’s text.
And if at the same moment you want to get the filling text:
//The following code won’t work(return null)
String s = jcb2.getSelectedItem().toString();
//Correct:
String s = ((JTextComponent)jcb.getEditor().getEditorComponent()).getText();
2:14:00 PM | Filed Under java | 0 Comments
Transfer text file between Windows and Linux
最近遇到的問題,普通的.txt檔案在windows上跟在linux上看起來沒什麼差別,但是事實上如果用HEX mode或是用Notepad++顯示所有字元,就會注意到差別! 換行字元的差別!!
在ASCII字元表裡的10( LF , line feed), 13(CR, carriage return)都有換行的作用,看到一篇文章裡有稍微解說:
Mac OS X開始是用LF,較舊的版本是用CR
Unix系統下,是用LF
愛搞怪的窗戶是用CRLF...
當我透過FTP把檔案從windows丟到linux上之後,每行資料最後的換行符號都從CRLF變成LF,整個檔案的長度就變了... 影響了程式執行的結果。於是就查了要怎麼避免這個行為,還滿簡單的,不過不知道就沒轍。
只要把FTP的傳輸模式改為binary mode即可。用command line做FTP的可以參考reference 2號,用UI的話,我是用fileZilla,在選單"傳輸>傳輸型態”裡可以選擇。就這樣,再傳一次,果然,換行符號就不會因不同系統而改變了。
ref:
3:34:00 PM | Filed Under linux, windows | 0 Comments