<script>
function isNumberPressed(){
var isValidKey = false;
var intCode = window.event.keyCode;
if (intCode >= 48 && intCode <= 57) isValidKey = true; //0-9
if (intCode == 13) isValidKey = true; //13 enter
if (intCode == 32) isValidKey = true; //32 spacebar
window.event.returnValue = isValidKey;
}
</script>
<input type=text name=txt1 id=txt1 onkeypress="javascript:isNumberPressed();">
行雲流水
2012年3月27日 星期二
javascript select new Option 用法
var myselect=document.getElementById("channels");
myselect.options[myselect.length] = new Option("123", "1", "", (channel==36)?1:0);
new Option("標題","value",沒用""即可,selected)
myselect.options[myselect.length] = new Option("123", "1", "", (channel==36)?1:0);
new Option("標題","value",沒用""即可,selected)
2012年3月25日 星期日
document.form1.xxx1-n多物件呼叫
for(var i=0;i<=10;i++)
{
var tmp=eval("document.form1.xxx"+i)
tmp.disabled=flase;
}
{
var tmp=eval("document.form1.xxx"+i)
tmp.disabled=flase;
}
2012年3月16日 星期五
svn 程式管理工具
apt-get install subversion
mkdir -p /home/svn/kin1
mkdir -p /home/svn/kin2
svnadmin create /home/svn/kin1
svnadmin create /home/svn/kin2
mkdir /home/svn/conf
cp /home/svn/kin1/conf/{authz,passwd} /home/svn/conf
ll /home/svn/conf
rm -rf /home/svn/kin{1,2}/conf/{authz,passwd}
vi /home/svn/kin1/conf/svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = ../../conf/passwd
authz-db = ../../conf/authz
realm = kin1 #驗證實會顯示出此訊息
vi /home/svn/kin2/conf/svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = ../../conf/passwd
authz-db = ../../conf/authz
realm = kin2 #驗證實會顯示出此訊息
vi /home/svn/conf/passwd
[users]
kin1 = 123456
kin2 = 123456
kin3 = 123456
vi /home/svn/conf/authz
[groups]
adm = kin1
user = kin2,kin3
[kin1:/]
@adm = rw
kin2 = rw
kin3 = r
[project2:/]
@adm = rw
kin2 = r
kin3 = rw
killall svnserve
svnserve -d -r /home/svn
svn import kin1(目錄) svn://127.0.0.1/kin1/ -m "Version1" --username=kin1 --password=123456 #Import 程式碼目錄到kin1底下
svn co svn://127.0.0.1/kin1/ --username=kin1 --password=123456
mkdir -p /home/svn/kin1
mkdir -p /home/svn/kin2
svnadmin create /home/svn/kin1
svnadmin create /home/svn/kin2
mkdir /home/svn/conf
cp /home/svn/kin1/conf/{authz,passwd} /home/svn/conf
ll /home/svn/conf
rm -rf /home/svn/kin{1,2}/conf/{authz,passwd}
vi /home/svn/kin1/conf/svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = ../../conf/passwd
authz-db = ../../conf/authz
realm = kin1 #驗證實會顯示出此訊息
vi /home/svn/kin2/conf/svnserve.conf
[general]
anon-access = none
auth-access = write
password-db = ../../conf/passwd
authz-db = ../../conf/authz
realm = kin2 #驗證實會顯示出此訊息
vi /home/svn/conf/passwd
[users]
kin1 = 123456
kin2 = 123456
kin3 = 123456
vi /home/svn/conf/authz
[groups]
adm = kin1
user = kin2,kin3
[kin1:/]
@adm = rw
kin2 = rw
kin3 = r
[project2:/]
@adm = rw
kin2 = r
kin3 = rw
killall svnserve
svnserve -d -r /home/svn
svn import kin1(目錄) svn://127.0.0.1/kin1/ -m "Version1" --username=kin1 --password=123456 #Import 程式碼目錄到kin1底下
svn co svn://127.0.0.1/kin1/ --username=kin1 --password=123456
2012年3月12日 星期一
2012年3月11日 星期日
rtorront 安裝過程
須先安裝兩各套件
libtorrent rtorrent
安裝過程中也需要一些輔助軟體
automake autoconf devscripts libtool libcppunit-dev
安裝步驟
# wget http://xxxxxxxxxxxxxxxxx/libtorrent-x.xx.x.tar.gz
# wget http://xxxxxxxxxxxxxxxxxxx/rtorrent-x.x.x.tar.gz
# tar -zxvf libtorrent-x.x.x.tar.gz
# tar -zxvf rtorrent-x.x.x.tar.gz
# cd libtorrent-x.x.x
# ./autogen.sh
# ./configure
# make
# make install
# cd ../rtorrent-x.x.x
# ./autogen.sh
# ./configure --with-xmlrpc-c
# make
# make install
安裝過程中需要先安裝XMLRPC-C
安裝完rtorrent並執行後若出現rtorrent: error while loading shared libraries: libtorrent.so.13: cannot open shared object file: No such file or directory訊息,可以試試看下面的處理方式:
就是先修改/etc/ld.so.conf,增加include /usr/local/lib 这一行。再运行ldconfig即可.
安裝完後需在家目錄(cd ~ 即可)新增.rtorrent.rc內容如下:
min_peers = 20
max_peers = 100
min_peers_seed = 5
max_peers_seed = 10
max_uploads = 10
download_rate = 0
upload_rate = 20
directory = /home/kin/filedownload/downloading
session = /home/kin/filedownload/session
port_range = 6881-6881
port_random = no
check_hash = yes
use_udp_trackers = yes
encryption = allow_incoming,enable_retry,prefer_plaintext
peer_exchange = yes
system.method.set_key = event.download.finished,move_complete,"execute=mv,-u,$d.get_base_path=,/home/kin/filedownload/downloads/;d.set_directory=/home/kin/filedownload/downloads/"
schedule = watch_directory,10,10,load_start=/home/kin/filedownload/torrent/*.torrent
schedule = tied_directory,10,10,start_tied=
schedule = untied_directory,10,10,close_untied=
system.method.set_key = event.download.inserted,delete_torrents,"d.delete_tied="
schedule = throttle_1,01:00:00,24:00:00,download_rate=50
schedule = throttle_2,15:00:00,24:00:00,upload_rate=20
encoding_list = UTF-8
dht = auto
dht_port = 6881
execute_nothrow=rm,/tmp/bt_scgi.socket
schedule = chmod,0,0,"execute=chmod,777,/tmp/bt_scgi.socket"
scgi_local = /tmp/bt_scgi.socket
# Enable the default ratio group.
ratio.enable=
# Change the limits, the defaults should be sufficient.
ratio.min.set=200
ratio.max.set=500
ratio.upload.set=5120M
# Changing the command triggered when the ratio is reached.
system.method.set = group.seeding.ratio.command, d.close=, d.erase=
network.send_buffer.size.set = 4M
network.receive_buffer.size.set = 16M
libtorrent rtorrent
安裝過程中也需要一些輔助軟體
automake autoconf devscripts libtool libcppunit-dev
安裝步驟
# wget http://xxxxxxxxxxxxxxxxx/libtorrent-x.xx.x.tar.gz
# wget http://xxxxxxxxxxxxxxxxxxx/rtorrent-x.x.x.tar.gz
# tar -zxvf libtorrent-x.x.x.tar.gz
# tar -zxvf rtorrent-x.x.x.tar.gz
# cd libtorrent-x.x.x
# ./autogen.sh
# ./configure
# make
# make install
# cd ../rtorrent-x.x.x
# ./autogen.sh
# ./configure --with-xmlrpc-c
# make
# make install
安裝過程中需要先安裝XMLRPC-C
安裝完rtorrent並執行後若出現rtorrent: error while loading shared libraries: libtorrent.so.13: cannot open shared object file: No such file or directory訊息,可以試試看下面的處理方式:
就是先修改/etc/ld.so.conf,增加include /usr/local/lib 这一行。再运行ldconfig即可.
安裝完後需在家目錄(cd ~ 即可)新增.rtorrent.rc內容如下:
min_peers = 20
max_peers = 100
min_peers_seed = 5
max_peers_seed = 10
max_uploads = 10
download_rate = 0
upload_rate = 20
directory = /home/kin/filedownload/downloading
session = /home/kin/filedownload/session
port_range = 6881-6881
port_random = no
check_hash = yes
use_udp_trackers = yes
encryption = allow_incoming,enable_retry,prefer_plaintext
peer_exchange = yes
system.method.set_key = event.download.finished,move_complete,"execute=mv,-u,$d.get_base_path=,/home/kin/filedownload/downloads/;d.set_directory=/home/kin/filedownload/downloads/"
schedule = watch_directory,10,10,load_start=/home/kin/filedownload/torrent/*.torrent
schedule = tied_directory,10,10,start_tied=
schedule = untied_directory,10,10,close_untied=
system.method.set_key = event.download.inserted,delete_torrents,"d.delete_tied="
schedule = throttle_1,01:00:00,24:00:00,download_rate=50
schedule = throttle_2,15:00:00,24:00:00,upload_rate=20
encoding_list = UTF-8
dht = auto
dht_port = 6881
execute_nothrow=rm,/tmp/bt_scgi.socket
schedule = chmod,0,0,"execute=chmod,777,/tmp/bt_scgi.socket"
scgi_local = /tmp/bt_scgi.socket
# Enable the default ratio group.
ratio.enable=
# Change the limits, the defaults should be sufficient.
ratio.min.set=200
ratio.max.set=500
ratio.upload.set=5120M
# Changing the command triggered when the ratio is reached.
system.method.set = group.seeding.ratio.command, d.close=, d.erase=
network.send_buffer.size.set = 4M
network.receive_buffer.size.set = 16M
2012年3月9日 星期五
Jquery下拉伸縮選單
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Jquery Menu</title>
<script type="text/javascript" src="http://www.webdm.cn/themes/script/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#wenzhang>dd>dl>dd").hide();
$("#wenzhang>dd>dl>dt").removeClass("open");
$.each($("#wenzhang>dd>dl>dt"), function(){
$(this).click(function(){
$("#wenzhang>dd>dl>dd").not($(this).next()).slideUp();
$(this).next().slideToggle(300);
});
//$(this).toggle(function(){$(this).addClass("open");},function(){$(this).removeClass("open");});
});
});
</script>
<style type="text/css">
dl,dd,dt,ul,li{ margin:0; padding:0; list-style:none;}
#wenzhang{ width:200px; text-align:center; font-size:12px;border-left:1px solid #dedede;border-right:1px solid #dedede; border-bottom:1px solid #dedede;}
#wenzhang dd dl dt{ border-top:1px solid #dedede; background:#f2f2f2; height:25px; line-height:25px; font-weight:bold;}
#wenzhang ul li{border-top:1px solid #efefef; line-height:25px; background:#f9f9f9;}
body {
margin-left: 0px;
margin-top: 0px;
}
</style>
</head>
<body>
<dl id="wenzhang">
<dd><dl><dt>AAAAAAAA</dt></dl></dd>
<dd>
<dl>
<dt >1111111111</dt>
<dd>
<ul>
<li>1111111111</li>
<li>1111111111</li>
<li>1111111111</li>
<li>1111111111</li>
<li>1111111111</li>
<li>1111111111</li>
</ul>
</dd>
</dl>
</dd>
<dd>
<dl>
<dt>2222222222</dt>
<dd>
<ul>
<li>2222222222</li>
<li>2222222222</li>
<li>2222222222</li>
<li>2222222222</li>
</ul>
</dd>
</dl>
</dd>
<dd>
<dl>
<dt>3333333333</dt>
<dd>
<ul>
<li>3333333333</li>
</ul>
</dd>
</dl>
</dd>
</dl>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Jquery Menu</title>
<script type="text/javascript" src="http://www.webdm.cn/themes/script/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#wenzhang>dd>dl>dd").hide();
$("#wenzhang>dd>dl>dt").removeClass("open");
$.each($("#wenzhang>dd>dl>dt"), function(){
$(this).click(function(){
$("#wenzhang>dd>dl>dd").not($(this).next()).slideUp();
$(this).next().slideToggle(300);
});
//$(this).toggle(function(){$(this).addClass("open");},function(){$(this).removeClass("open");});
});
});
</script>
<style type="text/css">
dl,dd,dt,ul,li{ margin:0; padding:0; list-style:none;}
#wenzhang{ width:200px; text-align:center; font-size:12px;border-left:1px solid #dedede;border-right:1px solid #dedede; border-bottom:1px solid #dedede;}
#wenzhang dd dl dt{ border-top:1px solid #dedede; background:#f2f2f2; height:25px; line-height:25px; font-weight:bold;}
#wenzhang ul li{border-top:1px solid #efefef; line-height:25px; background:#f9f9f9;}
body {
margin-left: 0px;
margin-top: 0px;
}
</style>
</head>
<body>
<dl id="wenzhang">
<dd><dl><dt>AAAAAAAA</dt></dl></dd>
<dd>
<dl>
<dt >1111111111</dt>
<dd>
<ul>
<li>1111111111</li>
<li>1111111111</li>
<li>1111111111</li>
<li>1111111111</li>
<li>1111111111</li>
<li>1111111111</li>
</ul>
</dd>
</dl>
</dd>
<dd>
<dl>
<dt>2222222222</dt>
<dd>
<ul>
<li>2222222222</li>
<li>2222222222</li>
<li>2222222222</li>
<li>2222222222</li>
</ul>
</dd>
</dl>
</dd>
<dd>
<dl>
<dt>3333333333</dt>
<dd>
<ul>
<li>3333333333</li>
</ul>
</dd>
</dl>
</dd>
</dl>
</body>
</html>
訂閱:
意見 (Atom)