2013年6月3日 星期一

Ubuntu 清理舊版核心流程

說明:\boot 空間不足時,會造成Linux 核心無法升級
原因:歷經多次升級和更新後,會有一堆的 Linux 核心版本被儲存在硬碟
解決:移除舊版核心

步驟:
1. 檢查有那些已安裝的 Linux 核心版本。(記下來)
    dpkg --get-selections | grep linux-image

2. 檢查目前正在用的版本(記下來)
    uname -r

3. 移除舊版本核心(目前正在用的版本與linux-image-generic兩者千萬不可移除)
    sudo apt-get purge linux-image-x.x.x-x-generic

4. 更新Grub2的選單
    sudo update-grub2

5. 完成

2013年2月20日 星期三

使用Smarty+CSS模板在IE中無法正常顯示

使用Smarty調用樣板時,如果內含CSS語法,於Firefox、Chrome中都可正常顯示,唯獨IE顯示會有問題。

原因是在UTF8的網頁上,用windows所產生的文件會自動在檔案最前面加上BOM標記(英語:byte-order mark,自行google "BOM UTF8"),所以可以用notepad++打開相關網頁文件,然後選"編碼"->"編譯成UTF-8碼(檔首無BOM)"->最後存檔即可。

==============================
Firefox、Chrome都會自動過濾掉檔首的BOM碼,但IE好像就沒這麼聰明了....

2012年4月10日 星期二

PowerBuilder 實用技巧

1. 如何在N-UP DataWindow 中,讀取第N欄資料?
A:第一欄column_name,第二欄column_name[1],...第N欄column_name[N-1]。

2. 如何將Grid DataWindow 改成Tabular DataWindow?
A:在DataWindow 的Edit Source中將processing=1改為processing=0,只有這兩種可互換。

2012年1月18日 星期三

C# sybase資料庫交易

C# sybase資料庫交易的寫法如下:
using Sybase.Data.AseClient;


AseConnection aseCon;
AseCommand dcom;

aseCon = new AseConnection(
"DataSource=127.0.0.1;Port=5000;Database=資料庫;UID=帳號;PWD=密碼;charset=utf8");
aseCon.Open();
//開啟資料庫交易
AseTransaction aseTransaction = aseCon.BeginTransaction();
dcom = new AseCommand();
dcom.Connection = aseCon;
dcom.Transaction = aseTransaction;

try
{
    //insert bank

   dcom.CommandText = "INSERT INTO bank1 VALUES('5555555', 0)";
   dcom.ExecuteNonQuery();
   dcom.CommandText = "INSERT INTO bank2 VALUES('5555555', 0)";
   dcom.ExecuteNonQuery();

    //執行成功時Commit
    aseTransaction.Commit();
}
catch (Exception err)
{
   //執行失敗時Rollback
   aseTransaction.Rollback();
   MessageBox.Show(err.Message);
}
aseCon.Close();

2011年9月21日 星期三

windows環境下sybase client字元集設定

windows上php連sybase會出現亂碼時,可依下列說明修改sybase client字元集。

1. 開啟SYBASE的安裝目錄的locales目錄中的locales.dat (C:\sybase\locales\locales.dat)
2. 依下列說明修改


[NT]
locale = enu, us_english, iso_1
locale = fra, french, iso_1
locale = deu, german, iso_1
locale = rus, russian, cp1251
locale = hun, us_english, cp1250
locale = ell, us_english, cp1253
locale = heb, us_english, cp1255
locale = ara, us_english, cp1256
locale = trk, us_english, cp1254
locale = esp, spanish, iso_1
locale = jpn, japanese, sjis
locale = japanese, japanese, sjis
locale = chs, chinese, eucgb
locale = cht, tchinese, big5
; locale = kor, korean, eucksc
locale = us_english.utf8, us_english, utf8
locale = default, us_english, iso_1(可改成utf8或其它,如:locale = default, us_english, utf8)

2011年5月22日 星期日

ubuntu安裝amule-daemon

1. 安裝amule-daemon
$sudo apt-get install amule-daemon

2.安裝amule-gnome-support
$sudo apt-get install amule-gnome-support

3. 設定amule-daemon
$sudo vim /etc/default/amule-daemon
# Configuration for /etc/init.d/amule-daemon

# The init.d script will only run if this variable non-empty.
AMULED_USER="使用者"
# You can set this variable to make the daemon use an alternative HOME.
# The daemon will use $AMULED_HOME/.aMule as the directory, so if you
# want to have $AMULED_HOME the real root (with an Incoming and Temp
# directories), you can do `ln -s . $AMULED_HOME/.aMule`.
AMULED_HOME="/home/使用者"
 
4. 產生MD5編碼後之密碼
$echo -n 你的密碼 |  md5sum | cut -d ' ' -f 1
 
5. 設定remote.conf
$cd /home/使用者目錄/.aMule/
$amuleweb -w
$vim remote.conf
Locale=
[EC]
Host=localhost
Port=4712
Password=編譯後的密碼

[Webserver]
Port=4711
UPnPWebServerEnabled=0
UPnPTCPPort=50001
Template=php-default
UseGzip=0
AllowGuest=0
AdminPassword=編譯後的密碼
GuestPassword=編譯後的密碼
6. 設定vim amule.conf

$vim amule.conf [ExternalConnect]
UseSrcSeeds=0
ShowPercent=1
ShowProgressBar=1
AcceptExternalConnections=1
ECPassword=編譯後的密碼
ECAddress=
ECPort=4712
UPnPECEnabled=0
IpFilterClients=1
IpFilterServers=1
UseSecIdent=1

[WebServer]
Enabled=1
Port=4711
UPnPWebServerEnabled=0
WebUPnPTCPPort=50001
PageRefreshTime=120
UseGzip=1
UseLowRightsUser=0
Password=編譯後的密碼
PasswordLow=
Template=default

7. 重新啟動amule-daemon
$sudo /etc/init.d/amule-daemon restart

8.連線
http://主機IP:4711

2011年3月1日 星期二

C# 連Sybase設定

C#連Sybase的方法:(目前只用過ADO.NET)
一、ADO.NET(用Sybase.Data.AseClient 連接)
1. 須先安裝sybase open client軟體(執行端也須安裝),安裝時請加選ADO.NET。

2. 至C:\sybase\ADO.NET\dll目錄中把Sybase.Data.AseClient.dll    sybdrvado11.dll sybdrvssl.dll三個文件Copy到bin資料夾中,並在參考中加入Sybase.Data.AseClient.dll 。

3. 使用範例
using Sybase.Data.AseClient;

AseConnection aseCon ;
aseCon = new AseConnection("DataSource=127.0.0.1;Port=5000;Database=資料庫;UID=帳號;PWD=密碼;charset=utf8");
aseCon.Open();
AseCommand dcom = new AseCommand("SELECT name FROM student", aseCon);
AseDataReader dr = dcom.ExecuteReader();
dr.Read();
Console.WriteLine("name : " + dr[0].ToString());
dr.Close();
aseCon.Close();