<?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>Erlang非业余研究</title>
	<atom:link href="http://blog.yufeng.info/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.yufeng.info</link>
	<description>Erlang系统深度探索和应用</description>
	<lastBuildDate>Tue, 27 Jul 2010 09:51:03 +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>sshpass 方便登录ssh</title>
		<link>http://blog.yufeng.info/archives/641</link>
		<comments>http://blog.yufeng.info/archives/641#comments</comments>
		<pubDate>Tue, 27 Jul 2010 09:51:03 +0000</pubDate>
		<dc:creator>Yu Feng</dc:creator>
				<category><![CDATA[工具介绍]]></category>
		<category><![CDATA[sshpass]]></category>

		<guid isPermaLink="false">http://blog.yufeng.info/?p=641</guid>
		<description><![CDATA[在集群的时候，通常需要登录到其他节点去执行命令。但是一般的机器都需要密码登录的，去做ssh信任又非常麻烦。sshpass来帮忙了。 sshpass -noninteractive ssh password provider. 在ubuntu下可以用 apt-get install sshpass来安装。 它支持密码从命令行，文件， 环境变量中读取。 有需要的同学实验下吧。 特别是erlang支持自定义的rsh, 参数是erl -rsh xxxxx]]></description>
			<content:encoded><![CDATA[<p>在集群的时候，通常需要登录到其他节点去执行命令。但是一般的机器都需要密码登录的，去做ssh信任又非常麻烦。sshpass来帮忙了。</p>
<p>sshpass -noninteractive ssh password provider. </p>
<p>在ubuntu下可以用 apt-get install sshpass来安装。</p>
<p>它支持密码从命令行，文件， 环境变量中读取。</p>
<p>有需要的同学实验下吧。 特别是erlang支持自定义的rsh, 参数是erl -rsh xxxxx</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yufeng.info/archives/641/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ProcessOne releases OneCached 很好的学习Erlang的材料</title>
		<link>http://blog.yufeng.info/archives/638</link>
		<comments>http://blog.yufeng.info/archives/638#comments</comments>
		<pubDate>Tue, 27 Jul 2010 09:26:56 +0000</pubDate>
		<dc:creator>Yu Feng</dc:creator>
				<category><![CDATA[Erlang探索]]></category>
		<category><![CDATA[memcached]]></category>
		<category><![CDATA[onecached]]></category>
		<category><![CDATA[学习]]></category>
		<category><![CDATA[项目]]></category>

		<guid isPermaLink="false">http://blog.yufeng.info/?p=638</guid>
		<description><![CDATA[July 05, 2010 ProcessOne has just released OneCached, a Memcached server and client implementation written in Erlang. OneCached is released under the Erlang Public License (EPL),. OneCached supports the set, add, replace, get, incr, decr, delete, flush_all and quit commands. It doesn&#8217;t handle expiration time. You call pull the source code from the public repository [...]]]></description>
			<content:encoded><![CDATA[<p>July 05, 2010<br />
ProcessOne has just released OneCached, a Memcached server and client implementation written in Erlang.<br />
OneCached is released under the Erlang Public License (EPL),.</p>
<p>OneCached supports the set, add, replace, get, incr, decr, delete, flush_all and quit commands. It doesn&#8217;t handle expiration time.</p>
<p>You call pull the source code from the public repository at:<a href=" https://git.process-one.net/onecached"> https://git.process-one.net/onecached</a></p>
<p>git clone git://git.process-one.net/onecached/mainline.git</p>
<p>To compile, just run make, and to start, just type:<br />
bin/onecachedctl start</p>
<p>这个项目是非常简单的一个memcached的模仿， 亮点在于底层用ets, dest, mnesia这样的erlang特有的存储。这个项目的意义在于演示了如何编写一个严肃的Erlang工程，以及需要掌握的技能。对于初学者来讲，这是很好的一个切入点。 你可以在上面修修改改， 打造出你自己的版本。</p>
<p>玩的开心！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yufeng.info/archives/638/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Erlang 64位虚拟机halfword版本</title>
		<link>http://blog.yufeng.info/archives/500</link>
		<comments>http://blog.yufeng.info/archives/500#comments</comments>
		<pubDate>Tue, 27 Jul 2010 09:17:38 +0000</pubDate>
		<dc:creator>Yu Feng</dc:creator>
				<category><![CDATA[Erlang探索]]></category>
		<category><![CDATA[64]]></category>
		<category><![CDATA[Erlang， VM]]></category>
		<category><![CDATA[halfword]]></category>

		<guid isPermaLink="false">http://blog.yufeng.info/?p=500</guid>
		<description><![CDATA[在即将发布的R14B版本中，包括了64位机器下用的Halfword版本。 我们知道在64位Linux下，指针和size_t都变成64位的， 而Erlang的基础数据结构Eterm都是用的和体系相同的数据结构，那么在64位机器下，虽然CPU运算的速度增加了，但是内存的访问速度不会随着CPU的加快而加快。反而是在64位系统下，比如Erlang的List，访问的内存加倍了，总体的速度下降了百分几十。 为了解决这个问题，Erlang的团队推出了halfword-emulator, 通过修改Etrem指针的长度， 来达到节省内存，加速的目的。 我们可以在编译的时候通过 configure &#8211;enable-halfword-emulator 来启用这个VM. half word 64-bit Erlang VM有以下特性 – 4 Gbytes process heaps (in total) –max size of Erlang term 4 Gbytes – ets tables and binaries in separate space can utilize the full 64 bit address space 但是需要注意的是，这个patch推出的时间不长，可能存在风险。 在提高速度的同时，也有不稳定的风险。 用户需要自己去评估。]]></description>
			<content:encoded><![CDATA[<p>在即将发布的R14B版本中，包括了64位机器下用的Halfword版本。 我们知道在64位Linux下，指针和size_t都变成64位的， 而Erlang的基础数据结构Eterm都是用的和体系相同的数据结构，那么在64位机器下，虽然CPU运算的速度增加了，但是内存的访问速度不会随着CPU的加快而加快。反而是在64位系统下，比如Erlang的List，访问的内存加倍了，总体的速度下降了百分几十。</p>
<p>为了解决这个问题，Erlang的团队推出了halfword-emulator, 通过修改Etrem指针的长度， 来达到节省内存，加速的目的。<br />
我们可以在编译的时候通过 configure &#8211;enable-halfword-emulator  来启用这个VM.</p>
<p>half word 64-bit Erlang VM有以下特性<br />
– 4 Gbytes process heaps (in total)<br />
–max size of Erlang term 4 Gbytes<br />
– ets tables and binaries in separate space can utilize the full 64 bit address space</p>
<p>但是需要注意的是，这个patch推出的时间不长，可能存在风险。 在提高速度的同时，也有不稳定的风险。 用户需要自己去评估。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yufeng.info/archives/500/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sysbench(系统性能基准)介绍</title>
		<link>http://blog.yufeng.info/archives/614</link>
		<comments>http://blog.yufeng.info/archives/614#comments</comments>
		<pubDate>Tue, 27 Jul 2010 09:09:03 +0000</pubDate>
		<dc:creator>Yu Feng</dc:creator>
				<category><![CDATA[工具介绍]]></category>
		<category><![CDATA[cpu]]></category>
		<category><![CDATA[fileio]]></category>
		<category><![CDATA[mutex]]></category>
		<category><![CDATA[oltp]]></category>
		<category><![CDATA[sysbench]]></category>

		<guid isPermaLink="false">http://blog.yufeng.info/?p=614</guid>
		<description><![CDATA[SysBench is a modular, cross-platform and multi-threaded benchmark tool for evaluating OS parameters that are important for a system running a database under intensive load. Current features allow to test the following system parameters: * cpu性能 * file I/O performance * scheduler performance * mutex的性能 * memory allocation and transfer speed, 支持hugepage * POSIX threads [...]]]></description>
			<content:encoded><![CDATA[<p>SysBench is a modular, cross-platform and multi-threaded benchmark tool for evaluating OS parameters that are important for a system running a database under intensive load.<br />
Current features allow to test the following system parameters:<br />
    * cpu性能<br />
    * file I/O performance<br />
    * scheduler performance<br />
    * mutex的性能<br />
    * memory allocation and transfer speed, 支持hugepage<br />
    * POSIX threads implementation performance<br />
    * database server performance (OLTP benchmark) 支持mysql，pgsql, oracle</p>
<p>项目地址是：<a href="http://sysbench.sourceforge.net/">http://sysbench.sourceforge.net/</a></p>
<p>从源码来看这个项目做的非常的模块化。 sysbench提供了诸如读取配置， 创建线程， 日志， 计时和模块化框架，支持的测试模式都是通过插件方式加入到框架去的。 </p>
<p>用户很容易扩展相应的模块， 通常模块只需要关注自己要实现的测试功能，其他的事情由框架来做，很大的方便用户自己编写特定的测试模块。其他的如多线程什么的都无需自己去考虑。</p>
<p>在数据库的驱动方面，目前提供了mysql，pgsql, oracle的驱动。在数据库抽象方面也是模块的，用户自己也能容易加入自己的数据库支持。</p>
<p>作为一个轻量级别的bench工具，在系统的系统测量方面，可以了解到对系统运行产生很大影响的性能，如内存，cpu，磁盘，锁，线程调度，数据库等方面的信息，是一个得心应手的工具。</p>
<p>在ubuntu下可以用apt-get install sysbench来安装，具体的使用参看 man sysbench。</p>
<p>玩的开心！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yufeng.info/archives/614/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>来自RHEL系统调优手册的几张经典图</title>
		<link>http://blog.yufeng.info/archives/617</link>
		<comments>http://blog.yufeng.info/archives/617#comments</comments>
		<pubDate>Tue, 20 Jul 2010 01:46:51 +0000</pubDate>
		<dc:creator>Yu Feng</dc:creator>
				<category><![CDATA[杂七杂八]]></category>
		<category><![CDATA[网络编程]]></category>

		<guid isPermaLink="false">http://blog.yufeng.info/?p=617</guid>
		<description><![CDATA[看图不说话：） IO架构图： 内存管理图： 很容易误解的socket buffer：]]></description>
			<content:encoded><![CDATA[<p>看图不说话：）</p>
<p>IO架构图：<br />
<a href="http://blog.yufeng.info/wp-content/uploads/2010/07/IO_subsystem_architecture.jpg"><img src="http://blog.yufeng.info/wp-content/uploads/2010/07/IO_subsystem_architecture-300x291.jpg" alt="" title="IO_subsystem_architecture" width="300" height="291" class="alignnone size-medium wp-image-620" /></a></p>
<p>内存管理图：<br />
<a href="http://blog.yufeng.info/wp-content/uploads/2010/07/Linux_virtual_memory_manager.jpg"><img src="http://blog.yufeng.info/wp-content/uploads/2010/07/Linux_virtual_memory_manager-300x197.jpg" alt="" title="Linux_virtual_memory_manager" width="300" height="197" class="alignnone size-medium wp-image-619" /></a></p>
<p>很容易误解的socket buffer：<br />
<a href="http://blog.yufeng.info/wp-content/uploads/2010/07/socket_buffer_memory_allocation.jpg"><img src="http://blog.yufeng.info/wp-content/uploads/2010/07/socket_buffer_memory_allocation-300x253.jpg" alt="" title="socket_buffer_memory_allocation" width="300" height="253" class="alignnone size-medium wp-image-618" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yufeng.info/archives/617/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tsung压力测试工具介绍PPT</title>
		<link>http://blog.yufeng.info/archives/605</link>
		<comments>http://blog.yufeng.info/archives/605#comments</comments>
		<pubDate>Wed, 14 Jul 2010 08:48:29 +0000</pubDate>
		<dc:creator>Yu Feng</dc:creator>
				<category><![CDATA[Erlang探索]]></category>
		<category><![CDATA[Loadrunner]]></category>
		<category><![CDATA[Tsung]]></category>
		<category><![CDATA[压力测试工具]]></category>

		<guid isPermaLink="false">http://blog.yufeng.info/?p=605</guid>
		<description><![CDATA[准备为测试部门的同学作个Tsung的讲座, 点击下载Tsung 需要进一步了解Tsung的同学 点这里看官方的文档! 想了解如何使用的还可以到Erlang china这里看看!]]></description>
			<content:encoded><![CDATA[<p>准备为测试部门的同学作个Tsung的讲座, <a href='http://blog.yufeng.info/wp-content/uploads/2010/07/Tsung_.pdf'>点击下载Tsung</a></p>
<p>需要进一步了解Tsung的同学 <a href="http://tsung.erlang-projects.org/user_manual.html">点这里</a>看官方的文档!<br />
想了解如何使用的还可以到<a href="http://erlang-china.org/study/tsung_your_web.html">Erlang china这里</a>看看!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yufeng.info/archives/605/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OTP R14A今天正式发布了</title>
		<link>http://blog.yufeng.info/archives/587</link>
		<comments>http://blog.yufeng.info/archives/587#comments</comments>
		<pubDate>Thu, 17 Jun 2010 06:40:51 +0000</pubDate>
		<dc:creator>Yu Feng</dc:creator>
				<category><![CDATA[Erlang探索]]></category>
		<category><![CDATA[R14A， Release]]></category>

		<guid isPermaLink="false">http://blog.yufeng.info/?p=587</guid>
		<description><![CDATA[点击这里下载R14A 以下是这次发布的亮点，没有太大的性能改进， 主要是修理了很多BUG！ &#8212; HIGHLIGHTS &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;- OTP-8217 == erts stdlib compiler == The module binary from EEP31 (and EEP9) is implemented. OTP-8485 == common_test == It is now possible for the user to provide specific callback modules that handle test configuration data, so that data on arbitray form can be accessed (e.g. by reading files [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.erlang.org/download.html">点击这里下载R14A</a><br />
以下是这次发布的亮点，没有太大的性能改进， 主要是修理了很多BUG！</p>
<p>&#8212; HIGHLIGHTS &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>OTP-8217  == erts stdlib compiler ==</p>
<p>The module binary from EEP31 (and EEP9) is implemented.</p>
<p>OTP-8485  == common_test ==</p>
<p>It is now possible for the user to provide specific callback<br />
modules that handle test configuration data, so that data on<br />
arbitray form can be accessed (e.g. by reading files or by<br />
communicating with a configuration server process). Two<br />
default callback modules have been introduced in Common Test:<br />
ct_config_plain and ct_config_xml. The former is used to<br />
handle the traditional Common Test configuration files (with<br />
terms on key-value tuple form) and the latter to handle<br />
configuration data on XML representation.</p>
<p>OTP-8555  == erts ==</p>
<p>New NIF features:</p>
<p>Send messages from a NIF, or from thread created by NIF, to<br />
any local process (enif_send)</p>
<p>Store terms between NIF calls (enif_alloc_env,<br />
enif_make_copy)</p>
<p>Create binary terms with user defined memory management<br />
(enif_make_resource_binary)</p>
<p>And some incompatible changes made to the API. For more<br />
information see the warning text in erl_nif(3).</p>
<p>OTP-8623  == compiler erts hipe stdlib ==</p>
<p>Receive statements that can only read out a newly created<br />
reference are now specially optimized so that it will execute<br />
in constant time regardless of the number of messages in the<br />
receive queue for the process. That optimization will benefit<br />
calls to gen_server:call(). (See gen:do_call/4 for an example<br />
of a receive statement that will be optimized.)</p>
<p>OTP-8650  == common_test ==</p>
<p>The run_test script has been replaced by a program (with the<br />
same name) which can be executed without explicit<br />
installation. The start flags are the same as for the legacy<br />
start script.</p>
<p>OTP-8706  == erts hipe tools ==</p>
<p>eprof has been reimplemented with support in the Erlang<br />
virtual machine and is now both faster (i.e. slows down the<br />
code being measured less) and scales much better. In<br />
measurements we saw speed-ups compared to the old eprof<br />
ranging from 6 times (for sequential code that only uses one<br />
scheduler/core) up to 84 times (for parallel code that uses 8<br />
cores).</p>
<p>Note: The API for the eprof has been cleaned up and extended.<br />
See the documentation.</p>
<p>期待R14B有大的动作！</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yufeng.info/archives/587/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>我的emacs配置</title>
		<link>http://blog.yufeng.info/archives/578</link>
		<comments>http://blog.yufeng.info/archives/578#comments</comments>
		<pubDate>Wed, 26 May 2010 10:00:38 +0000</pubDate>
		<dc:creator>Yu Feng</dc:creator>
				<category><![CDATA[杂七杂八]]></category>
		<category><![CDATA[emacs]]></category>
		<category><![CDATA[配置]]></category>

		<guid isPermaLink="false">http://blog.yufeng.info/?p=578</guid>
		<description><![CDATA[贴上来方便有用emacs的同学。配置部分是从网上淘来的，忘记出处了，见谅！ ;;(keyboard-translate ?\C-h ?\C-?) (defalias 'yes-or-no-p 'y-or-n-p) (setq time-stamp-active t) (setq time-stamp-warn-inactive t) (setq time-stamp-format &#34;%:y-%02m-%02d %3a %02H:%02M:%02S&#34;) (add-hook 'write-file-hooks 'time-stamp) (global-set-key [f2] 'rgrep) (global-set-key [(f5)] 'eshell) (global-set-key [C-f5] 'shell) (global-set-key (kbd &#34;M-3&#34;) 'capitalize-word) (global-set-key [f6] 'find-file) (global-set-key [C-Z] nil) (global-set-key [C-f4] 'kill-this-buffer) (global-set-key [(f4)] 'ibuffer) (global-set-key [(f8)] 'other-window) (require 'color-theme) ;;(color-theme-initialize) (color-theme-dark-blue2) (setq font-lock-verbose [...]]]></description>
			<content:encoded><![CDATA[<p>贴上来方便有用emacs的同学。配置部分是从网上淘来的，忘记出处了，见谅！</p>
<pre class="brush: plain;">
;;(keyboard-translate ?\C-h ?\C-?)
(defalias 'yes-or-no-p 'y-or-n-p)

(setq time-stamp-active t)
(setq time-stamp-warn-inactive t)
(setq time-stamp-format &quot;%:y-%02m-%02d %3a %02H:%02M:%02S&quot;)
(add-hook 'write-file-hooks 'time-stamp)

(global-set-key [f2] 'rgrep)
(global-set-key [(f5)] 'eshell)
(global-set-key [C-f5] 'shell)
(global-set-key (kbd &quot;M-3&quot;) 'capitalize-word)

(global-set-key [f6] 'find-file)
(global-set-key [C-Z] nil)
(global-set-key [C-f4] 'kill-this-buffer)

(global-set-key [(f4)] 'ibuffer)
(global-set-key [(f8)] 'other-window)

(require 'color-theme)
;;(color-theme-initialize)
(color-theme-dark-blue2)
(setq font-lock-verbose t)
;;(set-default-font &quot;Bitstream Vera Sans Mono-12&quot;)
(global-font-lock-mode t)
(tool-bar-mode -1)
(setq column-number-mode t)
(setq display-battery-mode t)
(setq size-indication-mode t)
(setq default-major-mode 'outline-mode)
(add-hook 'outline-mode-hook 'turn-off-auto-fill)

(setq transient-mark-mode t)
(setq-default shell-cd-regexp nil)
(setq-default shell-pushd-regexp nil)
(setq-default shell-popd-regexp nil)
(setq inhibit-startup-message t)
(setq visible-bell t)
(setq mouse-yank-at-point t)
(setq kill-ring-max 100)
(setq default-fill-column 60)

(global-set-key (kbd &quot;M-g&quot;) 'goto-line)
(global-set-key (kbd &quot;M-o&quot;) 'ff-find-related-file)

(setq require-final-newline t)

(setq track-eol t)

(setq gnus-inhibit-startup-message t)

(setq enable-recursive-minibuffers t)
(setq auto-save-mode nil)
(setq Man-notify-method 'pushy)

(display-time-mode 1)
(setq display-time-24hr-format t)
(setq display-time-day-and-date t)
(setq display-time-use-mail-icon t)
(setq display-time-interval 10)

(tool-bar-mode -1)
(customize-set-variable 'scroll-bar-mode 'right)

(setq speedbar-show-unknown-files t)
(setq speedbar-update-flag nil)
(setq speedbar-use-images nil)
(setq speedbar-verbosity-level 0)
(global-set-key [f9] 'speedbar)

;; set paren mode
(show-paren-mode t)
(setq show-paren-style 'parentheses)
(mouse-avoidance-mode 'animate)

;; set the default username and email
(setq user-full-name &quot;yufeng&quot;)
(setq user-mail-address &quot;mryufeng@gmail.com&quot;)

;; set the title name
(setq frame-title-format &quot;Emacs - %f&quot;)

;;-------------------------Shell 使用 ansi color-------------
(autoload 'ansi-color-for-comint-mode-on &quot;ansi-color&quot; nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

(require 'uniquify)
(setq
  uniquify-buffer-name-style 'post-forward
  uniquify-separator &quot;:&quot;)

;;
(require 'ibuffer)
(global-set-key (kbd &quot;C-x C-b&quot;) 'ibuffer)
(require 'ido)
(ido-mode t)

;;-------------------------让Emacs拥有tabs-------------------
(require 'tabbar)
(setq tabbar-buffer-groups-function
          (lambda ()
            (list &quot;All&quot;)))

(tabbar-mode)
(global-set-key [(control shift tab)] 'tabbar-backward)
(global-set-key [(control tab)] 'tabbar-forward)
(global-set-key (kbd &quot;M-1&quot;) 'tabbar-backward)
(global-set-key (kbd &quot;M-2&quot;) 'tabbar-forward) 

;;(require 'session)
;;(add-hook 'after-init-hook 'session-initialize)
;;(load &quot;desktop&quot;)
;;(desktop-load-default)
;;(desktop-read)
;;(setq desktop-save-mode t)

(require 'browse-kill-ring)
(global-set-key [(control c)(k)] 'browse-kill-ring)
(browse-kill-ring-default-keybindings)

;;erlang
;;(require 'erlang-eunit)
;;(load &quot;erlang_appwiz&quot; t nil)
(global-set-key [f3] 'erlang-next-error)
(global-set-key [C-f7] 'erlang-compile)
(global-set-key [f7] 'compile)
(global-set-key [f10] 'linum-mode)

;;distel
(add-to-list 'load-path &quot;/usr/local/share/distel/elisp&quot;)
(require 'distel)
(distel-setup)
;; Some Erlang customizations
(add-hook 'erlang-mode-hook
	    (lambda ()
	          ;; when starting an Erlang shell in Emacs, default in the node name
`	          (setq inferior-erlang-machine-options '(&quot;-sname&quot; &quot;emacs&quot;))
		      ;; add Erlang functions to an imenu menu
		      (imenu-add-to-menubar &quot;imenu&quot;)))

;; A number of the erlang-extended-mode key bindings are useful in the shell too
(defconst distel-shell-keys
  '((&quot;\C-\M-i&quot;   erl-complete)
    (&quot;\M-?&quot;      erl-complete)
    (&quot;\M-.&quot;      erl-find-source-under-point)
    (&quot;\M-,&quot;      erl-find-source-unwind)
    (&quot;\M-*&quot;      erl-find-source-unwind)
    )
  &quot;Additional keys to bind when in Erlang shell.&quot;)

(add-hook 'erlang-shell-mode-hook
	    (lambda ()
	          ;; add some Distel bindings to the Erlang shell
	          (dolist (spec distel-shell-keys)
		          (define-key erlang-shell-mode-map (car spec) (cadr spec)))))

;wrangler
(add-to-list 'load-path &quot;/usr/local/share/wrangler/elisp&quot;)
(require 'wrangler) 

;;ecb
(require 'xcscope)
(require 'cedet) ;;load cedet
(require 'ecb) ;;load ecb

(setq ecb-tip-of-the-day nil
inhibit-startup-message t
ecb-auto-compatibility-check nil
ecb-version-check nil)

(global-set-key [f12] 'ecb-activate)
(global-set-key [C-f12] 'ecb-deactivate)
(global-set-key [f11] 'delete-other-windows)
(global-set-key [(meta return)] 'semantic-ia-complete-symbol-menu)
(global-set-key (kbd &quot;C-c e&quot;) 'ecb-goto-window-edit-last)
(global-set-key (kbd &quot;C-c s&quot;) 'ecb-goto-window-sources)
(global-set-key (kbd &quot;C-c d&quot;) 'ecb-goto-window-directories)
(global-set-key (kbd &quot;C-c m&quot;) 'ecb-goto-window-methods)
(global-set-key (kbd &quot;C-c h&quot;) 'ecb-goto-window-history)
(global-set-key (kbd &quot;C-c r&quot;) 'ecb-redraw-layout)
(global-set-key (kbd &quot;C-.&quot;) 'cscope-find-global-definition-no-prompting)
(global-set-key (kbd &quot;C-,&quot;) 'cscope-pop-mark)
(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(ecb-options-version &quot;2.32&quot;)
 '(safe-local-variable-values (quote ((erlang-indent-level . 2)))))
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 )

;;msf abbrev
(add-to-list 'load-path &quot;~/emacs&quot;)
;; ensure abbrev mode is always on
(setq-default abbrev-mode t)
;; do not bug me about saving my abbreviations
(setq save-abbrevs nil)
;; load up modes I use
(require 'cc-mode)
;;(require 'perl-mode)
;;(require 'cperl-mode)
;;(require 'sh-script)
;;(require 'shell)
;;(require 'lua-mode)
;;(require 'erlang)
;; load up abbrevs for these modes
(require 'msf-abbrev)
(setq msf-abbrev-verbose t) ;; optional
(setq msf-abbrev-root &quot;~/emacs/mode-abbrevs&quot;)
(global-set-key (kbd &quot;C-c l&quot;) 'msf-abbrev-goto-root)
(global-set-key (kbd &quot;C-c a&quot;) 'msf-abbrev-define-new-abbrev-this-mode)
(msf-abbrev-load)

;;go mode
(require 'go-mode-load)
(require 'tramp)

;;gud
(add-hook 'gdb-mode-hook '(lambda ()
                            (define-key c-mode-base-map [(f5)] 'gud-go)
                            (define-key c-mode-base-map [(f7)] 'gud-step)
                            (define-key c-mode-base-map [(f8)] 'gud-next)))

(defvar no-easy-keys-minor-mode-map (make-keymap)
  &quot;no-easy-keys-minor-mode keymap.&quot;)
(let ((f (lambda (m)
           `(lambda () (interactive)
              (message (concat &quot;No! use &quot; ,m &quot; instead.&quot;))))))
  (dolist (l '((&quot;&lt;left&gt;&quot; . &quot;C-b&quot;) (&quot;&lt;right&gt;&quot; . &quot;C-f&quot;) (&quot;&lt;up&gt;&quot; . &quot;C-p&quot;)
               (&quot;&lt;down&gt;&quot; . &quot;C-n&quot;)
               (&quot;&lt;C-left&gt;&quot; . &quot;M-f&quot;) (&quot;&lt;C-right&gt;&quot; . &quot;M-b&quot;) (&quot;&lt;C-up&gt;&quot; . &quot;M-{&quot;)
               (&quot;&lt;C-down&gt;&quot; . &quot;M-}&quot;)
               (&quot;&lt;M-left&gt;&quot; . &quot;M-f&quot;) (&quot;&lt;M-right&gt;&quot; . &quot;M-b&quot;) (&quot;&lt;M-up&gt;&quot; . &quot;M-{&quot;)
               (&quot;&lt;M-down&gt;&quot; . &quot;M-}&quot;)
               (&quot;&lt;delete&gt;&quot; . &quot;C-d&quot;) (&quot;&lt;C-delete&gt;&quot; . &quot;M-d&quot;)
               (&quot;&lt;M-delete&gt;&quot; . &quot;M-d&quot;) (&quot;&lt;next&gt;&quot; . &quot;C-v&quot;) (&quot;&lt;C-next&gt;&quot; . &quot;M-x &lt;&quot;)
               (&quot;&lt;prior&gt;&quot; . &quot;M-v&quot;) (&quot;&lt;C-prior&gt;&quot; . &quot;M-x &gt;&quot;)
               (&quot;&lt;home&gt;&quot; . &quot;C-a&quot;) (&quot;&lt;C-home&gt;&quot; . &quot;M-&gt;&quot;)
               (&quot;&lt;C-home&gt;&quot; . &quot;M-&lt;&quot;) (&quot;&lt;end&gt;&quot; . &quot;C-e&quot;) (&quot;&lt;C-end&gt;&quot; . &quot;M-&gt;&quot;)))
    (define-key no-easy-keys-minor-mode-map
      (read-kbd-macro (car l)) (funcall f (cdr l)))))
(define-minor-mode no-easy-keys-minor-mode
  &quot;A minor mode that disables the arrow-keys, pg-up/down, delete
  and backspace.&quot;  t &quot; no-easy-keys&quot;
  'no-easy-keys-minor-mode-map :global t)
(no-easy-keys-minor-mode 1)

(require 'smex)
(smex-initialize)

(global-set-key (kbd &quot;M-x&quot;) 'smex)
(global-set-key (kbd &quot;M-X&quot;) 'smex-major-mode-commands)

(require 'org-install)
(add-to-list 'auto-mode-alist '(&quot;\\.org$&quot; . org-mode))
(define-key global-map &quot;\C-cl&quot; 'org-store-link)
(define-key global-map &quot;\C-ca&quot; 'org-agenda)
(setq org-log-done t)

(setq transient-mark-mode t) ; highlight text selection
(setq delete-selection-mode t) ; delete seleted text when typing

; highlight current line
(require 'hl-line)
(global-hl-line-mode t)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.yufeng.info/archives/578/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>R14A实现了EEP31，添加了binary模块</title>
		<link>http://blog.yufeng.info/archives/574</link>
		<comments>http://blog.yufeng.info/archives/574#comments</comments>
		<pubDate>Fri, 21 May 2010 03:24:55 +0000</pubDate>
		<dc:creator>Yu Feng</dc:creator>
				<category><![CDATA[Erlang探索]]></category>
		<category><![CDATA[AC]]></category>
		<category><![CDATA[binary]]></category>
		<category><![CDATA[BM]]></category>
		<category><![CDATA[EEP31]]></category>
		<category><![CDATA[match]]></category>
		<category><![CDATA[R14A]]></category>

		<guid isPermaLink="false">http://blog.yufeng.info/?p=574</guid>
		<description><![CDATA[Erlang的binary数据结构非常强大，而且偏向底层，在作网络程序的时候，很方便的能够和二进制协议对应起来。但是由于这个数据结构加入erlang语言的时间不是很长，相关的配套模块不是很多。 在binary的匹配，替换，修改就显的非常麻烦。 于是有了EEP31 。 R14A昨天已经实现了这个功能， 在stdlib下添加了个binary模块。 这个模块大部分功能是由BIF实现的， 同时充分考虑了CPU使用的公平性，源码大部分在erl_bif_binary.c下。 还添加了个gurad函数： binary_part进一步方便我们写匹配条件。 我们在源码里面发现了以下注释： /* * The native implementation functions for the module binary. * Searching is implemented using aither Boyer-More or Aho-Corasick * depending on number of searchstrings (BM if one, AC if more than one). * Native implementation is mostly for efficiency, nothing * (except binary:referenced_byte_size) [...]]]></description>
			<content:encoded><![CDATA[<p>Erlang的binary数据结构非常强大，而且偏向底层，在作网络程序的时候，很方便的能够和二进制协议对应起来。但是由于这个数据结构加入erlang语言的时间不是很长，相关的配套模块不是很多。 在binary的匹配，替换，修改就显的非常麻烦。 于是有了<a href="http://www.erlang.org/eeps/eep-0031.html">EEP31</a> 。 R14A昨天已经实现了这个功能， 在stdlib下添加了个binary模块。 这个模块大部分功能是由BIF实现的， 同时充分考虑了CPU使用的公平性，源码大部分在erl_bif_binary.c下。 还添加了个gurad函数： binary_part进一步方便我们写匹配条件。</p>
<p>我们在源码里面发现了以下注释：<br />
/*<br />
 * The native implementation functions for the module binary.<br />
 * Searching is implemented using aither Boyer-More or Aho-Corasick<br />
 * depending on number of searchstrings (BM if one, AC if more than one).<br />
 * Native implementation is mostly for efficiency, nothing<br />
 * (except binary:referenced_byte_size) really *needs* to be implemented<br />
 * in native code.<br />
 */</p>
<p>这个模块兼顾了效率和方便性，使用起来就大大简化了代码的复杂度，有福气了。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yufeng.info/archives/574/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>R14A添加新指令优化Ref消息的接收</title>
		<link>http://blog.yufeng.info/archives/570</link>
		<comments>http://blog.yufeng.info/archives/570#comments</comments>
		<pubDate>Wed, 19 May 2010 05:30:04 +0000</pubDate>
		<dc:creator>Yu Feng</dc:creator>
				<category><![CDATA[Erlang探索]]></category>
		<category><![CDATA[beam_receive]]></category>
		<category><![CDATA[make_ref]]></category>
		<category><![CDATA[recv_mark]]></category>
		<category><![CDATA[recv_set]]></category>

		<guid isPermaLink="false">http://blog.yufeng.info/?p=570</guid>
		<description><![CDATA[Erlang的惯用法之一就是在消息匹配的时候，如果需要唯一性，通常会通过make_ref搞个唯一的Ref来作为消息的一部分来匹配。这个惯用法用在gen_server:call或者demonitor这样的使用频度很高的函数里面。由于erlang的消息匹配是再消息队列里面挨个遍历来匹配，特别是消息队列特别长的时候，会有很大的性能瓶颈。于是新的优化出现了，以下是编译器beam_receive.erl里面的解释，写的很清楚： %%% %%% In code such as: %%% %%% Ref = make_ref(), %Or erlang:monitor(process, Pid) %%% . %%% . %%% . %%% receive %%% {Ref,Reply} -&#62; Reply %%% end. %%% %%% we know that none of the messages that exist in the message queue %%% before the call to make_ref/0 can be matched out in [...]]]></description>
			<content:encoded><![CDATA[<p>Erlang的惯用法之一就是在消息匹配的时候，如果需要唯一性，通常会通过make_ref搞个唯一的Ref来作为消息的一部分来匹配。这个惯用法用在gen_server:call或者demonitor这样的使用频度很高的函数里面。由于erlang的消息匹配是再消息队列里面挨个遍历来匹配，特别是消息队列特别长的时候，会有很大的性能瓶颈。于是新的优化出现了，以下是编译器beam_receive.erl里面的解释，写的很清楚：</p>
<pre class="brush: erlang;">
%%%
%%% In code such as:
%%%
%%%    Ref = make_ref(),        %Or erlang:monitor(process, Pid)
%%%      .
%%%      .
%%%      .
%%%    receive
%%%       {Ref,Reply} -&gt; Reply
%%%    end.
%%%
%%% we know that none of the messages that exist in the message queue
%%% before the call to make_ref/0 can be matched out in the receive
%%% statement. Therefore we can avoid going through the entire message
%%% queue if we introduce two new instructions (here written as
%%% BIFs in pseudo-Erlang):
%%%
%%%    recv_mark(SomeUniqInteger),
%%%    Ref = make_ref(),
%%%      .
%%%      .
%%%      .
%%%    recv_set(SomeUniqInteger),
%%%    receive
%%%       {Ref,Reply} -&gt; Reply
%%%    end.
%%%
%%% The recv_mark/1 instruction will save the current position and
%%% SomeUniqInteger in the process context. The recv_set
%%% instruction will verify that SomeUniqInteger is still stored
%%% in the process context. If it is, it will set the current pointer
%%% for the message queue (the next message to be read out) to the
%%% position that was saved by recv_mark/1.
%%%
%%% The remove_message instruction must be modified toinvalidate
%%% the information stored by the previous recv_mark/1, in case there
%%% is another receive executed between the calls to recv_mark/1 and
%%% recv_set/1.
%%%
%%% We use a reference to a label (i.e. a position in the loaded code)
%%% as the SomeUniqInteger.
%%%
</pre>
<p>结论： 点滴优化成就高性能。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.yufeng.info/archives/570/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
