﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-JBahamut</title><link>http://www.blogjava.net/JBahamut/</link><description>&lt;br&gt;最“邪恶”的问题是那些需要解决或者部分解决才能够定义的问题</description><language>zh-cn</language><lastBuildDate>Fri, 01 May 2026 11:40:44 GMT</lastBuildDate><pubDate>Fri, 01 May 2026 11:40:44 GMT</pubDate><ttl>60</ttl><item><title>build cvs Emacs23 on Ubuntu</title><link>http://www.blogjava.net/JBahamut/archive/2008/12/24/247995.html</link><dc:creator>JBahamut</dc:creator><author>JBahamut</author><pubDate>Tue, 23 Dec 2008 17:44:00 GMT</pubDate><guid>http://www.blogjava.net/JBahamut/archive/2008/12/24/247995.html</guid><wfw:comment>http://www.blogjava.net/JBahamut/comments/247995.html</wfw:comment><comments>http://www.blogjava.net/JBahamut/archive/2008/12/24/247995.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JBahamut/comments/commentRss/247995.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JBahamut/services/trackbacks/247995.html</trackback:ping><description><![CDATA[这里有个step by step<br />
http://www.saltycrane.com/blog/2008/10/installing-emacs-23-cvs-ubuntu-hardy/<br />
<br />
照做基本没什么问题<br />
<br />
如果要用 tool bar, menu bar, scroll bar, 需要在configure的时候加 --with-x-toolkit 选项，这个需要gtk+ &gt;= 2.6 glib &gt;= 2.6。<br />
这个依赖我在ubuntu hardy 上一直没搞定，反正我也不用，也就没有加。<br />
<br />
如果要让emacs在终端中运行还需要安装libncurses5-dev，否则会报错：<br />
*ERROR*: Cannot open termcap database file<br />
<br />
新的 --daemon 真的很好用，新建frame的速度超快，完全可以和VIM媲美，终于可以不用在commit的时候用VIM编辑commit message了。<br />
Emacs一统江湖，千秋万载~~~~<br />
<img src ="http://www.blogjava.net/JBahamut/aggbug/247995.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JBahamut/" target="_blank">JBahamut</a> 2008-12-24 01:44 <a href="http://www.blogjava.net/JBahamut/archive/2008/12/24/247995.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>为CMD增加Bitstream Vera Sans Mono字体</title><link>http://www.blogjava.net/JBahamut/archive/2008/12/18/247001.html</link><dc:creator>JBahamut</dc:creator><author>JBahamut</author><pubDate>Wed, 17 Dec 2008 17:58:00 GMT</pubDate><guid>http://www.blogjava.net/JBahamut/archive/2008/12/18/247001.html</guid><wfw:comment>http://www.blogjava.net/JBahamut/comments/247001.html</wfw:comment><comments>http://www.blogjava.net/JBahamut/archive/2008/12/18/247001.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.blogjava.net/JBahamut/comments/commentRss/247001.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JBahamut/services/trackbacks/247001.html</trackback:ping><description><![CDATA[Bitstream Vera Sans Mono 号称是最适合coding的字体，于是把emacs的默认字体都改成了Bitstream Vera Sans Mono，貌似不支持中文字符集，就先忍了反正一般也用不到。心血来潮，打算把CMD的字体也换成这个。网上搜到的方法大同小异：<br />
官方说发<br />
http://support.microsoft.com/kb/247815<br />
比较好的中文总结<br />
http://www.2maomao.com/blog/windows-console-font/<br />
<br />
1. 安装Bitstream Vera Sans Mono<br />
&nbsp; 安装后貌似不能直接用，重启后才能有效，不明白为什么<br />
2. 修改注册表<br />
&nbsp; 在 HKEY_LOCAL_MACHINE"SOFTWARE"Microsoft"Windows NT"CurrentVersion"Console"TrueTypeFont 下添加新键值：<br />
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #000000;">[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows&nbsp;NT\CurrentVersion\Console\TrueTypeFont]<br />
</span><span style="color: #000000;">"</span><span style="color: #000000;">0</span><span style="color: #000000;">"</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">Lucida&nbsp;Console</span><span style="color: #000000;">"</span><span style="color: #000000;"><br />
</span><span style="color: #000000;">"</span><span style="color: #000000;">932</span><span style="color: #000000;">"</span><span style="color: #000000;">=</span><span style="color: #000000;">hex(</span><span style="color: #000000;">7</span><span style="color: #000000;">):2a,</span><span style="color: #000000;">00</span><span style="color: #000000;">,2d,ff,</span><span style="color: #000000;">33</span><span style="color: #000000;">,ff,</span><span style="color: #000000;">20</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,b4,</span><span style="color: #000000;">30</span><span style="color: #000000;">,b7,</span><span style="color: #000000;">30</span><span style="color: #000000;">,c3,</span><span style="color: #000000;">30</span><span style="color: #000000;">,af,</span><span style="color: #000000;">30</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,2a,</span><span style="color: #000000;">00</span><span style="color: #000000;">,4d,</span><span style="color: #000000;">00</span><span style="color: #000000;">,\<br />
&nbsp;&nbsp;</span><span style="color: #000000;">53</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">20</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">47</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,6f,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">74</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">68</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">69</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">63</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;"><br />
</span><span style="color: #000000;">"</span><span style="color: #000000;">949</span><span style="color: #000000;">"</span><span style="color: #000000;">=</span><span style="color: #000000;">hex(</span><span style="color: #000000;">7</span><span style="color: #000000;">):2a,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">74</span><span style="color: #000000;">,ad,bc,b9,b4,cc,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,2a,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">47</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">75</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,6c,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">69</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,6d,</span><span style="color: #000000;">00</span><span style="color: #000000;">,\<br />
&nbsp;&nbsp;</span><span style="color: #000000;">43</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">68</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">65</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;"><br />
</span><span style="color: #000000;">"</span><span style="color: #000000;">936</span><span style="color: #000000;">"</span><span style="color: #000000;">=</span><span style="color: #000000;">hex(</span><span style="color: #000000;">7</span><span style="color: #000000;">):2a,</span><span style="color: #000000;">00</span><span style="color: #000000;">,b0,</span><span style="color: #000000;">65</span><span style="color: #000000;">,8b,5b,</span><span style="color: #000000;">53</span><span style="color: #000000;">,4f,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,2a,</span><span style="color: #000000;">00</span><span style="color: #000000;">,4e,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">53</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">69</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,6d,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">53</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,\<br />
&nbsp;&nbsp;</span><span style="color: #000000;">75</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,6e,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;"><br />
</span><span style="color: #000000;">"</span><span style="color: #000000;">950</span><span style="color: #000000;">"</span><span style="color: #000000;">=</span><span style="color: #000000;">hex(</span><span style="color: #000000;">7</span><span style="color: #000000;">):2a,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">30</span><span style="color: #000000;">,7d,0e,</span><span style="color: #000000;">66</span><span style="color: #000000;">,d4,9a,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,2a,</span><span style="color: #000000;">00</span><span style="color: #000000;">,4d,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">69</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,6e,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">67</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,4c,</span><span style="color: #000000;">00</span><span style="color: #000000;">,\<br />
&nbsp;&nbsp;</span><span style="color: #000000;">69</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">55</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;">,</span><span style="color: #000000;">00</span><span style="color: #000000;"><br />
</span><span style="color: #000000;">"</span><span style="color: #000000;">00</span><span style="color: #000000;">"</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">Consolas</span><span style="color: #000000;">"</span><span style="color: #000000;"><br />
</span><span style="color: #000000;">"</span><span style="color: #000000;">000</span><span style="color: #000000;">"</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">Courier&nbsp;New</span><span style="color: #000000;">"</span><span style="color: #000000;"><br />
</span><span style="color: #000000;">"</span><span style="color: #000000;">0000</span><span style="color: #000000;">"</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">Bitstream&nbsp;Vera&nbsp;Sans&nbsp;Mono</span><span style="color: #000000;">"</span><span style="color: #000000;"><br />
</span></div>
这段是从上面的blog中抄来的。新加键值规则如下：<br />
键名从 0 开始，每新加一个字体加一个 0<br />
字体必须是 monospace 系的<br />
<br />
3. 设置code page（optional）<br />
&nbsp; 新加的字体要在&#8220;当前代码页（code page）&#8221;是437时才会出现。估计是字体字符集的问题。<br />
&nbsp; 打开CMD，输入 "chcp 437"<br />
<br />
4. 修改CMD的属性设置<br />
&nbsp; 修改为你想要的字体就OK了<br />
<br />
<br />
<br />
<br />
<img src ="http://www.blogjava.net/JBahamut/aggbug/247001.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JBahamut/" target="_blank">JBahamut</a> 2008-12-18 01:58 <a href="http://www.blogjava.net/JBahamut/archive/2008/12/18/247001.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>项目小结</title><link>http://www.blogjava.net/JBahamut/archive/2008/11/03/238453.html</link><dc:creator>JBahamut</dc:creator><author>JBahamut</author><pubDate>Mon, 03 Nov 2008 15:42:00 GMT</pubDate><guid>http://www.blogjava.net/JBahamut/archive/2008/11/03/238453.html</guid><wfw:comment>http://www.blogjava.net/JBahamut/comments/238453.html</wfw:comment><comments>http://www.blogjava.net/JBahamut/archive/2008/11/03/238453.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JBahamut/comments/commentRss/238453.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JBahamut/services/trackbacks/238453.html</trackback:ping><description><![CDATA[<p>经过两周的连续加班jdwp终于快告一段落了，如果不出什么问题的话马上就会进入FRT了。我<br />
们从今年过完年就基本上在搞这个东西，期间问题无数，可以作为一个典型的失败案例，貌<br />
似自我进来之后参与的所有项目都没有一帆风顺的，就拿这个最典型的开刀，以醒后世。</p>
<p>先介绍一下我们这个项目：是将open source的一个实现拿到自己的产品当中（当然license<br />
上是没问题的）。主要的工作是移植+少量的升级，原来的实现只支持主流的Intel平台，我<br />
们要将这个东西移植到12个平台，而且我们已经有了一套port层的API，也就是说我们只需要<br />
将所有涉及到和平台相关的代码全部替换成port层中对应的API。原来的实现层次上也很清<br />
晰，大部分都是相同的代码，少数不同的地方也都放在了不同的文件。看起来是个非常简单<br />
的项目，那么我们就来看看这样一个简单的项目是如何失败。</p>
<p>一共4个人投入这个项目，计划两个人做升级，两个人做移植，我被分去做移植。</p>
<p><span style="font-size: 18pt; color: red">问题一</span></p>
<p>四个人都是做java的，只有一个在项目中使用C/C++，其他人都只停留在学校作业的水平</p>
<p>如果从上面的需求看，这样的状况完全是可以接受的。只要理解了框架，在合适的位置加点<br />
代码就可以了，已有的代码也是个很好的参照；移植基本就是个体力活，仔细不出错就没问<br />
题了。事实证明，对于不熟悉的语言，解决问题的效率明显下降，很多我们折腾了几天了的<br />
问题，有经验的人可能一分钟就能搞定。不过项目组里在实在是没有其他人了，这个风险应<br />
该是已经计算在内了。但是许多小问题堆积起来有可能就是致命的，这只能算是其中的一个<br />
了。</p>
<p><span style="font-size: 18pt; color: red">问题二</span></p>
<p>没有及时的与其他模块集成</p>
<p>我们这个号称敏捷的team在这一点上连敏捷最基本的尽早集成，持续集成都没有做到，汗颜<br />
啊。我们只是在自己的小作坊里拼命的搞呀搞，最后发现我们的东西拿给integration team<br />
根本就没法build，然后花了大量的时间来解决在各个平台上的build问题。这时问题一就凸<br />
显出来了，面对不熟悉的语言，不熟悉的工具，完全陌生的平台，写脚本去build一个复杂<br />
的工程（原来用的都是已有的东西）。由于build的问题迟迟没能解决，导致后面测试和我<br />
们fix bug的时间非常有限。</p>
<p><span style="font-size: 18pt; color: red">问题三</span></p>
<p>不求甚解</p>
<p>就我来说，我做完移植后都不知道整个模块的运行机制，工作原理，只是一个API翻译的码<br />
工。其他人也都差不多，对整体的构架和大致的流程都不是很清楚。不过我们这群人还是很<br />
强的，都是fix bug的高手，每天维护这大量完全不熟悉的代码，即使不懂，不太懂照样游<br />
刃有余。这里的问题是我们没有责任感，为移植而移植，为升级而升级，完全不去试图理解<br />
自己所在做的事情，殊不知，这些拿进产品的代码最终还是要我们自己来维护的啊。这种情<br />
况一直到项目的最后期才有所好转，修了那么多bug，再不熟都说不过去了。但这种从局部<br />
一点点的理解不仅效率低下，而且始终对代码没有充分的自信。即使现在我们也不敢对已有<br />
的代码做大的改动，因为我们完全不知道在这里的修改是否会影响的其他部分。</p>
<p>我觉得在项目刚开始应该首先学习已有的代码，顺便温习C/C++的知识，对项目整体的了解<br />
是必要的，也是最基本的。</p>
<p><span style="font-size: 18pt; color: red">问题四</span></p>
<p>对风险估计不足</p>
<p>细心的读者可能已经发现了，我们前面项目的概述中有两个重要的风险没有考虑到：已有代<br />
码中的bug和我们依赖的port API的bug，我们都假设它们是不存在的！！就是这两个东西让<br />
我们陷入了泥沼无法自拔。客观的说从open source拿的代码质量还是非常高的，而且有一<br />
个完整的测试框架和大量的自动化测试用例，但要作为产品，显然还需要锤炼。port API的<br />
问题相对少一些，但很难发现，而且一旦出问题修正的周期非常长，无疑对我们的进度会有<br />
很大的影响。</p>
<p>刚过了TCK我们说，TCK都过了，应该没啥问题了，可是SVT报过来一堆bug，我们恍然，SVT比<br />
TCK牛多了，真是什么bt的测试都有。等SVT都过了，突然冒出个RAD，一下就是十几个bug，<br />
还发现一个spec没实现，一问结果人家是人肉测试 -_-!!<br />
做最好的希望，做最坏的打算任何时候都是适用的</p>
<p><span style="font-size: 18pt; color: red">问题五</span></p>
<p>兵力分散</p>
<p>上一条对这个有直接的影响，也跟我们team人太少有关。项目中的4个人只有一个人是绝大<br />
部分时间在这上面，其他人是需要了再过来，搞着jdwp还要搞其他的东西，严重分散了精力。<br />
期间由于没赶上SR2，中间有一段相对空闲的时间，大部分人都被抽取干其他的任务，默认<br />
是不会再有什么问题了。。。这实际上是我们team一直存在的问题，一人多职，每个人都没<br />
法专注在一件事上，造成每件事都效率不高。</p>
<p><span style="font-size: 18pt; color: red">问题六</span></p>
<p>反馈迟缓</p>
<p>敏捷啊，又犯了敏捷的大忌。从项目开始的头几个月我们没有试图去获得或者争取任何反<br />
馈，直到测试组参与进来。即使我们能够获得完整的SVT测试用例我们也没有尝试主动去获取<br />
反馈（跑SVT测试），我们始终都是被动的。我们虽然没办法让客户尝试还没正式发布的版<br />
本，但至少我们自己可以，在team内部使用还是没什么问题的。jdwp大家平时调程序都会用<br />
到，如果我们自己使用的话，很多显而易见的bug就不会到最后才被发现。虽然作为SDK本事<br />
不稳定会影响大家开发的效率，但能及时发现问题，将其扼杀在摇篮中，我认为还是非常值<br />
得的。</p>
<p><span style="font-size: 18pt; color: red">问题七</span></p>
<p>基础设施（Infrastructure）不健全</p>
<p>我们的code repository还是不能不说的。为什么会变成这样我也不太清楚，总之它现在的情<br />
况是这样的：我们有自己的code repository A，每次做integration build，我们会把当前<br />
最新的代码发布到另一个repository B，这个B不仅包括了我们jdwp的代码，还有其他我们放<br />
进产品的代码，integration build会从这里拿代码去build。注意这里的发布其实就是复制<br />
A里的文件到B并且修改所有文件头的日期信息，这个动作是由脚本完成的，commit的注释就<br />
是load module balabala之类没啥意义的东西，如果用svn diff看某个版本的修改，你会看<br />
到所有的文件都被修改了，绝大部分仅仅是文件头被改了。看官可能要骂了，不就是个用来<br />
做integration build的临时库嘛，讲这么多干嘛，其实我们的项目只能在这个临时库<br />
build，因为修改过的脚本都在这里。各位现在能理解我们的痛苦了吗？我们必须在B上开<br />
发，而B除了做更新外没有任何用处，如果要查看历史，请去A，要提交修改，对不起请去A，<br />
我在B上开发竟然要去A上提交！！！就这样来回的折腾啊，我们的时间就这样消耗啊。。。</p>
<p><br />
这样看来整个项目真是一团糟，但我们竟然真的把它放进SR3了，当然还会有<br />
SR4，5，6，7。。。为了不让惨剧继续上演还有很多需要做：</p>
<p>1. 修改 repository A 上的build脚本，以后直接在A上工作</p>
<p>2. clean 测试用例，补充测试用例，这是保证质量的第一关。</p>
<p>3. 组织一次组内sharing，share项目的整体构架，运行机制，常见工具的使用，常用的解<br />
决问题的方式，将其记录在wiki上。</p>
<p>4. 号召大家在日常工作中使用自己开发的工具，小白鼠从自己做起。<br />
</p>
<img src ="http://www.blogjava.net/JBahamut/aggbug/238453.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JBahamut/" target="_blank">JBahamut</a> 2008-11-03 23:42 <a href="http://www.blogjava.net/JBahamut/archive/2008/11/03/238453.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>coloring diff</title><link>http://www.blogjava.net/JBahamut/archive/2008/09/27/231394.html</link><dc:creator>JBahamut</dc:creator><author>JBahamut</author><pubDate>Fri, 26 Sep 2008 16:29:00 GMT</pubDate><guid>http://www.blogjava.net/JBahamut/archive/2008/09/27/231394.html</guid><wfw:comment>http://www.blogjava.net/JBahamut/comments/231394.html</wfw:comment><comments>http://www.blogjava.net/JBahamut/archive/2008/09/27/231394.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JBahamut/comments/commentRss/231394.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JBahamut/services/trackbacks/231394.html</trackback:ping><description><![CDATA[用惯了git觉得没有颜色的diff实在是无法忍受，还好emacs可以配置diff-mode的颜色，但svn diff却没有发现有参数可以指定highlight diff的，于是自己写了一个。是一个bash脚本，用到了sed，linux下肯定没有问题；windows下需要装MinGW的bash，sed还有msys<br />
<br />
<br />
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #000000;">#!/bin/sh<br />
<br />
case&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">$TERM</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;in<br />
msys)<br />
CONTEXT_COLOR</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">[37m</span><span style="color: #000000;">"</span><span style="color: #000000;"><br />
ADD_COLOR</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">[32m</span><span style="color: #000000;">"</span><span style="color: #000000;"><br />
DELETE_COLOR</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">[31m</span><span style="color: #000000;">"</span><span style="color: #000000;"><br />
LOCATION_COLOR</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">[36m</span><span style="color: #000000;">"</span><span style="color: #000000;"><br />
INDEX_COLOR</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">[35m</span><span style="color: #000000;">"</span><span style="color: #000000;"><br />
NORM_COLOR</span><span style="color: #000000;">=</span><span style="color: #000000;">"</span><span style="color: #000000;">[0m</span><span style="color: #000000;">"</span><span style="color: #000000;"><br />
</span><span style="color: #008000;">;</span><span style="color: #008000;">;</span><span style="color: #008000;"><br />
</span><span style="color: #000000;">*)<br />
CONTEXT_COLOR</span><span style="color: #000000;">=</span><span style="color: #000000;">`tput&nbsp;setaf&nbsp;</span><span style="color: #000000;">7</span><span style="color: #000000;">`<br />
ADD_COLOR</span><span style="color: #000000;">=</span><span style="color: #000000;">`tput&nbsp;setaf&nbsp;</span><span style="color: #000000;">2</span><span style="color: #000000;">`<br />
DELETE_COLOR</span><span style="color: #000000;">=</span><span style="color: #000000;">`tput&nbsp;setaf&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">`<br />
LOCATION_COLOR</span><span style="color: #000000;">=</span><span style="color: #000000;">`tput&nbsp;setaf&nbsp;</span><span style="color: #000000;">6</span><span style="color: #000000;">`<br />
INDEX_COLOR</span><span style="color: #000000;">=</span><span style="color: #000000;">`tput&nbsp;setaf&nbsp;</span><span style="color: #000000;">5</span><span style="color: #000000;">`<br />
NORM_COLOR</span><span style="color: #000000;">=</span><span style="color: #000000;">`tput&nbsp;sgr0`<br />
</span><span style="color: #008000;">;</span><span style="color: #008000;">;</span><span style="color: #008000;"><br />
</span><span style="color: #000000;">esac<br />
<br />
svn&nbsp;diff&nbsp;$*&nbsp;|<br />
sed&nbsp;-e&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">s/^+.*/${ADD_COLOR}&amp;${NORM_COLOR}/g</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;-e&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">s/^-.*/${DELETE_COLOR}&amp;${NORM_COLOR}/g</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;\<br />
&nbsp;&nbsp;&nbsp;&nbsp;-e&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">s/^@@.*/${LOCATION_COLOR}&amp;${NORM_COLOR}/g</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;-e&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">s/^[iI]ndex.*/${INDEX_COLOR}&amp;${NORM_COLOR}/g</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;\<br />
&nbsp;&nbsp;&nbsp;&nbsp;-e&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">s/.*/${CONTEXT_COLOR}&amp;${NORM_COLOR}/g</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;|<br />
${PAGER:-less&nbsp;-QRS}<br />
</span></div>
<br />
由于windows上没有tput方法所以只能直接写操作字符，上面方块的字符可以通过下面命令将结果输出到文件得到<br />
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: #000000;">echo&nbsp;-e&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">\033[31mtest</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;&gt;&nbsp;out</span></div>
<br />
<span style="color: #000000;">tput&nbsp;setbf [0-7] 可以用来设置背景颜色。这有有颜色的代码:<br />
</span>http://www.frexx.de/xterm-256-notes/<br />
<br />
贴上来的代码中有特殊字符，貌似被解析成奇怪的东西了，可以点击<a href="http://www.blogjava.net/Files/JBahamut/svn-diff-color.zip">这里</a>下载<br />
<br />
<br />
<img src ="http://www.blogjava.net/JBahamut/aggbug/231394.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JBahamut/" target="_blank">JBahamut</a> 2008-09-27 00:29 <a href="http://www.blogjava.net/JBahamut/archive/2008/09/27/231394.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>如何用C++写出不依赖于stdlibc++.so的程序</title><link>http://www.blogjava.net/JBahamut/archive/2008/07/31/218866.html</link><dc:creator>JBahamut</dc:creator><author>JBahamut</author><pubDate>Wed, 30 Jul 2008 16:05:00 GMT</pubDate><guid>http://www.blogjava.net/JBahamut/archive/2008/07/31/218866.html</guid><wfw:comment>http://www.blogjava.net/JBahamut/comments/218866.html</wfw:comment><comments>http://www.blogjava.net/JBahamut/archive/2008/07/31/218866.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JBahamut/comments/commentRss/218866.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JBahamut/services/trackbacks/218866.html</trackback:ping><description><![CDATA[这个题目一看就很欠扁，既然用C++又不想依赖stdlibc++标准库这不是有病吗？其意义究竟<br />
何在？这实际上就是我最近被赋予的光荣使命，神奇的是原来真的可以做到！！！与标准库<br />
斗于编译器斗，其乐无穷~~~收获也不是没有，对C++，对编译器的认识又更近了一步，虽然<br />
本来就没有什么认识。<br />
<br />
故事是这样开始的，我们为公司的某产品开发了一个模块，其实就是两动态库。本来这东西<br />
也不是我们开发的，我们只是负责移植到公司的12个平台上。本来一切都很顺利，不幸的事<br />
是在test快要结束的时候发生的，某平台是build机器上与test机器上stdlibc++.so版本不<br />
一致，我们的so竟然不能load，这不是再正常不过的事情么，装一个需要的版本就一了百了<br />
了，但是。。但是可恶的印度人懒得装不说，还指责是我们的问题，说引入了新的依赖，不<br />
行不行就是不行，我的奇妙旅行就此开始了。（这个问题也可以通过静态链接stdlibc++解<br />
决，貌似他们没搞定，我也没有深入研究）<br />
<br />
总的来说C++对stdlibc++.so的依赖主要由以下几个部分产生：<br />
1. 对C++标准库的依赖<br />
&nbsp;&nbsp; 简单的看就是 include C++的头文件（不以.h结尾）<br />
&nbsp;&nbsp; 如果你大量使用的STL...请回吧，不送了。还好我们只使用到了vector和dqueue，简<br />
&nbsp;&nbsp; 单实现了一个，凑合着用了<br />
2. new 和 delete 操作符<br />
&nbsp;&nbsp; 这两个操作符实际上完成了两部分工作，首先是分配内存，其次是调用相应的构造/析构<br />
&nbsp;&nbsp; 方法。而对于gcc来说，分配内存的工作是在stdlibc++.so中完成的，所以会造成依赖，<br />
&nbsp;&nbsp; 幸运的是重载这两个操作符就是重载分配内存的部分，所以我们只需要用malloc/free简<br />
&nbsp;&nbsp; 单的重载这两个操作符就ok了<br />
3. 纯虚函数<br />
&nbsp;&nbsp; 使用继承和虚函数都是没问题的（竟然没有依赖rtti，需要继续研究），但纯虚函数是<br />
&nbsp;&nbsp; 不行的，这个估计跟实现有关。最简单的方法就是将所用的纯虚函数改为虚函数再添加<br />
&nbsp;&nbsp; 默认实现。<br />
4. exception<br />
&nbsp;&nbsp; 这是最麻烦的部分，如果exception用的不多，直接将exception作为返回值返回了结<br />
&nbsp;&nbsp; （原来有返回值的放到输出参数里），每次调用check一下，根据原来代码中的逻辑要么<br />
&nbsp;&nbsp; 返回exception（没有catch住该exception），要么做catch中的事。理论上是没问题的<br />
&nbsp;&nbsp; 就是麻烦点，代码ugly点，可能再用点goto也没啥大问题。<br />
&nbsp;&nbsp; 这里要介绍的是另一种方法，通过使用setjmp和longjmp实现exception机制，再利用宏<br />
&nbsp;&nbsp; 替换原来代码中的try throw catch，详细的就不写了，我也是从网上看到的参见：<br />
&nbsp;&nbsp; <a title="Exception Handling in C without C++" href="http://www.on-time.com/ddj0011.htm">Exception Handling in C without C++</a><br />
&nbsp;&nbsp; <a title="cexcept" href="http://www.nicemice.net/cexcept">cexcept</a>：sourceforge上的开源项目<br />
&nbsp;&nbsp; 看了就能明白，但要实现完整的exception机制还是有难度的，包括try catch的嵌<br />
&nbsp;&nbsp; 套，exception的继承，多catch等。我们现在也没能实现多catch，宏的能力还是有限啊。<br />
5. rtti<br />
&nbsp;&nbsp; 这是C++特用的东西，严重依赖于stdlibc++.so，凡是动态的类型判断都是要禁止<br />
&nbsp;&nbsp; 的，catch为了判断exception的类型就会使用到rtti，dynmaic_cast也会有同样的问<br />
&nbsp;&nbsp; 题，typeid之类的东西更是永不得的。<br />
6. 编译参数<br />
&nbsp;&nbsp; 当你完全完成了上面的工作，基本上就大功告成了，不过现代的编译器那是相当的聪明，在<br />
&nbsp;&nbsp; 背后为我们默默无闻的做了很多事情，比如对于c++的代码会默认帮你生成处理<br />
&nbsp;&nbsp; exception的代码，所以需要用 -fno-exceptions 来防止这样的事情发生，然而这还不<br />
&nbsp;&nbsp; 够，-fno-exceptions 和 -fno-rtti 必须是要同时使用的，只使用 -fno-exceptions只<br />
&nbsp;&nbsp; 能得到个半吊子的结果：依然会有rtti的代码生成（不知道gcc那帮人是怎么想的）。<br />
&nbsp;&nbsp; 你以为终于可以结束了吗？<br />
<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">&nbsp;(your_gcc_version&nbsp;</span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">3.4</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">6</span><span style="color: rgb(0, 0, 0);">)&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;goHome();<br />
&nbsp;&nbsp;&nbsp;&nbsp;happyEnding();<br />
}&nbsp;</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;听我慢慢道来();<br />
}</span></div>
&nbsp;&nbsp; 在gcc 3.4.6 以上版本会为local static生成保证线程安全的代码，不幸的是这些代码<br />
&nbsp;&nbsp; 是依赖于stdlibc++.so的，所以我们要禁止他们！！！请使用<br />
&nbsp;&nbsp; -fno-threadsafe-statics，并确保这些static代码是线程安全的<br />
<br />
终于写完了，估计没有人会再有这样奇怪的需求了，写在这里留作纪念。<br />
&nbsp; &nbsp;<br />
另外提一下模板是可以使用的，因为只是在编译时生成代码，不关标准库的事。<br />
<br />
<img src ="http://www.blogjava.net/JBahamut/aggbug/218866.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JBahamut/" target="_blank">JBahamut</a> 2008-07-31 00:05 <a href="http://www.blogjava.net/JBahamut/archive/2008/07/31/218866.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>读 Erlang mailing list 有感</title><link>http://www.blogjava.net/JBahamut/archive/2008/05/28/203362.html</link><dc:creator>JBahamut</dc:creator><author>JBahamut</author><pubDate>Tue, 27 May 2008 16:32:00 GMT</pubDate><guid>http://www.blogjava.net/JBahamut/archive/2008/05/28/203362.html</guid><wfw:comment>http://www.blogjava.net/JBahamut/comments/203362.html</wfw:comment><comments>http://www.blogjava.net/JBahamut/archive/2008/05/28/203362.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/JBahamut/comments/commentRss/203362.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JBahamut/services/trackbacks/203362.html</trackback:ping><description><![CDATA[多谢 erlang-china 的提醒，今天从 mailing list 中翻出了关于RPC的讨论，深有感触 -- 牛人就是牛人！！！<br />
<br />
关于 RPC is bad 的主要论点如下：<br />
<pre wrap=""><span style="font-size: 18pt;"><span style="color: red;">The fundamental problem of RPC, which is trying to make remote calls look local, is based on essentially trying to ignore the problems covered by the fallacies or trying to pretend they don't even exist</span></span><br />
<br />
严重同意，理由如下：<br />
<br />
<strong>Network partitions are real, timeouts are real, remote host and service<br />
crashes are real, the need for piecemeal system upgrade and handling<br />
version differences between systems is real, etc. The distributed<br />
systems programmer </strong><strong>*must* deal with these and other issues because<br />
they affect different applications very differently.</strong><br />
<br />
这一点非常赞同，也深有同感。在做FileServer的时候所有的节点都是通过RMI进行通讯，最初使用RMI的目的就是<br />
简化网络部分的开发，对于一般的开发人员无须理解RMI，动态代理，只需要像使用本地方法一样就可以访问远程<br />
节点。这种方案确实很好的隐藏了网络细节，使网络对开发人员完全透明，但有个问题始终无法很好的处理：<strong>异常。<br />
</strong>网络错误是随时都有可能发生的，对于不同的错误需要根据环境和需要做具体的处理，比如，多试几次，尝试下一个<br />
节点，对于无法处理的还可以直接抛出。而这种策略的选择和使用必须由应用逻辑层完成，可是应用层假设是不知道<br />
网络存在的，它甚至无法知道自己调用的方法中哪个是远程调用，哪个是本地调用。这种矛盾从根本上说明了网络的<br />
复杂性和多样性是开发分布式应用的程序员必须面对的，是逃不掉的，要直面这惨淡的人生T_T<br />
<br />
下面阐述了使用类型系统的缺陷：<br />
Such systems also have problems with impedance mismatch between the<br />
IDL and whatever languages you're translating it to. If the IDL is<br />
minimal so that it can be used with a wide variety of programming<br />
languages, it means advanced features of well-stocked languages like<br />
Java and C++ can't be used. OTOH if you make the IDL more powerful so<br />
that it's closer to such languages, then translating it to C or other<br />
more basic languages becomes quite difficult.<br />
On top of all that, no matter how you design the IDL type system, all <br />
the types won't -- indeed, can't -- map cleanly into every desired <br />
programming language.<br />
<br />
类型系统一直都在进化，从弱到强到动态，你相信会有一种类型系统可以和所有<br />
的其他语言进行完美的映射吗？如果真存在，类型系统的进化就毫无意义了。定义<br />
一个新的语言，然后映射到其他语言，最后号称&#8220;我是跨语言跨平台的！&#8221;，这种<br />
解决问题的方式根本就是有问题的。WSDL使用XML描述，有着更好的可扩展性，只是<br />
酒瓶换新酒，根烂了，再换也没用。<br />
<br />
Ultimately, RPC is a leaky abstraction. It can't hide what it tries to<br />
hide, and because of that, it can easily make the overall problem more<br />
difficult to deal with by adding a lot of accidental complexity.<br />
<br />
下面对为什么 message queuing system 适合分布式系统做了很好的总结：<br />
Message queuing systems work well because (in no particular<br />
order):<br />
<br />
* they don't pretend to be programming language procedure or method<br />
calls, so they avoid the associated impedance mismatch problems<br />
* they don't try to hide distributed systems issues<br />
* coupling is low -- drop a message into a queue here, pick up a<br />
message from a queue there<br />
* queues can be persistent, or more generally, delivery guarantees can<br />
be varied as needed<br />
* asynchrony<br />
* payloads need not conform to some made-up IDL type system<br />
* getting two different messaging systems to interoperate is easier<br />
than getting two different RPC or distributed object systems to<br />
interoperate<br />
</pre>
这和我在自己的硕士论文中的观点有些相似：完全使用消息机制进行构件间的通讯。构件可以<br />
是分布式的或在容器中的，基于消息的通讯都是完全适用的。对于网络应用同样如此。对于流行<br />
的网络协议，HTTP，FTP，LDAP 等等都是消息式的，完全经历了时间的考验。<br />
<br />
<img src ="http://www.blogjava.net/JBahamut/aggbug/203362.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JBahamut/" target="_blank">JBahamut</a> 2008-05-28 00:32 <a href="http://www.blogjava.net/JBahamut/archive/2008/05/28/203362.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Two very little tools for git</title><link>http://www.blogjava.net/JBahamut/archive/2008/05/27/203081.html</link><dc:creator>JBahamut</dc:creator><author>JBahamut</author><pubDate>Mon, 26 May 2008 16:57:00 GMT</pubDate><guid>http://www.blogjava.net/JBahamut/archive/2008/05/27/203081.html</guid><wfw:comment>http://www.blogjava.net/JBahamut/comments/203081.html</wfw:comment><comments>http://www.blogjava.net/JBahamut/archive/2008/05/27/203081.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JBahamut/comments/commentRss/203081.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JBahamut/services/trackbacks/203081.html</trackback:ping><description><![CDATA[Fist one, I call it git2svn. We know 'git diff' has the format like this:<br />
<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: rgb(0, 0, 0);">diff&nbsp;</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">git&nbsp;a</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">hello.git&nbsp;b</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">hello.git<br />
index&nbsp;808c280..3e60fff&nbsp;</span><span style="color: rgb(0, 0, 0);">100644</span><span style="color: rgb(0, 0, 0);"><br />
</span><span style="color: rgb(0, 0, 0);">---</span><span style="color: rgb(0, 0, 0);">&nbsp;a</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">hello.git<br />
</span><span style="color: rgb(0, 0, 0);">+++</span><span style="color: rgb(0, 0, 0);">&nbsp;b</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">hello.git<br />
@@&nbsp;</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);">3</span><span style="color: rgb(0, 0, 0);">&nbsp;@@<br />
&nbsp;</span><span style="color: rgb(0, 0, 0);">111111</span><span style="color: rgb(0, 0, 0);"><br />
&nbsp;sdfsfsdf<br />
</span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);">111</span><span style="color: rgb(0, 0, 0);"><br />
</span></div>
<br />
It's different with svn diff output format which we are familiar with, although patch can work with this format, but it would be strange if we applied a patch with git format to a open source project which use SVN as source repository. That's why i wrote git2svn, which convert git diff format to svn diff format. It's very very simple, only one line:<br />
<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: rgb(0, 0, 0);">#</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">bin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">sh<br />
<br />
#&nbsp;convert&nbsp;git&nbsp;diff&nbsp;output&nbsp;to&nbsp;svn&nbsp;format:<br />
#&nbsp;git&nbsp;diff&nbsp;like:<br />
#<br />
#&nbsp;diff&nbsp;</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">git&nbsp;a</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">hello.git&nbsp;b</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">hello.git<br />
#&nbsp;index&nbsp;90d2950..808c280&nbsp;</span><span style="color: rgb(0, 0, 0);">100644</span><span style="color: rgb(0, 0, 0);"><br />
#&nbsp;</span><span style="color: rgb(0, 0, 0);">---</span><span style="color: rgb(0, 0, 0);">&nbsp;a</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">hello.git<br />
#&nbsp;</span><span style="color: rgb(0, 0, 0);">+++</span><span style="color: rgb(0, 0, 0);">&nbsp;b</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">hello.git<br />
#<br />
#&nbsp;after&nbsp;converting,&nbsp;it</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">s&nbsp;our&nbsp;familiar&nbsp;svn&nbsp;diff&nbsp;format</span><span style="color: rgb(0, 0, 0);"><br />
</span><span style="color: rgb(0, 0, 0);">#<br />
#&nbsp;Index:&nbsp;hello.git<br />
#&nbsp;</span><span style="color: rgb(0, 0, 0);">=====================================================================</span><span style="color: rgb(0, 0, 0);"><br />
#&nbsp;</span><span style="color: rgb(0, 0, 0);">---</span><span style="color: rgb(0, 0, 0);">&nbsp;hello.git<br />
#&nbsp;</span><span style="color: rgb(0, 0, 0);">+++</span><span style="color: rgb(0, 0, 0);">&nbsp;hello.git<br />
#<br />
#&nbsp;It</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">s&nbsp;useful&nbsp;to&nbsp;apply&nbsp;patch&nbsp;to&nbsp;project&nbsp;using&nbsp;svn&nbsp;as&nbsp;their&nbsp;repository&nbsp;and</span><span style="color: rgb(0, 0, 0);"><br />
</span><span style="color: rgb(0, 0, 0);">#&nbsp;you&nbsp;use&nbsp;git&nbsp;</span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">&nbsp;your&nbsp;local&nbsp;work<br />
<br />
sed&nbsp;</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">e&nbsp;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">/^[iI]ndex/s/^index.*/=====================================================================/</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">e&nbsp;</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">/^diff/s/^diff&nbsp;--g\</span><span style="color: rgb(0, 0, 0);"><br />
</span><span style="color: rgb(0, 0, 0);">it&nbsp;a\</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">Index:&nbsp;/'&nbsp;-e&nbsp;'/^Index:/s/&nbsp;b\/.*</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">'&nbsp;-e&nbsp;'/^---&nbsp;a\</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">s/---&nbsp;a\</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">---&nbsp;/'&nbsp;-e&nbsp;'/^+++&nbsp;b\</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">s/+++&nbsp;b\</span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">+++&nbsp;/'&nbsp;$*<br />
</span></div>
<br />
Another, can't call it as 'tool' exactly, I think, just a convenient way or shortcut to query which files are changed in one or between two commits and their status, like 'svn diff --summarize':<br />
<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: rgb(0, 0, 0);">#</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">&nbsp;</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">bin</span><span style="color: rgb(0, 0, 0);">/</span><span style="color: rgb(0, 0, 0);">sh<br />
<br />
#summary&nbsp;changed&nbsp;files&nbsp;which&nbsp;status,&nbsp;in&nbsp;one&nbsp;commit&nbsp;or&nbsp;between&nbsp;two&nbsp;commits<br />
<br />
git</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">diff</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">tree&nbsp;</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">r&nbsp;</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">name</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">status&nbsp;</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">pretty</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">format:</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">%Cgreen%s&nbsp;&nbsp;&nbsp;&nbsp;%CblueSHA1:&nbsp;%H%Creset</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">&nbsp;$</span><span style="color: rgb(0, 0, 0);">*</span><span style="color: rgb(0, 0, 0);"><br />
</span></div>
<br />
You can also do it like this:<br />
<div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br />
<br />
Code highlighting produced by Actipro CodeHighlighter (freeware)<br />
http://www.CodeHighlighter.com/<br />
<br />
--><span style="color: rgb(0, 0, 0);">alias&nbsp;git</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">diff</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">tree&nbsp;</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">r&nbsp;</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">name</span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);">status&nbsp;</span><span style="color: rgb(0, 0, 0);">--</span><span style="color: rgb(0, 0, 0);">pretty</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">format:</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">%Cgreen%s&nbsp;&nbsp;&nbsp;&nbsp;%CblueSHA1:&nbsp;%H%Creset</span><span style="color: rgb(0, 0, 0);">" git-changed-files<br />
</span></div>
and add this line to your $HOME/.bashrc<br />
<br />
<img src ="http://www.blogjava.net/JBahamut/aggbug/203081.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JBahamut/" target="_blank">JBahamut</a> 2008-05-27 00:57 <a href="http://www.blogjava.net/JBahamut/archive/2008/05/27/203081.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Some very useful git commands</title><link>http://www.blogjava.net/JBahamut/archive/2008/05/27/203074.html</link><dc:creator>JBahamut</dc:creator><author>JBahamut</author><pubDate>Mon, 26 May 2008 16:29:00 GMT</pubDate><guid>http://www.blogjava.net/JBahamut/archive/2008/05/27/203074.html</guid><wfw:comment>http://www.blogjava.net/JBahamut/comments/203074.html</wfw:comment><comments>http://www.blogjava.net/JBahamut/archive/2008/05/27/203074.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JBahamut/comments/commentRss/203074.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JBahamut/services/trackbacks/203074.html</trackback:ping><description><![CDATA[<strong>checkout &lt;branch&gt;</strong><br />
switch branch<br />
<strong>checkout -b &lt;new branch&gt;</strong><br />
create new branch and switch to it<br />
<strong>checkout &lt;file&gt;</strong><br />
checkout file in HEAD and overwrite local file (NOTE: use it carefully, maybe lost your local work)<br />
<br />
<strong>diff</strong><br />
diff index and working copy<br />
<strong>diff --cached</strong><br />
diff index and last commit, which is what you will commit without '-a' option<br />
<br />
<strong>log</strong><br />
display commit logs<br />
<strong>log -p</strong><br />
include commit diff<br />
<strong>log --first-parent</strong><br />
follow only the first parent commit upon seeing a merge commit. This option gives a better overview of the evolution of a particular branch.<br />
<strong>log -S'string' </strong><br />
commits which add or remove data matching the 'string'<br />
<strong>log -r --name-status</strong><br />
show changed files with full path and status, just like 'svn diff --summarize'<br />
<br />
<strong>branch&nbsp;&nbsp; &nbsp;</strong>&nbsp;&nbsp;&nbsp; <br />
display all branches, current branch started with *<br />
<strong>branch -r</strong><br />
display remote branches<br />
<strong>merge --no-commit</strong>&nbsp;&nbsp;&nbsp; <br />
not commit immediately, all changes write to index<br />
<br />
<strong>reset --mixed&nbsp;&nbsp; </strong>&nbsp;&nbsp;&nbsp;&nbsp; <br />
default, adjust HEAD and clear index, changes in working copy is reserved, and changes between original HEAD and current HEAD will write to working copy<br />
<strong>reset --soft&nbsp;</strong>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; <br />
adjust HEAD, changes between original HEAD and current HEAD will write to index<br />
<strong>reset --hard&nbsp;&nbsp; </strong>&nbsp;&nbsp;&nbsp;&nbsp; <br />
adjust HEAD, and clear index and working copy (NOTES: only use it when you are sure that the changes in index, working copy and changes reset in history will never be used)<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<img src ="http://www.blogjava.net/JBahamut/aggbug/203074.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JBahamut/" target="_blank">JBahamut</a> 2008-05-27 00:29 <a href="http://www.blogjava.net/JBahamut/archive/2008/05/27/203074.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>感谢blogjava</title><link>http://www.blogjava.net/JBahamut/archive/2007/10/07/150936.html</link><dc:creator>JBahamut</dc:creator><author>JBahamut</author><pubDate>Sun, 07 Oct 2007 15:10:00 GMT</pubDate><guid>http://www.blogjava.net/JBahamut/archive/2007/10/07/150936.html</guid><wfw:comment>http://www.blogjava.net/JBahamut/comments/150936.html</wfw:comment><comments>http://www.blogjava.net/JBahamut/archive/2007/10/07/150936.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.blogjava.net/JBahamut/comments/commentRss/150936.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JBahamut/services/trackbacks/150936.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp; 感谢blogjava，大半年没更新了，我的blog竟然还可以登录<img src="/CuteSoft_Client/CuteEditor/images/emdgust.gif" align="absmiddle" border="0"  alt="" /><br />
&nbsp;&nbsp;&nbsp; 发现自己真的是很懒啊，总是没法坚持写些东西，从本质上说我还是个不擅长写作的<br />
程序员，正确的表达自己比写出正确的程序要困难许多，表达出能让别让共鸣的东西<br />
更是难上加难。<br />
&nbsp;&nbsp;&nbsp; 但是，文章还是必须要是会写的，牛皮也是必须要会吹的。神啊，请允许我再一次许诺吧，<br />
试着写点东西吧。<br />
<br />
<img src ="http://www.blogjava.net/JBahamut/aggbug/150936.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JBahamut/" target="_blank">JBahamut</a> 2007-10-07 23:10 <a href="http://www.blogjava.net/JBahamut/archive/2007/10/07/150936.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>惊喜！！发现了自己的blog-_-!!!</title><link>http://www.blogjava.net/JBahamut/archive/2006/12/26/90171.html</link><dc:creator>JBahamut</dc:creator><author>JBahamut</author><pubDate>Tue, 26 Dec 2006 13:29:00 GMT</pubDate><guid>http://www.blogjava.net/JBahamut/archive/2006/12/26/90171.html</guid><wfw:comment>http://www.blogjava.net/JBahamut/comments/90171.html</wfw:comment><comments>http://www.blogjava.net/JBahamut/archive/2006/12/26/90171.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/JBahamut/comments/commentRss/90171.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/JBahamut/services/trackbacks/90171.html</trackback:ping><description><![CDATA[整理收藏夹竟然发现了自己的blog-_-!!<br /><br />
翻翻发现最新的文章竟然是半年以前了，还号称“不再偷懒了”，实在惭愧啊。项目一忙起来<br />
确实是顾不上了，回来还有看动画片的重任在身自然更是无暇顾及了，说到底自己终久不是<br />
喜欢码字的人。不过翻翻以前写的东西还是蛮有意思的，有些东西回头看看还是很有好处<br />
的，于是决定还是写写吧，哪怕下一次会是半年以后^_^<br /><br />
最近工作搞定了，FileServer也初见成果，正在整理代码，是时候好好整理一下前段时间工作的体会了，第一次组织项目还是有很多感想可写的，请各位看官（如果有的话）敬请期待吧！！！<br /><br /><img src ="http://www.blogjava.net/JBahamut/aggbug/90171.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/JBahamut/" target="_blank">JBahamut</a> 2006-12-26 21:29 <a href="http://www.blogjava.net/JBahamut/archive/2006/12/26/90171.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>