?? 新建 文本文檔.txt
字號:
function ReDrawLine(endline,startline,moveline){
var obj;
for(var i= startline - 1; i>endline; i--){
for(var j=0; j<10; j++){
obj = document.all("Main" + i + "#" + j);
var oldcolor = obj.style.background;
obj.style.background = Color[0];
var rowid = i + moveline;
obj = document.all("Main" + rowid + "#" + j);
obj.style.background = oldcolor;
}
}
}
function MoveSquare(from,to){
if(isBounds(to) == false) return false;
var obj;
loop:
for(var i=0; i<to.length; i++){
obj = document.all("Main" + to[i].rows + "#" + to[i].cols);
if(obj.style.background != Color[0]){
for(var j=0; j<from.length; j++)
if(to[i].cols==from[j].cols&&to[i].rows==from[j].rows&&to[i].color==from[j].color)
continue loop;
return false
}
}
return true;
}
function MoveCurSq(x,y,isRotate){
NextSq = new Array(CurSq.length);
for(var i=0; i<CurSq.length; i++){
if(isRotate){
var dx = CurSq[i].cols - CurSq[0].cols;
var dy = CurSq[i].rows - CurSq[0].rows;
NextSq[i] = new Square(CurSq[0].cols-dy,CurSq[0].rows+dx,CurSq[i].color);
}
else
NextSq[i] = new Square(CurSq[i].cols+x,CurSq[i].rows+y,CurSq[i].color);
}
if(isRotate) reNextSq();
if(MoveSquare(CurSq,NextSq) == false){
for(var i=0; i<CurSq.length; i++){
if((CurSq[i].rows==0&&CurSq[i].cols==Cols/2)||(CurSq[i].rows==0&&CurSq[i].cols==Cols/2-1))
isOver = true;
}
return false;
}
clearDraw('Main',CurSq);
CurSq = NextSq;
reDraw('Main',CurSq);
return true;
}
function reNextSq(){
var minCols = SortSquare(NextSq,'Cols',false);
var minRows = SortSquare(NextSq,'Rows',false);
var maxCols = SortSquare(NextSq,'Cols',true);
var maxRows = SortSquare(NextSq,'Rows',true);
if(minCols<0) changeNextSq('Cols',-minCols);
if(minRows<0) changeNextSq('Rows',-minRows);
if(maxCols>9) changeNextSq('Cols',9-maxCols);
if(maxRows>19) changeNextSq('Rows',19-maxRows);
}
function changeNextSq(name,pos){
for(var i=0; i<NextSq.length; i++){
if(name="Rows")
NextSq[i].rows = NextSq[i].rows + pos;
else
NextSq[i].cols = NextSq[i].cols + pos;
}
}
function keyDown(){
switch(event.keyCode){
case 40:
MoveCurSq(0,1,false);
break;
case 37:
MoveCurSq(-1,0,false);
break;
case 38:
MoveCurSq(0,0,true);
break;
case 39:
MoveCurSq(1,0,false);
break;
}
}
function PauseGame(){
if(pause.innerText == "暫停游戲"){
isPause = true;
pause.innerText = "繼續游戲";
pause.focus();
}
else{
isPause = false;
pause.innerText = "暫停游戲";
pause.focus();
Run();
}
}
function OverGame(str){
if(typeof(str)=="undefined") str = "你的得分:" + score +"。是否重玩游戲? ";
else str = str + "你的得分:" + score +"。是否重玩游戲? ";
var isOK = window.confirm(str);
if(!isOK) {
document.location.reload();
window.close();
}
else{
document.location.reload();
}
}
CNBIE BLOG
--------------------------------------------------------------------------------
一個JAVA后臺程序的設計方案
原文:一個JAVA后臺程序的設計方案
作者:陳剛,桂林人,97年畢業于廣西師范大學數學系,暫于IBM中國研究中心兼職從事軟件開發(2004.2-?),專注基于java
CNBIE BLOG
--------------------------------------------------------------------------------
一個JBPM工作流管理示例(三)
原文:一個JBPM工作流管理示例(三)
(二)Decision
package kellerdu.jbpm.delegation;
import org.jbpm.delegation.*;
import kellerdu.jbpm.LogsFactory;
import org.apache.commons.logging.Log;
import kellerdu.jbpm.Constants;
public class ChiefDecision implements DecisionHandler {
public ChiefDecision() {
}
/**
* 判斷是否需要主管批準,決定下一個要進行的transition
*
* @param executionContext ExecutionContext
* @return String
* @todo Implement this org.jbpm.delegation.DecisionHandler method
*/
public String decide(ExecutionContext executionContext) {
Log log=LogsFactory.getLogInstance(this.getClass());
String ac=(String)executionContext.getVariable(Constants.USER_NAME);
if(ac!=null&&(ac.equals("dali")||ac.equals("wang"))){
log.info(ac+"需要老板批準!");
return "BossApprove";
}else{
log.info(ac+"需要先經主管批準");
return "ChiefApprove";
}
}
}
=======================
(三)fork
package kellerdu.jbpm.delegation;
import org.jbpm.*;
import org.jbpm.delegation.*;
import org.jbpm.model.execution.*;
import java.util.*;
public class DecidedJoin implements JoinHandler {
public DecidedJoin() {
}
/**
* fork,只要一個分支到達,即可進行下一步操作,同時取消其它同時進行的分支。
* 這里就是用戶如果取消,請假就取消。如果用戶請假批準,則用戶不能取消。
*
* @param forkContext ForkContext
* @throws ExecutionException
* @todo Implement this org.jbpm.delegation.ForkHandler method
*/
public void join(JoinContext joinContext) throws ExecutionException {
Iterator it=joinContext.getConcurrentTokens().values().iterator();
Token arrivingToken = joinContext.getToken();
while(it.hasNext()){
Token to=(Token)it.next();
if(to.getId().equals(arrivingToken.getId())){
//取消其它執行的Token
joinContext.getExecutionService().cancelToken(to.getId());
}
}
// reactivate the parent token.
joinContext.reactivateToken( arrivingToken.getParent() );
}
}
asp?id=32881" width="1" height="1">
CNBIE BLOG
--------------------------------------------------------------------------------
一個jdbc連接oracle8的例子(本機的頁可以)!!!!
原文:一個jdbc連接oracle8的例子(本機的頁可以)!!!!
try {
//加載一個Oracle驅動
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//使用OCI8連接到數據庫
conn=DriverManager.getConnection("jdbc:oracle:oci8:@DatabaseName"+,"user","password");
}catch(SQLException e) { //捕捉SQL違例
System.out.println("Ora8iConnect在連接oracle8數據庫時捕獲");
while (e!=null)
{ System.out.println("SQLState:"+e.getSQLState());
System.out.println("Message :"+e.getMessage());
System.out.println("Vendor :"+e.getErrorCode());
e=e.getNextException();
System.out.println(" ");
}
conn=null;
}
try {
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
//orcl為你的數據庫的SID
String url="jdbc:oracle:thin:@localhost:1521:orcl";
Connection conn= DriverManager.getConnection(url,"user","password");
}catch(SQLException e) { //捕捉SQL違例
System.out.println("Ora8iConnect在連接oracle8數據庫時捕獲");
while (e!=null)
{ System.out.println("SQLState:"+e.getSQLState());
System.out.println("Message :"+e.getMessage());
System.out.println("Vendor :"+e.getErrorCode());
e=e.getNextException();
System.out.println(" ");
}
conn=null;
}
CNBIE BLOG
--------------------------------------------------------------------------------
一個Jsp初學者的學習過程(四)
原文:一個Jsp初學者的學習過程(四)
一個Jsp初學者的學習過程(四)
TheUnforgiven
第四章 第一個Javabean
一、先看看如何取當前時間并顯示的代碼:
------------------------------------------------
<%
java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
java.util.Date currentTime = new java.util.Date();//得到當前系統時間
String str_date1 = formatter.format(currentTime); //將日期時間格式化
String str_date2 = currentTime.toString(); //將Date型日期時間轉換成字符串形式
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -