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

<channel>
	<title>Aiur - ZelluX 的技术博客 &#187; Tools</title>
	<atom:link href="http://techblog.iamzellux.com/category/tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://techblog.iamzellux.com</link>
	<description>Security, Kernel, Virtualization, Programming Languages</description>
	<lastBuildDate>Fri, 14 May 2010 03:47:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>利用HTTPS代理访问GitHub</title>
		<link>http://techblog.iamzellux.com/2010/05/git-through-https-proxy/</link>
		<comments>http://techblog.iamzellux.com/2010/05/git-through-https-proxy/#comments</comments>
		<pubDate>Fri, 14 May 2010 03:46:21 +0000</pubDate>
		<dc:creator>zellux</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[Proxy]]></category>

		<guid isPermaLink="false">http://techblog.iamzellux.com/?p=62841</guid>
		<description><![CDATA[网上找了不少设置方法，终于翻出来一个可行的，和大家分享下。]]></description>
			<content:encoded><![CDATA[<p>网上找了不少设置方法，终于翻出来一个可行的，和大家分享下。<!--more--!></p>
<p>1. 安装corkscrew，ArchLinux和Ubuntu的源里就有，也可以从<a href="http://www.agroman.net/corkscrew/" target="_blank">http://www.agroman.net/corkscrew/</a>下载源码编译一个。</p>
<p>2. 修改~/.ssh/config</p>
<pre class="brush: bash">Host gitproxy
User git
Hostname ssh.github.com
Port 443
ProxyCommand corkscrew proxy.example.com 3128 %h %p
IdentityFile /home/username/.ssh/id_rsa
</pre>
<p>修改其中的proxy.example.com和3128为代理IP和端口，如果代理需要帐号密码，就在ProxyCommand这一行的最后加上密码文件，内容为<strong>用户名:密码</strong>。</p>
<p>IdentitiFile的参数是对应于GitHub中帐号的私钥地址。</p>
<p>3. 使用git@gitproxy作为新地址访问GitHub即可，例如要clone git@github.com:foo/bar.git，执行git clone git@gitproxy:foo/bar.git即可。</p>
<p>原文地址：<a href="http://www.wetware.co.nz/blog/2010/03/cant-access-github-behind-proxy-or-firewall/" target="_blank">http://www.wetware.co.nz/blog/2010/03/cant-access-github-behind-proxy-or-firewall/</a></p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">Host gitproxy<br />
User git<br />
Hostname ssh.github.com<br />
Port 443<br />
ProxyCommand /usr/local/bin/corkscrew proxy.example.com 3128 %h %p<br />
IdentityFile /home/jordan/.ssh/id_rsa</div>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>2010/02/14 -- <a href="http://techblog.iamzellux.com/2010/02/gitk-font/" title="优化gitk的字体显示">优化gitk的字体显示</a></li><li>2010/01/25 -- <a href="http://techblog.iamzellux.com/2010/01/git-completion/" title="Git命令行自动补全">Git命令行自动补全</a></li><li>2009/11/10 -- <a href="http://techblog.iamzellux.com/2009/11/git-modify-specified-commit/" title="在git中修改之前提交的内容">在git中修改之前提交的内容</a></li><li>2009/05/26 -- <a href="http://techblog.iamzellux.com/2009/05/install-git-gitoss-gitweb-in-archlinux/" title="ArchLinux下安装git, gitosis, gitweb服务">ArchLinux下安装git, gitosis, gitweb服务</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://techblog.iamzellux.com/2010/05/git-through-https-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>记录GNU screen中的历史命令</title>
		<link>http://techblog.iamzellux.com/2010/03/keep-gnu-screen-history/</link>
		<comments>http://techblog.iamzellux.com/2010/03/keep-gnu-screen-history/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 16:14:57 +0000</pubDate>
		<dc:creator>zellux</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[screen]]></category>

		<guid isPermaLink="false">http://techblog.iamzellux.com/?p=62787</guid>
		<description><![CDATA[GNU screen中执行的历史命令保存在内存中，默认情况下并不会像在bash中直接执行的命令一样保存在.bash_history中，这在某些场合下带来了一定的不便。
]]></description>
			<content:encoded><![CDATA[<p>GNU screen中执行的历史命令保存在内存中，默认情况下并不会像在bash中直接执行的命令一样保存在.bash_history中，这在某些场合下带来了一定的不便。</p>
<p>在superuser上看到一个<a href="http://superuser.com/questions/37576/can-history-files-be-unified-in-" target="_blank">解决方法</a>，指定历史文件的读写方式为追加，并在每次命令行提示符显示的时候，自动更新bash的历史命令记录。要实现这个方法很简单，只要在.bashrc中加入下面两行代码即可</p>
<pre class="brush: bash">shopt -s histappend
export PROMPT_COMMAND="history -a; history -n"</pre>
<p>另外如果之前设置过PROMPT_COMMAND的话，只要在<span style="text-decoration: underline;">history -a</span>前加入<span style="text-decoration: underline;">$PROMPT_COMMAND;</span> 就行了。</p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>2010/01/21 -- <a href="http://techblog.iamzellux.com/2010/01/grep-trick/" title="使用grep查找进程的技巧">使用grep查找进程的技巧</a></li><li>2008/10/23 -- <a href="http://techblog.iamzellux.com/2008/10/archlinux-svn-server/" title="ArchLinux中架设svn服务器">ArchLinux中架设svn服务器</a></li><li>2008/09/24 -- <a href="http://techblog.iamzellux.com/2008/09/the-slub-allocator/" title="The SLUB allocator">The SLUB allocator</a></li><li>2008/08/15 -- <a href="http://techblog.iamzellux.com/2008/08/why-does-switch_to-need-three-arguments/" title="switch_to宏的第三个参数">switch_to宏的第三个参数</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://techblog.iamzellux.com/2010/03/keep-gnu-screen-history/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>优化gitk的字体显示</title>
		<link>http://techblog.iamzellux.com/2010/02/gitk-font/</link>
		<comments>http://techblog.iamzellux.com/2010/02/gitk-font/#comments</comments>
		<pubDate>Sun, 14 Feb 2010 11:08:35 +0000</pubDate>
		<dc:creator>zellux</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Fonts]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://techblog.iamzellux.com/?p=62763</guid>
		<description><![CDATA[gitk是用Tcl/Tk写的工具，默认使用Tk 8.4，不支持抗锯齿，因此字体显示很难看。好在Tk 8.5支持了部分抗锯齿字体，修改gitk使用Tk 8.5后显示效果会好一点。
]]></description>
			<content:encoded><![CDATA[<p>gitk是用Tcl/Tk写的工具，默认使用Tk 8.4，不支持抗锯齿，因此字体显示很难看。好在Tk 8.5支持了部分抗锯齿字体，修改gitk使用Tk 8.5后显示效果会好一点。</p>
<p>以Ubuntu为例，安装tk8.5包后，编辑/usr/bin/gitk文件，把开头调用wish的那行</p>
<pre class="brush: bash; gutter: false;">exec /usr/bin/wish "$0" -- "$@"</pre>
<p>改成</p>
<pre class="brush: bash; gutter: false;">exec /usr/bin/wish8.5 "$0" -- "$@"</pre>
<p>这样就能在gitk中开启抗锯齿了，虽然效果还不是很好。另外<a href="http://digilander.libero.it/mcostalba/" target="_blank">qgit</a>也是一个不错的选择。</p>
<p>参考链接：<a href="http://navarra.ca/?p=44" target="_blank">http://navarra.ca/?p=44</a></p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>2010/05/14 -- <a href="http://techblog.iamzellux.com/2010/05/git-through-https-proxy/" title="利用HTTPS代理访问GitHub">利用HTTPS代理访问GitHub</a></li><li>2010/01/25 -- <a href="http://techblog.iamzellux.com/2010/01/git-completion/" title="Git命令行自动补全">Git命令行自动补全</a></li><li>2009/11/10 -- <a href="http://techblog.iamzellux.com/2009/11/git-modify-specified-commit/" title="在git中修改之前提交的内容">在git中修改之前提交的内容</a></li><li>2009/05/26 -- <a href="http://techblog.iamzellux.com/2009/05/install-git-gitoss-gitweb-in-archlinux/" title="ArchLinux下安装git, gitosis, gitweb服务">ArchLinux下安装git, gitosis, gitweb服务</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://techblog.iamzellux.com/2010/02/gitk-font/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WPtouch</title>
		<link>http://techblog.iamzellux.com/2010/02/wptouch/</link>
		<comments>http://techblog.iamzellux.com/2010/02/wptouch/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 05:52:23 +0000</pubDate>
		<dc:creator>zellux</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[iPod Touch]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://techblog.iamzellux.com/?p=62753</guid>
		<description><![CDATA[这是一个让wordpress对移动设备更友好的插件，下载地址在<a href="http://wordpress.org/extend/plugins/wptouch/">http://wordpress.org/extend/plugins/wptouch/</a>，当然也可以在wordpress后台查找wptouch并安装。
]]></description>
			<content:encoded><![CDATA[<p>这是一个让wordpress对移动设备更友好的插件，下载地址在<a href="http://wordpress.org/extend/plugins/wptouch/">http://wordpress.org/extend/plugins/wptouch/</a>，当然也可以在wordpress后台查找wptouch并安装。</p>
<p>在iPod Touch上的效果图</p>
<p><a href="http://techblog.iamzellux.com/wp-content/uploads/2010/02/wptouch1.png" rel="shadowbox[post-62753];player=img;"><img class="alignnone size-medium wp-image-62759" title="wptouch1" src="http://techblog.iamzellux.com/wp-content/uploads/2010/02/wptouch1-200x300.png" alt="" width="200" height="300" /></a> <a href="http://techblog.iamzellux.com/wp-content/uploads/2010/02/wptouch2.png" rel="shadowbox[post-62753];player=img;"><img class="alignnone size-medium wp-image-62760" title="wptouch2" src="http://techblog.iamzellux.com/wp-content/uploads/2010/02/wptouch2-200x300.png" alt="" width="200" height="300" /></a></p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>2009/10/21 -- <a href="http://techblog.iamzellux.com/2009/10/pocket-informant/" title="推荐个iPhone/iPod Touch上的时间管理工具">推荐个iPhone/iPod Touch上的时间管理工具</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://techblog.iamzellux.com/2010/02/wptouch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ecb和cscope的结合使用</title>
		<link>http://techblog.iamzellux.com/2010/02/bind-cscope-to-ecb/</link>
		<comments>http://techblog.iamzellux.com/2010/02/bind-cscope-to-ecb/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 15:30:07 +0000</pubDate>
		<dc:creator>zellux</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[cscope]]></category>
		<category><![CDATA[ECB]]></category>
		<category><![CDATA[Emacs]]></category>

		<guid isPermaLink="false">http://techblog.iamzellux.com/?p=62712</guid>
		<description><![CDATA[前几天<a href="http://techblog.iamzellux.com/2010/02/ecb-beginning/" target="_blank">试用了下ECB</a>，非常喜欢它的定义列表和文件浏览历史的功能。但是却发现了另外一个问题：使用ECB之前我把整个窗口分成左右两块，左边是代码，右边是cscope的查找结果，现在开启ECB之后就不能再切一块窗口给cscope用了。
]]></description>
			<content:encoded><![CDATA[<p>前几天<a href="http://techblog.iamzellux.com/2010/02/ecb-beginning/" target="_blank">试用了下ECB</a>，非常喜欢它的定义列表和文件浏览历史的功能。但是却发现了另外一个问题：使用ECB之前我把整个窗口分成左右两块，左边是代码，右边是cscope的查找结果，现在开启ECB之后就不能再切一块窗口给cscope用了。</p>
<p>感谢<a href="http://stackoverflow.com/questions/2190062/how-to-remove-directory-window-and-add-a-cscope-window-in-emacs-ecb/2192059#2192059" target="_blank">stackoverflow上的sanitynic</a>，给出了自定义ECB窗口的参考。现在俺终于能把cscope窗口绑定到屏幕左下角啦。</p>
<p><a href="http://techblog.iamzellux.com/wp-content/uploads/2010/02/Screenshot-emacs@zellux-laptop-1.png" rel="shadowbox[post-62712];player=img;"><img class="alignnone size-medium wp-image-62726" title="Screenshot-emacs@zellux-laptop-1" src="http://techblog.iamzellux.com/wp-content/uploads/2010/02/Screenshot-emacs@zellux-laptop-1-300x170.png" alt="" width="300" height="170" /></a></p>
<p>自定义ECB layout其实也挺方便的，上图对应的配置为</p>
<pre class="brush: lisp">(ecb-layout-define "my-cscope-layout" left nil
                   (ecb-set-methods-buffer)
                   (ecb-split-ver 0.5 t)
                   (other-window 1)
                   (ecb-set-history-buffer)
                   (ecb-split-ver 0.25 t)
                   (other-window 1)
                   (ecb-set-cscope-buffer))

(defecb-window-dedicator ecb-set-cscope-buffer " *ECB cscope-buf*"
                         (switch-to-buffer "*cscope*"))

(setq ecb-layout-name "my-cscope-layout")

;; Disable buckets so that history buffer can display more entries
(setq ecb-history-make-buckets 'never)</pre>
<p>my-cscope-layout这个layout左边窗口分为三部分，最上面的函数列表占一半高度，中间为历史文件列表，下面为cscope的查找结果，它们各占四分之一的高度。</p>
<p>另外再简单提下cscope插件的安装和配置，使用前需确认当前系统已经安装了cscope，另外要有cscope-indexer这个脚本。在cscope/contrib目录下找到一个xcscope.el，复制到Emacs的插件目录中，并在Emacs初始化文件中加入</p>
<pre class="brush: lisp">(require 'xcscope)</pre>
<p>即可。某些发行版的包里面似乎没有cscope-indexer和xcscope.el，直接从网上下一个好了。</p>
<p>几个常用的快捷键：<br />
<code>C-c s I</code> 建立cscope索引<br />
<code>C-c s a</code> 设置搜索目录<br />
<code>C-c s d</code> 查找定义<br />
<code>C-c s s</code> 查找字符串<br />
<code>C-c s c</code> 查找调用者<br />
<code>C-c s n</code> 下一个查找结果<br />
<code>C-c s p</code> 上一个查找结果<br />
更多的快捷键可以通过<code>C-h b</code>在cscope-minor-mode区找到。</p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>2010/02/02 -- <a href="http://techblog.iamzellux.com/2010/02/ecb-beginning/" title="ECB的简单配置和使用">ECB的简单配置和使用</a></li><li>2010/02/03 -- <a href="http://techblog.iamzellux.com/2010/02/configuring-semantic/" title="为特定的项目配置semantic">为特定的项目配置semantic</a></li><li>2009/12/01 -- <a href="http://techblog.iamzellux.com/2009/12/emacs-set-styles-by-projects/" title="Emacs中对不同项目指定不同的风格">Emacs中对不同项目指定不同的风格</a></li><li>2009/06/02 -- <a href="http://techblog.iamzellux.com/2009/06/emacs-company-mode/" title="Company-mode: Emacs自动补全">Company-mode: Emacs自动补全</a></li><li>2009/05/04 -- <a href="http://techblog.iamzellux.com/2009/05/caps-lock-to-ctrl/" title="给你的小指减负：将Caps Lock键改成Ctrl">给你的小指减负：将Caps Lock键改成Ctrl</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://techblog.iamzellux.com/2010/02/bind-cscope-to-ecb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>为特定的项目配置semantic</title>
		<link>http://techblog.iamzellux.com/2010/02/configuring-semantic/</link>
		<comments>http://techblog.iamzellux.com/2010/02/configuring-semantic/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 07:30:46 +0000</pubDate>
		<dc:creator>zellux</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[cedet]]></category>
		<category><![CDATA[Emacs]]></category>

		<guid isPermaLink="false">http://techblog.iamzellux.com/?p=62692</guid>
		<description><![CDATA[semantic是<a href="http://cedet.sourceforge.net/" target="_blank">cedet</a>的组件之一，它可以对程序做语义分析，结合<a href="http://techblog.iamzellux.com/2009/06/emacs-company-mode/" target="_blank">company</a>等其他插件，可以实现自动补全菜单等功能。
]]></description>
			<content:encoded><![CDATA[<p>semantic是<a href="http://cedet.sourceforge.net/" target="_blank">cedet</a>的组件之一，它可以对程序做语义分析，结合<a href="http://techblog.iamzellux.com/2009/06/emacs-company-mode/" target="_blank">company</a>等其他插件，可以实现自动补全菜单等功能。</p>
<p>之前用semantic+company写MIT 6.828的lab时几乎不需要什么特殊的设置就能直接用了，这次拿来改Xen的代码的时候却出现了semantic无法找到符号定义的问题，究其原因在于MIT 6.828的目录结构相对简单，头文件都在inc/目录下，而Xen的头文件在多个目录下，而且做预处理时还要加上Makefile里定义的一些预定义宏。今天参考了<a href="http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html" target="_blank">Alex Ott的这篇文章</a>终于成功地让semantic支持Xen的代码分析了：</p>
<pre><a href="http://techblog.iamzellux.com/wp-content/uploads/2010/02/semantic.png" rel="shadowbox[post-62692];player=img;"><img title="semantic" src="http://techblog.iamzellux.com/wp-content/uploads/2010/02/semantic-300x213.png" alt="" width="300" height="213" /></a></pre>
<p>这里分享一下和项目相关的一些设置，semantic安装等问题请参考网上的其他文章。也可以参考我的配置文件<a href="http://code.google.com/p/zellux-emacs-conf/source/browse/my-cc-mode.el">http://code.google.com/p/zellux-emacs-conf/source/browse/my-cc-mode.el</a>，cscope ecb semantic和company等配置都在这个文件里了，不过有点混乱。</p>
<pre class="brush: lisp">;; Danimoth-specified configurations
(add-to-list 'semanticdb-project-roots "~/danimoth/xen")

(setq semanticdb-project-roots
      (list
       (expand-file-name "/")))

(setq danimoth-base-dir "/home/wyx/danimoth")

(add-to-list 'auto-mode-alist (cons danimoth-base-dir 'c++-mode))
(add-to-list 'auto-mode-alist (cons danimoth-base-dir 'c-mode))

(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat danimoth-base-dir "/xen/include/config.h"))
(add-to-list 'semantic-lex-c-preprocessor-symbol-file (concat danimoth-base-dir "/xen/include/asm-x86/config.h"))

(ede-cpp-root-project "Danimoth"
                      :name "Danimoth"
                      ;; Any file at root directory of the project
                      :file "~/danimoth/xen/Makefile"
                      ;; Relative to the project's root directory
                      :include-path '("/"
                                      "/include/asm-x86"
                                      "/include/xen"
                                      "/include/public"
                                      "/include/acpi"
                                      "/arch/x86/cpu/"
                                      )
                      ;; Pre-definds macro for preprocessing
                      :spp-table '(("__XEN__" . "")
                                   ))</pre>
<p>其中，/home/wyx/danimoth/xen是项目的主目录，xen/include/config.h和xen/include/asm-x86/config.h里定义了一些基本的宏。</p>
<p>接下来，ede-cpp-root-project指定了这个项目的其他信息：<br />
:file 指向项目主目录下任一一个存在的文件<br />
:include-path 指定头文件的所在目录<br />
:spp-table 给出了预处理时的使用的宏，通常是在Makefile里使用-DXXX定义的宏，例如这里的__XEN__。</p>
<p>配置好semantic后，可以用<code>M-x semantic-ia-complete-symbol</code>测试。如果Emacs能正确显示补全列表，这就说明semantic已经配置成功了。配合这个<a href="http://techblog.iamzellux.com/2009/06/emacs-company-mode/" target="_blank">简单的company设置</a>，就能用<code>Shift-Tab</code>显示类似图片中的自动补全菜单了。</p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>2010/02/07 -- <a href="http://techblog.iamzellux.com/2010/02/bind-cscope-to-ecb/" title="ecb和cscope的结合使用">ecb和cscope的结合使用</a></li><li>2010/02/02 -- <a href="http://techblog.iamzellux.com/2010/02/ecb-beginning/" title="ECB的简单配置和使用">ECB的简单配置和使用</a></li><li>2009/12/01 -- <a href="http://techblog.iamzellux.com/2009/12/emacs-set-styles-by-projects/" title="Emacs中对不同项目指定不同的风格">Emacs中对不同项目指定不同的风格</a></li><li>2009/06/02 -- <a href="http://techblog.iamzellux.com/2009/06/emacs-company-mode/" title="Company-mode: Emacs自动补全">Company-mode: Emacs自动补全</a></li><li>2009/05/04 -- <a href="http://techblog.iamzellux.com/2009/05/caps-lock-to-ctrl/" title="给你的小指减负：将Caps Lock键改成Ctrl">给你的小指减负：将Caps Lock键改成Ctrl</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://techblog.iamzellux.com/2010/02/configuring-semantic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ECB的简单配置和使用</title>
		<link>http://techblog.iamzellux.com/2010/02/ecb-beginning/</link>
		<comments>http://techblog.iamzellux.com/2010/02/ecb-beginning/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 08:52:52 +0000</pubDate>
		<dc:creator>zellux</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[ECB]]></category>
		<category><![CDATA[Emacs]]></category>

		<guid isPermaLink="false">http://techblog.iamzellux.com/?p=62679</guid>
		<description><![CDATA[终端下的效果图（Windows 7下使用pietty远登） 下载 http://ecb.sourceforge.net/downloads.html CVS或者压缩包都可以，当然也可以通过各发行版的包管理器安装。 安装 在.emacs中加入 ;; ECB configurations (add-to-list 'load-path "~/emacs/ecb-2.40") (add-to-list 'load-path "~/emacs/cedet-1.0pre6/eieio") (add-to-list 'load-path "~/emacs/cedet-1.0pre6/semantic") (add-to-list 'load-path "~/emacs/cedet-1.0pre6/speedbar") (setq semantic-load-turn-everything-on t) (require 'semantic-load) (require 'ecb-autoloads) 运行Emacs后执行ecb-byte-compile，并重启Emacs（我这里不重启的话执行ecb-active后会报错）。 使用 第一次使用时先要设置项目目录，M-x customize-variable &#60;RET&#62; ecb-source-path &#60;RET&#62;，在这里加上你的项目根目录。 接下来使用M-x ecb-active就能激活ECB了，成功激活后Emacs窗口会被切成左右两半。左边的几个窗口依次显示：目录，当前目录下的文件，当前文件中的函数/全局变量等定义，文件浏览历史。如果打开了一个源文件后函数定义窗口里面是空的，有可能是因为这个项目过大cedet尚未完成对它的分析，闲置一段时间后就能看到文件里的定义。 ECB提供了方便在这些窗口间切换的快捷键： 切换到目录窗口 Ctrl-c . g d 切换到函数/方法窗口 Ctrl-c . g m 切换到文件窗口 Ctrl-c . g s 切换到历史窗口 [...]]]></description>
			<content:encoded><![CDATA[<p>终端下的效果图（Windows 7下使用pietty远登）</p>
<p><a href="http://techblog.iamzellux.com/wp-content/uploads/2010/02/ecb.png" rel="shadowbox[post-62679];player=img;"><img title="ecb" src="http://techblog.iamzellux.com/wp-content/uploads/2010/02/ecb-300x179.png" alt="ECB Terminal" width="300" height="179" /></a></p>
<p><strong>下载</strong></p>
<p><a href="http://ecb.sourceforge.net/downloads.html">http://ecb.sourceforge.net/downloads.html</a> CVS或者压缩包都可以，当然也可以通过各发行版的包管理器安装。</p>
<p><strong>安装</strong></p>
<p>在.emacs中加入</p>
<pre class="brush: lisp">;; ECB configurations
(add-to-list 'load-path "~/emacs/ecb-2.40")
(add-to-list 'load-path "~/emacs/cedet-1.0pre6/eieio")
(add-to-list 'load-path "~/emacs/cedet-1.0pre6/semantic")
(add-to-list 'load-path "~/emacs/cedet-1.0pre6/speedbar")
(setq semantic-load-turn-everything-on t)
(require 'semantic-load)
(require 'ecb-autoloads)</pre>
<p>运行Emacs后执行<code>ecb-byte-compile</code>，并重启Emacs（我这里不重启的话执行<code>ecb-active</code>后会报错）。</p>
<p><strong>使用</strong></p>
<p>第一次使用时先要设置项目目录，<code>M-x customize-variable &lt;RET&gt; ecb-source-path &lt;RET&gt;</code>，在这里加上你的项目根目录。</p>
<p>接下来使用<code>M-x ecb-active</code>就能激活ECB了，成功激活后Emacs窗口会被切成左右两半。左边的几个窗口依次显示：目录，当前目录下的文件，当前文件中的函数/全局变量等定义，文件浏览历史。如果打开了一个源文件后函数定义窗口里面是空的，有可能是因为这个项目过大cedet尚未完成对它的分析，闲置一段时间后就能看到文件里的定义。</p>
<p>ECB提供了方便在这些窗口间切换的快捷键：</p>
<p>切换到目录窗口 <code>Ctrl-c . g d</code><br />
切换到函数/方法窗口 <code>Ctrl-c . g m</code><br />
切换到文件窗口 <code>Ctrl-c . g s</code><br />
切换到历史窗口 <code>Ctrl-c . g h</code><br />
切换到上一个编辑窗口 <code>Ctrl-c . g l</code></p>
<p>最基本的使用就是这样，<code>Ctrl-C . h</code>可以看到更详细的帮助信息。</p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>2010/02/07 -- <a href="http://techblog.iamzellux.com/2010/02/bind-cscope-to-ecb/" title="ecb和cscope的结合使用">ecb和cscope的结合使用</a></li><li>2010/02/03 -- <a href="http://techblog.iamzellux.com/2010/02/configuring-semantic/" title="为特定的项目配置semantic">为特定的项目配置semantic</a></li><li>2009/12/01 -- <a href="http://techblog.iamzellux.com/2009/12/emacs-set-styles-by-projects/" title="Emacs中对不同项目指定不同的风格">Emacs中对不同项目指定不同的风格</a></li><li>2009/06/02 -- <a href="http://techblog.iamzellux.com/2009/06/emacs-company-mode/" title="Company-mode: Emacs自动补全">Company-mode: Emacs自动补全</a></li><li>2009/05/04 -- <a href="http://techblog.iamzellux.com/2009/05/caps-lock-to-ctrl/" title="给你的小指减负：将Caps Lock键改成Ctrl">给你的小指减负：将Caps Lock键改成Ctrl</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://techblog.iamzellux.com/2010/02/ecb-beginning/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Git命令行自动补全</title>
		<link>http://techblog.iamzellux.com/2010/01/git-completion/</link>
		<comments>http://techblog.iamzellux.com/2010/01/git-completion/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 07:45:09 +0000</pubDate>
		<dc:creator>zellux</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://techblog.iamzellux.com/?p=62447</guid>
		<description><![CDATA[在Pro Git上看到的技巧，git的源代码包里的contrib/completion目录下有个git-completion.bash，把这个文件保存到~/.git-completion.bash，然后在.bashrc中加入一行 source ~/.git-completion.bash 这样就能在bash下用tab自动补全git命令、branch等内容了。另外Debian/Ubuntu里有个包就叫git-completion，这个包安装完成后会自动把这个补全脚本放到/etc/bash_completion.d/下，由bash-compleletion载入执行。 Related Posts2010/05/14 -- 利用HTTPS代理访问GitHub2010/02/14 -- 优化gitk的字体显示2009/11/10 -- 在git中修改之前提交的内容2009/05/26 -- ArchLinux下安装git, gitosis, gitweb服务]]></description>
			<content:encoded><![CDATA[<p>在<a href="http://progit.org/book/ch2-7.html" target="_blank">Pro Git</a>上看到的技巧，git的源代码包里的contrib/completion目录下有个<span style="font-family: monospace; line-height: 18px; font-size: 12px; white-space: pre;"><a href="http://repo.or.cz/w/git.git/blob_plain/HEAD:/contrib/completion/git-completion.bash" target="_blank">git-completion.bash</a>，把这个文件保存到~/.git-completion.bash，然后在.bashrc中加入一行</span></p>
<pre name="code" class="brush: bash">source ~/.git-completion.bash</pre>
<p>这样就能在bash下用tab自动补全git命令、branch等内容了。另外Debian/Ubuntu里有个包就叫git-completion，这个包安装完成后会自动把这个补全脚本放到/etc/bash_completion.d/下，由bash-compleletion载入执行。</p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>2010/05/14 -- <a href="http://techblog.iamzellux.com/2010/05/git-through-https-proxy/" title="利用HTTPS代理访问GitHub">利用HTTPS代理访问GitHub</a></li><li>2010/02/14 -- <a href="http://techblog.iamzellux.com/2010/02/gitk-font/" title="优化gitk的字体显示">优化gitk的字体显示</a></li><li>2009/11/10 -- <a href="http://techblog.iamzellux.com/2009/11/git-modify-specified-commit/" title="在git中修改之前提交的内容">在git中修改之前提交的内容</a></li><li>2009/05/26 -- <a href="http://techblog.iamzellux.com/2009/05/install-git-gitoss-gitweb-in-archlinux/" title="ArchLinux下安装git, gitosis, gitweb服务">ArchLinux下安装git, gitosis, gitweb服务</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://techblog.iamzellux.com/2010/01/git-completion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用grep查找进程的技巧</title>
		<link>http://techblog.iamzellux.com/2010/01/grep-trick/</link>
		<comments>http://techblog.iamzellux.com/2010/01/grep-trick/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 12:47:45 +0000</pubDate>
		<dc:creator>zellux</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://techblog.iamzellux.com/?p=62425</guid>
		<description><![CDATA[使用grep在ps aux的输出结果中查找进程的时候经常会把grep进程本身也找出来，比如查找emacs进程： $ ps aux &#124; grep emacs wyx 7090 0.0 0.0 3336 796 pts/2 S+ 04:49 0:00 grep emacs wyx 10128 0.1 4.9 66904 50388 pts/3 S+ Jan21 2:21 emacs 一个常见的防止grep进程出现的方法就是在后面再加一个grep -v grep： $ ps aux &#124; grep emacs &#124; grep -v grep wyx 10128 0.1 4.9 66904 50388 pts/3 S+ Jan21 2:21 emacs [...]]]></description>
			<content:encoded><![CDATA[<p>使用grep在ps aux的输出结果中查找进程的时候经常会把grep进程本身也找出来，比如查找emacs进程：</p>
<pre class="brush: bash" name="code">$ ps aux | grep emacs
wyx   7090  0.0  0.0   3336   796 pts/2 S+ 04:49 0:00 grep emacs
wyx  10128  0.1  4.9  66904 50388 pts/3 S+ Jan21 2:21 emacs</pre>
<p>一个常见的防止grep进程出现的方法就是在后面再加一个grep -v grep：</p>
<pre class="brush: bash" name="code">$ ps aux | grep emacs | grep -v grep
wyx  10128  0.1  4.9  66904 50388 pts/3 S+ Jan21 2:21 emacs</pre>
<p>今天在<a href="http://the-hydra.blogspot.com/2010/01/grep-string-anyone.html" target="_blank">Santosa的博客</a>上看到了另一个巧妙的做法，使用grep [e]macs来搜索emacs这个进程：</p>
<pre class="brush: bash" name="code">$ ps aux | grep [e]macs
wyx  10128  0.1  4.9  66904 50388 pts/3 S+ Jan21 2:21 emacs</pre>
<p>为什么会有这样的效果，知道grep正则中[]的作用后想一想就能明白啦。很有意思的trick，虽然说它比grep -v grep也未必方便多少，因为后者能通过alias简化输入。</p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>2010/03/01 -- <a href="http://techblog.iamzellux.com/2010/03/keep-gnu-screen-history/" title="记录GNU screen中的历史命令">记录GNU screen中的历史命令</a></li><li>2008/10/23 -- <a href="http://techblog.iamzellux.com/2008/10/archlinux-svn-server/" title="ArchLinux中架设svn服务器">ArchLinux中架设svn服务器</a></li><li>2008/09/24 -- <a href="http://techblog.iamzellux.com/2008/09/the-slub-allocator/" title="The SLUB allocator">The SLUB allocator</a></li><li>2008/08/15 -- <a href="http://techblog.iamzellux.com/2008/08/why-does-switch_to-need-three-arguments/" title="switch_to宏的第三个参数">switch_to宏的第三个参数</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://techblog.iamzellux.com/2010/01/grep-trick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu下编译Linux-xen的问题</title>
		<link>http://techblog.iamzellux.com/2009/12/linux-xen-compiling-error-in-ubuntu/</link>
		<comments>http://techblog.iamzellux.com/2009/12/linux-xen-compiling-error-in-ubuntu/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 06:41:15 +0000</pubDate>
		<dc:creator>zellux</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[Makefile]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://techblog.iamzellux.com/?p=62381</guid>
		<description><![CDATA[在Ubuntu下编译Linux-xen时碰到arch/i386/kernel/head-xen.o无法找到的问题，而该目录下有head-xen.S这个文件，说明make之前的的工作并没有把这个.S文件编译成.o。而同样的代码，在ArchLinux和Fedora上svn checkout后编译没有任何问题。 最后发现问题在于Ubuntu默认会把/bin/sh指向/bin/dash，在scripts/Makefile.build里面加上一行SHELL=/bin/bash指定$(shell)使用bash即可。后来还搜了一下为什么Ubuntu使用dash而不是bash，其理由是dash的执行效率更高，但不可否认的是这个改动也导致了一些项目无法成功编译，虽然无法成功编译的原因可能是Makefile里使用了一些bash的特性而非POSIX shell所提供的那些。 另外在debug过程中在网上找到了一些debug Makefile的技巧： make -n 可以仅仅打印出将要被执行的命令，而不去实际执行 make -np 可以打印出更多的信息（使用的规则和变量），并执行每一条命令 remake也是个不错的选择：“remake is a patched and modernized version of GNU make utility that adds improved error reporting, the ability to trace execution in a comprehensible way, and a debugger.” 在检查shell命令的时候，可以使用set -x使得所有shell命令在执行前都能被输出。 Related Posts2010/02/27 -- 因为1个异常导入190个包2009/05/27 -- 利用VMware的虚拟串口调试Xen]]></description>
			<content:encoded><![CDATA[<p>在Ubuntu下编译Linux-xen时碰到arch/i386/kernel/head-xen.o无法找到的问题，而该目录下有head-xen.S这个文件，说明make之前的的工作并没有把这个.S文件编译成.o。而同样的代码，在ArchLinux和Fedora上svn checkout后编译没有任何问题。</p>
<p>最后发现问题在于Ubuntu默认会把/bin/sh指向/bin/dash，在scripts/Makefile.build里面加上一行SHELL=/bin/bash指定$(shell)使用bash即可。后来还搜了一下为什么Ubuntu使用dash而不是bash，其理由是dash的<a href="https://wiki.ubuntu.com/DashAsBinSh" target="_blank">执行效率更高</a>，但不可否认的是这个改动也导致了一些<a href="https://bugs.launchpad.net/ubuntu/+source/dash/+bug/61463" target="_blank">项目无法成功编译</a>，虽然无法成功编译的原因可能是Makefile里使用了一些bash的特性而非POSIX shell所提供的那些。</p>
<p>另外在debug过程中在网上找到了一些debug Makefile的技巧：</p>
<p>make -n 可以仅仅打印出将要被执行的命令，而不去实际执行</p>
<p>make -np 可以打印出更多的信息（使用的规则和变量），并执行每一条命令</p>
<p><a href="http://bashdb.sourceforge.net/remake/" target="_blank">remake</a>也是个不错的选择：“<tt>remake</tt> is a patched and modernized version of GNU make utility that adds improved error reporting, the ability to trace execution in a comprehensible way, and a debugger.”</p>
<p>在检查shell命令的时候，可以使用set -x使得所有shell命令在执行前都能被输出。</p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>2010/02/27 -- <a href="http://techblog.iamzellux.com/2010/02/ubuntu-python-aport-bug/" title="因为1个异常导入190个包">因为1个异常导入190个包</a></li><li>2009/05/27 -- <a href="http://techblog.iamzellux.com/2009/05/debug-xen-with-vmware-serial-port/" title="利用VMware的虚拟串口调试Xen">利用VMware的虚拟串口调试Xen</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://techblog.iamzellux.com/2009/12/linux-xen-compiling-error-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
