2012年11月5日 星期一

Linux vi 存檔錯誤

File-encodings setting (notice the plural) does not include utf-8, so Vim does not try to save it with that encoding. It probably either tries to save it using plain old ASCII encoding or something like latin1, which does not include this char and therefore conversion fails. 
You should fix your 'fencs' setting to something like ucs-bom,utf-8,default,latin1 or you can force Vim to save it in utf-8 encoding, by issuing :w ++enc=utf8 filename. (It might be, that this needs the +multi_byte feature, which is only enabled, when compiling at least a big version of Vim). 

簡單的說就是檔案含有UTF-8的內容,vim存檔時沒有使用UTF-8的encoding存檔所產生的錯誤。

解決方法只需在存檔時加入一個option即可,如下:

:w ++enc=utf8 FileName

2012年9月12日 星期三

System Update Error "Failed to fetch http://..."

當在做系統update時,出現無法Fetch....的錯誤訊息時,可嘗試下列commands


First confirm that you are able to browse other websites. 
Then, Run this commands:  sudo mv /var/lib/apt/lists{,bakjune4};
sudo mv /var/cache/apt/archives/partial{,bakjune4};
sudo apt-get update;
sudo apt-get upgrade;  


Linux Terminal 快捷鍵

Paste copied Text : [Shift] + [Insert]
Stop : [Ctrl] + [C]
Paste High Lighted Text : [Middle button]
Create New Terminal Tab : [Ctrl] + [T]
Switch Terminal Tabs : [Alt] + [#(Number)]
Close Current Terminal Tab : [Ctrl] + [Shift] + [W]

待續...

2012年7月3日 星期二

使用Eclipse+Vim 做為Python 的 IDE

最近開始使用Python練習寫一些程式,蒐集了一下資訊,網友建議使用eclipse,再加上個人比較偏好使用vim,所以找了下方法,大致分為兩種。
基本上安裝好下面的軟體即可! 注意Eclipse的版本有限定是v.3.7

Python v.3
Eclipse v.3.7 (要安裝Pydev,並設定Python interpreter)
gvim v.7
Eclim v.1.76

此方式是把vim 內嵌在eclipse裡,好處是vim的所有功能皆有,但跟eclipse本身介面會有點切割。如eclipse的快捷鍵必須要在滑鼠的focus不在vim視窗裡才有效、eclipse的auto-completion的功能失效、vim編輯完一定要存檔,eclipse自動存檔的功能無效等等。


基於以上理由,所以我選擇第二種方式


2.
第二種方式沒有限定版本,我只列出我安裝的版本,需要的軟體如下


Python v.3.2
Eclipse 4.2

接著安裝Eclipse plugins
在 Help -> Install New Software... -> Work with: 欄位加入要安裝的plugin address


  • Pydev,並設定Python interpreter,預設路徑是"C:\Python32"
http://pydev.org/updates


  • Vrapper,仿vim的plugin

http://vrapper.sourceforge.net/update-site/stable


  • ColorScheme,能夠把editor設成vim的配色

http://eclipse-color-theme.github.com/update

設定好效果如下



如此設定的好處是保有vim editor的操作,也同時擁有eclipse的auto completion的功能。只是會犧牲掉vim一些特有的功能,但對我來說影響不大。

2012年5月23日 星期三

使用WireShark 抓取SOAP封包

Filter輸入ip.addr==A&&ip.addr==B
A:為你Client之IP
B:為你Server之IP

會filter出Client與Server間的封包,大部分為SOAP。選擇其一封包並於其上按右鍵,選擇 "Follow TCP Stream",此時就會跳出一個視窗,show出所有的封包內容,就可以一次看到所有SOAP的XML資料。

Done

Linux環境下 console模式下抓封包



我的使用方式,開兩個terminals,一個執行
$ tcpdump -i eth0 -w abc.cap

另一個執行
$ tcpdump -r abc.cap 

使用tcpdump指令3個會用到的options


Ex.抓封包存入abc.cap檔案
$ tcpdump -i eth0 -w abc.cap 

Ex. 抓封包,分割每個儲存的封包(size 1500bytes)
$ tcpdump -i eth0 -s 1500 -w a.cap 

Ex. 讀封包
$ tcpdump -r abc.cap 

p.s. 必須使用root權限

2012年5月22日 星期二

[SOAP] No address associated with

PHP SOAP在Load wsdl時發生的錯誤
Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: No address associated with 
相關討論串Non-SOAP bindingBug#50443

解決方法為移除無Address的port之Binding,如下紅色部分。

Example:


  
    https://services.contentdirect.tv/v3.0/SubscriberService.svc"/>
  
  



2012年5月18日 星期五

VAIO 顯卡更新成官網最新driver方法

最近想要把我的VAIO sz58的顯示卡驅動程式更新到最新時,發現nVidia官方driver無法安裝,所以google了一下解決方法



依照以下步驟:
1. 下載對應到官方網站最新nVidia驅動程式版本,先執行一次,他會把安裝軟體解壓縮到C槽。
2. 到下面路徑找到兩個檔案 nvaa.inf, nvac.inf (版本號296.10會不一定會一樣)

C:\NVIDIA\DisplayDriver\296.10\WinVista_Win7\International\Display.Driver\

3. 修改裡面的內容 (記得先備份),每個檔案有3個sections要改,有兩個是緊接著[Manufacturer]這個section之後的兩個sections,另一個是[Strings]這個section,要加的內容都加在所屬section的最後面。 (紅色字體為要加的內容)

另外特別注意的是"PCI\VEN_10DE&DEV_0427&SUBSYS_9008104D" 此為你的顯卡硬體裝置ID,可在Device manager裡查看,如下圖



nvaa.inf
...

[Manufacturer]
%NVIDIA_A% = NVIDIA_SetA_Devices,NTx86.6.0,NTx86.6.1

[NVIDIA_SetA_Devices.NTx86.6.0]

%NVIDIA_DEV.0407.0770.152D% = Section001, PCI\VEN_10DE&DEV_0407&SUBSYS_0770152D 
%NVIDIA_DEV.0407.1515.1043% = Section001, PCI\VEN_10DE&DEV_0407&SUBSYS_15151043 
...
%NVIDIA_DEV.0427.01% = Section001, PCI\VEN_10DE&DEV_0427&SUBSYS_9008104D


[NVIDIA_SetA_Devices.NTx86.6.1]
%NVIDIA_DEV.0407.0770.152D% = Section002, PCI\VEN_10DE&DEV_0407&SUBSYS_0770152D 
%NVIDIA_DEV.0407.1515.1043% = Section002, PCI\VEN_10DE&DEV_0407&SUBSYS_15151043 
...
%NVIDIA_DEV.0427.01% = Section002, PCI\VEN_10DE&DEV_0427&SUBSYS_9008104D


[Strings]
DiskID1 = "NVIDIA Windows Vista / Windows 7 (32 bit) Driver Library Installation Disk 1"
NVIDIA = "NVIDIA"
NVIDIA_A = "NVIDIA"
NVIDIA_DEV.0407.0770.152D = "NVIDIA GeForce 8600M GT"
NVIDIA_DEV.0407.1515.1043 = "NVIDIA GeForce 8600M GT "
...
NVIDIA_DEV.0427.01 = "NVIDIA GeForce 8400M GS"

nvac.inf
...


[Manufacturer]
%NVIDIA_A% = NVIDIA_SetA_Devices,NTx86.6.0,NTx86.6.1

[NVIDIA_SetA_Devices.NTx86.6.0]
%NVIDIA_DEV.0405.011D.1025% = Section001, PCI\VEN_10DE&DEV_0405&SUBSYS_011D1025 
%NVIDIA_DEV.0405.011E.1025% = Section001, PCI\VEN_10DE&DEV_0405&SUBSYS_011E1025 
...
%NVIDIA_DEV.0427.01% = Section001, PCI\VEN_10DE&DEV_0427&SUBSYS_9008104D

[NVIDIA_SetA_Devices.NTx86.6.1]
%NVIDIA_DEV.0405.011D.1025% = Section002, PCI\VEN_10DE&DEV_0405&SUBSYS_011D1025 
%NVIDIA_DEV.0405.011E.1025% = Section002, PCI\VEN_10DE&DEV_0405&SUBSYS_011E1025 
...
%NVIDIA_DEV.0427.01% = Section002, PCI\VEN_10DE&DEV_0427&SUBSYS_9008104D

[Strings]
DiskID1 = "NVIDIA Windows Vista / Windows 7 (32 bit) Driver Library Installation Disk 1"
NVIDIA = "NVIDIA"
NVIDIA_A = "NVIDIA"
NVIDIA_DEV.0405.011D.1025 = "NVIDIA GeForce 9500M GS"
NVIDIA_DEV.0405.011E.1025 = "NVIDIA GeForce 9500M GS "
...
NVIDIA_DEV.0427.01 = "NVIDIA GeForce 8400M GS"

4. 修改完後,存檔,重新執行setup.exe,此執行檔會在下面這個目錄
C:\NVIDIA\DisplayDriver\296.10\WinVista_Win7\International
5. 重開機

Done

搜尋此網誌