2009年10月24日星期六

在VMware6.5安装Ubuntu9.04 vmware-tools

VMware6.5自带的vmware-tools不好使
需要VMwareTools-7.9.6-173382.tar.gz
http://forum.ubuntu.org.cn/viewtopic.php?f=65&t=197597

2009年10月23日星期五

String split方法

       

String split方法 当在末尾含有空字符时尤其应注意

        String a = ",,";
        System.out.println(a.split(",").length);//0
        System.out.println(a.split(",",-1).length);//3
        a = ",,1";
        System.out.println(a.split(",").length);//3
        System.out.println(a.split(",",-1).length);//3
        a = "1,,";
        System.out.println(a.split(",").length);//1
        System.out.println(a.split(",",-1).length);//3

2009年10月19日星期一

jstl 循环 break 变通方式

如果直接使用<c:forEach> 直接在中间的代码中 插入break , 并不能退出循环。可以采用以下策略进行代换:
1. 用 <c:set var="collections" value="${forEach中的items}"/>
2. 用 jspContext.getAttribute("collections"); 获得对应的集合
3.最后就用最原始的for()。

但还是觉得不爽

2009年10月18日星期日

修改JetBrains idea缓存目录

修改idea.properties

将${user.home}换成自己想到的目录

# path to IDEA config folder. Make sure you're using forward slashes
idea.config.path=E:/Program Files/JetBrains/IdeaConfig/.IntelliJIdea90/config

# path to IDEA system folder. Make sure you're using forward slashes
idea.system.path=E:/Program Files/JetBrains/IdeaConfig/.IntelliJIdea90/system

# path to user installed plugins folder. Make sure you're using forward slashes
idea.plugins.path=E:/Program Files/JetBrains/IdeaConfig/.IntelliJIdea90/config/plugins

2009年10月14日星期三

java随机产生网页颜色

int randomNumber(){   
return (int)Math.floor(Math.random()*256);   
}
String decToHex(int dec)   
{   
String hexStr = "0123456789ABCDEF";   
int low = Math.abs(dec % 16);   
int high = Math.abs((dec - low)/16);   
String hex = "" + (hexStr.length()>high?hexStr.charAt(high):hexStr.charAt(0)) + (hexStr.length()>low?hexStr.charAt(low):hexStr.charAt(10));   
return hex;   
}
String randomBgColor()   
{   
String r,g,b;   
r = decToHex(randomNumber()-1);   
g = decToHex(randomNumber()-1);   
b = decToHex(randomNumber()-1);   
return "#" + r + g + b;   
}