删除一个任务
Schtasks /Delete /tn
计划的名字 /f
创建一个一次性的任务
Schtasks /Create /tn "
GameStart" /tr
D:\JavaWorkSpace\GameGate\doc\run.bat /sc once /st
23:04:00 /sd
2010/06/03 /ru
Administrator /rp
123456
posted @
2010-06-03 23:06 Vincent.Yu 阅读(284) |
评论 (0) |
编辑 收藏
摘要: 首先上代码,一个是工具类,一个是修该的SUN RUNTIME 里的 ZipOutputStream 类(用来解决中文乱码问题)。
ZipTools.java
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->package...
阅读全文
posted @
2008-10-30 17:55 Vincent.Yu 阅读(12509) |
评论 (0) |
编辑 收藏
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Todoist</title>
<script>
function Douban(){
Douban.val = "test";
Douban.prototype.test = function(name){
alert("hello "+name);
}
Douban.testA = function(name){
alert("hello "+name);
}
};
</script>
</head>
<body>
<script>
var douban = new Douban();
alert(Douban.val);
douban.test("中国");
Douban.testA("中国");
</script>
</body>
</html>
直接设的可以直接调用,使用prototype的,需要有一该类的对象。
posted @
2008-10-30 17:37 Vincent.Yu 阅读(238) |
评论 (0) |
编辑 收藏
1.介绍
FCKeditor 是一个使用广泛,支持多语言的在线HTML编辑器,它支持asp,php,jsp等常见的网络编程语言.它的官方网站是:
http://www.fckeditor.net/ 目前最新版本是2.4.3 ,百度空间等大型的网站都有用到FCKeditor
2.下载
我们今天讨论的是在java环境下的使用.我们要下载两个文件包.一个是FCKeditor的主文件包,还有一个是用来实现JSP tag,和处理文件的上传和浏览的FCKeditor For Jsp 的压缩包.
下载地址:
http://sourceforge.net/project/showfiles.php?group_id=75348
选择下载:
FCKeditor_2.4.3.zip 和
FCKeditor.Java 里的
FCKeditor-2.3.zip
下载完成后解压. 就像下面的样子:
3.拷贝文件
a.首先把FCKeditor_2.4.3里的fckeditor拷贝到你的网站文件根目录.一般是WebRoot或WebContent下面并把_samples文件夹和一些不要的asp,php 文件删除.网站的目录结构就像下面的这个样子:
b.把FCKeditor-2.3(也就是FCKeditor For Java 的那个文件夹)下的\web\WEB-INF\lib目录下的FCKeditor-2.3.jar和commons-fileupload.jar拷贝到你网站的WEB-INF/lib下面
拷贝到:
4.配置Servlet
我们要把处理图片上传的Servlet配置到web.xml里: 我的写法是这样的:
<!-- FCKeditro 配置 -->
<servlet>
<servlet-name>Connector</servlet-name>
<servlet-class>com.fredck.FCKeditor.connector.ConnectorServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
<param-value>/UserFiles/</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>SimpleUploader</servlet-name>
<servlet-class>com.fredck.FCKeditor.uploader.SimpleUploaderServlet</servlet-class>
<init-param>
<param-name>baseDir</param-name>
<param-value>/UserFiles/</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>enabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsFile</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsFile</param-name>
<param-value>php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi</param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsImage</param-name>
<param-value>jpg|gif|jpeg|png|bmp</param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsImage</param-name>
<param-value></param-value>
</init-param>
<init-param>
<param-name>AllowedExtensionsFlash</param-name>
<param-value>swf|fla</param-value>
</init-param>
<init-param>
<param-name>DeniedExtensionsFlash</param-name>
<param-value></param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Connector</servlet-name>
<url-pattern>/fckeditor/editor/filemanager/browser/default/connectors/jsp/connector</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SimpleUploader</servlet-name>
<url-pattern>/fckeditor/editor/filemanager/upload/simpleuploader</url-pattern>
</servlet-mapping>
<!-- 结束FCKeditor配置 -->
一共有2个servlet.
5.配置Jsp
要在JSP页面上能显示出来编辑器的话,还要在JSP页面调用FCKeditor,调用的方法可以有很多种,可以用Java代码调用,也可以是纯javascript,asp,JSP Tag.在本例中,我们用JSP Tag调用:
假设在你的页面表单中新闻内容字段名为content的话.那JSP的代码如下:
a.在页面的头部引入Taglib:
<%@ taglib uri="http://fckeditor.net/tags-fckeditor" prefix="FCK" %>
b.在页面相应的部分嵌入tag:
<tr>
<td colspan="2" height="500px;">
<FCK:editor id="content" basePath="fckeditor/" height="500"
imageBrowserURL="../filemanager/browser/default/browser.html?Type=Image&Connector=connectors/jsp/connector"
linkBrowserURL="../filemanager/browser/default/browser.html?Connector=connectors/jsp/connector"
flashBrowserURL="../filemanager/browser/default/browser.html?Type=Flash&Connector=connectors/jsp/connector"
imageUploadURL="../filemanager/upload/simpleuploader?Type=Image"
linkUploadURL="../filemanager/upload/simpleuploader?Type=File"
flashUploadURL="../filemanager/upload/simpleuploader?Type=Flash">
<%= U.f(doc.getContent()) %>
</FCK:editor>
</td>
</tr>
那个
<%= U.f(doc.getContent()) %> 是用来设置初始值的.您可以换成你的代码.
6.完成
如果您的完全按照我的这样的方法陪置,那你现在就可以正常的用它了.要是不是的话,就是路径不对导致的问题,那你要自己调一下了.也就是说servlet里的url-pattern和FCK标签里的那些URL要调一下.如果是用默认的话,其它地方就不用调,如果你要个性化,那调的地方就多了.呵呵.自己倒腾吧.
Servlet 加载成功的话,tomcat启动时会打印如下信息:
---- SimpleUploaderServlet initialization started ----
php|php3|php5|phtml|asp|aspx|ascx|jsp|cfm|cfc|pl|bat|exe|dll|reg|cgi
0 - php
1 - php3
2 - php5
3 - phtml
4 - asp
5 - aspx
6 - ascx
7 - jsp
8 - cfm
9 - cfc
10 - pl
11 - bat
12 - exe
13 - dll
14 - reg
15 - cgi
jpg|gif|jpeg|png|bmp
0 - jpg
1 - gif
2 - jpeg
3 - png
4 - bmp
swf|fla
0 - swf
1 - fla
---- SimpleUploaderServlet initialization completed ----
下面是成功的图片,可以上传图片.
第一次这么认真的写BLOG,希望能帮到一些朋友,呵呵,有什么问题也可以留言.我们一起讨论.
posted @
2007-09-23 14:06 Vincent.Yu 阅读(1612) |
评论 (9) |
编辑 收藏
摘要: 1.下载jxl.rar包
项目地址:http://www.andykhan.com/jexcelapi/
下载地址:http://www.andykhan.com/jexcelapi/download.html
目前版本的信息
Reads data from Excel 95, 97, 2000 workbooks
Reads and writes formulas (Excel...
阅读全文
posted @
2007-09-20 14:47 Vincent.Yu 阅读(12500) |
评论 (10) |
编辑 收藏
1。先打印出来:
System.out.println(testString);
2。这一段出现了乱码,那么不妨用穷举法猜测一下它的实际编码格式。
System.out.println(new String(testString.getBytes("ISO-8859-1"),"gb2312"));
System.out.println(new String(testString.getBytes("UTF8"),"gb2312"));
System.out.println(new String(testString.getBytes("GB2312"),"gb2312"));
System.out.println(new String(testString.getBytes("GBK"),"gb2312"));
System.out.println(new String(testString.getBytes("BIG5"),"gb2312"));
3。进行相应的处理。
posted @
2007-08-24 10:23 Vincent.Yu 阅读(292) |
评论 (0) |
编辑 收藏
package com.mypcs.utils;
import java.io.*;
import java.util.*;
/** *//**
* 生成Html文件的工具类
* alex 2007-5-29 下午09:54:14
*/
public class CreateHtml {
public CreateHtml(){
}
public String readHtml(String fileName){
StringBuffer sb = new StringBuffer();
try{
fileName = fileName.replaceAll("\\\\", "/");
FileInputStream fis = new FileInputStream(fileName);
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
String line =reader.readLine();
while(line != null){
sb.append(line);
sb.append("\r\n");
line = reader.readLine();
}
reader.close();
fis.close();
}catch(Exception ex){
return "";
}
return sb.toString();
}
public void writeHtml(String nowPath,String fileName,String s){
try{
//分级建目录
String needBulid = fileName.substring(0, fileName.lastIndexOf("\\"));
needBulid = needBulid.substring(nowPath.length());
String array[] = needBulid.split("\\\\");
nowPath = nowPath.replaceAll("\\\\", "/");
String bulidNow = nowPath.substring(0,nowPath.length()-1);
for (int i = 0; i < array.length; i++) {
String temp = array[i];
if(temp!=null&&temp.length()>0){
bulidNow = bulidNow + "/" + temp;
File file = new File(bulidNow);
while(!file.exists()){
file.mkdirs();
}
}
}
fileName = fileName.replaceAll("\\\\", "/");
File outFile = new File(fileName);
while(!outFile.exists()){
outFile.createNewFile();
}
FileWriter writer = new FileWriter(new File(fileName));
BufferedWriter bufferedWriter = new BufferedWriter(writer);
bufferedWriter.write(s);
bufferedWriter.close();
writer.close();
}catch(Exception ex){
ex.printStackTrace();
}
}
public String setValue(String s,List list,HashMap hashMap){
for(int i = 0; i < list.size(); i++){
String name = (String)list.get(i);
if(name==null){
name = "";
}
String value = (String)hashMap.get(name);
if(value==null){
value = "";
}
value = value.replaceAll("\\$", "#美元#");
s = s.replaceAll("#"+name+"#",value);
}
return s;
}
}
没有乱码问题,呵呵,希望能帮到一些朋友。
posted @
2007-07-16 15:34 Vincent.Yu 阅读(761) |
评论 (2) |
编辑 收藏
Dom4j 下载地址简单的例子,初学者可以看看.没有乱码的问题,有什么帮得到的可以跟贴.
package com.alex.mj;
import java.io.*;
import java.util.Iterator;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.DocumentHelper;
import org.dom4j.io.XMLWriter;
import org.dom4j.io.SAXReader;
public class ModelReder {
public static void main(String[] args) {
try {
ModelReder modelReder = new ModelReder();
modelReder.testWrite();
modelReder.testRead();
} catch (Exception e) {
e.printStackTrace();
}
}
public void testRead() throws Exception{
SAXReader reader = new SAXReader();
Document document = reader.read(new FileInputStream("output.xml"));
Element root = document.getRootElement();
for (Iterator iter = root.elementIterator(); iter.hasNext();) {
Element element = (Element) iter.next();
System.out.println(element.getText());
System.out.println(element.attributeValue("name"));
System.out.println(element.attributeValue("blog"));
}
}
public void testWrite() throws Exception{
Document document = DocumentHelper.createDocument();
Element root = document.addElement("root");
Element element1 = root.addElement("user")
.addAttribute("name","Alexander")
.addAttribute("blog", "http://netnova.blogjava.net")
.addText("我是中文的名字");
XMLWriter writer = new XMLWriter(new FileOutputStream("output.xml"));
writer.write(document);
writer.close();
}
}
打印结果:
我是中文的名字
Alexander
http://netnova.blogjava.net
生成的文件内容:
<?xml version="1.0" encoding="UTF-8"?>
<root><user name="Alexander" blog="http://netnova.blogjava.net">我是中文的名字</user></root>
:-)
posted @
2007-07-09 21:52 Vincent.Yu 阅读(6081) |
评论 (3) |
编辑 收藏