<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dan&#039;s Workspace</title>
	<atom:link href="http://www.shanhh.com/index.php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.shanhh.com</link>
	<description>未来的家庭, 除了一扇窗户, 还有一只企鹅</description>
	<lastBuildDate>Sat, 31 Dec 2011 06:02:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>基于黑莓平台的MD5密码生成器</title>
		<link>http://www.shanhh.com/index.php/archives/298</link>
		<comments>http://www.shanhh.com/index.php/archives/298#comments</comments>
		<pubDate>Sat, 31 Dec 2011 06:02:22 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[blackberry]]></category>

		<guid isPermaLink="false">http://www.shanhh.com/?p=298</guid>
		<description><![CDATA[前段时间大量密码泄漏的问题闹得挺严重的, 自己也发现我几乎所有网站的注册密码都是相同的. 非常不安全. 如果考虑每个网站使用不同的密码, 对自己来说也是一种负担. 于是就考虑是用md5对自己的密码进行加密. 自己提供一个私钥, 然后输入注册的网站. 之后程序在其中混入数字和符号. 计算md5, 取其中的某几位来生成密码. 这样我只要记住自己的私钥, 那么当我登录weibo的时候, 我的我就在WebSite中写weibo. 这样又好记, 又安全. 我只在自己的黑莓9780上6.0os上测试了, 按道理 96,97应该都能使用. &#169;2012 Dan&#039;s Workspace. All Rights Reserved..]]></description>
			<content:encoded><![CDATA[<p>前段时间大量密码泄漏的问题闹得挺严重的, 自己也发现我几乎所有网站的注册密码都是相同的. 非常不安全.<br />
如果考虑每个网站使用不同的密码, 对自己来说也是一种负担. 于是就考虑是用md5对自己的密码进行加密.<br />
自己提供一个私钥, 然后输入注册的网站. 之后程序在其中混入数字和符号. 计算md5, 取其中的某几位来生成密码.<br />
这样我只要记住自己的私钥, 那么当我登录weibo的时候, 我的我就在WebSite中写weibo. 这样又好记, 又安全.<br />
我只在自己的黑莓9780上6.0os上测试了, 按道理 96,97应该都能使用.<br />
<a href="http://www.shanhh.com/wp-content/uploads/2011/12/634609365861898750.jpg"><img src="http://www.shanhh.com/wp-content/uploads/2011/12/634609365861898750.jpg" alt="" title="MyMd5Tools" width="480" height="360" class="alignnone size-full wp-image-299" /></a><br />
<a href="http://www.shanhh.com/wp-content/plugins/download-monitor/download.php?id=7" title="Md5Tools for blackberry" ><b>点击下载: MyMd5Tools</b></a> - 已下载 25 次</p>
<p>&copy;2012 <a href="http://www.shanhh.com">Dan&#039;s Workspace</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.shanhh.com/index.php/archives/298/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>黑莓联通BIS使用Exchange和Google企业套件</title>
		<link>http://www.shanhh.com/index.php/archives/295</link>
		<comments>http://www.shanhh.com/index.php/archives/295#comments</comments>
		<pubDate>Thu, 27 Oct 2011 02:52:08 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[BlackBerry]]></category>
		<category><![CDATA[bis]]></category>
		<category><![CDATA[blackberry]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[黑莓]]></category>

		<guid isPermaLink="false">http://www.shanhh.com/index.php/2011/10/%e9%bb%91%e8%8e%93%e8%81%94%e9%80%9abis%e4%bd%bf%e7%94%a8exchange%e5%92%8cgoogle%e4%bc%81%e4%b8%9a%e5%a5%97%e4%bb%b6/</guid>
		<description><![CDATA[2011-10-15, 我在上海开通联通BIS, 想用来收发邮件. 自己之前有域名, 并且注册的Google企业邮箱. 公司用的Exchange 2010, 所有邮件重定向到我自己的邮箱, 这样只收我的私人邮箱就可以了. 问题是回邮件的时候只能用私人邮箱去回复公司邮件, 这点很不好. 但是本周一发现, 我的Google企业邮箱无法收发邮件了, 删掉再添加, 没问题, 但是马上手机就收到一封标题为”Action required. Update settings for xxxxx@xxxx.com”邮件说: Your xxxxx@xxxx.com email messages are not being delivered to your BlackBerry device. To receive your email messages, turn on the IMAP setting for All Mail in your xxxxx@xxxx.com account. After your turn on the [...]]]></description>
			<content:encoded><![CDATA[<p>2011-10-15, 我在上海开通联通BIS, 想用来收发邮件. 自己之前有域名, 并且注册的Google企业邮箱. 公司用的Exchange 2010, 所有邮件重定向到我自己的邮箱, 这样只收我的私人邮箱就可以了. 问题是回邮件的时候只能用私人邮箱去回复公司邮件, 这点很不好.</p>
<p>但是本周一发现, 我的Google企业邮箱无法收发邮件了, 删掉再添加, 没问题, 但是马上手机就收到一封标题为”Action required. Update settings for <a href="mailto:xxxxx@xxxx.com">xxxxx@xxxx.com</a>”邮件说:</p>
<blockquote><p>Your <a href="mailto:xxxxx@xxxx.com">xxxxx@xxxx.com</a> email messages are not being delivered to your BlackBerry device. To receive your email messages, turn on the IMAP setting for All Mail in your <a href="mailto:xxxxx@xxxx.com">xxxxx@xxxx.com</a> account.</p>
<p>After your turn on the IMAP setting for All Mail, you must validate your account on your BlackBerry device.</p>
</blockquote>
<p>但是无论我修改IMAP还是任何操作, validate 都是没有问题, 但是隔了几秒钟, 又会收到相同的邮件, 登陆 <a href="http://chinaunicom.blackberry.com">http://chinaunicom.blackberry.com</a> 看到的邮箱也是标红了, 无法收到邮件.</p>
<p><a href="http://www.shanhh.com/wp-content/uploads/2011/10/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.shanhh.com/wp-content/uploads/2011/10/image_thumb.png" width="205" height="55" /></a> </p>
<p>这个问题折腾了很久, 还以为和自己混刷有关, 尝试和刷不同版本的4.6和5.0都没有解决. 后来解决方案是让exchange不往google企业邮箱重定向, 而使用blackberry直接收exchange, 用yuchberry收gmail. 也算是一种解决方案, 不过心里还是非常不爽. </p>
<p>在blackberry中添加exchange邮箱直接输入用户名和密码通常就可以了, 也能收发自如, 但是在查看信息(Advanced Settings)的时候, 发现其实走的是imap, 这还Push个P啊. 不行, 继续折腾.</p>
<p><a href="http://www.shanhh.com/wp-content/uploads/2011/10/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.shanhh.com/wp-content/uploads/2011/10/image_thumb1.png" width="244" height="47" /></a> </p>
<p>无意中发现BlackBerry添加我以前的一个@gmail.com邮箱不会出现之前要求validate问题, 看来只有企业套件有影响, 但是好像联通bis也没提供修改pop3或者imap什么的方法, 这点很头疼. 这样解决, 添加邮箱的时候, 随便写个地址, 一定要是非标准的, 密码也随便写:</p>
<p><a href="http://www.shanhh.com/wp-content/uploads/2011/10/image2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.shanhh.com/wp-content/uploads/2011/10/image_thumb2.png" width="244" height="118" /></a> </p>
<p>然后经过漫长的等待…这点要提一下, 联通这个processing页面做的真挫, 一闪一闪的…然后就到了这个页面.</p>
<p><a href="http://www.shanhh.com/wp-content/uploads/2011/10/image3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.shanhh.com/wp-content/uploads/2011/10/image_thumb3.png" width="244" height="128" /></a> </p>
</p>
<p>点击provide additional settings, 就能自定义server了, 真折腾, 这种用户体验, 活该你用户少…</p>
<p><a href="http://www.shanhh.com/wp-content/uploads/2011/10/image4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.shanhh.com/wp-content/uploads/2011/10/image_thumb4.png" width="244" height="217" /></a> </p>
<p>这里就可以设置gmail企业邮箱了, Email server写 imap.gmail.com, User name写完整的邮箱名称</p>
<p><a href="http://www.shanhh.com/wp-content/uploads/2011/10/image5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.shanhh.com/wp-content/uploads/2011/10/image_thumb5.png" width="213" height="244" /></a> </p>
<p>之后就解决了, Exchange也是这里设置, </p>
<p><a href="http://www.shanhh.com/wp-content/uploads/2011/10/image6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.shanhh.com/wp-content/uploads/2011/10/image_thumb6.png" width="233" height="244" /></a> </p>
<p>之后, 两个邮箱都是正常使用了, 问题解决.</p>
<p>&copy;2012 <a href="http://www.shanhh.com">Dan&#039;s Workspace</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.shanhh.com/index.php/archives/295/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java循环遍历不定长数组链表</title>
		<link>http://www.shanhh.com/index.php/archives/266</link>
		<comments>http://www.shanhh.com/index.php/archives/266#comments</comments>
		<pubDate>Thu, 21 Apr 2011 02:59:04 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.shanhh.com/?p=266</guid>
		<description><![CDATA[功能描述 一个链表中保存多个不同长度的数组, 根据一个索引值, 能取到对应的元素所在的数组下标 测试方法: 测试结果 0,0,0 0,1,0 0,2,0 0,3,0 1,0,0 1,1,0 1,2,0 1,3,0 0,0,0 0,1,0 0,2,0 0,3,0 1,0,0 1,1,0 1,2,0 1,3,0 0,0,0 0,1,0 0,2,0 0,3,0 1,0,0 1,1,0 1,2,0 1,3,0 0,0,0 0,1,0 0,2,0 0,3,0 1,0,0 1,1,0 &#169;2012 Dan&#039;s Workspace. All Rights Reserved..]]></description>
			<content:encoded><![CDATA[<p>功能描述<br />
一个链表中保存多个不同长度的数组, 根据一个索引值, 能取到对应的元素所在的数组下标</p>
<pre class="brush: java; title: ; notranslate">
public static int[] calcIndexArr(final List&lt;String[]&gt; list, int index) {
    int listSize;
    if (list == null || (listSize = list.size()) == 0) {
        return new int[0];
    }

    int max = 1;
    for (int i = 0; i &lt; list.size(); i++) {
        max *= list.get(i).length;
    }
    while (index &gt;= max) {
        index -= max;
    }

    int[] indexArr = new int[list.size()];

    for (int i = 0; i &lt; listSize; i++) {
        int b = 1;
        for (int j = i + 1; j &lt; listSize; j++) {
            b *= list.get(j).length;
        }
        int a = index / b;
        indexArr[i] = a;
        index = index - a * b;
    }
    return indexArr;
}
</pre>
<p>测试方法:</p>
<pre class="brush: java; title: ; notranslate">
public void testCalcIndexArr() {
    List&lt;String[]&gt; list = new ArrayList&lt;String[]&gt;();
    list.add(new String[2]);
    list.add(new String[4]);
    list.add(new String[1]);
    for (int i = 0; i &lt; 30; i++) {
        int arr[] = RandName.calcIndexArr(list, i);
        assertEquals(3, arr.length);
        System.out.println(arr[0] + &quot;,&quot; + arr[1] + &quot;,&quot; + arr[2]);
    }
}
</pre>
<p>测试结果</p>
<blockquote><p>
0,0,0<br />
0,1,0<br />
0,2,0<br />
0,3,0<br />
1,0,0<br />
1,1,0<br />
1,2,0<br />
1,3,0<br />
0,0,0<br />
0,1,0<br />
0,2,0<br />
0,3,0<br />
1,0,0<br />
1,1,0<br />
1,2,0<br />
1,3,0<br />
0,0,0<br />
0,1,0<br />
0,2,0<br />
0,3,0<br />
1,0,0<br />
1,1,0<br />
1,2,0<br />
1,3,0<br />
0,0,0<br />
0,1,0<br />
0,2,0<br />
0,3,0<br />
1,0,0<br />
1,1,0
</p></blockquote>
<p>&copy;2012 <a href="http://www.shanhh.com">Dan&#039;s Workspace</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.shanhh.com/index.php/archives/266/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PPLive祝大家新年快乐! 3x加油</title>
		<link>http://www.shanhh.com/index.php/archives/255</link>
		<comments>http://www.shanhh.com/index.php/archives/255#comments</comments>
		<pubDate>Sat, 05 Feb 2011 03:47:40 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PPLive]]></category>

		<guid isPermaLink="false">http://www.shanhh.com/?p=255</guid>
		<description><![CDATA[&#169;2012 Dan&#039;s Workspace. All Rights Reserved..]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://www.shanhh.com/wp-content/uploads/2011/02/PPLIVE11.jpg"><img class="size-full wp-image-257 aligncenter" title="PPLIVE~1" src="http://www.shanhh.com/wp-content/uploads/2011/02/PPLIVE11.jpg" alt="" width="640" height="427" /></a></p>
<p>&copy;2012 <a href="http://www.shanhh.com">Dan&#039;s Workspace</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.shanhh.com/index.php/archives/255/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>解决Jsp插入Mysql，设置UTF8依然乱码问题</title>
		<link>http://www.shanhh.com/index.php/archives/223</link>
		<comments>http://www.shanhh.com/index.php/archives/223#comments</comments>
		<pubDate>Wed, 19 Jan 2011 06:10:21 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Profiles]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[profile]]></category>

		<guid isPermaLink="false">http://www.shanhh.com/?p=223</guid>
		<description><![CDATA[问题描述： JSP网页里是charset=UTF-8：  &#60;%@ page contentType= &#8220;text/html; charset=UTF-8 &#8221; language= &#8220;java &#8221; import= &#8220;java.sql.* &#8221; errorPage= &#8220;error.jsp &#8221; %&#62;  Mysql5里存取的数据库的charset也设成了UTF-8，可是通过JSP网页存取中文还是显示乱码  解决方案：加个过滤类  然后在web.xml文件中配置一下就可以了  &#169;2012 Dan&#039;s Workspace. All Rights Reserved..]]></description>
			<content:encoded><![CDATA[<p>问题描述：<br />
JSP网页里是charset=UTF-8： </p>
<p>&lt;%@ page contentType= &#8220;text/html; charset=UTF-8 &#8221; language= &#8220;java &#8221; import= &#8220;java.sql.* &#8221; errorPage= &#8220;error.jsp &#8221; %&gt; </p>
<p>Mysql5里存取的数据库的charset也设成了UTF-8，可是通过JSP网页存取中文还是显示乱码 </p>
<p>解决方案：加个过滤类 </p>
<pre class="brush: java; title: ; notranslate">package com.bx.util; 

import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; 

public class SetEncodingFilter implements Filter { 

    // ----------------------------------------------------- Instance  Variables 

    /**
     * The default character encoding to set for requests that pass through this
     * filter.
     */
    protected String encoding = null; 

    /**
     * The filter configuration object we are associated with. If this value is
     * null, this filter instance is not currently configured.
     */
    protected FilterConfig filterConfig = null; 

    /**
     * Should a character encoding specified by the client be ignored?
     */
    protected boolean ignore = true; 

    // --------------------------------------------------------- Public Methods 

    /**
     * Take this filter out of service.
     */
    public void destroy() {
        this.encoding = null;
        this.filterConfig = null;
    } 

    /**
     * Select and set (if specified) the character encoding to be used to
     * interpret request parameters for this request.
     *
     * @param request
     * The servlet request we are processing
     * @param result
     * The servlet response we are creating
     * @param chain
     * The filter chain we are processing
     *
     * @exception IOException
     * if an input/output error occurs
     * @exception ServletException
     * if a servlet error occurs
     */
    public void doFilter(ServletRequest request, ServletResponse response,
            FilterChain chain) throws IOException, ServletException {
        // Conditionally select and set the character encoding to be used
        if (ignore || (request.getCharacterEncoding() == null)) {
            String encoding = selectEncoding(request);
            if (encoding != null) {
                request.setCharacterEncoding(encoding);
            }
        } 

        // Pass control on to the next filter
        chain.doFilter(request, response);
    } 

    /**
     * Place this filter into service.
     *
     * @param filterConfig
     * The filter configuration object
     */
    public void init(FilterConfig filterConfig) throws ServletException { 

        this.filterConfig = filterConfig;
        this.encoding = filterConfig.getInitParameter(&quot;encoding&quot;);
        String value = filterConfig.getInitParameter(&quot;ignore&quot;);
        if (value == null) {
            this.ignore = true;
        } else if (value.equalsIgnoreCase(&quot;true&quot;)) {
            this.ignore = true;
        } else if (value.equalsIgnoreCase(&quot;yes&quot;)) {
           this.ignore = true;
        } else {
           this.ignore = false;
        }
    } 

    // ------------------------------------------------------ Protected Methods 

    /**
     * Select an appropriate character encoding to be used, based on the
     * characteristics of the current request and/or filter initialization
     * parameters. If no character encoding should be set, return
     * &lt;code&gt;null&lt;/code&gt;.
     * &lt;p&gt;
     * The default implementation unconditionally returns the value configured
     * by the &lt;strong&gt;encoding&lt;/strong&gt; initialization parameter for this
     * filter.
     *
     * @param request
     * The servlet request we are processing
     */
    protected String selectEncoding(ServletRequest request) {
        return (this.encoding);
    }
}</pre>
<p>然后在web.xml文件中配置一下就可以了 </p>
<pre class="brush: xml; title: ; notranslate">&lt;filter&gt;
    &lt;filter-name&gt;Set Character Encoding&lt;/filter-name&gt;
    &lt;filter-class&gt;com.bx.util.SetEncodingFilter类的路径&lt;/filter-class&gt;
    &lt;init-param&gt;
        &lt;param-name&gt;encoding&lt;/param-name&gt;
        &lt;param-value&gt;UTF-8&lt;/param-value&gt;
    &lt;/init-param&gt;
&lt;/filter&gt;
&lt;filter-mapping&gt;
    &lt;filter-name&gt;Set Character Encoding&lt;/filter-name&gt;
    &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
&lt;/filter-mapping&gt;</pre>
<p>&copy;2012 <a href="http://www.shanhh.com">Dan&#039;s Workspace</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.shanhh.com/index.php/archives/223/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>解决/bin/bash^M: bad interpreter错误</title>
		<link>http://www.shanhh.com/index.php/archives/209</link>
		<comments>http://www.shanhh.com/index.php/archives/209#comments</comments>
		<pubDate>Mon, 13 Dec 2010 11:40:30 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Profiles]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[profile]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.shanhh.com/?p=209</guid>
		<description><![CDATA[可能是你的脚本文件是DOS格式的, 即每一行的行尾以\r\n来标识, 其ASCII码分别是0x0D, 0x0A. 而Unix只有\n. 可以有很多种办法看这个文件是DOS格式的还是UNIX格式的, 还是MAC格式的. 比如 然后用命令 :set ff? 可以看到dos或unix的字样. 如果确实是dos的换行方式, 出现这个问题的原因, 通常是该文本文件由windows通过ftp上传, 或者直接从windows下copy的一段代码, 导致了换行方式不同. 只要把文件中的\r换行符删除就好了. 可以在上传的时候选择ascii text模式 或者手动转换 方法1: 方法2: Vim中执行 :%s/^M//g   (^M中的^不是Shift+6, 而是先按Ctr-V 再按 Ctrl-M) &#169;2012 Dan&#039;s Workspace. All Rights Reserved..]]></description>
			<content:encoded><![CDATA[<p>可能是你的脚本文件是DOS格式的, 即每一行的行尾以\r\n来标识, 其ASCII码分别是0x0D, 0x0A. 而Unix只有\n.<br />
可以有很多种办法看这个文件是DOS格式的还是UNIX格式的, 还是MAC格式的. 比如</p>
<pre class="brush: bash; title: ; notranslate">
vi filename
</pre>
<p>然后用命令<br />
:set ff?<br />
可以看到dos或unix的字样.</p>
<p>如果确实是dos的换行方式, 出现这个问题的原因, 通常是该文本文件由windows通过ftp上传, 或者直接从windows下copy的一段代码, 导致了换行方式不同. 只要把文件中的\r换行符删除就好了.</p>
<p>可以在上传的时候选择ascii text模式</p>
<p>或者手动转换</p>
<p>方法1:</p>
<pre class="brush: bash; title: ; notranslate">

sed -i &quot;s/\r//&quot;&lt;filename&gt;
</pre>
<p>方法2:</p>
<p>Vim中执行 :%s/^M//g   (^M中的^不是Shift+6, 而是先按Ctr-V 再按 Ctrl-M)</p>
<p>&copy;2012 <a href="http://www.shanhh.com">Dan&#039;s Workspace</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.shanhh.com/index.php/archives/209/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>测试PreparedStatement的批处理效率</title>
		<link>http://www.shanhh.com/index.php/archives/179</link>
		<comments>http://www.shanhh.com/index.php/archives/179#comments</comments>
		<pubDate>Thu, 09 Dec 2010 10:05:25 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.shanhh.com/?p=179</guid>
		<description><![CDATA[今天研究了一下Java中PreparedStatement的批处理能力. 测试环境如下: jdk1.6.0_21 +Mysql 5.1 Core 2 Duo T5470 (1.60GHz) + 3G内存 测试的是实现最简单的插入: INSERT INTO `testdb` (`id`, `value`) VALUES (123456, &#8216;http://www.pptv.com&#8217;) 共插入20万条数据, 每个测试前都把数据库清空, 然后执行插入, 从开始插入进行计时.每项测试跑3次取平均值. 分为两项测试: 1个是不使用批处理, 逐条插入; 一个是使用addBatch(), 分别按50, 100, 500, 1000, 5000, 10000, 50000, 100000的划分方式进行批量插入. 关键代码如下: 逐行插入: 批处理操作 记录的log如下: 11:59:25,703 DBTestMulti test  *** 以100000为一次批量操作, 执行批处理语句  *** 11:59:25,703 BaseDBTest cleanDB 初始化数据库 11:59:58,984 DBTestMulti test [...]]]></description>
			<content:encoded><![CDATA[<p>今天研究了一下Java中PreparedStatement的批处理能力.</p>
<p>测试环境如下:</p>
<p>jdk1.6.0_21 +Mysql 5.1</p>
<p>Core 2 Duo T5470 (1.60GHz) + 3G内存</p>
<p>测试的是实现最简单的插入:</p>
<p>INSERT INTO `testdb` (`id`, `value`) VALUES (123456, &#8216;http://www.pptv.com&#8217;)</p>
<p>共插入20万条数据, 每个测试前都把数据库清空, 然后执行插入, 从开始插入进行计时.每项测试跑3次取平均值.</p>
<p>分为两项测试: 1个是不使用批处理, 逐条插入; 一个是使用addBatch(), 分别按50, 100, 500, 1000, 5000, 10000, 50000, 100000的划分方式进行批量插入. 关键代码如下:</p>
<p>逐行插入:</p>
<pre class="brush: java; title: ; notranslate">
for (int times = 0; times &amp;lt; TEST_TIMES; times++) {
    cleanDB();
    conn = DBMgr.getDBconn(&amp;quot;testdb&amp;quot;);
    long starttime = System.currentTimeMillis();
    for (int i = 0; i &amp;lt; MAX_COUNT; i++) {
        pstmt = conn.prepareStatement(SQL);
        pstmt.executeUpdate();
        pstmt.close();
        System.out.println(&amp;quot;working: &amp;quot; + i + &amp;quot;/&amp;quot; + MAX_COUNT);
    }
    long endtime = System.currentTimeMillis();
    LOG.info(&amp;quot;第&amp;quot; + (times + 1) + &amp;quot;次测试, 耗时&amp;quot; + (endtime - starttime) + &amp;quot;ms&amp;quot;);
    alltime += endtime - starttime;
}
LOG.info(&amp;quot;平均耗时: &amp;quot; + (alltime / TEST_TIMES) + &amp;quot;ms&amp;quot;);
</pre>
<p>批处理操作</p>
<pre class="brush: java; title: ; notranslate">
for (int times = 0; times &amp;lt; TEST_TIMES; times++) {
    cleanDB();
    conn = DBMgr.getDBconn(&amp;quot;testdb&amp;quot;);
    conn.setAutoCommit(false);
    int num = 0;
    long starttime = System.currentTimeMillis();
    pstmt = conn.prepareStatement(SQL);
    for (int i = 0; i &amp;lt; MAX_COUNT; i++) {
        pstmt.addBatch();
        num++;
        if (num % count == 0 || num == MAX_COUNT) {
            pstmt.executeBatch();
            pstmt.clearBatch();
            pstmt.close();
            pstmt = conn.prepareStatement(SQL);
        }
        System.out.println(&amp;quot;working: &amp;quot; + i + &amp;quot;/&amp;quot; + MAX_COUNT);
    }
    long endtime = System.currentTimeMillis();
    LOG.info(&amp;quot;第&amp;quot; + (times + 1) + &amp;quot;次测试, 耗时&amp;quot; + (endtime - starttime) + &amp;quot;ms&amp;quot;);
    alltime += endtime - starttime;
}
LOG.info(&amp;quot;平均耗时: &amp;quot; + (alltime / TEST_TIMES) + &amp;quot;ms&amp;quot;);
</pre>
<p>记录的log如下:</p>
<blockquote><p>11:59:25,703 DBTestMulti test  *** 以100000为一次批量操作, 执行批处理语句  ***<br />
11:59:25,703 BaseDBTest cleanDB 初始化数据库<br />
11:59:58,984 DBTestMulti test 第1次测试, 耗时33000ms<br />
11:59:58,984 BaseDBTest cleanDB 初始化数据库<br />
12:01:21,687 DBTestMulti test 第2次测试, 耗时32594ms<br />
12:01:21,687 BaseDBTest cleanDB 初始化数据库<br />
12:02:44,640 DBTestMulti test 第3次测试, 耗时32562ms<br />
12:02:44,640 DBTestMulti test 平均耗时: 32718ms<br />
12:02:47,093 DBTestMulti test  *** 以50000为一次批量操作, 执行批处理语句  ***<br />
12:02:47,093 BaseDBTest cleanDB 初始化数据库<br />
12:03:19,734 DBTestMulti test 第1次测试, 耗时32625ms<br />
12:03:19,734 BaseDBTest cleanDB 初始化数据库<br />
12:04:43,406 DBTestMulti test 第2次测试, 耗时33328ms<br />
12:04:43,406 BaseDBTest cleanDB 初始化数据库<br />
12:06:06,687 DBTestMulti test 第3次测试, 耗时32609ms<br />
12:06:06,687 DBTestMulti test 平均耗时: 32854ms<br />
12:06:09,125 DBTestMulti test  *** 以10000为一次批量操作, 执行批处理语句  ***<br />
12:06:09,125 BaseDBTest cleanDB 初始化数据库<br />
12:06:40,921 DBTestMulti test 第1次测试, 耗时31781ms<br />
12:06:40,921 BaseDBTest cleanDB 初始化数据库<br />
12:08:03,125 DBTestMulti test 第2次测试, 耗时32032ms<br />
12:08:03,125 BaseDBTest cleanDB 初始化数据库<br />
12:09:26,859 DBTestMulti test 第3次测试, 耗时32781ms<br />
12:09:26,859 DBTestMulti test 平均耗时: 32198ms<br />
12:09:29,296 DBTestMulti test  *** 以5000为一次批量操作, 执行批处理语句  ***<br />
12:09:29,296 BaseDBTest cleanDB 初始化数据库<br />
12:10:00,406 DBTestMulti test 第1次测试, 耗时31094ms<br />
12:10:00,406 BaseDBTest cleanDB 初始化数据库<br />
12:11:23,031 DBTestMulti test 第2次测试, 耗时31953ms<br />
12:11:23,031 BaseDBTest cleanDB 初始化数据库<br />
12:12:46,265 DBTestMulti test 第3次测试, 耗时32187ms<br />
12:12:46,265 DBTestMulti test 平均耗时: 31744ms<br />
12:12:48,718 DBTestMulti test  *** 以1000为一次批量操作, 执行批处理语句  ***<br />
12:12:48,718 BaseDBTest cleanDB 初始化数据库<br />
12:13:20,468 DBTestMulti test 第1次测试, 耗时31750ms<br />
12:13:20,468 BaseDBTest cleanDB 初始化数据库<br />
12:14:43,703 DBTestMulti test 第2次测试, 耗时32625ms<br />
12:14:43,703 BaseDBTest cleanDB 初始化数据库<br />
12:16:06,203 DBTestMulti test 第3次测试, 耗时32125ms<br />
12:16:06,203 DBTestMulti test 平均耗时: 32166ms<br />
12:16:08,656 DBTestMulti test  *** 以500为一次批量操作, 执行批处理语句  ***<br />
12:16:08,656 BaseDBTest cleanDB 初始化数据库<br />
12:16:40,906 DBTestMulti test 第1次测试, 耗时32235ms<br />
12:16:40,906 BaseDBTest cleanDB 初始化数据库<br />
12:18:03,625 DBTestMulti test 第2次测试, 耗时32547ms<br />
12:18:03,625 BaseDBTest cleanDB 初始化数据库<br />
12:19:27,343 DBTestMulti test 第3次测试, 耗时33265ms<br />
12:19:27,343 DBTestMulti test 平均耗时: 32682ms<br />
12:19:30,406 DBTestMulti test  *** 以100为一次批量操作, 执行批处理语句  ***<br />
12:19:30,406 BaseDBTest cleanDB 初始化数据库<br />
12:20:53,875 DBTestMulti test 第1次测试, 耗时32782ms<br />
12:20:53,875 BaseDBTest cleanDB 初始化数据库<br />
12:22:17,765 DBTestMulti test 第2次测试, 耗时33687ms<br />
12:22:17,765 BaseDBTest cleanDB 初始化数据库<br />
12:23:41,609 DBTestMulti test 第3次测试, 耗时33531ms<br />
12:23:41,609 DBTestMulti test 平均耗时: 33333ms<br />
12:23:44,421 DBTestMulti test  *** 以50为一次批量操作, 执行批处理语句  ***<br />
12:23:44,421 BaseDBTest cleanDB 初始化数据库<br />
12:25:07,578 DBTestMulti test 第1次测试, 耗时32500ms<br />
12:25:07,578 BaseDBTest cleanDB 初始化数据库<br />
12:26:31,796 DBTestMulti test 第2次测试, 耗时33718ms<br />
12:26:31,796 BaseDBTest cleanDB 初始化数据库<br />
12:27:55,640 DBTestMulti test 第3次测试, 耗时33562ms<br />
12:27:55,640 DBTestMulti test 平均耗时: 33260ms<br />
12:27:58,468 BaseDBTest cleanDB 初始化数据库<br />
14:08:25,484 DBTestSingle test 第1次测试, 耗时5976406ms<br />
14:08:25,484 BaseDBTest cleanDB 初始化数据库<br />
15:47:18,828 DBTestSingle test 第2次测试, 耗时5882735ms<br />
15:47:18,828 BaseDBTest cleanDB 初始化数据库</p></blockquote>
<p>其中批处理都是执行3次取平均值, 而逐行操作, 一次执行时间就要1个半小时, 所以只跑了两次. 日志筛选如下:</p>
<p>每次100000条, 分2次处理: 32718ms</p>
<p>每次50000条, 分4次处理: 32854ms</p>
<p>每次10000条, 分20次处理: 32198ms</p>
<p>每次5000条, 分40次处理: 31744ms</p>
<p>每次1000条, 分200次处理: 32166ms</p>
<p>每次500条, 分400次处理: 32682ms</p>
<p>每次100条, 分2000次处理: 33333ms</p>
<p>每次50条, 分4000次处理: 33260ms</p>
<p>而最后的两条是没有使用批处理跑出来的 用时近600000ms, 近1小时40分钟, 完全不是一个数量级的.</p>
<p>相比较而言, 批处理语句在量的划分上差别并不明显, 在千级的划分只有一点点的减少.</p>
<p>详细测试间测试代码(已上传).</p>
<pre><a href="http://www.shanhh.com/wp-content/plugins/download-monitor/download.php?id=6" title="测试PreparedStatement批处理效率" ><b>点击下载: db-batch-test</b></a> - 已下载 214 次</pre>
<p>&copy;2012 <a href="http://www.shanhh.com">Dan&#039;s Workspace</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.shanhh.com/index.php/archives/179/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决JDK1.6下SunJCE() is not accessible问题</title>
		<link>http://www.shanhh.com/index.php/archives/176</link>
		<comments>http://www.shanhh.com/index.php/archives/176#comments</comments>
		<pubDate>Thu, 09 Dec 2010 07:56:48 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[j2ee]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.shanhh.com/?p=176</guid>
		<description><![CDATA[一个老的项目从JDK1.5迁移到1.6时, Eclipse抛出一堆错误 主要是: Access restriction: The constructor SunJCE() is not accessible due to restriction on required library /pp/develop/install/jdk1.6.0_21/jre/lib/ext/sunjce_provider.jar 访问限制: 由于/pp/develop/install/jdk1.6.0_21/jre/lib/ext/sunjce_provider.jar库的限制, SunJCE() 构造函数不可访问. 在网上搜了一下, 解决办法是修改编译选项, 方法如下: Window -&#62;Preferences -&#62; Java -&#62; Compiler -&#62; Errors/Warnings -&#62; Deprecated and restricted API -&#62; Forbidden reference (access rules) -&#62; Warnings或者Ignore即可. &#169;2012 Dan&#039;s Workspace. All Rights Reserved..]]></description>
			<content:encoded><![CDATA[<p>一个老的项目从JDK1.5迁移到1.6时, Eclipse抛出一堆错误 主要是:</p>
<p>Access restriction: The constructor SunJCE() is not accessible due to restriction on required library /pp/develop/install/jdk1.6.0_21/jre/lib/ext/sunjce_provider.jar</p>
<p>访问限制: 由于/pp/develop/install/jdk1.6.0_21/jre/lib/ext/sunjce_provider.jar库的限制, SunJCE() 构造函数不可访问.</p>
<p>在网上搜了一下, 解决办法是修改编译选项, 方法如下: Window -&gt;Preferences -&gt; Java -&gt; Compiler -&gt; Errors/Warnings -&gt; Deprecated and restricted API -&gt; Forbidden reference (access rules) -&gt; Warnings或者Ignore即可.</p>
<p>&copy;2012 <a href="http://www.shanhh.com">Dan&#039;s Workspace</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.shanhh.com/index.php/archives/176/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>proxool 0.8.3使用java搭建MySql连接池的配置和测试</title>
		<link>http://www.shanhh.com/index.php/archives/166</link>
		<comments>http://www.shanhh.com/index.php/archives/166#comments</comments>
		<pubDate>Fri, 26 Nov 2010 01:51:17 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[proxool]]></category>

		<guid isPermaLink="false">http://www.shanhh.com/?p=166</guid>
		<description><![CDATA[在企业开发的时候, 很多情况都会使用数据库连接, 下面提出使用配置方案.   下载地址: http://proxool.sourceforge.net/   创建一个xml配置文件db.xml, 放在CLASSPATH路径:   如果有多个数据库, 则要使用多个proxool标签, 配置不同的alias.   然后配置web.xml, 里见加入:   创建一个DBMgr.java, 作为连接数据库的模板类   至于怎么用, 都应该知道了, 调用getDBconn时, 传入最上面db.xml中设定的alias值, 即可连接不同的数据库.   再来说测试, 使用单元测试的时候, 并不希望每次都启动网站来测试, 希望直接就能调用数据库的配置. 其实也很简单:   只要手动加载配置文件, 见setUp()方法.   这里注意一下, 单元测试需要手动的关闭连接池, 否则测试程序停止后会抛异常, 见tearDown()方法的最后一行:   连接池个别情况不能替代传统的jdbc连接, 比如需要建立长连接时, 这个时候, 可能就需要创建一个保持连接的Connection, 而不能使用proxool了, 因为会被自动Kill.  &#169;2012 Dan&#039;s Workspace. All Rights Reserved..]]></description>
			<content:encoded><![CDATA[<p>在企业开发的时候, 很多情况都会使用数据库连接, 下面提出使用配置方案.  </p>
<p>下载地址: <span style="font-size: x-small;"><a href="http://proxool.sourceforge.net/">http://proxool.sourceforge.net/</a></span>  </p>
<p><span style="font-size: x-small;">创建一个xml配置文件db.xml, 放在CLASSPATH路径:</span>  </p>
<pre class="brush: xml; title: ; notranslate">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;something-else-entirely&gt;
 &lt;proxool&gt;
  &lt;!-- 数据源的别名 --&gt;
  &lt;alias&gt;search&lt;/alias&gt;
  &lt;driver-url&gt;jdbc:mysql://localhost:3306/search
  &lt;/driver-url&gt;
  &lt;driver-class&gt;com.mysql.jdbc.Driver
  &lt;/driver-class&gt;
  &lt;!-- 连接池使用状况统计 --&gt;
  &lt;statistics&gt;1m,15m,1d&lt;/statistics&gt;
  &lt;driver-properties&gt;
   &lt;property name=&quot;user&quot; value=&quot;root&quot; /&gt;
   &lt;property name=&quot;password&quot; value=&quot;root&quot; /&gt;
   &lt;property name=&quot;characterEncoding&quot; value=&quot;UTF-8&quot; /&gt;
   &lt;property name=&quot;useUnicode&quot; value=&quot;true&quot; /&gt;
  &lt;/driver-properties&gt; 

  &lt;!-- proxool自动侦察各个连接状态的时间间隔(毫秒) 
    侦察到空闲的连接就马上回收,超时的销毁 默认30秒 --&gt;
  &lt;house-keeping-sleep-time&gt;90000&lt;/house-keeping-sleep-time&gt; 

  &lt;!-- 连接池中可用的连接数量.如果当前的连接池中的连接少于这个数值. 
    新的连接将被建立 (假设没有超过最大可用数).例如.我们有3个活动连接2个可用连接 
    而我们的prototype-count是4,那么数据库连接池将试图建立另外2个连接.这和 
    minimum-connection-count 不同. minimum-connection-count把活动的连接 
    也计算在内.prototype-count  是spare connections 的数量. --&gt;
  &lt;prototype-count&gt;5&lt;/prototype-count&gt; 

  &lt;!-- 最大连接数(默认5个),超过了这个连接数,再有请求时,就排在队列中等候, 最大的等待 
    请求数由maximum-new-connections决定 --&gt;
  &lt;maximum-connection-count&gt;100&lt;/maximum-connection-count&gt;
        &lt;simultaneous-build-throttle&gt;100&lt;/simultaneous-build-throttle&gt;
  &lt;!--最小连接数(默认2个) --&gt;
  &lt;minimum-connection-count&gt;2&lt;/minimum-connection-count&gt;
  &lt;!-- 如果housekeeper 检测到某个线程的活动时间大于这个数值.它将会杀掉这线程 
    所以确认一下你的服务器的带宽.然后定一个合适的值.默认是5分钟 --&gt;
  &lt;maximum-active-time&gt;300000&lt;/maximum-active-time&gt;
  &lt;house-keeping-test-sql&gt;select CURRENT_DATE&lt;/house-keeping-test-sql&gt;
 &lt;/proxool&gt;
&lt;/something-else-entirely&gt;
</pre>
<p>如果有多个数据库, 则要使用多个proxool标签, 配置不同的alias.  </p>
<p>然后配置web.xml, 里见加入:  </p>
<pre class="brush: xml; title: ; notranslate">
    &lt;servlet&gt; 
        &lt;description&gt;proxool配置servlet&lt;/description&gt;
        &lt;servlet-name&gt;ServletConfigurator&lt;/servlet-name&gt;
        &lt;servlet-class&gt;org.logicalcobwebs.proxool.configuration.ServletConfigurator&lt;/servlet-class&gt;
        &lt;init-param&gt;
            &lt;param-name&gt;xmlFile&lt;/param-name&gt; 
            &lt;!-- 这里是上面那个配置文件的路径 --&gt;
            &lt;param-value&gt;WEB-INF/classes/db.xml&lt;/param-value&gt;
        &lt;/init-param&gt;
        &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
    &lt;/servlet&gt;
    &lt;servlet&gt; 
        &lt;description&gt;proxool管理servlet&lt;/description&gt;
        &lt;servlet-name&gt;proxool&lt;/servlet-name&gt;
        &lt;servlet-class&gt;org.logicalcobwebs.proxool.admin.servlet.AdminServlet&lt;/servlet-class&gt;
    &lt;/servlet&gt;
    &lt;servlet-mapping&gt;
        &lt;servlet-name&gt;proxool&lt;/servlet-name&gt;
        &lt;url-pattern&gt;/admin&lt;/url-pattern&gt;
    &lt;/servlet-mapping&gt;
</pre>
<p>创建一个DBMgr.java, 作为连接数据库的模板类  </p>
<pre class="brush: java; title: ; notranslate">
package com.pptv.config;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException; 

import org.apache.log4j.Logger; 

/**
 * 数据库的基本连接类, 通过proxool连接池连接Mysql
 *
 * @author Dan Shan
 *
 */
public final class DBMgr {
    /**
     * Log4j.
     */
    private static final Logger LOG = Logger.getLogger(DBMgr.class);
    static {
        try {
            Class.forName(&quot;org.logicalcobwebs.proxool.ProxoolDriver&quot;);
        } catch (ClassNotFoundException e) {
            LOG.error(&quot;Load proxool failed: &quot; + e);
        }
    } 

    /**
     * 所有方法都为static, 不允许实例化.
     */
    private DBMgr() {
    } 

    public static Connection getDBconn(final String dbName)
            throws SQLException {
        Connection conn = null;
        try {
            conn = DriverManager.getConnection(&quot;proxool.&quot; + dbName);
        } catch (Exception e) {
            LOG.error(&quot;Read the database configuration files error: &quot; + e);
        }
        return conn;
    }
}
</pre>
<p>至于怎么用, 都应该知道了, 调用getDBconn时, 传入最上面db.xml中设定的alias值, 即可连接不同的数据库.  </p>
<p>再来说测试, 使用单元测试的时候, 并不希望每次都启动网站来测试, 希望直接就能调用数据库的配置. 其实也很简单:  </p>
<pre class="brush: java; title: ; notranslate">
package com.pptv.config; 
import java.sql.Connection;
import java.sql.SQLException; 

import junit.framework.TestCase; 

import org.junit.Test;
import org.logicalcobwebs.proxool.ProxoolException;
import org.logicalcobwebs.proxool.ProxoolFacade;
import org.logicalcobwebs.proxool.configuration.JAXPConfigurator; 

public class DBMgrTest
        extends TestCase { 

    private Connection conn; 

    @Override
    protected void setUp()
            throws Exception {
        super.setUp();
        String dbConfigFile = DBMgrTest.class.getResource(&quot;/db.xml&quot;).getPath();
        try {
            JAXPConfigurator.configure(dbConfigFile, false);
        } catch (ProxoolException e) {
            e.printStackTrace();
        }
    } 

    @Override
    protected void tearDown()
            throws Exception {
        super.tearDown();
        if (conn != null) {
            conn.close();
        }
        ProxoolFacade.shutdown(0);
    } 

    @Test
    public void testGetDBconn()
            throws SQLException {
        conn = DBMgr.getDBconn(&quot;search&quot;);
        assertNotNull(conn);
    }
}
</pre>
<p>只要手动加载配置文件, 见setUp()方法.  </p>
<p>这里注意一下, 单元测试需要手动的关闭连接池, 否则测试程序停止后会抛异常, 见tearDown()方法的最后一行:  </p>
<pre class="brush: java; title: ; notranslate">
ProxoolFacade.shutdown(0);
</pre>
<p>连接池个别情况不能替代传统的jdbc连接, 比如需要建立长连接时, 这个时候, 可能就需要创建一个保持连接的Connection, 而不能使用proxool了, 因为会被自动Kill. </p>
<a href="http://www.shanhh.com/wp-content/plugins/download-monitor/download.php?id=5" title="" ><b>点击下载: proxool-config</b></a> - 已下载 193 次
<p>&copy;2012 <a href="http://www.shanhh.com">Dan&#039;s Workspace</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.shanhh.com/index.php/archives/166/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决安装Vim中文包之后, Vim 菜单和提示乱码问题</title>
		<link>http://www.shanhh.com/index.php/archives/154</link>
		<comments>http://www.shanhh.com/index.php/archives/154#comments</comments>
		<pubDate>Thu, 25 Nov 2010 11:08:56 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Profiles]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.shanhh.com/?p=154</guid>
		<description><![CDATA[很多国内用户安装完Vim/GVim后, 为了更好的获得帮助, 从网上下载了中文的文档包:  http://vimcdoc.sourceforge.net/ 安装之后发现文档帮助文档确实变成中文了, 但是同时, Vim和GVim的菜单和提示都变成乱码. 解决方案如下: 最新版VIM中文帮助会默认安装一个全局插件vim/vimfiles/plugin/vimcdoc.vim 里面有个语言设置 set encoding=utf-8 因为windows 使用GBK字符集, 所以乱码了,注释这个选项就可以了. &#169;2012 Dan&#039;s Workspace. All Rights Reserved..]]></description>
			<content:encoded><![CDATA[<p>很多国内用户安装完Vim/GVim后, 为了更好的获得帮助, 从网上下载了中文的文档包:</p>
<p> <a href="http://vimcdoc.sourceforge.net/">http://vimcdoc.sourceforge.net/</a></p>
<p>安装之后发现文档帮助文档确实变成中文了, 但是同时, Vim和GVim的菜单和提示都变成乱码. 解决方案如下:</p>
<p>最新版VIM中文帮助会默认安装一个全局插件vim/vimfiles/plugin/vimcdoc.vim</p>
<p>里面有个语言设置</p>
<pre>set encoding=utf-8</pre>
<p>因为windows 使用GBK字符集, 所以乱码了,注释这个选项就可以了.</p>
<p>&copy;2012 <a href="http://www.shanhh.com">Dan&#039;s Workspace</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.shanhh.com/index.php/archives/154/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

