Archive for 十月, 2009

[HTML]Firebug 網頁程式設計人員的好工具

http://getfirebug.com/
撰寫網頁時,十分方便的除錯工具….
它的功能簡單介紹如下:

友善可調整的編輯方式.
偵測並編輯HTML
調整CSS至完善
CSS呈現結果視覺化
監控網路活動
JavaScript除錯與微調
快速地找尋錯誤
瀏覽DOM結構
以命令列方式執行JavaScript
JavaScript紀錄器

Continue reading »

語系代碼

Language
ISO Code

Abkhazian
ab

Afar
aa

Afrikaans
af

Albanian
sq

Amharic
am

Arabic
ar

Armenian
hy

Assamese
as

Aymara
ay

Azerbaijani
az

Bashkir
ba

Basque
eu

Bengali (Bangla)
bn

Bhutani
dz

Bihari
bh

Bislama
bi

Breton
br

Bulgarian
bg

Burmese
my

Byelorussian (Belarusian)
be

Cambodian
km

Catalan
ca

Cherokee

Chewa

Chinese (Simplified)
zh

Chinese (Traditional)
zh

Corsican
co

Croatian
hr

Czech
cs

Danish
da

Divehi

Dutch
nl

Edo

English
en

Esperanto
eo

Estonian
et

Faeroese
fo

Farsi
fa

Fiji
fj

Finnish
fi

Flemish

French
fr

Frisian
fy

Fulfulde

Galician
gl

Gaelic (Scottish)
gd

Gaelic (Manx)
gv

Georgian
ka

German
de

Greek
el

Greenlandic
kl

Guarani
gn

Gujarati
gu

Hausa
ha

Hawaiian

Hebrew
he, iw

Hindi
hi

Hungarian
hu

Ibibio

Icelandic
is

Igbo

Indonesian
id, in

Interlingua
ia

Interlingue
ie

Inuktitut
iu

Inupiak
ik

Irish
ga

Italian
it

Japanese
ja

Javanese
jv

Kannada
kn

Kanuri

Kashmiri
ks

Kazakh
kk

Kinyarwanda (Ruanda)
rw

Kirghiz
ky

Kirundi (Rundi)
rn

Konkani

Korean
ko

Kurdish
ku

Laothian
lo

Latin
la

Latvian (Lettish)
lv

Limburgish ( Limburger)
li

Lingala
ln

Lithuanian
lt

Macedonian
mk

Malagasy
mg

Malay
ms

Malayalam
ml

Maltese
mt

Maori
mi

Marathi
mr

Moldavian
mo

Mongolian
mn

Nauru
na

Nepali
ne

Norwegian
no

Occitan
oc

Oriya
or

Oromo (Afan, Galla)
om

Papiamentu

Pashto (Pushto)
ps

Polish
pl

Portuguese
pt

Punjabi
pa

Quechua
qu

Rhaeto-Romance
rm

Romanian
ro

Russian
ru

Sami (Lappish)

Samoan
sm

Sangro
sg

Sanskrit
sa

Serbian
sr

Serbo-Croatian
sh

Sesotho
st

Setswana
tn

Shona
sn

Sindhi
sd

Sinhalese
si

Siswati
ss

Slovak
sk

Slovenian
sl

Somali
so

Spanish
es

Sundanese
su

Swahili (Kiswahili)
sw

Swedish
sv

Syriac

Tagalog
tl

Tajik
tg

Tamazight

Tamil
ta

Tatar
tt

Telugu
te

Thai
th

Tibetan
bo

Tigrinya
ti

Tonga
to

Tsonga
ts

Turkish
tr

Turkmen
tk

Twi
tw

Uighur
ug

Ukrainian
uk

Urdu
ur

Uzbek
uz

Venda

Vietnamese
vi

Volapük
vo

Welsh
cy

Wolof
wo

Xhosa
xh

Yi

Yiddish
yi, ji

Yoruba
yo

Zulu
zu

Continue reading »

ShowMessage on Client(ASP.NET)

protected void ShowMessage(string strMessage)
{
StringBuilder strScript = new StringBuilder();
strScript.Append(“<script language=’javascript’> “);
strScript.Append(“alert(‘” + strMessage + “‘)”);
strScript.Append(“</script>”);
//UpdatePanel內呼叫要用下面的寫法,否則Script不會寫到前端去
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), “testScript”, strScript.ToString(), false);
//一般ServerSide內呼叫
//ClientScript.RegisterStartupScript(this.GetType(), “SetValueScript”, strScript.ToString());
}
protected void ShowMessage(string strMessage)
{
StringBuilder strScript = new StringBuilder();
strScript.Append(“<script language=’javascript’> “);
strScript.Append(“alert(‘” + strMessage + “‘)”);
strScript.Append(“</script>”);
 
//UpdatePanel內呼叫,否則Script不會寫到前端去
ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), “testScript”, strScript.ToString(), false);
//一般ServerSide內呼叫
//ClientScript.RegisterStartupScript(this.GetType(), “SetValueScript”, strScript.ToString());
}

