\n'); } function setFlash(){ var myFlshObj = document.myFlash; var photoAlbum=document.getElementById('photoAlbum'); if(photoAlbum&&myFlshObj){ var awidth=0; awidth=parseInt(photoAlbum.offsetWidth); if(awidth<260) myFlshObj.height='150px'; if(awidth>=260 && awidth<350) myFlshObj.height='240px'; if(awidth>=350 && awidth<370) myFlshObj.height='305px'; if(awidth>=370 && awidth<550) myFlshObj.height='320px'; if(awidth>=550 && awidth<730) myFlshObj.height='455px'; if(awidth>=730) myFlshObj.height='590px'; } } function setAlbumUrl(name){ albumTypename=name; setFlash(); myFlash_DoFSCommand(null,"test"); } function showLoginWindow(ev){ var obj = document.getElementById("pop-login"); if(document.all){ obj.style.top = ev.clientY +'px'; obj.style.left = ev.clientX - 272 +'px'; } else{ obj.style.top = ev.pageY +'px'; obj.style.left = ev.pageX - 272 +'px' } obj.style.display ="block"; document.getElementById("pop-user-name").focus(); } function hideLoginWindow(){ document.getElementById("pop-login").style.display ="none"; } var blogID=getBlogID(); var UserName = ""; if(blogID!=null){ var tmpUserName=blogID.split("."); UserName=tmpUserName[0]; } function resize(obj){ if(window.event.srcElement.tagName == 'A'){ return; } obj.parentNode.childNodes[1].style.display = obj.parentNode.childNodes[1].style.display=='none' ? 'block': 'none'; obj.parentNode.childNodes[2].style.display = obj.parentNode.childNodes[2].style.display=='none' ? 'block': 'none'; } function tab(event){ var evt = (document.all)?window.event:event; if(evt.keyCode == 9){ document.getElementById("pop-password").focus(); return false; } else{ return evt.keyCode; } } function tab1(event){ var evt = (document.all)?window.event:event; if(evt.keyCode == 9){ document.getElementById("save").focus(); return false; } else{ return evt.keyCode; } } function tabTrack(event) { var evt = (document.all)?window.event:event; if(evt.keyCode == 9){ document.getElementById("pop-password-track").focus(); return false; } else{ return evt.keyCode; } }
Where there is a will,there is a way!
我的工具


