桌面

来源:互联网 发布:汕头招聘淘宝打包 编辑:程序博客网 时间:2024/04/27 16:43

=========================================================== ===========================================================

获得时间 import java.util.Date; import java.text.SimpleDateFormat; System.out.println(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(new Date()));

===========================================================

2008-5-28: 在java文件中可以通过"D://test//test.gif"访问该文件 但是在jsp程序中这样访问不到. ===========================================================

2008-5-26 :获得系统属性代码:System.getProperty("user.dir")

import java.util.Properties; import java.util.Enumeration;

public class GetSystemInfo{     public static void main(String [] args){         Properties pr = System.getProperties();         System.out.println("pr.size() is:"+pr.size());         Enumeration st = pr.propertyNames();         while(st.hasMoreElements()){             String tmp = (String)st.nextElement();             System.out.println(""+tmp+" :"+pr.getProperty(tmp));                     }     } }

===========================================================

2008-5-26:jTextArea将URL地址html化 ===========================================================

2008-5-26:jTextArea实时刷新 将jTextArea的ActionEvent类里的代码封装在一个多线程类 里,实例化该线程并启动线程。

===========================================================

2008-5-22:web页面数据读取中的bug 通过:             URI strURI = new URI(getSearchURI());             URL strURL = strURI.toURL();             InputStream inputStr = strURL.openStream();             BufferedReader bufRead = new BufferedReader(new InputStreamReader(inputStr)); 然后:             StringBuffer sb = new StringBuffer();             while(bufRead.ready()){                 sb.append(bufRead.readLine()+"/n");             }             bufRead.close();             String strSB = sb.toString(); 然后具体截取时:str即为上面的strSB         int beginInd = str.lastIndexOf("<DIV id=ScriptDiv></DIV>");         int endInd = str.indexOf("<br clear=all>");         return str.substring(beginInd,endInd); 发现strSB字符串不够???大多数数据不见??? ===========================================================

2008-5-21:正则表达式匹配地址和标题         Pattern p = Pattern.compile("<table.*?<a.*?</a>");         Matcher m = p.matcher(str);         while(m.find()){             System.out.println("地址:" + m.group().replaceAll("<table.*?href=/"","").replaceAll("/".*",""));             System.out.println("标题:" + m.group().replaceAll("<table.*?>|<font.*?>|<tr.*?>|<td.*?>|<a.*?>|</font>|</a>",""));         }

===========================================================

2008-5-20 (判断BufferedReader是否已经read完:.ready())             BufferedReader bufRead = new BufferedReader(new InputStreamReader(inputStr));             StringBuffer sb = new StringBuffer();             while(bufRead.ready()){                 sb.append(bufRead.readLine()+"/n");             }

===========================================================

2008-5-20

grep全称为全局正则表达式打印(global regular expression print) ===========================================================

2008-5-4

jTextArea.setLineWrap(true)设置jTextArea是否满时换行 ===========================================================

C:/Program Files/Common Files/Microsoft Shared/IME/IMSC40A 微软拼音输入法自造词工具(汉字转换为拼音) ===========================================================

oracle:nvl

===========================================================

Log4J配置步骤: ①--------在web.xml里添加-----------------   <context-param>     <param-name>log4jConfigLocation</param-name>     <param-value>/WEB-INF/log4j.properties</param-value>   </context-param>   <context-param>     <param-name>log4jRefreshInterval</param-name>     <param-value>60000</param-value>   </context-param> ②----新建文件:log4j.properties---------- log4j.rootLogger=warn,stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.conversionPattern=[%5p] %d{mm:ss}/(%F:%M:%L)%n%m%n%n

log4j.logger.com.ibatis=debug log4j.logger.com.ibatis.common.jdbc.SimpleDataSource=debug log4j.logger.com.ibatis.common.jdbc.ScriptRunner=debug log4j.logger.com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate=debug log4j.logger.java.sql.Connection=debug log4j.logger.java.sql.Statement=debug log4j.logger.java.sql.PreparedStatement=debug,stdout ------------------------------------------ 实际上只要将log4j.properties放在WEB-INF/classes目录下,并 且将log4j-1.2.8.jar放在lib目录下即可实现在控制台日志输出??

===========================================================

