2012-05-11

MAC - 將 3gs 刷回 4.3.3

在 3gs 跑 ios5 本來已經不太快了, 又亂裝了一些 cydia 的東西,
造成只要開 sbsetting 就會 hang 個半分鐘... 決定刷回 4.3.3 再 jb
過程紀錄如下~

2012-05-09

TOOL - 電腦硬體故障聲音


CODE - 用 java 發 get 的 http request

...
String getUrl = "http://xx.xx/test.php?sn=xx&path=xx";
URL url = new URL(getUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8"));
loggerHelper.log("Contents of get request");
// 取得 return 值
String lines;
while ((lines = reader.readLine()) != null){
    loggerHelper.log("lines: "+lines);
}
reader.close();
connection.disconnect();
...

cf :
http://www.jiucool.com/java-sending-http-requests-get-and-post-method-request/
http://www.exampledepot.com/egs/java.net/post.html

2012-05-07

LINUX - shell 的字串取代

sample 1 :
# 將號嗎間的空白改由 @@ 取代, 這樣多筆才能順利傳進 php 裡
# MOBILES 是變數
argv=${MOBILES/ /@@}

sample 2 :
# 將號嗎間的空白改由 @@ 取代, 這樣多筆才能順利傳進 php 裡
# /home/MOBILE_CONFIG.sh 是一個 file
sed -e "s/@@/\ /g" /home/MOBILE_CONFIG.sh



LINUX - sudo 成 root 時, 也載入 profile 設定

as title
sudo -u root bash -l



2012-05-04

TOOL - editor 的垂直選取

mac
sublime - 按 mouse 中間那顆就可以了

windows
notepad++ - alt + mouse 左鍵



cf : 



LINUX - 用 tail 顯示 log 的倒數 n 行

ex : 顯示 error.log 的倒數五行
tail -n 5 /home/logs/php/error.log


[options]
-c:--bytes=N 指定輸出檔案最後的 "N" 個字元組。
-n:--lines=N 指定輸出檔案最後 "N" 行。
-f:持續顯示檔案更新的資訊。
-q:--quiet, --silen 不輸出檔案名稱的訊息。
+n:從第n 行開始顯示到檔案結尾。


cf : http://blog.xuite.net/altohorn/linux/17259888




LINUX - 查看作業系統種類及 kernel

lsb_release -a