工程師的點滴
2011年11月29日 星期二
Javascript:For 迴圈與梯形公式
一般工程師對於數字的加總,第一個想到的應該是For迴圈,
但其實還有一個更快的的方式,就是梯形公式,不管累加的數字有多大,
馬上就計算出來,相對的如果是用For迴圈,累加的數字愈大,
效能也就愈差。
For 迴圈:
var temp=0;
for(var i=1;i<=1000){
temp = temp + i;
}
梯形公式:
var temp=0;
temp = ((1+1000) * 1000)/2;
安裝Apache Tomcat 7.0
此篇文章寫得很不錯→
http://javasight.net/2011/05/install-apache-tomcat7-on-windows/
安裝及設定Java環境
此篇文章說得非常詳細→
http://it-easy.tw/java-class-1/
2011年8月4日 星期四
在Lotus Notes 的web 中,取得資料庫路徑的方法有兩種【較常用的方法】,複雜的就不說了。
1.url:
var pathname = (window.location.pathname);
var dbpath=pathname.substring(0,(pathname.toLowerCase().lastIndexOf('.nsf')+5));
如果網址為→http://Test.com.tw/test01/test.nsf/testForm?OpenForm
那印出的值為→【/test01/test.nsf/】
2.用javascript設定常數:
<已計算完值>裡面的公式為→@WebDbName
這樣在javascript 裡直接取_CurrentDBName值就可以了
較新的文章
首頁
訂閱:
文章 (Atom)