java与eclipse的工作小结

1、Eclipse 的启动画面

   A、加启动参数。如: eclipse.exe -showsplash C:/splash.bmp

        更多可参考:http://www.cnblogs.com/sharewind/archive/2007/03/11/671270.html

   B、修改默认图片。位于:plugins/org.eclipse.platform_3.3.2.R33x_v20071022(灰色为版本号)

2、Tomcat 的虚拟目录配置

  打开 %Tomcat%/conf/server.xml 文件,在 <Host> 和 </Host> 之间加入

<Context path="/myapp" docBase="D:/myapp" workDir="" debug="0" reloadable="true" crossContext="true" />  

3、struts 的 database.properties 配置

# Database properties file  
# Oracle  
# driver=oracle.jdbc.driver.OracleDriver  
# url=jdbc:oracle:thin:@localhost:1521/dbname  
# username=oracle  
# password=oracle  
# DB2  
# driver=com.ibm.db2.jcc.DB2Driver  
# url=jdbc:db2://localhost:50000/dbname  
# username=db2admin  
# password=db2  
# MySQL  
# driver=org.gjt.mm.mysql.Driver  
# url=jdbc:mysql://localhost:3306/dbname  
# username=root  
# password=mysql

  4、JSP 页面禁止缓存

response.setHeader("Pragma", "no-cache");  
response.setHeader("Cache-Control", "no-cache");  
response.setDateHeader("Expires", 0);  

5、Html 页面禁止缓存

1 <meta http-equiv="Pragma" content="no-cache" />  
2 <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />  
3 <meta http-equiv="Expires" content="0" />  

6、Java 中得到当前方法的名字

1 String sMethodName = Thread.currentThread().getStackTrace()[1].getMethodName();  

7、Java 中 .properties 文件中单引号的转义

默认情况下 .properties 文件中单引号(') 会被转义,要想避免被转义,再前面再加一个 /' 即可。于是就变成了 /'' 。

8、Weblogic 的缓存位置

/home/weblogic/bea/user_projects/domains/[工程名]/servers/AdminServer/tmp/_WL_user/  

9、Eclipse 删除 UDC (Usage Data Collector)

Eclipse 的 UDC 老定期蹦出来说要上传使用数据到 eclipse 官网服务器,直接干掉省的心烦。

// 删除 eclipse/plugins 目录下以 org.eclipse.epp.usagedata 开头的所有 jar 文件  
// 删除 eclipse/features 目录下以 org.eclipse.epp.usagedata 开头的所有文件夹  

10、HashMap 高效遍历

import java.util.*;  
import java.util.Map.*;  
  
Map<String, Integer> mapper = new HashMap<String, Integer>();  
  
Iterator<Entry<String, Integer>> iterator = mapper.entrySet().iterator();  
while (iterator.hasNext())  
{  
    Entry<String, Integer> entry = iterator.next();  
    System.out.println("	Word: " + entry.getKey() + "    --->    Count: " + entry.getValue());  
}

 11、ArrayList 不区分大小写的排序

1 List<String> alsDirectoryFiles = new ArrayList<String>();  
2 // ...  
3 if (alsDirectoryFiles != null && alsDirectoryFiles.size() > 0)  
4 {  
5     Comparator<String> sortComparator = String.CASE_INSENSITIVE_ORDER;  
6     Collections.sort(alsDirectoryFiles, sortComparator);  
7 }
原文地址:https://www.cnblogs.com/hjweifans/p/6890157.html