我的广告
日历
日志索引
统计
统计中,请等候...
统计中,请等候...
日志
在《Learning jQuery》-Better Interaction Design and Web Development with Simple JavaScript Techniques一书中,作者Jonathan Chaffer 和Karl Swedberg 提供的代码中部分函数在新版的jQuery中已经去掉,所以书中提供的分页示例代码无法使用,在国外网站找到解决办法。
移除.gt((currentPage 1) * numPerPage - 1) 用.slice((currentPage 1) * numPerPage - 1)代替
另外可以把分页处理修改为:
$table.find('tbody tr').hide()
.slice(currentPage * numPerPage, (currentPage 1) * numPerPage - 1)
.show();
也可达到同样之效果。
/**
*
*/
package com.lucene.indexs;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Date;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.DateTools;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexWriter;
/**
*
*/
public class Indexer {
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
if(args.length!=2){
throw new Exception("使用: java " Indexer.class.getName() " <索引存放目录> <被索引文件所在目录>");
}
File indexDir= new File(args[0]);
File dataDir= new File(args[1]);
long start= new Date().getTime();
int numIndexed= index(indexDir,dataDir);
long end= new Date().getTime();
System.out.println("索引了 " numIndexed "个文件,用了" (end-start) " 毫秒");
}
/**
*
* @param indexDir
* @param dataDir
* @return
* @throws IOException
*/
private static int index(File indexDir, File dataDir) throws IOException {
if(!dataDir.exists() || !dataDir.isDirectory()){
throw new IOException(dataDir " 不存在或不是目录");
}
IndexWriter writer= new IndexWriter(indexDir,new StandardAnalyzer(),true);
writer.setUseCompoundFile(false);
indexDirectory(writer,dataDir);
int numIndexed= writer.docCount();
writer.optimize();
writer.close();
return numIndexed;
}
/**
*
* @param writer
* @param dataDir
* @throws IOException
*/
private static void indexDirectory(IndexWriter writer, File dataDir) throws IOException {
File[] files= dataDir.listFiles();
int fileSize= files.length;
for(int i=0;i<fileSize;i ){
File file= files[i];
if(file.isDirectory()){
indexDirectory(writer,file);
}else if(file.getName().endsWith(".txt")){
indexFile(writer,file);
}
}
}
/**
*
* @param writer
* @param file
* @throws IOException
*/
private static void indexFile(IndexWriter writer, File file) throws IOException {
if(file.isHidden() || !file.exists() || !file.canRead()){
return;
}
System.out.println("Indexing " file.getCanonicalPath());
Document doc= new Document();
doc.add(new Field("contents",new FileReader(file)));
doc.add(new Field("filename",file.getCanonicalPath(),Field.Store.YES,Field.Index.UN_TOKENIZED));
doc.add(new Field("modified",DateTools.timeToString(file.lastModified(), DateTools.Resolution.MINUTE),Field.Store.YES,Field.Index.UN_TOKENIZED));
writer.addDocument(doc);
}
}
1、javac
D:devstudioeclipse3.2_newworkspaceLuceneStudysrc>javac -classpath ../lib/lucene-core-2.3.2.jar com/lucene/indexs/Indexer.java
2、java
D:devstudioeclipse3.2_newworkspaceLuceneStudysrc>java -classpath ../lib/lucene-core-2.3.2.jar; com.lucene.indexs.Indexer d:lucene_index d:lucene_data
2008年8月8号,北京举行了29届奥运会开幕式,北京奥运会正式开始啦。
作为在家门口举行的奥运会,我感到很自豪。
能够在北京感受到奥运的气氛,我感到自豪。
看着首都人们对奥运的热情,我很激动,同时很自豪。
我感到今日中国变得越来越强大,越来越自信和成熟了。
少年强,则中国强,作为一名当代的青年,我们要更加努力、自强,把国家建设得更加强大。
让我们为北京奥运加油!
让我们为全世界的奥运健儿加油!
最后,让我们记住顾拜旦在1936年奥运会演讲时说过的一句话:"奥运会重要的不是胜利,而是参与;生活的本质不是索取,而是奋斗。"。
quartz_jobs.xml 中时间格式的问题,写成 2008-06-20 7:23:00 PM 的话 JobSchedulingDataProcessor.parseDate(value) 没办法解析
在 quartz_jobs.xml 中 <start-time> 的格式是:
<start-time>2008-06-23T21:23:00</start-time>
T隔开日期和时间,默认时区
或者:
<start-time>2008-06-23T21:23:00 08:00</start-time>
08:00 表示东八区
我觉得这是 Quartz 的一个 Bug,其实 Quartz 在解析时间时准备了两个 Pattern 的,分别是:
yyyy-MM-dd'T'hh:mm:ss
yyyy-MM-dd hh:mm:ss a
但是在 JobSchedulingDataProcessor.parseDate(value) 方法中只会以第一个 Pattern 解析时间,并不会尝试使用第二个 Pattern 去解析时间,第二个 Pattern 是可以认识 2008-06-20 7:23:00 PM 的。
所以为了规避这个问题,还是应该写成 yyyy-MM-dd'T'hh:mm:ss 格式。
本人用Spring集成Struts时老出Servlet action is not available错
找配置文件找了N久,没有找出错来。后面把
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property value="contextConfigLocation" property="/WEB-INF/applicationContext.xml"/>
</plug-in>
这段代码给剪掉。在web.xml文件中加上
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
就OK了!!
在tomcat5.5.17上运行struts项目时报如下错误:
java.lang.ClassCastException: org.apache.struts.action.ActionMessage org.apache.struts.taglib.html.ErrorsTag.doStartTag(ErrorsTag.java:215) org.apache.jsp.login_jsp._jspx_meth_html_005ferrors_005f0(login_jsp.java:173) org.apache.jsp.login_jsp._jspx_meth_html_005fform_005f0(login_jsp.java:115) org.apache.jsp.login_jsp._jspService(login_jsp.java:77) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069) org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:1012) org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:980) org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) javax.servlet.http.HttpServlet.service(HttpServlet.java:710) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
解决办法:
将
ActionErrors error=new ActionErrors();
if ("login".equals(status)) {
if (this.id == null || "".equals(this.id)) {
error.add("id", new ActionMessage("id.null"));
}
}
该为
ActionErrors error=new ActionErrors();
if ("login".equals(status)) {
if (this.id == null || "".equals(this.id)) {
error.add("id", new ActionError("id.null"));
}
}
就可以了 ActionError比ActionMessage好用