Continue reading »

利用Regex檢查是否為數值(ASP.NET)

public bool CheckIsNumber(string val)
{
Regex reNum = new Regex(@”^\d+$”);
bool isNumeric = reNum.Match(val).Success;
return isNumeric;
}

Continue reading »

DownLoad File From Asp.Net

….
if (file.Exists)
{
//Method-1 將檔案資料讀入Stream,這時檔案已經可以刪除了..之後再把檔案內容輸出即可
//Read File Content
sr = new StreamReader(path);
Response.Clear();
Response.AddHeader(“Content-Disposition”, “attachment; filename=ExcelExport.xls“); //下載的檔案名稱
Response.AddHeader(“Content-Length”, file.Length.ToString());  //下載的檔案大小
Response.ContentType = “application/vnd.ms-excel“; //下載的檔案類型
Response.Write(sr.ReadToEnd());
Response.End();
//Method-2 這是第二個方法,直接把檔案內容寫到前端,此時是不允許將檔案給刪除的,因為檔案是讀取的目標
//Response.Clear();
//Response.AddHeader(“Content-Disposition”, “attachment; filename=ExcelExport.xls”);
//Response.AddHeader(“Content-Length”, file.Length.ToString());
//Response.ContentType = “application/vnd.ms-excel”;
//Response.WriteFile(file.FullName);
//Response.End();
}
….

Continue reading »

DownLoad Excel MultiSheet

這裡是asp.net Code的部份,這裡作了一個Excel檔案。
protected string ExportExeclByXSLT_Direct(DataSet dsReportData)
{
string fileName = “././DownLoadFile/ExcelExport.xls”;
string xslPath = “././Xsl_Template/Excel.xslt”;
string xlsPath = “././DownLoadFile/ExcelExport.xls”;
StreamWriter oExcelWriter = System.IO.File.CreateText(Server.MapPath(xlsPath));
try
{
XmlDataDocument xddData = new XmlDataDocument(dsReportData);
XslCompiledTransform xt = new XslCompiledTransform();
xt.Load(Server.MapPath(xslPath));
xt.Transform(xddData, null, oExcelWriter);
return fileName;
}
catch (Exception ex)
{
return “”;
}
finally
{
oExcelWriter.Close();
}
}
這裡是Excel下載的頁面(DownLoad.aspx)
protected void Page_Load(object sender, EventArgs e)
{
NameValueCollection coll = Request.QueryString;
String strRequest = coll["file"];
if (strRequest != “”)
{
String path = Server.MapPath(strRequest);
FileInfo file = new FileInfo(path);
StreamReader sr = null;
try
{
if [...]

Continue reading »

TemplateField Add Number Format

前端的寫法:
<asp:templatefield>
<itemtemplate>
<asp:label id=”Label1″ runat=”server” text=’<%# Eval(“MyDateField”, “{0:d}”) %>’ />
</itemtemplate>
</asp:templatefield>

這個很好用,一定要記起來
增加千分位請用 ”{0:N0}”
日期格式請用 ”{0:d}”

後端的寫法:
lblGVTotal.Text = Total.ToString(“N0″);

Continue reading »

公司資料備份的程序

下載免費備份程式
FreeFileSync 3.0 免安裝中文版
匯出批次檔設定
從備份程式中匯出設定檔
自動排定工作的參數
“C:\Program Files\FreeFileSync\FreeFileSync.exe” C:\Documents” and Settings\kl.cheng\My Documents\Calendar_Backup.ffs_batch
排程測試…大功告成…

Continue reading »

SSIS:解決資料匯入Excel時,資料型態的錯誤

1) Using Data Conversion transformation
data types you need to select is DT_WSTR (unicode in terms of SQL: 2005)
2) derived coloumn transformation
expression you need to use is :
(DT_WSTR, 20) (note : 20 can be replace by your character size)
Note:
Above teo method create replica of your esting [...]

Continue reading »

數字格式 靠右

txtPay.Attributes.CssStyle.Add(“TEXT-ALIGN”,”right”);

Continue reading »