2012年3月15日 星期四

Linux ~/.vimrc 設定

原文網址

在 Terminal中輸入
gvim ~/.vimrc
可設定以下內容 (以下是我個人的設定)

syntax on                           " 語法上色顯示
set ai              "自動縮排
set tabstop=2        " 設定縮排寬度 = 2
set softtabstop=2    " tab 的字元數
set shiftwidth=2           
set ruler            " 顯示右下角設定值
set ic               " 設定搜尋忽略大小寫
set ru               " 第幾行第幾個字
set hlsearc          " 設定高亮度顯示搜尋結果
set incsearch        " 在關鍵字還沒完全輸入完畢前就顯示結果
set smartindent
set history=100      " 保留 100 個使用過的指令

set nocp



colorscheme torte 

2012年3月14日 星期三

Linux File Time (atime, ctime, mtime)

st_atime
           Time when file data was last accessed. Changed by  the
           following   functions:   creat(),   mknod(),   pipe(),
           utime(2), and read(2).

st_mtime
           Time when data was last modified. Changed by the  fol-
           lowing  functions:  creat(), mknod(), pipe(), utime(),
           and write(2).

st_ctime
           Time when file status was last changed. Changed by the
           following   functions:   chmod(),   chown(),  creat(),
           link(2),  mknod(),  pipe(),  unlink(2),  utime(),  and
           write().


指令可使用
stat -c %x filename
stat -c %y filename
stat -c %z filename
或者
ls -lu  filename
ls -l    filename
ls -lc  filename


-lu    show access time and sort by name
-l     show modified time and sort by name
-lc   show ctime and sort by name

%x   Time of last access
%y   Time of last modification
%z   Time of last change

2012年3月12日 星期一

簡易 Linux FTP upload shell

簡易的FTP 檔案上傳Shell script


於Terminal中,輸入
gvim ftpUpload.sh
並輸入下列內容於此檔案
#!/bin/bash
echo file(s) upload $*;
ftp -v -i -n FTP位址 << FTPIT
user 帳戶 密碼
bin
cd /切換至要放上傳檔案的目錄
mput $*
quit
FTPIT
exit 0
存檔離開,並改變此檔案的屬性
chmod 755 ftpUpload.sh
最後,執行
./ftpUpload.sh file1.txt file2.doc file3.mov

p.s. 後面帶的參數即為要傳送的檔案名,而$*則為儲存所有arg的變數(以空格區隔)

Gvim plugin安裝於Ubuntu



以下內容出自上面原文,我再加上修改後,可於Ubuntu上安裝成功

註解程式快捷鍵plugin

於Terminal中輸入下列指令
sudo apt-get install vim-addon-manager vim-scripts
vim-addons install enhanced-commentify
即可
於Gvim中,將游標移至想要註解的那一行後按下
\+x
若要往下一行繼續註解,則按下
\+c

2012年3月6日 星期二

Ubuntu Wifi Hotspot不斷連線 斷線

在Ubuntu 11.10的版本,建立Hotspot後會不停的斷線與連線問題,嘗試了很多解法後,下面方法可以workable !
原文連結--> Cannot make Wi-Fi hotspot

1. go to System settings > Network > Wireless > Use as hotspot > Configure (or 'Edit connections' under your connections > Edit the hotspot connection)
2. Switch to IPv6 Settings tab > Set Method to 'Ignore' and confirm/save
3. in terminal (Ctrl + Alt + T) run the following command to kill all dnsmasq processes: sudo killall dnsmasq
4. go to System settings > Network > Wireless > Use as hotspot

How to dump SOAP FAULT in PHP

當SOAP function有exception發生時,可使用var_dump去顯示error msg


try
{
    throw new 
SoapFault('code''string''actor''detail''name''header');
}
catch( Exception $ex )
{
    
var_dump($ex->faultcode$ex->faultstring$ex->faultactor$ex->detail$ex->_name$ex->headerfault);
    // or
    var_dump($ex);
}
?>

2012年3月2日 星期五

[問題] SOAP (WSDL) Complex Object in C#

使用C#去寫SOAP client遇到了困難,server 傳回來array object時,不知該如何接收此物件,但使用PHP5卻能輕易讀取資料,目前此問題待解....

{Map}
   -{Mapitem}
      -{陣列資訊}

Install PHP5 on Ubuntu

在Ubuntu上安裝PHP5

sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5
sudo /etc/init.d/apache2 restart

網頁存放的目錄是
/var/www/

本機端瀏覽的方式很容易只要在瀏覽器網址輸入
http://localhost
即可

2012年3月1日 星期四

Ubuntu 使用Root 帳號權限

1. 打開terminal

2. sudo -i 登入root後 

3. passwd更改root密碼

4. 之後即可使用 su 切換root

Ubuntu 11.10 輸入法設定

1. 先
apt-get install gcin
2. 然後點擊左上角Dash Board主目錄
3. 在搜尋框輸入ibus
4. 下方會出現Keyboard Input Method


點擊進入即可設定

搜尋此網誌