2009年11月25日 星期三

2009年11月24日 星期二

IE點選視窗的X時觸發某一事件

=====HTML部分========

加上一個LinkButton




=======JAVASCRIPT========
function onBeforeUnload()
{
__doPostBack('LinkButton1','');
}

=================================
LinkButton1_Click寫進資料庫之類的程式

2009年11月11日 星期三

Oracle 的 @@IDENTIFY 抓 INSERT 的 PK

INSERT INTO TABLE01 (SYS_PK, F1, F2) VALUE( SYS_GUID(), 'xxx', 'yyy') RETURNING SYS_PK INTO :UOTPARAM
再用  ParameterDirection.Output
抓出來

2009年11月8日 星期日

Responses to “Pivoting in SQL using the 10g Model Clause”

here is a performace test i’ve maded on worked_hours.

insert into work_hours select mod(rownum,56),
rownum,mod(rownum,7),1 from dba_objects;

select count(1) from worked_hours;
49647

select weekno
, empno
, mon
, tue
, wed
, thu
, fri
, sat
, sun
from worked_hours
model
return updated rows
partition by (weekno, empno)
dimension by ( day )
measures ( hours, 0 mon, 0 tue, 0 wed, 0 thu, 0 fri, 0 sat, 0 sun)
RULES upsert
(
mon [0] = hours [1]
, tue [0] = hours [2]
, wed [0] = hours [3]
, thu [0] = hours [4]
, fri [0] = hours [5]
, sat [0] = hours [6]
, sun [0] = hours [7]
)
/

Statistics
———————————————————-
10 recursive calls
0 db block gets
184 consistent gets
1260 physical reads
0 redo size
1228664 bytes sent via SQL*Net to client
36900 bytes received via SQL*Net from client
3310 SQL*Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
49635 rows processed

49635 rows selected.

Elapsed: 00:00:04.21

SQL> select weekno
2 , empno
3 , mon
4 , tue
5 , wed
6 , thu
7 , fri
8 , sat
9 , sun
10 from (
11 select weekno,empno,sum(decode(day,2,hours,0)) mon,
12 sum(decode(day,3,hours,0)) tue
13 ,sum(decode(day,4,hours,0)) wed
14 ,sum(decode(day,5,hours,0)) thu
15 ,sum(decode(day,6,hours,0)) fri
16 ,sum(decode(day,7,hours,0)) sat
17 ,sum(decode(day,7,hours,0)) sun from
18 worked_hours group by weekno,empno)
19 /

49635 rows selected.

Elapsed: 00:00:01.92

Statistics
———————————————————-
4 recursive calls
6 db block gets
184 consistent gets
272 physical reads
0 redo size
943540 bytes sent via SQL*Net to client
36900 bytes received via SQL*Net from client
3310 SQL*Net roundtrips to/from client
0 sorts (memory)
1 sorts (disk)
49635 rows processed

It seems that the old pivot method is better. It seems that the difference connect somehow to phiscal reads.
參考來源

2009年9月1日 星期二

指定button為enter的第一個觸發button

經常希望在登入頁的登入button為key完帳號,密碼後的按enter的第一個觸發button,可是如果在這個button之前有其他的button,那麼,預設的第一個button就會是整個頁面上的第一個,為了解決此問題,可將整頁用panel包起來設定DefaultButton="登入button name"即可讓登入的button為第一個觸發的按鈕.

2009年8月31日 星期一

局部設定responseEncoding

通常我們會因為整個系統中要使用的編碼會設定在web.config中,

但是有時會因為與其他系統的介接需要做response,而對方的系統只吃big5時可以單支指定
context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("big5");


context.Response.HeaderEncoding = System.Text.Encoding.GetEncoding("big5");
context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("big5");
context.Response.AppendHeader("Content-Disposition", "attachment;filename=big5");

來做局部設定

2009年8月27日 星期四

如何查看w3wp.exe是在執行那個站台

1.在cmd下打Iisapp 即會顯示目前在運作的 w3wp.exe 所屬的 PID 及對應的集區,
集區會因為還沒回收等...會有重複,但可透過PID來對應工作管理員的處理程序。
如:
W3WP.exe PID: 5716 AppPoolid:eCampus3P
W3WP.exe PID: 5710 AppPoolid:eCampus3
2.再開啟工作管理員=>檢視=>選擇欄位=>勾選PID即可得知目前正在執行的w3wp.exe是在執行那個站台,可由應用集區來做區分,再依佔用的資源量判斷是否需要再做調整

參考資料:
Iisapp.vbs:IIS 應用程式查詢指令檔

2009年8月26日 星期三

windows7的IIS管理員放在那裡

要顯示系統管理工具,在下方工具列空白處點選滑鼠右鍵,選內容
在開始功能表,點選自訂
找到系統管理工具,選擇顯示所有程式功能表
在開始->程式集中就會看到系統管理工具
參考資料:
WINDOWS7預設是不安裝IIS7的

2009年8月17日 星期一

取固定長度的顯示字串

///
/// 取固定長度的顯示字串
///

/// 原始字串
/// 最大長度
///
public string ShowString(string strOri, int iMax)
{
string strResult;
int n;

strResult = "";
n = 0;

for (int i = 0; i < strOri.Length; i++)
{
char ch = strOri[i];

if (ch >= 'a' && ch <= 'z')
{
n += 1;
}
else if (ch >= 'A' && ch <= 'Z')
{
n += 2;
}
else
n += 3;

if (n >= (iMax - 2) * 3)
break;

strResult += strOri[i];
}

if (strResult.Length < strOri.Length)
strResult += "...";
return strResult;

}