Skip to content

Instantly share code, notes, and snippets.

@arvinLee
arvinLee / BackUpTableTask.java
Created August 22, 2012 09:02
Servlet中的定时任务
public class BackUpTableTask extends TimerTask {
private static Log log = LogFactory.getLog(BackUpTableTask.class);
private static boolean isRunning = false;
public void run() {
if (!isRunning) {
isRunning = true;
log.debug("开始执行任务..."); //开始任务
//working add what you want to do
log.debug("执行任务完成..."); //任务完成
isRunning = false;
@arvinLee
arvinLee / Demo.java
Created August 22, 2012 08:54
java定时任务
java.util.Timer timer = new java.util.Timer(true);
// true 说明这个timer以daemon方式运行(优先级低,
// 程序结束timer也自动结束),注意,javax.swing
// 包中也有一个Timer类,如果import中用到swing包,
// 要注意名字的冲突。
TimerTask task = new TimerTask() {
public void run() {
... //每次需要执行的代码放到这里面。
}
@arvinLee
arvinLee / fileName.html
Created August 14, 2012 14:38
使用正则表达式过滤上传文件
<!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" />
<script type="text/javascript" src="js/jquery.js"></script>
<title></title>
</head>
<body>
<form action="#">
<input type="file" name="myfile" id="xx" />
@arvinLee
arvinLee / BaseDao.java
Created August 2, 2012 00:53 — forked from fankay/BaseDao.java
SSH中BaseDao的写法
package com.kaishengit.dao.core;
import java.io.Serializable;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Map;
import org.hibernate.Criteria;
import org.hibernate.Query;