1、修改linux系統(tǒng)默認(rèn)的1024個(gè)文件上限。
在/root/.bash_profile文件中加入:ulimit -n 4096
2、查看某個(gè)進(jìn)程打開的文件數(shù):
先用ps -aux找到pid,然后運(yùn)行l(wèi)sof -p %pid% | wc -l
3、查看80端口的連接數(shù)
netstat -nat|grep -i “80″|wc -l
4、查看系統(tǒng)內(nèi)核版本
uname -a
5、查看Linux版本
登錄到服務(wù)器執(zhí)行 lsb_release -a ,即可列出所有版本信息
6、查看目錄空間
du -h --max-depth=2 | sort -n
作為一個(gè)項(xiàng)目構(gòu)建工具,Maven除具備Ant的功能外,最最要的就是jar包的管理。
相關(guān)文章:
http://m.tkk7.com/calvin/archive/2006/03/19/36098.html
http://www.ibm.com/developerworks/cn/opensource/os-maven2/
如果不小心安裝了正版驗(yàn)證補(bǔ)丁,可以建一個(gè)批處理文件,在安全模式下運(yùn)行即可刪除。批處理文件內(nèi)容如下:
@echo off
title 刪除 Windows Genuine Advantage 腳本
cls
:ClearTemp
echo.
echo.
set choice=
set /p choice= 是否要嘗試刪除 Windows Genuine Advantage (Y/N)?:
if "%choice%"=="N" goto End
if "%choice%"=="n" goto End
echo.
echo 正在嘗試刪除 Windows Genuine Advantage ……
echo.
taskkill /f /im wgatray.exe /t
taskkill /f /im wgatray.dll /t
del /f /q %systemroot%\system32\wga*.*
taskkill /f /im wgatray.exe /t
taskkill /f /im wgatray.dll /t
del /f /q %systemroot%\system32\wga*.*
taskkill /f /im wgatray.exe /t
taskkill /f /im wgatray.dll /t
del /f /q %systemroot%\system32\wga*.*
taskkill /f /im wgatray.exe /t
taskkill /f /im wgatray.dll /t
del /f /q %systemroot%\system32\wga*.*

del /f /q %systemroot%\system32\legitcheckcontrol.dll
del /f /q %systemroot%\system32\dllcache\wga*.*

reg delete HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Notify\WGALogon /f
reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\uninstall\wganotify /f

:End
echo.
echo -----------------------處理完畢。請關(guān)閉。-----------------------
echo.
echo.
pause>nul