不允许刷新: org.apache.struts.util.TokenProcessor String tokenDisRefresh=TokenProcessor.getInstance().generateToken(request); session.setAttribute("tokenDisRefresh",tokenDisRefresh); 得到唯一标示 <input type="hidden" name="tokenDisRefresh" value="<%=tokenDisRefresh%>"> 隐藏提交 --------------     private void disRefresh(HttpServletRequest request) throws Exception {         String tokenSession = (String) request.getSession().getAttribute("tokenDisRefresh");         String tokenDisRefresh = request.getParameter("tokenDisRefresh");         if(tokenSession==null || !tokenDisRefresh.equals(tokenSession)){             throw new Exception("不允许刷新!");         }else{             request.getSession().removeAttribute("tokenDisRefresh");         }     } --------------函数判断             }catch(RefreshException e){                 ActionError actionError = new ActionError("errors.generally.failed",e.toString());                 actionErrors.add("addNewReOutputAppFeiled", actionError);                 saveErrors(request, actionErrors);                 request.getSession().setAttribute("msg", "不允许刷新或用浏览器退回!");                 target = "disRefresh";                        } ===========================================================

 lastUrl = request.getHeader("Referer").replaceAll("http://"+request.getHeader("Host")+request.getContextPath(), ""); ===========================================================

  javascript异常:     try     {         colors[2] = "red";     }     catch(e)     {         alert("An exception occured in the script.Error name: " + e.name             + ".Error message: " + e.message);     } -----     JavaScript中共有六种基本的异常类型:

    * EvalError   : 在错误的调用eval()函数时引发;     * RangeError  : 在一个数字型变量的值超出了其范围时引发;     * ReferenceError : 在使用一个无效的引用时引发;     * SyntaxError : 在解析JavaScript代码时其中的语法错误引发;     * TypeError   : 遇到一个意外的类型时引发;     * URIError    :  错误地使用encodeURI()或decodeURI()函数时引发。

===========================================================

  2007-11-22 在struts里,当通过action forward转向一个JSP页面时,该JSP页面里引 用别的资源如:js,css等将会找不到,如:href="../../css/general.css"; 必须通过<%=request.getContextPath()%>相对于整个应用才可以,如:href="<%=request.getContextPath()%>/css/general.css"。 ===========================================================

  select 不可以编辑:disabled="disabled" ===========================================================

2007-11-12 提交表单时在下个页面找不到参数 document.myForm.action="<%=request.getContextPath()%>/storehouse/ReOutputApplyAction.do?flag=doInsert"; String flag = request.getParameter("flag"); 原因:action时没有指明方法:post  ===========================================================

document.formForOutputApp.applyPeop.readOnly=false; document.formForOutputApp.applyPeop.readOnly=true;注意大小写有时候会影响

===========================================================

String sysDate=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); //获得系统当前时间 ===========================================================

