<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[帐前卒专栏]]></title>
  <link href="http://chilly.github.com/atom.xml" rel="self"/>
  <link href="http://chilly.github.com/"/>
  <updated>2012-02-23T02:36:49+08:00</updated>
  <id>http://chilly.github.com/</id>
  <author>
    <name><![CDATA[chillycreator]]></name>
    
  </author>
  <generator uri="http://octopress.org/">Octopress</generator>

  
  <entry>
    <title type="html"><![CDATA[有道云笔记1.5正式版上线]]></title>
    <link href="http://chilly.github.com/blog/2012/02/23/you-dao-yun-bi-ji-1-dot-5zheng-shi-ban-shang-xian/"/>
    <updated>2012-02-23T02:08:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/02/23/you-dao-yun-bi-ji-1-dot-5zheng-shi-ban-shang-xian</id>
    <content type="html"><![CDATA[<p>今天晚上..或者说今天早上。反正是跨天的.有道云笔记1.5版本正式上线。开始时数据转换花了很长时间。后面基本没有出现什么大问题，主要是id不统一。整到两点钟才算正式搞好。明天早上就不准备去上班了.困&#8230;还是把这篇blog写完吧。</p>

<h4>问题：</h4>

<ol>
<li>其实测试环境下，还是不能测试出所有到问题。因为和线上的配置不一样。</li>
<li>其实组内改动什么设计问题，可能牵扯到几个人，但是做设计或者真正写代码的时候，其实不知道牵扯到谁。</li>
<li>web页面的文字链.其实没有提前做好。不知道为什么UI总是在临上线的时候才有。</li>
<li>技术先导的project,再让PM来设计.真的是比较痛苦。</li>
</ol>


<h4>新的功能：</h4>

<ol>
<li>客户端新浪微博帐号登录。其实根据现在的涉及还是有些bug的。比如打开两个授权页面，第一个页面其实已经不能再用来登录了。但是用户输入用户名密码还是会授权成功。至于为什么..我不告诉你～</li>
<li>锁屏&#8230;离线登录态&#8230;.还有啥就不知道了。</li>
<li>server端的设计有改动。</li>
<li>。。。。。</li>
</ol>


<h4>好了..该去睡觉了。</h4>

<p>另外今天上线的是有道云笔记1.5正式版&#8230;..比官方稿件快7-8个小时&#8230;
另外地址是<a href="http://note.youdao.com">有道云笔记1.5</a></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[windows c++程序迁移到linux]]></title>
    <link href="http://chilly.github.com/blog/2012/02/21/windows-c-plus-plus-cheng-xu-qian-yi-dao-linux/"/>
    <updated>2012-02-21T20:16:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/02/21/windows-c-plus-plus-cheng-xu-qian-yi-dao-linux</id>
    <content type="html"><![CDATA[<p>今天把程序从windows上迁移到了linux上。主要遇到到问题是: makeFile, lib库, compile error, 编码 encoding.</p>

<h4>make file</h4>

<p>这里其实可以使用eclipse中到cdt插件，然后就可以从eclipse中写c++。挺方便的，同时也解决了make file的问题。因为创建一个c++ 或者 c project，eclipse会自动创建一系列的makefile文件。所以让make file步骤简单无比。</p>

<h4>lib库和include库</h4>

<p>这里真的要注意/usr/include和/usr/lib中是否有你想要到文件。当然如果你是纯c++代码，可以尝试下只使用/usr/include/c++. 当如除了-L libpath, 还有-llibname, 这里的libname其实是libXXXX.so中的XXXX. 不过如果不会写，这里还是会费些劲。还有include路径要使用<code>-I</code>,每一个路径前都要有一个<code>-I</code>. 另外还要在eclipse run configurate中的environment中填入LD_LIBRARY_PATH,这个是你要调用的lib库（这个lib库如果不在/usr/lib中，那么就要手工将路径填入到LD_LIBRARY_PATH变量里）。并且在.bashrc中写：</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>LD_LIBRARY_PATH=$LD_LIBRARY_PATH:your_lib_path</span></code></pre></td></tr></table></div></figure>


<p></p>

<h4>编码</h4>

<p>因为windows上最常用到中文编码是GBK,而文件编码最常用到是utf-16el.这里最有可能会出错。在eclipse中或者gcc直接编译，都最好转换为UTF-8编码。文件也需要是UTF-8的编码。否则就会报&#8221;程序有游离的XXX, 忽略空字符&#8221;等诡异的错误。<a href="http://chillyc.info/blog/2012/02/20/jie-jue-cheng-xu-zhong-you-you-chi-de-slash-xxx-hu-lue-kong-zi-fu/">详见解决方法</a></p>

<h4>compile error</h4>

<p>这个可能就多种多样了。不过有c/c++基础的，应该大部分都可以搞定了。</p>

<p>如果使用eclipse, 直接build project就可以编译成功。然后找到main函数run就可以了。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[octopress error, rake generate]]></title>
    <link href="http://chilly.github.com/blog/2012/02/21/octopress-error/"/>
    <updated>2012-02-21T20:00:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/02/21/octopress-error</id>
    <content type="html"><![CDATA[<p>Today, I met the following problem. I wrote an article, and use <code>rake generate</code> to generate the site. Then the console reports:</p>

<blockquote><p>/home/chico/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/psych.rb:148:in `parse&#8217;: couldn&#8217;t parse YAML at line 3 column 17 (Psych::SyntaxError)</p></blockquote>


<p>why?   <br/>
Then I found the reason:</p>

<blockquote><p>&#8220;&#92;&#8221; should not be written in title of your article. If you really want to write it, use &#8220;&#92;&#92;&#8221;</p></blockquote>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[程序中有游离的\x,忽略空字符]]></title>
    <link href="http://chilly.github.com/blog/2012/02/20/jie-jue-cheng-xu-zhong-you-you-chi-de-slash-xxx-hu-lue-kong-zi-fu/"/>
    <updated>2012-02-20T13:32:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/02/20/jie-jue-cheng-xu-zhong-you-you-chi-de-slash-xxx-hu-lue-kong-zi-fu</id>
    <content type="html"><![CDATA[<p>今天解决了linux 环境中编译c++或者c文件时产生的错误。</p>

<blockquote><p>程序中有游离的&#8221;\xxx&#8221;<br/>忽略空字符</p></blockquote>


<p>以上两个错误，产生的原因和字符编码有关系。一般是文件从windows转移到linux下，然后使用c或者cc或者g++编译。产生了一系列的报警和错误信息。
解决方法如下：</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>1. 使用vi打开报错的文件
</span><span class='line'>2. 查看其文件编码. 也就是用vi 查看encoding变量。":set fileencoding?" 
</span><span class='line'>3. 如果编码不是utf-8则转换为utf-8. 使用":set fileencoding=utf-8"
</span><span class='line'>4. 保存文件</span></code></pre></td></tr></table></div></figure>


<p>当然产生这种错误的原因还有可能是由于在代码里输入了全角字符引起的。如果上面的方法不对，还需要再进一步排查<code>cat -A filename</code>。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[xrange and range in python]]></title>
    <link href="http://chilly.github.com/blog/2012/02/13/xrange-and-range-in-python/"/>
    <updated>2012-02-13T20:14:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/02/13/xrange-and-range-in-python</id>
    <content type="html"><![CDATA[<h4>简单来说</h4>

<p>python range会生成一个list对象，然后返回list中的内容，而xrange不会生成list对象。所以xrange相对与range来说更省空间，并且速度较快。</p>

<p>在英文中的官方解释是：</p>

<blockquote><p>class xrange(object)<br/> |  xrange([start,] stop[, step]) -> xrange object<br/> |  <br/> |  Like range(), but instead of returning a list, returns an object that<br/> |  generates the numbers in the range on demand.  For looping, this is <br/> |  slightly faster than range() and more memory efficient.</p></blockquote>


<p>ok. Do you understand?</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[build website in ubuntu]]></title>
    <link href="http://chilly.github.com/blog/2012/02/11/build-website-in-ubuntu/"/>
    <updated>2012-02-11T14:31:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/02/11/build-website-in-ubuntu</id>
    <content type="html"><![CDATA[<p>This article will tell you how to build a website in ubuntu system. First you should install apache and php. These two tools can help you to build a small website, like &#8220;hello world&#8221; websit:D</p>

<blockquote><p>// run the following commands<br/>sudo apt-get install apache2 php5 libapache2-mod-php5<br/>/etc/init.d/apache2 restart</p></blockquote>


<h4>important path</h4>

<p>Then you should remember the following paths:</p>

<blockquote><p>* /etc/init.d/apache2 <br/> * /var/www <br/> * /etc/apache2/apache2.conf<br/> * /etc/apache2/conf.d<br/> * /etc/apache2/sites-enabled</p></blockquote>


<p>  Apache&#8217;s default document root is /var/www on Ubuntu, and the configuration file is /etc/apache2/apache2.conf. Additional configurations are stored in subdirectories of the /etc/apache2 directory such as /etc/apache2/mods-enabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and /etc/apache2/conf.d</p>

<h4>Test your php</h4>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>vi /var/www/hello.php</span></code></pre></td></tr></table></div></figure>


<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>&lt;?php
</span><span class='line'>phpinfo();
</span><span class='line'>?&gt;</span></code></pre></td></tr></table></div></figure>


<p>Then call this file in browser (http://localhost/hello.php)
DONE:D</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[machine learning]]></title>
    <link href="http://chilly.github.com/blog/2012/02/06/machine-learning/"/>
    <updated>2012-02-06T14:06:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/02/06/machine-learning</id>
    <content type="html"><![CDATA[<p>概率，贝叶斯，熵，条件熵。互信息<code>I(X,Y)=H(Y)-H(Y|X)</code>，两个变量之间的依赖度。
今天接触了一个新的概念：学习的本质是压缩。化为经典就是<code>大道至简</code>。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[jstack jmap resin]]></title>
    <link href="http://chilly.github.com/blog/2012/02/01/jstack-jmap-resin/"/>
    <updated>2012-02-01T20:41:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/02/01/jstack-jmap-resin</id>
    <content type="html"><![CDATA[<p>Today, I use <code>jstack</code>, <code>jmap</code>, and <code>resin</code> to look up why my server is deading in stress test. And I also find printing information into log is useful. You can print log in entrance of function and exit of function. <br/>
jstack is a tool which is looked up stack of system, specailly in threads. It is mainly for looking up dead lock and some functions which are executed too slowly.  <br/>
jmap is a tool which is looked up current memory of system or some memery jvm can not delete immediately.
You can use jstack like this:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>jstack -l [pid]</span></code></pre></td></tr></table></div></figure>


<p>If you know pid of the process, you can see what&#8217;s the situation of stacks in process. If you want to see the detail, looking at those stacks. <br/>
jmap is used like this:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>jmap -heap [pid]</span></code></pre></td></tr></table></div></figure>


<p>Today, Big niu Qiao tells me about JVM GC policy. <br/>
There are New Generation, Old Generate and Perm Generation in JVM. You can find them in jmap command. And New Generation are new objects. And Old Generation are old objects which are still be refered. Eden Space stores new generate objects. And From Space stores still alive objects after gc once. To space stores objects which are not refered and in From space before gc once. If an objects is in From Space many times, it will be moved to Old Generation by JVM. Perm Generation are static objects and Classes. <br/>
By the way, if your application runs in resin, you should look up those logs of resin, for example, jvm-default.log. The log file contains GC log information. If GC throws overMemory exception, you should modify your configuration of resin (resin.xml in resin4.0+). Modify or add:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>&lt;jvm-arg&gt;-Xmx1024&lt;/jvm-arg&gt;</span></code></pre></td></tr></table></div></figure>


<p>
This means set JVM heap space to 1G.</p>

<!-- more -->


<p>
今天使用了一下jstack, jmap来查看系统为啥在压力测试中缓慢的挂掉。我发现还是很有用的还有就是打log.函数入口和函数出口都打log。  <br/>
jstack是查看系统现在卡在那里，特别是各个线程在哪里，主要是排查死锁或者运行相当缓慢的函数。jmap是为了看系统的内存。当前使用的内存，以及jvm想删除却很久都没有删除的内存。  <br/>
jstack的使用方法如下</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>jstack -l [pid]</span></code></pre></td></tr></table></div></figure>


<p>只要知道pid,就能知道该进程现在的stack情况。具体排查就是看那些stack&#8230;</p>

<p>jmap的使用基本一致</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>jmap -heap [pid]</span></code></pre></td></tr></table></div></figure>


<p>今天继续听巧大牛讲JVM GC策略。
jmap中有New Generation 和Old Generation. 分别对应新生成的和很久都没有被释放的。Eden Space就是新生成的对象。而From Space是以前曾经存活的对象（一次GC之后，Eden区的对象都会转换为From区）。To Space是以前曾经存活的对象但是现在已经没有引用了（一次GC过后, Eden区全部对象和From区尚有引用的对象回全部放入到To区）。而对象如果一直在From区，就会被jvm放入到Old Generation中。
Old Generation是扫描一边标记，再扫一边回收，另外涉及到内存压缩云云。
Perm Generation是static对象和class  <br/>
另外如果运行在resin中，还是看看resin的各个log.例如jvm-default.log.这个log中有关于GC的信息。如果GC已经OverMemery了.那就不用找了，直接在resin的conf中的resin.xml中找到jvm参数修改-Xmx的值即可。例如改为<code>-Xmx1024</code>即为java将使用内存1G.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[git alias]]></title>
    <link href="http://chilly.github.com/blog/2012/01/31/git-alias/"/>
    <updated>2012-01-31T19:57:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/01/31/git-alias</id>
    <content type="html"><![CDATA[<p>今天唐大牛教了些git的命令。顺便把他的git别名也发给我了。啥叫别名，就是</p>

<blockquote><p>git br<br/>==><br/>git branch</p></blockquote>


<p>只需要在home目录下的.gitconfig文件中添加：</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>[alias]
</span><span class='line'>  st = status -s
</span><span class='line'>  ci = commit
</span><span class='line'>  l = log --oneline --decorate -13
</span><span class='line'>  ll = log --oneline --decorate
</span><span class='line'>  co = checkout
</span><span class='line'>  br = branch
</span><span class='line'>  rb = rebase
</span><span class='line'>  dci = dcommit</span></code></pre></td></tr></table></div></figure>


<p>以后就可以使用别名了。</p>

<!-- more -->


<p>Today, big tang teaches me some git commands. And he gives me his alias of git commands to me. What&#8217;s alias? That&#8217;s</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>git br
</span><span class='line'>==&gt;
</span><span class='line'>git branch
</span></code></pre></td></tr></table></div></figure>


<p>only write the following code in <code>~/.gitconfig</code> file.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
<span class='line-number'>7</span>
<span class='line-number'>8</span>
<span class='line-number'>9</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>[alias]
</span><span class='line'>  st = status -s
</span><span class='line'>  ci = commit
</span><span class='line'>  l = log --oneline --decorate -13
</span><span class='line'>  ll = log --oneline --decorate
</span><span class='line'>  co = checkout
</span><span class='line'>  br = branch
</span><span class='line'>  rb = rebase
</span><span class='line'>  dci = dcommit
</span></code></pre></td></tr></table></div></figure>


<p>And now you can use alias of git commands. Try <code>git br</code></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[孔府，孔庙，孔林]]></title>
    <link href="http://chilly.github.com/blog/2012/01/26/kong-fu-kong-miao-kong-lin/"/>
    <updated>2012-01-26T19:41:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/01/26/kong-fu-kong-miao-kong-lin</id>
    <content type="html"><![CDATA[<p>今天跟姐和姐夫逛了下曲阜。三孔很小的时候去过，现在基本什么记忆都没有了。当年好像破破烂烂。现在好像好一点了。很多翻修的痕迹，如果过去不砸，也就不用修了。跟着导游看了看，貌似只有题字有看的必要。翻修的有些差，就如同翻修的长城。    <br/>
在孔林里听说只要姓孔就可以埋到孔林里。孔老师看来很有希望&#8230;</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[octopress deploy]]></title>
    <link href="http://chilly.github.com/blog/2012/01/25/octopress-deploy/"/>
    <updated>2012-01-25T23:23:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/01/25/octopress-deploy</id>
    <content type="html"><![CDATA[<p>octopress这东西还是很难弄的。这几天发生了各种git的异常。也不知道是怎么发生的。亦难解决。这stack overflow中查到都是中看不中用的东西。最后只好从github上再次clone下来。然后<code>git init</code>.这里要注意的是，octopress的home目录中其实是ignore <code>_deploy</code> 文件夹的。home 对应的是自己的source分支。而<code>_deploy</code>中才是master分支。    <br/>
<code>rake deploy</code> 其实是调用的<code>rake push</code>。其实是将<code>_public</code>中的内容copy到<code>_deploy</code>中。然后</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
<span class='line-number'>5</span>
<span class='line-number'>6</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>cd _deploy
</span><span class='line'>git init
</span><span class='line'>git add .
</span><span class='line'>git add -u
</span><span class='line'>git commit -m "some time"
</span><span class='line'>git push -u origin master</span></code></pre></td></tr></table></div></figure>


<p>所以还是多看看octopress的内部实现比较好。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[octopress bugs]]></title>
    <link href="http://chilly.github.com/blog/2012/01/21/octopress-bugs/"/>
    <updated>2012-01-21T21:19:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/01/21/octopress-bugs</id>
    <content type="html"><![CDATA[<p><meta name="Keywords" content="octopress,bug,solve"/>
<meta name="Description" content="The page will show many octopress bugs. And tell you how to solve it."></p>

<p>Today, I have met a bug of octopress. When you write your blog with number in categories, like &#8220;cattegories: [some keyword, 2012]&#8221;.</p>

<p>When you type  <code>rake generate</code>. The command will report:</p>

<blockquote><p>/plugins/category_generator.rb:109:in `block in write_category_indexes`;: undefined method `gsub`; for 2012:Fixnum (NoMethodError)</p></blockquote>


<p> <br/>
It is caused by your number <code>2012</code>.</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>vi plugins/category_generator.rb</span></code></pre></td></tr></table></div></figure>


<p>Go to line <code>109</code>. and add a line code:</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>category = category.to_s</span></code></pre></td></tr></table></div></figure>


<p>Now, type <code>rake generate</code> again. It will be fine.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[back home]]></title>
    <link href="http://chilly.github.com/blog/2012/01/21/back-home/"/>
    <updated>2012-01-21T21:11:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/01/21/back-home</id>
    <content type="html"><![CDATA[<p>今天终于到家了。卧了一夜到火车。在六点多睡势良好的情况下被列车猿唤醒换票。另外卧铺车厢开灯太早了，并且关灯太晚了。 <br/>
回到家中吃吃喝喝，洗澡理发，不知不觉就到中午了。下午实在困，睡了一下午。晚上的时候家人一起玩玩UNO.感觉很好。教会了爸妈。UNO还是适合各种人群的。 <br/>
公司发的扑克牌，貌似只对懂外语的年轻人有效。对爸妈一点杀伤力都没有。下午还看了一下holmes.剧情还不错，根据现代场景改变的历史剧还是很有看头。 <br/>
晚上再研究一下wordpress导入。自己改的脚本还是多多少少有些问题。导致解析不成功。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[新浪Oauth]]></title>
    <link href="http://chilly.github.com/blog/2012/01/17/xin-lang-oauth/"/>
    <updated>2012-01-17T00:11:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/01/17/xin-lang-oauth</id>
    <content type="html"><![CDATA[<p><meta name="description" content="这篇文章是关于新浪Oauth认证上的一些经验">
新浪Oauth好像是上Oauth2.0了。不过也支持OAuth 1.0a.但是新浪的OAuth 1.0a是冒牌的。也就是说，应该是1.0～1.0a或者是真正到1.0 alpha.
因为这个Oauth不支持oauth_callback_confirm参数，也就是在request_token之后就仅仅返回oauth_token和oauth_secret.因为没有这个oauth_call_confirm,
也就无法区分Oauth到底是1.0的还是1.0a的。另外如果你真的照着OAuth1.0a的流程与新浪的接口整合。就会发现在获取authorized_token，还是要传给新浪
oauth_callback,否则新浪真的不知道callback到哪里去，于是新浪就展示给你获取oauth_verifier到页面,也就是授权码页面。</p>

<p><span class='pullquote-right' data-pullquote='所以请记住：国内就真的没有什么Oauth1.0a. '>
另外如果你真的加了oauth_callback,加入你的callback中没有参数，那谢天谢地，你的程序可以跑得很好。如果你的callback中有一个参数，那也谢天谢地，
你的程序可以跑得良好。如果你的callback中有更多到参数，那就别想跑得好了。因为新浪在某些情况下会丢参数。即使你将oauth_callback中的值整个用urlEncode编码一下（再使用替换个别字符转为Oauth特殊编码），也是有可能给你丢参数的。  <br/>
所以请记住：国内就真的没有什么Oauth1.0a.
另外传说腾讯Oauth的oauth_callback的特殊值不是oob, 而是null.  <br/>
所以最简单有效到方法是将oauth_callback值中的&#8217;&amp;&#8217;替换为&#8217;||&#8217;，将&#8217;=&#8217;替换为&#8217;|&#8217;.然后在callback之后的页面进行反编码。就可以得到自己想要到参数了。
新浪是从Oauth1.0进行改版到Oauth1.0a的。其实就仅仅做了oauth_verifier的生成。然后就真的啥事请都没有做。<br/>
</span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[temp file, just test]]></title>
    <link href="http://chilly.github.com/blog/2012/01/16/test/"/>
    <updated>2012-01-16T20:43:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/01/16/test</id>
    <content type="html"><![CDATA[<p>This blog is just for octopress test. Not use <code>rake new_post</code>, just <code>vi source/_post/2012-01-16-test.markdown</code>. I want to see whether it works. <br/>
En, it works.</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[web config permission of files and dirs]]></title>
    <link href="http://chilly.github.com/blog/2012/01/15/web-config-permission-of-files-and-dirs/"/>
    <updated>2012-01-15T23:29:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/01/15/web-config-permission-of-files-and-dirs</id>
    <content type="html"><![CDATA[<p>permission of files: 0644
permission of dirs:  0755
if not, you will not see the web page. Or your site may have an exploit.
配置文件的权限为0644, 配置dir的权限为0755,这样即可以让用户访问到，又不会有太大的安全漏洞。</p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[octopress markdown]]></title>
    <link href="http://chilly.github.com/blog/2012/01/14/new-title/"/>
    <updated>2012-01-14T20:49:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/01/14/new-title</id>
    <content type="html"><![CDATA[<p>今天又弄了一下octopress，发现octopress和markdown中间还是有些兼容问题。例如codeblock、四个空格、tab、` ` `以及*的使用。都有些bug。应该是octopress解析时候有问题。<code>*</code>后面紧跟的一段，如果后面紧跟代码一定是8个空格或者两个tab。偶然情况下，使用4个空格也是可以作为code的。而code一定是以没有空格开头到行结束的。即使你使用了{\% codeblock \%} 以及 {\% endcodeblock \%} 也是不会被识别的。
所以blog还是简单点好。</p>

<blockquote><p>Simple is beauty! <br/>
 by someone</p></blockquote>

<blockquote><p>Simple is beauty!</p><footer><strong>someone</strong> <cite><a href='http://chillyc.info'>chillyc.info/&hellip;</a></cite></footer></blockquote>


<p><span class='pullquote-right' data-pullquote='其实我真的不想再说什么了&#8230;'>
下面再使用一下pull quote
其实我真的不想再说什么了&#8230;
好吧，让这篇blog结束吧。
</span></p>
]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[first use octopress]]></title>
    <link href="http://chilly.github.com/blog/2012/01/14/new/"/>
    <updated>2012-01-14T20:43:00+08:00</updated>
    <id>http://chilly.github.com/blog/2012/01/14/new</id>
    <content type="html"><![CDATA[<p>这是第二篇blog。第一篇貌似什么都没有写。现在在linux下过得相当到舒坦。比windows的感觉好多了。就是拼音输入法支持到不怎么样。谢谢搭建octopress的感受吧。第一感受是这东西真不好装。需要现学到知识也有很多，例如rvm, ruby, gem, bundle, rake, git, MarkDown. 再加上在windows下养成到习惯，到linux下还是要熟悉一下。首先要先安装openssl和libtool相关的包。</p>

<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class=''><span class='line'>sudo apt-get install openssh-client openssl libruby1.9.1 libssl-dev libssl libtool</span></code></pre></td></tr></table></div></figure>


<p>下面挨个介绍吧。<br/>
*   rvm 是管理ruby的工具，因为octopress需要使用ruby1.9.2所以必须使用rvm,否则就自己去<a href="http://ruby-lang.org">ruby</a>的官网上自己下载，然后编译安装。这里使用rvm是可以管理多个ruby版本。并且可以自动编译安装ruby。安装rvm需要一行命令</p>

<pre><code>bash -s stable &lt; &lt;(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)   
</code></pre>

<p>敲命令时注意<code>&lt; &lt;</code>之间的空格。安装完这个，需要将rvm添加到path中。在~/.bashrc中添加<code>PATH=$PATH:~/.rvm/bin</code>。注意有些系统可能~/.bashprofile或者其他，详情在哪里添加请<a href="http://google.com">google</a>。添加完后，关闭bash shell.再启动shell或者终端。然后下面的命令可以很好执行：</p>

<pre><code>which rvm
# 看到底rvm路径对了没有
rvm install 1.9.2 &amp;&amp; rvm use 1.9.2
# 安装ruby 1.9.2并且使用这个版本
ruby --version
# 是否是1.9.2版本
</code></pre>

<p>这里需要注意rvm use 1.9.2,如果你的机器重启，这里下次还要再设置一边。否则很有可能不能找到正确的ruby.
*   这一步要使用到git, git是管理代码到工具。不会用的话详情见<a href="http://git-scm.com">git</a>。octopress也主要使用了git和github,否则该实现到功能都不能用了。</p>

<pre><code>git clone git://github.com/imathis/octopress.git octopress
# 把octopress的主要内容down下来。   
</code></pre>

<ul>
<li>这里要使用gem， bundle, rake了。gem,bundler都是管理ruby各个小类库的工具。而rake是ruby make.

<pre><code>gem install bundler
bundle install
rake install
# 如果这里rake运行不成功，有可能是有多个版本到rake,要使用bundle exec rake install
</code></pre></li>
<li>剩下的详情请查阅<a href="http://octopress.org/docs/deploying/">octopress</a>。
如果在<code>rake generate</code>处因为openssl卡住，则需要安装完openssl,再安装ruby.yaml编译不成功，是因为没有安装libtool.</li>
</ul>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[CSDN hacked]]></title>
    <link href="http://chilly.github.com/blog/2011/12/22/csdn-hacked/"/>
    <updated>2011-12-22T00:00:00+08:00</updated>
    <id>http://chilly.github.com/blog/2011/12/22/csdn-hacked</id>
    <content type="html"><![CDATA[<p><meta name="_edit_last" content="1" />
<meta name="_su_description" content="csdn password" />
<meta name="_su_rich_snippet_type" content="none" />
<meta name="_su_title" content="csdn password" />
<meta name="views" content="55" />
CSDN lost its user-password-email information. And all has published in Internet. If you want to find whether your password is exposed. Go to this website[<a href="http://0bad.com/csdn.php" title="the link" target="_blank">the link</a>].</p>

<table>
<tr><tb> repeat times </tb><tb> passwod </tb><tb> percent </tb></tr><br/>
<tr><tb> 501 </tb><tb> qwerasdf </tb><tb> (0.0124073903469017) </tb></tr><br/>
<tr><tb> 504 </tb><tb> computer </tb><tb> (0.012481686097482) </tb></tr><br/>
<tr><tb> 519 </tb><tb> zxczxczxc </tb><tb> (0.0128531648503832) </tb></tr><br/>
<tr><tb> 521 </tb><tb> dddddddd </tb><tb> (0.0129026953507701) </tb></tr><br/>
<tr><tb> 525 </tb><tb> 299792458 </tb><tb> (0.0130017563515437) </tb></tr><br/>
<tr><tb> 532 </tb><tb> 135792468 </tb><tb> (0.0131751131028976) </tb></tr><br/>
<tr><tb> 535 </tb><tb> 20082008 </tb><tb> (0.0132494088534779) </tb></tr><br/>
<tr><tb> 536 </tb><tb> 369369369 </tb><tb> (0.0132741741036713) </tb></tr><br/>
<tr><tb> 553 </tb><tb> 5845211314 </tb><tb> (0.0136951833569594) </tb></tr><br/>
<tr><tb> 556 </tb><tb> yangyang </tb><tb> (0.0137694791075396) </tb></tr><br/>
<tr><tb> 559 </tb><tb> csdncsdn </tb><tb> (0.0138437748581199) </tb></tr><br/>
<tr><tb> 559 </tb><tb> google250 </tb><tb> (0.0138437748581199) </tb></tr><br/>
<tr><tb> 561 </tb><tb> woaini520 </tb><tb> (0.0138933053585067) </tb></tr><br/>
<tr><tb> 562 </tb><tb> zhang123 </tb><tb> (0.0139180706087001) </tb></tr><br/>
<tr><tb> 562 </tb><tb> 1234567b </tb><tb> (0.0139180706087001) </tb></tr><br/>
<tr><tb> 565 </tb><tb> wocaonima </tb><tb> (0.0139923663592804) </tb></tr><br/>
<tr><tb> 567 </tb><tb> 1233211234567 </tb><tb> (0.0140418968596672) </tb></tr><br/>
<tr><tb> 567 </tb><tb> 9876543210 </tb><tb> (0.0140418968596672) </tb></tr><br/>
<tr><tb> 570 </tb><tb> qaz123456 </tb><tb> (0.0141161926102475) </tb></tr><br/>
<tr><tb> 571 </tb><tb> q123456789 </tb><tb> (0.0141409578604409) </tb></tr><br/>
<tr><tb> 572 </tb><tb> 321654987 </tb><tb> (0.0141657231106343) </tb></tr><br/>
<tr><tb> 578 </tb><tb> 369258147 </tb><tb> (0.0143143146117948) </tb></tr><br/>
<tr><tb> 585 </tb><tb> aaa123456 </tb><tb> (0.0144876713631487) </tb></tr><br/>
<tr><tb> 589 </tb><tb> 1357924680 </tb><tb> (0.0145867323639224) </tb></tr><br/>
<tr><tb> 592 </tb><tb> 123321aa </tb><tb> (0.0146610281145026) </tb></tr><br/>
<tr><tb> 601 </tb><tb> 25257758 </tb><tb> (0.0148839153662434) </tb></tr><br/>
<tr><tb> 608 </tb><tb> wojiushiwo </tb><tb> (0.0150572721175973) </tb></tr><br/>
<tr><tb> 616 </tb><tb> ssssssss </tb><tb> (0.0152553941191446) </tb></tr><br/>
<tr><tb> 618 </tb><tb> qazwsx123 </tb><tb> (0.0153049246195315) </tb></tr><br/>
<tr><tb> 621 </tb><tb> 123456aaa </tb><tb> (0.0153792203701117) </tb></tr><br/>
<tr><tb> 623 </tb><tb> 1234567a </tb><tb> (0.0154287508704985) </tb></tr><br/>
<tr><tb> 642 </tb><tb> z123456789 </tb><tb> (0.0158992906241735) </tb></tr><br/>
<tr><tb> 649 </tb><tb> woainima </tb><tb> (0.0160726473755274) </tb></tr><br/>
<tr><tb> 650 </tb><tb> 44444444 </tb><tb> (0.0160974126257208) </tb></tr><br/>
<tr><tb> 651 </tb><tb> buzhidao </tb><tb> (0.0161221778759142) </tb></tr><br/>
<tr><tb> 657 </tb><tb> ffffffff </tb><tb> (0.0162707693770747) </tb></tr><br/>
<tr><tb> 669 </tb><tb> 100200300 </tb><tb> (0.0165679523793957) </tb></tr><br/>
<tr><tb> 680 </tb><tb> 12345679 </tb><tb> (0.0168403701315233) </tb></tr><br/>
<tr><tb> 685 </tb><tb> 12369874 </tb><tb> (0.0169641963824904) </tb></tr><br/>
<tr><tb> 693 </tb><tb> 1122334455 </tb><tb> (0.0171623183840377) </tb></tr><br/>
<tr><tb> 702 </tb><tb> 111111 </tb><tb> (0.0173852056357785) </tb></tr><br/>
<tr><tb> 708 </tb><tb> woaini123 </tb><tb> (0.017533797136939) </tb></tr><br/>
<tr><tb> 713 </tb><tb> qwe123456 </tb><tb> (0.017657623387906) </tb></tr><br/>
<tr><tb> 726 </tb><tb> xiaoxiao </tb><tb> (0.0179795716404205) </tb></tr><br/>
<tr><tb> 727 </tb><tb> 123456654321 </tb><tb> (0.0180043368906139) </tb></tr><br/>
<tr><tb> 729 </tb><tb> woshishui </tb><tb> (0.0180538673910007) </tb></tr><br/>
<tr><tb> 732 </tb><tb> 12301230 </tb><tb> (0.018128163141581) </tb></tr><br/>
<tr><tb> 740 </tb><tb> 1234554321 </tb><tb> (0.0183262851431283) </tb></tr><br/>
<tr><tb> 741 </tb><tb> 5201314520 </tb><tb> (0.0183510503933217) </tb></tr><br/>
<tr><tb> 744 </tb><tb> 12345612 </tb><tb> (0.018425346143902) </tb></tr><br/>
<tr><tb> 765 </tb><tb> lilylily </tb><tb> (0.0189454163979637) </tb></tr><br/>
<tr><tb> 770 </tb><tb> 123456asd </tb><tb> (0.0190692426489308) </tb></tr><br/>
<tr><tb> 772 </tb><tb> 10101010 </tb><tb> (0.0191187731493176) </tb></tr><br/>
<tr><tb> 777 </tb><tb> 1q2w3e4r5t </tb><tb> (0.0192425994002847) </tb></tr><br/>
<tr><tb> 783 </tb><tb> 11235813 </tb><tb> (0.0193911909014452) </tb></tr><br/>
<tr><tb> 805 </tb><tb> 12345600 </tb><tb> (0.0199360264057004) </tb></tr><br/>
<tr><tb> 835 </tb><tb> 11111111111111111111 </tb><tb> (0.0206789839115029) </tb></tr><br/>
<tr><tb> 847 </tb><tb> wwwwwwww </tb><tb> (0.0209761669138239) </tb></tr><br/>
<tr><tb> 852 </tb><tb> 0987654321 </tb><tb> (0.0210999931647909) </tb></tr><br/>
<tr><tb> 882 </tb><tb> 5845201314 </tb><tb> (0.0218429506705934) </tb></tr><br/>
<tr><tb> 882 </tb><tb> zxcvbnm123 </tb><tb> (0.0218429506705934) </tb></tr><br/>
<tr><tb> 892 </tb><tb> kingcom5 </tb><tb> (0.0220906031725276) </tb></tr><br/>
<tr><tb> 894 </tb><tb> 123456987 </tb><tb> (0.0221401336729144) </tb></tr><br/>
<tr><tb> 910 </tb><tb> 05962514787 </tb><tb> (0.0225363776760091) </tb></tr><br/>
<tr><tb> 920 </tb><tb> 321321321 </tb><tb> (0.0227840301779433) </tb></tr><br/>
<tr><tb> 967 </tb><tb> woaiwojia </tb><tb> (0.0239479969370339) </tb></tr><br/>
<tr><tb> 975 </tb><tb> 1qazxsw2 </tb><tb> (0.0241461189385812) </tb></tr><br/>
<tr><tb> 988 </tb><tb> 123qweasd </tb><tb> (0.0244680671910956) </tb></tr><br/>
<tr><tb> 991 </tb><tb> 1234abcd </tb><tb> (0.0245423629416759) </tb></tr><br/>
<tr><tb> 1003 </tb><tb> woaini1314 </tb><tb> (0.0248395459439969) </tb></tr><br/>
<tr><tb> 1037 </tb><tb> 12345678a </tb><tb> (0.025681564450573) </tb></tr><br/>
<tr><tb> 1054 </tb><tb> q1w2e3r4 </tb><tb> (0.0261025737038611) </tb></tr><br/>
<tr><tb> 1058 </tb><tb> asdfghjk </tb><tb> (0.0262016347046348) </tb></tr><br/>
<tr><tb> 1109 </tb><tb> 1123581321 </tb><tb> (0.027464662464499) </tb></tr><br/>
<tr><tb> 1111 </tb><tb> 123698745 </tb><tb> (0.0275141929648858) </tb></tr><br/>
<tr><tb> 1119 </tb><tb> asdf1234 </tb><tb> (0.0277123149664332) </tb></tr><br/>
<tr><tb> 1136 </tb><tb> 521521521 </tb><tb> (0.0281333242197213) </tb></tr><br/>
<tr><tb> 1148 </tb><tb> 147852369 </tb><tb> (0.0284305072220423) </tb></tr><br/>
<tr><tb> 1183 </tb><tb> 123456qq </tb><tb> (0.0292972909788118) </tb></tr><br/>
<tr><tb> 1200 </tb><tb> 3.1415926 </tb><tb> (0.0297183002320999) </tb></tr><br/>
<tr><tb> 1206 </tb><tb> qweqweqwe </tb><tb> (0.0298668917332604) </tb></tr><br/>
<tr><tb> 1214 </tb><tb> 111222333 </tb><tb> (0.0300650137348078) </tb></tr><br/>
<tr><tb> 1245 </tb><tb> zzzzzzzz </tb><tb> (0.0308327364908037) </tb></tr><br/>
<tr><tb> 1268 </tb><tb> ms0083jxj </tb><tb> (0.0314023372452523) </tb></tr><br/>
<tr><tb> 1273 </tb><tb> 11112222 </tb><tb> (0.0315261634962193) </tb></tr><br/>
<tr><tb> 1285 </tb><tb> code8925 </tb><tb> (0.0318233464985403) </tb></tr><br/>
<tr><tb> 1316 </tb><tb> qweasdzxc </tb><tb> (0.0325910692545363) </tb></tr><br/>
<tr><tb> 1339 </tb><tb> 77777777 </tb><tb> (0.0331606700089848) </tb></tr><br/>
<tr><tb> 1384 </tb><tb> asd123456 </tb><tb> (0.0342751062676886) </tb></tr><br/>
<tr><tb> 1480 </tb><tb> qwer1234 </tb><tb> (0.0366525702862566) </tb></tr><br/>
<tr><tb> 1589 </tb><tb> 33333333 </tb><tb> (0.039351982557339) </tb></tr><br/>
<tr><tb> 1652 </tb><tb> 55555555 </tb><tb> (0.0409121933195242) </tb></tr><br/>
<tr><tb> 1652 </tb><tb> 741852963 </tb><tb> (0.0409121933195242) </tb></tr><br/>
<tr><tb> 1656 </tb><tb> 963852741 </tb><tb> (0.0410112543202979) </tb></tr><br/>
<tr><tb> 1699 </tb><tb> 520520520 </tb><tb> (0.0420761600786148) </tb></tr><br/>
<tr><tb> 1854 </tb><tb> 123456123456 </tb><tb> (0.0459147738585944) </tb></tr><br/>
<tr><tb> 1859 </tb><tb> 999999999 </tb><tb> (0.0460386001095615) </tb></tr><br/>
<tr><tb> 1859 </tb><tb> 123456aa </tb><tb> (0.0460386001095615) </tb></tr><br/>
<tr><tb> 1891 </tb><tb> 99999999 </tb><tb> (0.0468310881157508) </tb></tr><br/>
<tr><tb> 1918 </tb><tb> asdfasdf </tb><tb> (0.047499749870973) </tb></tr><br/>
<tr><tb> 1971 </tb><tb> aa123456 </tb><tb> (0.0488123081312241) </tb></tr><br/>
<tr><tb> 1986 </tb><tb> 123456789a </tb><tb> (0.0491837868841254) </tb></tr><br/>
<tr><tb> 1989 </tb><tb> qwertyui </tb><tb> (0.0492580826347056) </tb></tr><br/>
<tr><tb> 2100 </tb><tb> 1234qwer </tb><tb> (0.0520070254061749) </tb></tr><br/>
<tr><tb> 2106 </tb><tb> a1234567 </tb><tb> (0.0521556169073354) </tb></tr><br/>
<tr><tb> 2113 </tb><tb> 123456123 </tb><tb> (0.0523289736586893) </tb></tr><br/>
<tr><tb> 2131 </tb><tb> 123456 </tb><tb> (0.0527747481621708) </tb></tr><br/>
<tr><tb> 2138 </tb><tb> a12345678 </tb><tb> (0.0529481049135247) </tb></tr><br/>
<tr><tb> 2160 </tb><tb> abc123456 </tb><tb> (0.0534929404177799) </tb></tr><br/>
<tr><tb> 2166 </tb><tb> 123321123 </tb><tb> (0.0536415319189404) </tb></tr><br/>
<tr><tb> 2243 </tb><tb> 22222222 </tb><tb> (0.0555484561838334) </tb></tr><br/>
<tr><tb> 2296 </tb><tb> asdasdasd </tb><tb> (0.0568610144440845) </tb></tr><br/>
<tr><tb> 2348 </tb><tb> 110110110 </tb><tb> (0.0581488074541422) </tb></tr><br/>
<tr><tb> 2380 </tb><tb> 12341234 </tb><tb> (0.0589412954603315) </tb></tr><br/>
<tr><tb> 2396 </tb><tb> abcd1234 </tb><tb> (0.0593375394634262) </tb></tr><br/>
<tr><tb> 2515 </tb><tb> qazwsxedc </tb><tb> (0.0622846042364428) </tb></tr><br/>
<tr><tb> 2540 </tb><tb> 12121212 </tb><tb> (0.0629037354912782) </tb></tr><br/>
<tr><tb> 2573 </tb><tb> 123654789 </tb><tb> (0.0637209887476609) </tb></tr><br/>
<tr><tb> 2578 </tb><tb> 0123456789 </tb><tb> (0.063844814998628) </tb></tr><br/>
<tr><tb> 2580 </tb><tb> 123456abc </tb><tb> (0.0638943454990148) </tb></tr><br/>
<tr><tb> 2796 </tb><tb> 1q2w3e4r </tb><tb> (0.0692436395407928) </tb></tr><br/>
<tr><tb> 2826 </tb><tb> asdfghjkl </tb><tb> (0.0699865970465953) </tb></tr><br/>
<tr><tb> 2885 </tb><tb> 0000000000 </tb><tb> (0.0714477468080069) </tb></tr><br/>
<tr><tb> 2985 </tb><tb> 12344321 </tb><tb> (0.0739242718273486) </tb></tr><br/>
<tr><tb> 3061 </tb><tb> 31415926 </tb><tb> (0.0758064308420482) </tb></tr><br/>
<tr><tb> 3080 </tb><tb> iloveyou </tb><tb> (0.0762769705957231) </tb></tr><br/>
<tr><tb> 3094 </tb><tb> qq123456 </tb><tb> (0.076623684098431) </tb></tr><br/>
<tr><tb> 3143 </tb><tb> qwertyuiop </tb><tb> (0.0778371813579084) </tb></tr><br/>
<tr><tb> 3175 </tb><tb> 000000000 </tb><tb> (0.0786296693640977) </tb></tr><br/>
<tr><tb> 3277 </tb><tb> qqqqqqqq </tb><tb> (0.0811557248838262) </tb></tr><br/>
<tr><tb> 3281 </tb><tb> 87654321 </tb><tb> (0.0812547858845999) </tb></tr><br/>
<tr><tb> 3501 </tb><tb> password </tb><tb> (0.0867031409271515) </tb></tr><br/>
<tr><tb> 3610 </tb><tb> 789456123 </tb><tb> (0.0894025531982339) </tb></tr><br/>
<tr><tb> 3649 </tb><tb> xiazhili </tb><tb> (0.0903683979557772) </tb></tr><br/>
<tr><tb> 3667 </tb><tb> 1qaz2wsx </tb><tb> (0.0908141724592587) </tb></tr><br/>
<tr><tb> 4096 </tb><tb> 11223344 </tb><tb> (0.101438464792234) </tb></tr><br/>
<tr><tb> 4435 </tb><tb> a123456789 </tb><tb> (0.109833884607803) </tb></tr><br/>
<tr><tb> 5025 </tb><tb> 66666666 </tb><tb> (0.124445382221918) </tb></tr><br/>
<tr><tb> 5145 </tb><tb> 1111111111 </tb><tb> (0.127417212245128) </tb></tr><br/>
<tr><tb> 5459 </tb><tb> aaaaaaaa </tb><tb> (0.135193500805861) </tb></tr><br/>
<tr><tb> 5553 </tb><tb> 987654321 </tb><tb> (0.137521434324042) </tb></tr><br/>
<tr><tb> 5965 </tb><tb> 147258369 </tb><tb> (0.14772471740373) </tb></tr><br/>
<tr><tb> 6995 </tb><tb> 111111111 </tb><tb> (0.173232925102949) </tb></tr><br/>
<tr><tb> 15033 </tb><tb> 88888888 </tb><tb> (0.372296006157632) </tb></tr><br/>
<tr><tb> 17790 </tb><tb> 1234567890 </tb><tb> (0.440573800940881) </tb></tr><br/>
<tr><tb> 19986 </tb><tb> 123123123 </tb><tb> (0.494958290365624) </tb></tr><br/>
<tr><tb> 34952 </tb><tb> 00000000 </tb><tb> (0.865595024760297) </tb></tr><br/>
<tr><tb> 46053 </tb><tb> dearbook </tb><tb> (1.14051406715741) </tb></tr><br/>
<tr><tb> 76346 </tb><tb> 11111111 </tb><tb> (1.89072779126658) </tb></tr><br/>
<tr><tb> 212749 </tb><tb> 12345678 </tb><tb> (5.26878221339919) </tb></tr><br/>
<tr><tb> 235012 </tb><tb> 123456789 </tb><tb> (5.82013097845522) </tb></tr><br/>
</table>


<br/>


<!--more-->


<p>CSDN的用户名-密码-邮箱被泄露在互联网上。如果你想知道自己的用户名密码是否被泄露，点击<a href="http://0bad.com/csdn.php" target="_blank">链接</a>。
这里是统计出的密码重复次数。转载自某个地方..</p>

<table>
<tr><tb> 重复次数 </tb><tb> 密码 </tb><tb> 百分比 </tb></tr><br/>
<tr><tb> 501 </tb><tb> qwerasdf </tb><tb> (0.0124073903469017) </tb></tr><br/>
<tr><tb> 504 </tb><tb> computer </tb><tb> (0.012481686097482) </tb></tr><br/>
<tr><tb> 519 </tb><tb> zxczxczxc </tb><tb> (0.0128531648503832) </tb></tr><br/>
<tr><tb> 521 </tb><tb> dddddddd </tb><tb> (0.0129026953507701) </tb></tr><br/>
<tr><tb> 525 </tb><tb> 299792458 </tb><tb> (0.0130017563515437) </tb></tr><br/>
<tr><tb> 532 </tb><tb> 135792468 </tb><tb> (0.0131751131028976) </tb></tr><br/>
<tr><tb> 535 </tb><tb> 20082008 </tb><tb> (0.0132494088534779) </tb></tr><br/>
<tr><tb> 536 </tb><tb> 369369369 </tb><tb> (0.0132741741036713) </tb></tr><br/>
<tr><tb> 553 </tb><tb> 5845211314 </tb><tb> (0.0136951833569594) </tb></tr><br/>
<tr><tb> 556 </tb><tb> yangyang </tb><tb> (0.0137694791075396) </tb></tr><br/>
<tr><tb> 559 </tb><tb> csdncsdn </tb><tb> (0.0138437748581199) </tb></tr><br/>
<tr><tb> 559 </tb><tb> google250 </tb><tb> (0.0138437748581199) </tb></tr><br/>
<tr><tb> 561 </tb><tb> woaini520 </tb><tb> (0.0138933053585067) </tb></tr><br/>
<tr><tb> 562 </tb><tb> zhang123 </tb><tb> (0.0139180706087001) </tb></tr><br/>
<tr><tb> 562 </tb><tb> 1234567b </tb><tb> (0.0139180706087001) </tb></tr><br/>
<tr><tb> 565 </tb><tb> wocaonima </tb><tb> (0.0139923663592804) </tb></tr><br/>
<tr><tb> 567 </tb><tb> 1233211234567 </tb><tb> (0.0140418968596672) </tb></tr><br/>
<tr><tb> 567 </tb><tb> 9876543210 </tb><tb> (0.0140418968596672) </tb></tr><br/>
<tr><tb> 570 </tb><tb> qaz123456 </tb><tb> (0.0141161926102475) </tb></tr><br/>
<tr><tb> 571 </tb><tb> q123456789 </tb><tb> (0.0141409578604409) </tb></tr><br/>
<tr><tb> 572 </tb><tb> 321654987 </tb><tb> (0.0141657231106343) </tb></tr><br/>
<tr><tb> 578 </tb><tb> 369258147 </tb><tb> (0.0143143146117948) </tb></tr><br/>
<tr><tb> 585 </tb><tb> aaa123456 </tb><tb> (0.0144876713631487) </tb></tr><br/>
<tr><tb> 589 </tb><tb> 1357924680 </tb><tb> (0.0145867323639224) </tb></tr><br/>
<tr><tb> 592 </tb><tb> 123321aa </tb><tb> (0.0146610281145026) </tb></tr><br/>
<tr><tb> 601 </tb><tb> 25257758 </tb><tb> (0.0148839153662434) </tb></tr><br/>
<tr><tb> 608 </tb><tb> wojiushiwo </tb><tb> (0.0150572721175973) </tb></tr><br/>
<tr><tb> 616 </tb><tb> ssssssss </tb><tb> (0.0152553941191446) </tb></tr><br/>
<tr><tb> 618 </tb><tb> qazwsx123 </tb><tb> (0.0153049246195315) </tb></tr><br/>
<tr><tb> 621 </tb><tb> 123456aaa </tb><tb> (0.0153792203701117) </tb></tr><br/>
<tr><tb> 623 </tb><tb> 1234567a </tb><tb> (0.0154287508704985) </tb></tr><br/>
<tr><tb> 642 </tb><tb> z123456789 </tb><tb> (0.0158992906241735) </tb></tr><br/>
<tr><tb> 649 </tb><tb> woainima </tb><tb> (0.0160726473755274) </tb></tr><br/>
<tr><tb> 650 </tb><tb> 44444444 </tb><tb> (0.0160974126257208) </tb></tr><br/>
<tr><tb> 651 </tb><tb> buzhidao </tb><tb> (0.0161221778759142) </tb></tr><br/>
<tr><tb> 657 </tb><tb> ffffffff </tb><tb> (0.0162707693770747) </tb></tr><br/>
<tr><tb> 669 </tb><tb> 100200300 </tb><tb> (0.0165679523793957) </tb></tr><br/>
<tr><tb> 680 </tb><tb> 12345679 </tb><tb> (0.0168403701315233) </tb></tr><br/>
<tr><tb> 685 </tb><tb> 12369874 </tb><tb> (0.0169641963824904) </tb></tr><br/>
<tr><tb> 693 </tb><tb> 1122334455 </tb><tb> (0.0171623183840377) </tb></tr><br/>
<tr><tb> 702 </tb><tb> 111111 </tb><tb> (0.0173852056357785) </tb></tr><br/>
<tr><tb> 708 </tb><tb> woaini123 </tb><tb> (0.017533797136939) </tb></tr><br/>
<tr><tb> 713 </tb><tb> qwe123456 </tb><tb> (0.017657623387906) </tb></tr><br/>
<tr><tb> 726 </tb><tb> xiaoxiao </tb><tb> (0.0179795716404205) </tb></tr><br/>
<tr><tb> 727 </tb><tb> 123456654321 </tb><tb> (0.0180043368906139) </tb></tr><br/>
<tr><tb> 729 </tb><tb> woshishui </tb><tb> (0.0180538673910007) </tb></tr><br/>
<tr><tb> 732 </tb><tb> 12301230 </tb><tb> (0.018128163141581) </tb></tr><br/>
<tr><tb> 740 </tb><tb> 1234554321 </tb><tb> (0.0183262851431283) </tb></tr><br/>
<tr><tb> 741 </tb><tb> 5201314520 </tb><tb> (0.0183510503933217) </tb></tr><br/>
<tr><tb> 744 </tb><tb> 12345612 </tb><tb> (0.018425346143902) </tb></tr><br/>
<tr><tb> 765 </tb><tb> lilylily </tb><tb> (0.0189454163979637) </tb></tr><br/>
<tr><tb> 770 </tb><tb> 123456asd </tb><tb> (0.0190692426489308) </tb></tr><br/>
<tr><tb> 772 </tb><tb> 10101010 </tb><tb> (0.0191187731493176) </tb></tr><br/>
<tr><tb> 777 </tb><tb> 1q2w3e4r5t </tb><tb> (0.0192425994002847) </tb></tr><br/>
<tr><tb> 783 </tb><tb> 11235813 </tb><tb> (0.0193911909014452) </tb></tr><br/>
<tr><tb> 805 </tb><tb> 12345600 </tb><tb> (0.0199360264057004) </tb></tr><br/>
<tr><tb> 835 </tb><tb> 11111111111111111111 </tb><tb> (0.0206789839115029) </tb></tr><br/>
<tr><tb> 847 </tb><tb> wwwwwwww </tb><tb> (0.0209761669138239) </tb></tr><br/>
<tr><tb> 852 </tb><tb> 0987654321 </tb><tb> (0.0210999931647909) </tb></tr><br/>
<tr><tb> 882 </tb><tb> 5845201314 </tb><tb> (0.0218429506705934) </tb></tr><br/>
<tr><tb> 882 </tb><tb> zxcvbnm123 </tb><tb> (0.0218429506705934) </tb></tr><br/>
<tr><tb> 892 </tb><tb> kingcom5 </tb><tb> (0.0220906031725276) </tb></tr><br/>
<tr><tb> 894 </tb><tb> 123456987 </tb><tb> (0.0221401336729144) </tb></tr><br/>
<tr><tb> 910 </tb><tb> 05962514787 </tb><tb> (0.0225363776760091) </tb></tr><br/>
<tr><tb> 920 </tb><tb> 321321321 </tb><tb> (0.0227840301779433) </tb></tr><br/>
<tr><tb> 967 </tb><tb> woaiwojia </tb><tb> (0.0239479969370339) </tb></tr><br/>
<tr><tb> 975 </tb><tb> 1qazxsw2 </tb><tb> (0.0241461189385812) </tb></tr><br/>
<tr><tb> 988 </tb><tb> 123qweasd </tb><tb> (0.0244680671910956) </tb></tr><br/>
<tr><tb> 991 </tb><tb> 1234abcd </tb><tb> (0.0245423629416759) </tb></tr><br/>
<tr><tb> 1003 </tb><tb> woaini1314 </tb><tb> (0.0248395459439969) </tb></tr><br/>
<tr><tb> 1037 </tb><tb> 12345678a </tb><tb> (0.025681564450573) </tb></tr><br/>
<tr><tb> 1054 </tb><tb> q1w2e3r4 </tb><tb> (0.0261025737038611) </tb></tr><br/>
<tr><tb> 1058 </tb><tb> asdfghjk </tb><tb> (0.0262016347046348) </tb></tr><br/>
<tr><tb> 1109 </tb><tb> 1123581321 </tb><tb> (0.027464662464499) </tb></tr><br/>
<tr><tb> 1111 </tb><tb> 123698745 </tb><tb> (0.0275141929648858) </tb></tr><br/>
<tr><tb> 1119 </tb><tb> asdf1234 </tb><tb> (0.0277123149664332) </tb></tr><br/>
<tr><tb> 1136 </tb><tb> 521521521 </tb><tb> (0.0281333242197213) </tb></tr><br/>
<tr><tb> 1148 </tb><tb> 147852369 </tb><tb> (0.0284305072220423) </tb></tr><br/>
<tr><tb> 1183 </tb><tb> 123456qq </tb><tb> (0.0292972909788118) </tb></tr><br/>
<tr><tb> 1200 </tb><tb> 3.1415926 </tb><tb> (0.0297183002320999) </tb></tr><br/>
<tr><tb> 1206 </tb><tb> qweqweqwe </tb><tb> (0.0298668917332604) </tb></tr><br/>
<tr><tb> 1214 </tb><tb> 111222333 </tb><tb> (0.0300650137348078) </tb></tr><br/>
<tr><tb> 1245 </tb><tb> zzzzzzzz </tb><tb> (0.0308327364908037) </tb></tr><br/>
<tr><tb> 1268 </tb><tb> ms0083jxj </tb><tb> (0.0314023372452523) </tb></tr><br/>
<tr><tb> 1273 </tb><tb> 11112222 </tb><tb> (0.0315261634962193) </tb></tr><br/>
<tr><tb> 1285 </tb><tb> code8925 </tb><tb> (0.0318233464985403) </tb></tr><br/>
<tr><tb> 1316 </tb><tb> qweasdzxc </tb><tb> (0.0325910692545363) </tb></tr><br/>
<tr><tb> 1339 </tb><tb> 77777777 </tb><tb> (0.0331606700089848) </tb></tr><br/>
<tr><tb> 1384 </tb><tb> asd123456 </tb><tb> (0.0342751062676886) </tb></tr><br/>
<tr><tb> 1480 </tb><tb> qwer1234 </tb><tb> (0.0366525702862566) </tb></tr><br/>
<tr><tb> 1589 </tb><tb> 33333333 </tb><tb> (0.039351982557339) </tb></tr><br/>
<tr><tb> 1652 </tb><tb> 55555555 </tb><tb> (0.0409121933195242) </tb></tr><br/>
<tr><tb> 1652 </tb><tb> 741852963 </tb><tb> (0.0409121933195242) </tb></tr><br/>
<tr><tb> 1656 </tb><tb> 963852741 </tb><tb> (0.0410112543202979) </tb></tr><br/>
<tr><tb> 1699 </tb><tb> 520520520 </tb><tb> (0.0420761600786148) </tb></tr><br/>
<tr><tb> 1854 </tb><tb> 123456123456 </tb><tb> (0.0459147738585944) </tb></tr><br/>
<tr><tb> 1859 </tb><tb> 999999999 </tb><tb> (0.0460386001095615) </tb></tr><br/>
<tr><tb> 1859 </tb><tb> 123456aa </tb><tb> (0.0460386001095615) </tb></tr><br/>
<tr><tb> 1891 </tb><tb> 99999999 </tb><tb> (0.0468310881157508) </tb></tr><br/>
<tr><tb> 1918 </tb><tb> asdfasdf </tb><tb> (0.047499749870973) </tb></tr><br/>
<tr><tb> 1971 </tb><tb> aa123456 </tb><tb> (0.0488123081312241) </tb></tr><br/>
<tr><tb> 1986 </tb><tb> 123456789a </tb><tb> (0.0491837868841254) </tb></tr><br/>
<tr><tb> 1989 </tb><tb> qwertyui </tb><tb> (0.0492580826347056) </tb></tr><br/>
<tr><tb> 2100 </tb><tb> 1234qwer </tb><tb> (0.0520070254061749) </tb></tr><br/>
<tr><tb> 2106 </tb><tb> a1234567 </tb><tb> (0.0521556169073354) </tb></tr><br/>
<tr><tb> 2113 </tb><tb> 123456123 </tb><tb> (0.0523289736586893) </tb></tr><br/>
<tr><tb> 2131 </tb><tb> 123456 </tb><tb> (0.0527747481621708) </tb></tr><br/>
<tr><tb> 2138 </tb><tb> a12345678 </tb><tb> (0.0529481049135247) </tb></tr><br/>
<tr><tb> 2160 </tb><tb> abc123456 </tb><tb> (0.0534929404177799) </tb></tr><br/>
<tr><tb> 2166 </tb><tb> 123321123 </tb><tb> (0.0536415319189404) </tb></tr><br/>
<tr><tb> 2243 </tb><tb> 22222222 </tb><tb> (0.0555484561838334) </tb></tr><br/>
<tr><tb> 2296 </tb><tb> asdasdasd </tb><tb> (0.0568610144440845) </tb></tr><br/>
<tr><tb> 2348 </tb><tb> 110110110 </tb><tb> (0.0581488074541422) </tb></tr><br/>
<tr><tb> 2380 </tb><tb> 12341234 </tb><tb> (0.0589412954603315) </tb></tr><br/>
<tr><tb> 2396 </tb><tb> abcd1234 </tb><tb> (0.0593375394634262) </tb></tr><br/>
<tr><tb> 2515 </tb><tb> qazwsxedc </tb><tb> (0.0622846042364428) </tb></tr><br/>
<tr><tb> 2540 </tb><tb> 12121212 </tb><tb> (0.0629037354912782) </tb></tr><br/>
<tr><tb> 2573 </tb><tb> 123654789 </tb><tb> (0.0637209887476609) </tb></tr><br/>
<tr><tb> 2578 </tb><tb> 0123456789 </tb><tb> (0.063844814998628) </tb></tr><br/>
<tr><tb> 2580 </tb><tb> 123456abc </tb><tb> (0.0638943454990148) </tb></tr><br/>
<tr><tb> 2796 </tb><tb> 1q2w3e4r </tb><tb> (0.0692436395407928) </tb></tr><br/>
<tr><tb> 2826 </tb><tb> asdfghjkl </tb><tb> (0.0699865970465953) </tb></tr><br/>
<tr><tb> 2885 </tb><tb> 0000000000 </tb><tb> (0.0714477468080069) </tb></tr><br/>
<tr><tb> 2985 </tb><tb> 12344321 </tb><tb> (0.0739242718273486) </tb></tr><br/>
<tr><tb> 3061 </tb><tb> 31415926 </tb><tb> (0.0758064308420482) </tb></tr><br/>
<tr><tb> 3080 </tb><tb> iloveyou </tb><tb> (0.0762769705957231) </tb></tr><br/>
<tr><tb> 3094 </tb><tb> qq123456 </tb><tb> (0.076623684098431) </tb></tr><br/>
<tr><tb> 3143 </tb><tb> qwertyuiop </tb><tb> (0.0778371813579084) </tb></tr><br/>
<tr><tb> 3175 </tb><tb> 000000000 </tb><tb> (0.0786296693640977) </tb></tr><br/>
<tr><tb> 3277 </tb><tb> qqqqqqqq </tb><tb> (0.0811557248838262) </tb></tr><br/>
<tr><tb> 3281 </tb><tb> 87654321 </tb><tb> (0.0812547858845999) </tb></tr><br/>
<tr><tb> 3501 </tb><tb> password </tb><tb> (0.0867031409271515) </tb></tr><br/>
<tr><tb> 3610 </tb><tb> 789456123 </tb><tb> (0.0894025531982339) </tb></tr><br/>
<tr><tb> 3649 </tb><tb> xiazhili </tb><tb> (0.0903683979557772) </tb></tr><br/>
<tr><tb> 3667 </tb><tb> 1qaz2wsx </tb><tb> (0.0908141724592587) </tb></tr><br/>
<tr><tb> 4096 </tb><tb> 11223344 </tb><tb> (0.101438464792234) </tb></tr><br/>
<tr><tb> 4435 </tb><tb> a123456789 </tb><tb> (0.109833884607803) </tb></tr><br/>
<tr><tb> 5025 </tb><tb> 66666666 </tb><tb> (0.124445382221918) </tb></tr><br/>
<tr><tb> 5145 </tb><tb> 1111111111 </tb><tb> (0.127417212245128) </tb></tr><br/>
<tr><tb> 5459 </tb><tb> aaaaaaaa </tb><tb> (0.135193500805861) </tb></tr><br/>
<tr><tb> 5553 </tb><tb> 987654321 </tb><tb> (0.137521434324042) </tb></tr><br/>
<tr><tb> 5965 </tb><tb> 147258369 </tb><tb> (0.14772471740373) </tb></tr><br/>
<tr><tb> 6995 </tb><tb> 111111111 </tb><tb> (0.173232925102949) </tb></tr><br/>
<tr><tb> 15033 </tb><tb> 88888888 </tb><tb> (0.372296006157632) </tb></tr><br/>
<tr><tb> 17790 </tb><tb> 1234567890 </tb><tb> (0.440573800940881) </tb></tr><br/>
<tr><tb> 19986 </tb><tb> 123123123 </tb><tb> (0.494958290365624) </tb></tr><br/>
<tr><tb> 34952 </tb><tb> 00000000 </tb><tb> (0.865595024760297) </tb></tr><br/>
<tr><tb> 46053 </tb><tb> dearbook </tb><tb> (1.14051406715741) </tb></tr><br/>
<tr><tb> 76346 </tb><tb> 11111111 </tb><tb> (1.89072779126658) </tb></tr><br/>
<tr><tb> 212749 </tb><tb> 12345678 </tb><tb> (5.26878221339919) </tb></tr><br/>
<tr><tb> 235012 </tb><tb> 123456789 </tb><tb> (5.82013097845522) </tb></tr><br/>
</table>

]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[velocity encoding charset error]]></title>
    <link href="http://chilly.github.com/blog/2011/12/04/velocity-encoding-error-2/"/>
    <updated>2011-12-04T00:00:00+08:00</updated>
    <id>http://chilly.github.com/blog/2011/12/04/velocity-encoding-error-2</id>
    <content type="html"><![CDATA[<p><meta name="_edit_last" content="1" />
<meta name="_su_description" content="There is a solution for solve velocity encoding or charset error." />
<meta name="_su_keywords" content="encoding, charset, error, velocity" />
<meta name="_su_rich_snippet_type" content="none" />
<meta name="_su_title" content="encoding, charset, velocity, error, exception, java, web" />
<meta name="views" content="64" />
<meta name="_wp_old_slug" content="velocity-encoding-error" /></p>

<p>   First, set some properties for velocity engine. Set vm file reading path. use file read-mode not resource read-mode.<br />
<br />
// set velocity path, if you don&#8217;t do these, you will get Resource not found exception.<br />
Properties p = new Properties();<br />
p.setProperty(&#8220;resource.loader&#8221;, &#8220;file&#8221;);<br />
p.setProperty(&#8220;class.resource.loader.class&#8221;,&#8221;org.apache.velocity.runtime.resource.loader.FileResourceLoader&#8221;);<br />
// where is your vms path, set it<br />
p.setProperty(&#8220;file.resource.loader.path&#8221;, realPath + &#8220;/vm&#8221;);<br />
// set output encoding<br />
// nearly almost articals said the following will work, but it won&#8217;t<br />
p.setProperty(Velocity.INPUT_ENCODING, Constant.DEFAULT_ENCODING);<br />
p.setProperty(Velocity.OUTPUT_ENCODING, Constant.DEFAULT_ENCODING);<br />
p.setProperty(&#8220;contentType&#8221;, &#8220;text/html;charset=&#8221;+Constant.DEFAULT_ENCODING);<br />
Velocity.init(p);<br />
<br />
   The above code should be write in beginning of use any of velocity objects. In Spring or Java web application, you should write them into Servlet context listener.<br />
   If you use ascii word. There will no error encoding. But if you use gb2312 or UTF-8. You will find something weird. The above code dose not work. So I use response output to solve those encoding problem. In web application, we always use response.getOutputStream() to write something back. But now, we should construct output stream to write correct encoding word to the page. So velocity can encoding them correctly. The following code will help you.<br />
<br />
String encoding = &#8220;utf-8&#8221;;<br />
// If you use UTF-8 encoding in your application<br />
Writer writer = new PrintWriter(new PrintStream(resp.getOutputStream(), true, encoding));<br />
// velocity will find abc.vm in your file path folder.<br />
String pageName = &#8220;abc&#8221;;<br />
Template template = Velocity.getTemplate(pageName);<br />
VelocityContext context = new VelocityContext();<br />
context.put(&#8220;test&#8221;, new String(&#8220;hello&#8221;.getBytes(encoding), encoding));<br />
// here velocity will use the writer to write correct encoding words to response stream. So we can see the correct words showed by our page.<br />
template.merge(context, writer);<br />
<br />
   If you use jetty to run your web application, it works fine.<br />
   But maybe you use windows resin to run war package. Sometimes, error encoding comes again. There is something wrong with your resin application. You should change config file in resin conf folder. In conf/resin.xml( resin 4.0+ ), add &lt;character-encoding&gt;UTF-8&lt;/character-encoding&gt;  in  &lt; web-app-default &gt;. Like following:<br />
<blockquote>
&lt; web-app-default &gt;<br />
    &lt;character-encoding&gt;UTF-8&lt;/character-encoding&gt;<br />
&#8230;<br />
&lt; /web-app-default &gt;<br />
</blockquote>
   And you should use correct charset to start your resin. Else resin will use default charset of your operation system.</p>


<blockquote><p>java -Dfile.encoding=UTF-8 -jar lib/resin.jar </p></blockquote>


<p>   Addition, if you use spring framework, don&#8217;t forget the encoding filter :<br />
<blockquote>
&lt;filter&gt;<br />
    &lt;filter-name&gt;characterEncodingFilter&lt;/filter-name&gt;<br />
        &lt;filter-class&gt;org.springframework.web.filter.CharacterEncodingFilter&lt;/filter-class&gt;<br />
        &lt;init-param&gt;<br />
            &lt;param-name&gt;encoding&lt;/param-name&gt;
            &lt;param-value&gt;UTF-8&lt;/param-value&gt;
        &lt;/init-param&gt;<br />
    &lt;/filter&gt;<br />
    &lt;filter-mapping&gt;<br />
        &lt;filter-name&gt;characterEncodingFilter&lt;/filter-name&gt;<br />
        &lt;url-pattern&gt;/*&lt;/url-pattern&gt;<br />
    &lt;/filter-mapping&gt;<br />
</blockquote>
   In encoding or charset error. You should consider the following :</p>


<p><li>  <b>environment (like resin, jetty, eclipse and etc.)</b></li>
<li>  <b>Input (from outside, like user input, or reading from database )</b></li>
<li>  <b>Output (to outside, like page presented, or writing to database or file)</b></li>
<li>  <b>Process (maybe you encode words twice or more, or encode them to some other different charset)</b></li></p>
]]></content>
  </entry>
  
</feed>

