Tuesday, April 28, 2009

轉換sql datetime為RFC 822格式

SET LANGUAGE 'English';
select  left(datename( dw, getutcdate() ), 3 )  + ', ' +convert( varchar(20), getutcdate(), 113 ) + ' GMT'
SET LANGUAGE 'Traditional Chinese'

由於使用的是'繁體中文'語系,再轉換前還需要將語系改為'英文'

 

附註: .net datetime轉RFC 822格式

DateTime today = DateTime.Now;
CulturInfo ci = new Culturinfo("en-US");
string rfc822 = today.ToString("ddd, dd MMM yyyy HH:mm:ss",ci)+" +0800";

Monday, April 20, 2009

DVD轉AVI

破區碼
anydvd, clonedvd
1.安裝ayndvd, clondvd
2.執行clonedvd, 轉成ISO檔案

dvd轉avi
bitRipper, alcohol120%
1. 掛載ISO至alcohol120%
2. 執行bitRipper
3. 按下start ripping

DVD轉出字幕
VobSub
1. 執行VobSub Configure.exe
2. "open"->選擇DVD中VIDEO_TS目錄底下的xxx.ifo, 再選擇輸出字幕目錄
3.  在右上角留下要轉出的語系
4.  ok-> 開始輸出

壓縮:
virtualDub.exe
1. File->open vedio file
2. Video->compression->"Xvid MPEG-4 Codec"->config->Towpass-1st pass
3. File->save as AVI
4. File->open vedio file
5. Video->compression->"Xvid MPEG-4 Codec"->config->Towpass-2nd pass
6. 在Target size中填入要壓成的大小(k)
7. File->save as AVI

把字幕壓在AVI中
1. 安裝VobSub_2.23.exe
2. 執行virtualDub目錄中的auxsetup.exe載入這些filter
1. File->open vedio file
2. Video->Filters->add->"TextSub2.23"
3. 選擇字幕檔
4. File->save as AVI

imovie的m4v轉avi
使用pazera video converters suite 1.2
1. 選擇other viedo converts-> MOV –> AVI/MPEG
2. Video codec中可以選擇編碼格式, 我想轉品質好的,選擇’H.264/MPEG-4 AVC’
    Bitrate:2000 kbit/s
    FPS:50
    Resolution: 1280?*720
3. 按下CONVERT(Ctrl+e) 開始轉換

Monday, April 13, 2009

儲存doc至資料庫

1. 上傳doc後,讀入bytes至陣列中,儲存bytes[]至資料庫的varbinary(MAX)。
2. 輸出的時候,從varbinary(MAX)讀出bytes[],response輸出二進位字元,設定標頭為"Content-disposition", "inline; filename=xxx.doc", contenttype為application/msword。

寫入

protected void UploadButton_Click(Object sender , EventArgs e ){   // Handles UploadButton.Click
Stream stream = FileUpload1.FileContent;
BinaryReader binReader = new BinaryReader(stream);

byte[] bytes = new byte[stream.Length];
int numBytesToRead = (int)stream.Length;
int numBytesRead = 0;
while (numBytesToRead > 0)
{
int n = stream.Read(bytes, numBytesRead, numBytesToRead);
if (n == 0)
break;
numBytesRead += n;
numBytesToRead -= n;
}
}
public string insertDoc(byte[] bytes)
{
.....
sqlCommand.Parameters.Add("@doc", SqlDbType.VarBinary, -1).Value = bytes;
......
}

輸出
protected void Page_Load(object sender, EventArgs e)
{
DBAccess dba = new DBAccess();
byte[] docContent = dba.getDoc();

string fileName = "kkk我.doc";
if (Request.Browser.Browser == "IE")
{
fileName = Server.UrlPathEncode(fileName);
}
Response.ContentType = "application/msword";
Response.AppendHeader("Content-disposition", "inline; filename=" + fileName);
Response.BinaryWrite(docContent);

}



dotnetnuke

試著管理與使用dotnetnuke幾天,整理一下
架設的環境為iis5.1, .net2.0, dotnetnuke 4.92

1. 網站的中文化官網有提供到4.83,可以直接安裝使用,當然有些項目沒有轉成中文 ,中文化是指網站中文化而已,各模組的中文還需要另外安裝,如果找得到的話,當然也可以自己修改。
2. dotnetnuke允許在其之下安裝多個網站
3. search blog這個模組無法搜尋blog作者,但中文內容都是OK的
4. 導覽列中若有中文,造成網頁的路徑包含中文的話,連結會失效。要解決這個問題可以參考DSLocalizator這個模組,我是還沒有試。
5. Documents這個文件管理的模組,好像只支援管理者上傳檔案至主機上,其他使用者都無法使用上傳外部檔案至主機的功能。
6. media模組也是依樣,只有管理者可以上傳外部檔案。
7. 討論區模組,只能設定一層的群組與討論區。中文搜尋支援,作者扔然無法搜尋。中文介面目前還沒找到
8. Announcement 這個模組好像只能公布全文,沒有摘要模式。要摘要模式的畫,我是配合RSS reader來達成。
9. Events 行事曆模組可以支援匯出CVS,但是中文不支援。
10. 權限的劃分,分成網頁、模組、以及模組內功能是否支援。
11. email server只能在host中設定無法在各站台各自設定。
12. 安裝中文化網站時,安裝完成後,扔需要在各網站的語系選擇繁中,如果還是沒有work的話,把預設語言設定成繁中,再把英文語系刪除,應該就可以work。

摸了幾天而已,後來公司又臨時說不用了...真是OX@#