Oracle时间操作 to_date(#registerDate#,'yyyy-MM-dd HH24:mi:ss') to_date(#appInDate#,'yyyy-mm-dd') ===========================================================

在jsp中的java异常并不抛出被捕捉,而是直接从出现异常的地方以下开始不显示。 JSP编译为servlet,servlet不是执行完之后才发送到客户端?还是执行多少发送多少? 还是把执行结果缓存,缓存满则发送到客户端? ===========================================================

  2007-9-27: native2ascii命令 编码转换 -reverse -encoding encoding_name -Joption ===========================================================

  %TOMCAT_HOME%/conf/Catalina/localhost/host-manager.xml

---- <!--

    Context configuration file for the Tomcat Host Manager Web App

    $Id: host-manager.xml 303743 2005-03-11 22:39:26Z remm $

-->

<Context docBase="${catalina.home}/server/webapps/host-manager"          privileged="true" antiResourceLocking="false" antiJARLocking="false">

</Context>

-----------------------------------------------------------------------------------------------

<!--

    Context configuration file for the Tomcat Administration Web App

    $Id: admin.xml,v 1.3 2002/07/23 12:12:15 remm Exp $         speicfication  URIEncoding="UTF-8"  or  useBodyEncodingForURI="true" at Connector 8080 and 8009

-->

<Context path="/tws" docBase="C:/donguan/myItm/itm"         debug="0" privileged="true" reloadable="true">

  <!-- Uncomment this Valve to limit access to the Admin app to localhost    for obvious security reasons. Allow may be a comma-separated list of    hosts (or even regular expressions).   <Valve className=" org.apache.catalina.valves.RemoteAddrValve"     allow="127.0.0.1"/>   -->

  <Logger className="org.apache.catalina.logger.FileLogger"           directory="C:/donguan/myItm/logs"  prefix="localhost_itm_log_" suffix=".txt"           timestamp="true"/>   <Valve className="org.apache.catalina.valves.AccessLogValve"   directory="C:/donguan/myItm/logs"  prefix="localhost_itm_access_log." suffix=".txt"   pattern="common" resolveHosts="false"/>

</Context>

===========================================================

一、根据进程查端口号 tasklist netstat -ano 二、根据端口号查进程 tasklist /fi "PID eq 4" 三、查出进程对应的程序 --------- 关闭某进程:taskkill /pid 2400 参数:/f 强制关闭 ===========================================================

Java中的float和double问题: 1305.00,87.72,667705.00,10789.56,=679887.30(679887.28) -----------------------------------会失去精度:--------------------------------- float myFloat=0; myFloat+=Float.parseFloat(str); -----------------------------------以下则不会----------------------------------- Double myDouble=0; myDouble+=Double.parseDouble(str); ----------------------------------- 换为:也不会. Double myDouble=0; myDouble+=Float.parseFloat(str); ----------------------------------- float和double: Java中的浮点数分析: http://dev.csdn.net/author/feng_sundy/e0b115e74526494ba559445f76b379b5.html ===========================================================

java.util.regex.Pattern

===========================================================

 public static String getToday() {      SimpleDateFormat format=new SimpleDateFormat("MM/dd/yyyy");      Date date=new Date();      return format.format(date);      } ===========================================================

java.util.Properties java.sql.DriverManager.getConnection  ===========================================================

浏览器地址栏出现小图标 <link rel="icon" href="/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> ===========================================================

%TOMCAT_HOME%/conf/Catalina/localhost/*.xml ===========================================================

<td></td>中数据撑大格式 style='table-layout:fixed;' 固定大小 <div style="height:40;width:90;overflow:hidden"></div> 固定大小 ===========================================================

类:java.beans.SimpleBeanInfo   : java.beans.PropertyDescriptor package com.dongguan.inventory.bean; public class StockInTranVariableBeanInfo extends SimpleBeanInfo ===========================================================

set transaction isolation level serializable    set transaction isolation level read committed

数据库操作中的事务:

try{    con.setAutoCommit(false);    for(i=0;i<size();i++){       int res=存储过程(i);       if(res != -1){          con.rollback();          return 某个标记;          }       }    con.commit();    return 某个标记;    }catch(Exception ex){       ex.printStackTrace();       con.rollback();       return 某个标记;       }finally{          con.setAutoCommit(true);          closeConnection();          } }

===========================================================

document.getElementById("totalAmount").innerText=totalAmount.innerHTML <span id="totalAmount">this span's value</span>

===========================================================

JSON里 ①for循环用i+=1,与i++有区别? ②/x00-/x1f代表什么东西? ③Cntrl -- ASCII控制字符[/x00-/x1F] ===========================================================

存储过程里效率问题: and (@FromSupPono='' or SA.SupPono>=@FromSupPono) 快、高 and (SA.SupPono>=@FromSupPono or @FromSupPono='') 慢、低 ===========================================================

存储过程里按时间搜索容易出问题:   and (convert(nvarchar(10),hA.iDate,112)< =@ToDate or @ToDate='') ===========================================================

js/formchecking.jsp: var ed = Date.parseDate(d,"<%=user.getnUser_DateStyle()%>"); ed = ed.print("%m/%d/%Y");

===========================================================

<div>的显示隐藏问题 document.getElementById("deliverySchedule").style.display = "block";      显示         .style.display = "none";       隐藏,不占空间

document.getElementById("purchaseInfoTitle").style.visibility ="visible"; 显示          .style.visibility ="hidden";  隐藏,占空间

div不能在table的里面!!

===========================================================

IE中热键:AccessKey属性。IE4.0以上 ===========================================================

<script type="text/javascript"> function reSizeiframey(){  document.getElementById("celement").style.height = parseInt(document.body.clientHeight ) -50 + "px"; } window.onresize = function(){  reSizeiframey(); } window.onload=reSizeiframey; </script>

<div id="celement">

</div> 在测试页面可以,但在itm/accountlink/info_Customer.jsp则不可以???? 问题所在: <style type="text/css"> <!-- #celement{  overflow:auto; }

--> </style> 备注:此<div>标签可以和<form>标签交叉,但不能与<table>标签交叉。 ***************************** 或者用frameset达到同样的效果: <frameset rows="60,*" frameborder="Yes" framespacing="0" border="1">  <frame name="menu" src="infoheader.jsp" marginwidth="0" marginheight="0" scrolling="No" FRAMEBORDER="No" noresize framespacing="0">  <frame name="acode" src=" info.jsp" marginwidth="0" marginheight="0" scrolling="Auto" frameborder="No" noresize framespacing="0"> </frameset> ***************************** 或者用tHead,表头: -- div.tableContainer {  clear: both;  border: 1px solid #963;  height: 285px;  overflow: auto;  width: 100%; } thead.fixedHeader{   position: relative;   top: expression(document.getElementById ("tableContainer").scrollTop)  } -- <div id="tableContainer" class="tableContainer"> <table>  <thead class="fixedHeader">  </thead> </table> </div> *****************************

===========================================================

servlet ①timer.scheduleAtFixedRate(schedulerTask.timerTask, 180000,600000); ②timer.schedule( schedulerTask.timerTask,time,600000); 似乎时钟不准确,刚开始①按照10分钟执行,但执行4次之后则时间乱了:三分钟、两分钟、一分钟...

===========================================================

JDK API:java.lang.reflect.Method以及java.lang.reflect.下相关的东西 ===========================================================

将字符串转到在JavaScript中处理,特殊字符的转意 accountcode["<%= StringUtil.escapeSymbolsForJavaScript((String) t.get("CodeNo")) %>"] = "<%= StringUtil.escapeSymbolsForJavaScript((String) t.get("Description")) %>"; ********************************** 在HTML里才用:StringUtil.escapeHTMLEntities StringUtil.escapeSymbolsForJavaScript StringUtil.escapeHTMLEntities(StringUtil.escapeSymbolsForJavaScript /com/dongguan/util/StringUtil.java

NumericUtil.trimTrailingZero

StringUtil.getNonNullString

NumericUtil.setScale 设置小数位 roundoffDisplay(js:formchecking.jsp) roundoff       (js:formchecking.jsp) ===========================================================

数据库XML解析(SQL Server2000)等等:(参见存储过程:n_AccountGLD_update) sp_xml_preparedocument sp_xml_removedocument *********** ①声明一游标:declare @xmldoc int ②解析:exec sp_xml_preparedocument @xmldoc output,'xml文本(ntext)' ③插入到一临时表中:select identity(int,1,1) as keyNo,       LinkSource,              ...    into #tmp    from openxml(@xmldoc,'/linkInfo/link',1)    with(         LinkSource nvarchar(50) '@LinkSources'         ...        )   注意:LinkSource为在临时表中的字段名,必须与with里的对应。with里:字段名 类型 在xml中的节点名 ④删除文档句柄指定的 XML 文档的内部表示形式并使该文档句柄无效:exec sp_xml_removedocument @xmldoc ⑤ ⑥ ⑦ ⑧ ⑨ ⑩

例子中的XML:'<linkInfo><link OrderNos="P070026" DepositAmounts="10" LinkSources="PO" /><link OrderNos="GBS/07/0058K01" DepositAmounts="10" LinkSources="PO" /></linkInfo>' ===========================================================

游标使用 declare CursorName cursor for(select * from where) open CursorName fetch next from CursorName into @f1,@f2,@f3 *** close CursorName deallocate CursorName ===========================================================

而是一个用来跟踪内核开发的工具,叫做git──一个版本控制系统。(对git感兴趣的读者可以观看http://www.youtube.com/watch?v=4XpnKHJAok8) 个时空数据处理 http://pjf.blogone.net http://pjf.blogcn.com/index.shtml ===========================================================

===========================================================

===========================================================

===========================================================

===========================================================