2013年3月13日 星期三

MS SQL 讀取資料表中,欄位設定的相關資訊



讀取資料表中,欄位設定的相關資訊(欄位名稱,資料型別,最大長度,欄位備註...)

SELECT 
a.TABLE_NAME as 表格名稱, 
b.COLUMN_NAME as 欄位名稱, 
b.DATA_TYPE as 資料型別, 
b.CHARACTER_MAXIMUM_LENGTH as 最大長度, 
b.COLUMN_DEFAULT as 預設值, 
b.IS_NULLABLE as 允許空值, 
( SELECT value FROM fn_listextendedproperty (NULL, 'schema', 'dbo', 'table', a.TABLE_NAME, 'column', default) WHERE name='MS_Description' and objtype='COLUMN' and objname Collate Chinese_Taiwan_Stroke_CI_AS = b.COLUMN_NAME ) as 欄位描述 

FROM INFORMATION_SCHEMA.TABLES a 
LEFT JOIN INFORMATION_SCHEMA.COLUMNS b ON ( a.TABLE_NAME=b.TABLE_NAME ) 
WHERE TABLE_TYPE='BASE TABLE' 
AND 
--列出特定表  
a.TABLE_NAME ='' 
AND
  --列出所有資料表  
a.TABLE_NAME in (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES) 
ORDER BY a.TABLE_NAME, ordinal_position

Example.

select b.CHARACTER_MAXIMUM_LENGTH from INFORMATION_SCHEMA.TABLES a 
left join INFORMATION_SCHEMA.COLUMNS b ON (a.TABLE_NAME=b.TABLE_NAME) where TABLE_TYPE='BASE TABLE' and a.TABLE_NAME='ABC' and b.COLUMN_NAME='Test' order by a.TABLE_NAME, ordinal_position

2012年11月27日 星期二

簡易PHP +Shell Programming環境 (eclipse+vrapper)

最近在找能夠幫助我維護php程式的環境,找到了這個版本的eclipse


能夠提供php簡易的錯誤parsing 功能,再加上


擁有快速的編輯介面 (仿vi)

最後安裝Shell Editor

ShellEd Wiki

將.vrapperrc檔案放置於

C:\Users\帳號名\

底下

內容設定可參考

2012年11月20日 星期二

[VAIO SZ58 WebCam Driver] Sony Visual Communication Camera VGP-VCC7 Win 7 64bit drivers


在SONY VAIO SZ58 上安裝Win 7 64-bit時,發生WebCam無法啟動,所以找了一下driver,終於找到合用的,如下



How to use:
1.) In device managerupdate the driver for the Sony Webcam, 'browse my computer...'. 
2.) Now select 'LET ME PICK FROM A LIST.....'.
3.) Click 'HAVE DISKand then browse to the path of the extracted zip file.
4.) 'Sony Visual Communication Camera VGP-VCC7is now selectedClick NEXT.
5.) Windows can't verify publisher.... who cares. 'INSTALL THIS DRIVER SOFTWAREANYWAY'
6.) Test in Skype

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

搜尋此網誌