創(chuàng)建.bat文件,輸入如下內(nèi)容:
netsh interface ip set address "本地連接" static 192.9.101.106 255.255.255.0 192.9.101.1 1
netsh interface ip add dns name = "本地連接" addr = 202.101.172.35
netsh interface ip add dns name = "本地連接" addr = 202.101.172.36
posted @
2008-05-28 14:40 josson 閱讀(1051) |
評(píng)論 (0) |
編輯 收藏
AXIS快速生成客戶端調(diào)用文件的命令:
java -Djava.ext.dirs=./lib org.apache.axis.wsdl.WSDL2Java -o . -d Session -s -S true -p com.company.webservice.user http://192.9.101.106:8080/cms/services/UserService?wsdl
說明:
1、com.company.webservice.user表示新生成類文件的包名。
2、http://192.9.101.106:8080/cms/services/UserService?wsdl 表示W(wǎng)ebservice服務(wù)地址。
3、注:相關(guān)的依賴包須存放在lib目錄下,依賴包包括:
axis.jar
axis-ant.jar
axis-schema.jar
commons-discovery-0.2.jar
commons-logging-1.0.4.jar
jaxrpc.jar
log4j-1.2.8.jar
saaj.jar
wsdl4j-1.5.1.jar
創(chuàng)建bat文件,并將輸入上述命令,執(zhí)行后,即將在當(dāng)前目錄生成相關(guān)的類文件。
1、服務(wù)器向指定客戶端推送數(shù)據(jù)
完成聊天室之類的項(xiàng)目時(shí),利用DWR推模式向所有客戶端推送數(shù)據(jù),的確是很方便,只要客戶端的訪問頁面確定就可以了。但是,若需要對(duì)訪問同一頁面的兩個(gè)客戶端(特別是根據(jù)用戶身份作不同處理),加以區(qū)分,推送不同數(shù)據(jù)時(shí),就沒這么簡單了。
有兩種方式可以解決這個(gè)問題:
a)、服務(wù)端不處理,只管往客戶端推送數(shù)據(jù),由客戶端對(duì)收到的數(shù)據(jù)進(jìn)行過濾,然后再顯示出來。但這種方式的缺點(diǎn)很明顯,數(shù)據(jù)包多且不安全。
b)、對(duì)每個(gè)客戶端進(jìn)行單兒標(biāo)識(shí)。DWR中以ScriptSession來代表一個(gè)客戶端連接,我們可以通過設(shè)置ScriptSession的屬性,來達(dá)到標(biāo)識(shí)客戶端的作用。如將sessionid或用戶登錄名保存在相應(yīng)的ScriptSession屬性中,向客戶端推送數(shù)據(jù)時(shí),根據(jù)這個(gè)屬性加以過濾。相應(yīng)的代碼片段如下:
/**
* 返回有效的ScriptSession.
* @param user
* @return
*/
@SuppressWarnings("unchecked")
private ScriptSession getCurrentSession(String user){
ScriptSession xSession = null;
Collection<ScriptSession> sessions = new HashSet<ScriptSession>();
sessions.addAll(sctx.getScriptSessionsByPage(PAGE_MAIN));
for (ScriptSession session : sessions) {
//查詢與消息接收者相符的客戶端頁面,并輸出消息內(nèi)容
String xuser = (String)session.getAttribute(SESSION_ATTRNAME_USER);
if(xuser != null && xuser .equals(user)){
xSession = session;
}
}
return xSession;
}
/**
* 清除已有連接, 標(biāo)識(shí)當(dāng)前連接用戶(登錄或刷新頁面時(shí),進(jìn)行必要的清理).
* @param user
* @param session
*/
private void cleanDwrConnection(user,ScriptSession session){
String jid = StringUtils.parseBareAddress(user);
ScriptSession oldSession = getCurrentSession(jid);
if(oldSession != null && oldSession != session){
oldSession.invalidate();
oldSession = null;
}
session = WebContextFactory.get().getScriptSession();
session.setAttribute(SESSION_ATTRNAME_USER, jid);
}
2、使用DWR推模式的實(shí)現(xiàn)中,刷新頁面引起長連接丟失問題
最近在做web版即時(shí)消息客戶端時(shí),遇到這樣一個(gè)問題:為了減少無用的服務(wù)連接,只在登錄后才激活長連接(dwr.engine.setActiveReverseAjax(true),注銷后取消長連接)。登錄客戶端后,用了一段時(shí)間后,無法收消息了(消息無法推送到客戶端)。后來調(diào)試后,發(fā)現(xiàn)ScriptSession實(shí)例沒有綁定物理連接信息(conduits:m:root為空)。測試后發(fā)現(xiàn),當(dāng)刷新頁面后,會(huì)產(chǎn)生一個(gè)新的ScriptSession實(shí)例,而這個(gè)ScriptSession的conduits:m:root為空,所以怎么都無法將數(shù)據(jù)推送到客戶端去了。
客戶端激活長連接后(dwr.engine.setActiveReverseAjax(true);),對(duì)應(yīng)的ScriptSession實(shí)例會(huì)綁定物理連接信息,而刷新頁面刷新而不重新激活長連接,新產(chǎn)生的ScriptSession是沒有綁定物理連接信息的,一旦綁定物理連接信息的ScriptSession被銷毀后,就產(chǎn)生了這個(gè)問題。
posted @
2008-03-31 16:41 josson 閱讀(4122) |
評(píng)論 (0) |
編輯 收藏
刪除表主鍵:
ALTER TABLE TABLENAME DROP CONSTRAINT PK_TABLENAME;
新增表主鍵:
alter table TABLENAME add CONSTRAINT PK_TABLENAME primary key (ID);
window.event
IE:有window.event對(duì)象
FF:沒有window.event對(duì)象。可以通過給函數(shù)的參數(shù)傳遞event對(duì)象。如onmousemove=doMouseMove(event)
鼠標(biāo)當(dāng)前坐標(biāo)
IE:event.x和event.y。
FF:event.pageX和event.pageY。
通用:兩者都有event.clientX和event.clientY屬性。
鼠標(biāo)當(dāng)前坐標(biāo)(加上滾動(dòng)條滾過的距離)
IE:event.offsetX和event.offsetY。
FF:event.layerX和event.layerY。
通用:event.clientY+document.documentElement.scrollTop(加垂直滾動(dòng)條)。
通用:event.clientX+document.documentElement.scrollLeft(加水平滾動(dòng)條)。
示例:
<script>
function xyzb(xy){
xl = xy.clientX+document.documentElement.scrollLeft;
yr = xy.clientY+document.documentElement.scrollTop;
document.getElementById("xys").innerHTML=xl+","+yr;
}
</script>
<div id="xys" style="width:500px;height:500px;border:1px solid;" onmousemove="xyzb(event);"></div>
標(biāo)簽的x和y的坐標(biāo)位置:style.posLeft 和 style.posTop
IE:有。
FF:沒有。
通用:object.offsetLeft 和 object.offsetTop。
窗體的高度和寬度
IE:document.body.offsetWidth和document.body.offsetHeight。注意:此時(shí)頁面一定要有body標(biāo)簽。
FF:window.innerWidth和window.innerHegiht,以及document.documentElement.clientWidth和document.documentElement.clientHeight。
通用:document.body.clientWidth和document.body.clientHeight。
添加事件
IE:element.attachEvent("onclick", func);。
FF:element.addEventListener("click", func, true)。
通用:element.onclick=func。雖然都可以使用onclick事件,但是onclick和上面兩種方法的效果是不一樣的,onclick只有執(zhí)行一個(gè)過程,而attachEvent和addEventListener執(zhí)行的是一個(gè)過程列表,也就是多個(gè)過程。例如:element.attachEvent("onclick",
func1);element.attachEvent("onclick", func2)這樣func1和func2都會(huì)被執(zhí)行。
標(biāo)簽的自定義屬性
IE:如果給標(biāo)簽div1定義了一個(gè)屬性value,可以div1.value和div1["value"]取得該值。
FF:不能用div1.value和div1["value"]取。
通用:div1.getAttribute("value")。
父節(jié)點(diǎn)、子節(jié)點(diǎn)和刪除節(jié)點(diǎn)
IE:parentElement、parement.children,element.romoveNode(true)。
FF:parentNode、parentNode.childNodes,node.parentNode.removeChild(node)。
畫圖
IE:VML。
FF:SVG。
CSS:透明
IE:filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=60)。
FF:opacity:0.6。
CSS:圓角
IE:不支持圓角。
FF:-moz-border-radius:4px,或者-moz-border-radius-topleft:4px;-moz-border-radius-topright:4px;-moz-border-radius-bottomleft:4px;-moz-border-radius-bottomright:4px;。
CSS:雙線凹凸邊框
IE:border:2px outset;。
FF:-moz-border-top-colors: #d4d0c8 white;-moz-border-left-colors: #d4d0c8
white;-moz-border-right-colors:#404040 #808080;-moz-border-bottom-colors:#404040
#808080;。
http://dhtmlx.com 包含目錄樹、菜單、工具條等很多js控件,功能十分強(qiáng)大。
現(xiàn)將dhtmlxTree 使用樣例記錄如下(包括目錄樹、上下文菜單):
1、所需js文件
dhtmlxcommon.js
dhtmlxtree.js
dhtmlxtree_json.js
//菜單控件所需的js
dhtmlxprotobar.js
dhtmlxmenubar.js
dhtmlxmenubar.js
2、sample.html代碼:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標(biāo)題文檔</title>
<script src="./dhtmlxcommon.js"></script>
<script src="./dhtmlxtree.js"></script>
<script language="JavaScript" src="./extend/dhtmlxtree_json.js"></script>
<script language="JavaScript" src="./dhtmlxprotobar.js"></script>
<script language="JavaScript" src="./dhtmlxmenubar.js"></script>
<script language="JavaScript" src="./dhtmlxmenubar_cp.js"></script>
<link rel="STYLESHEET" type="text/css" href="./dhtmlxtree.css">
<link rel="STYLESHEET" type="text/css" href="./context.css">
<link rel="STYLESHEET" type="text/css" href="./dhtmlxmenu.css">
</head>
<body>
<div id="treeBox" style="width:200;height:200"></div>
<script>
//init menu
aMenu=new dhtmlXContextMenuObject('120',0,"images/");
aMenu.menu.loadXML("./_context.xml");
aMenu.setContextMenuHandler(onMenuClick);
tree=new dhtmlXTreeObject('treeBox',"100%","100%",0);
tree.setImagePath("images/");
tree.enableCheckBoxes(true);
tree.enableDragAndDrop(true);
tree.enableContextMenu(aMenu); //link context menu to tree
tree.loadCSV("./data.txt");//for loading from file
function onMenuClick(id,s){ alert("Menu item "+id+" was clicked"+s); }
</script>
</body>
</html>
3、數(shù)據(jù)文件data.txt
1,0,node 1
2,1,node 1.1
3,2,node 1.1.1
4,0,node 2
bd2f46a212ffae3b011305afd5eb0108,4,node 2.1
6,1,node 1.2
4、菜單文件_context.xml
<?xml version='1.0' ?>
<menu absolutePosition="auto" mode="popup" maxItems="8" globalCss="contextMenu" globalSecondCss="contextMenu" globalTextCss="contextMenuItem">
<MenuItem name="Red" src="./images/red.gif" id="edit_Red"/>
<MenuItem name="Green" src="./images/green.gif" id="edit_Green"/>
<MenuItem name="Blue" src="./images/blue.gif" id="edit_Blue"/>
<MenuItem name="Other
" src="" id="outher" width="120px" panelWidth="120">
<MenuItem name="Yellow" src="./images/yellow.gif" id="edit_Yellow"/>
<MenuItem name="White" src="./images/white.gif" id="edit_White"/>
</MenuItem>
</menu>
注:dhtmlxTree 標(biāo)準(zhǔn)版不支持菜單功能,所以需要對(duì)
dhtmlxtree.js做些修改,在腳本的最后面加上如下方法:
dhtmlXTreeObject.prototype.enableContextMenu=function(menu)
{
if(menu) this.cMenu=menu
};
posted @
2008-01-30 15:53 josson 閱讀(8346) |
評(píng)論 (1) |
編輯 收藏
摘要: 1、命令控制
啟動(dòng):/usr/local/mysql/bin/mysqld-safe --user=mysql &
停止:/usr/local/mysql/bin/mysqladmin -u root -p pwd shutdown
2、自啟動(dòng)sh腳本(mysqld 存放于/etc/init.d目錄下,注意下面mysql數(shù)據(jù)所在路徑)
Code highl...
閱讀全文
posted @
2008-01-23 10:53 josson 閱讀(4786) |
評(píng)論 (0) |
編輯 收藏