<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>

<channel>
	<title>Neio Notes</title>
	<atom:link href="http://www.imneio.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.imneio.com</link>
	<description>Share knowledge and experience with you</description>
	<lastBuildDate>Thu, 08 Sep 2011 07:35:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
		<item>
		<title>Game Font Generator &#8211; BMFont</title>
		<link>http://www.imneio.com/2011/09/game-font-generator-bmfont/</link>
		<comments>http://www.imneio.com/2011/09/game-font-generator-bmfont/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 07:34:25 +0000</pubDate>
		<dc:creator>Neio</dc:creator>
				<category><![CDATA[经验之谈]]></category>

		<guid isPermaLink="false">http://www.imneio.com/?p=146</guid>
		<description><![CDATA[Somebody may face the difficult of drawing text by  using directX or OpenGL  directly. We have to generate character bitmap then use it as texture for showing texts. BMFont helps us with this task. BMFont provides both GUI window mode and command line mode. In GUI window mode, you can tick what character you need [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="bmfont" src="http://www.angelcode.com/products/bmfont/images/bmfont.png" alt="" width="274" height="184" />Somebody may face the difficult of drawing text by  using directX or OpenGL  directly. We have to generate character bitmap then use it as texture for showing texts.</p>
<p>BMFont helps us with this task. BMFont provides both GUI window mode and command line mode. In GUI window mode, you can tick what character you need to generate, you will receive a png format font image and configuration file for accessing the font image.</p>
<p>Command line mode is suitable for automatic generating purpose. For example, you write an Unicode encoded text file with the text that you need to display. Then use command line to generate. For example:</p>
<p><strong>bmfont.com -c config.bmfc -o gamefont.fnt -t text.txt </strong></p>
<p>This command line tell bmfont load config.bmfc and output as gamefont.fnt while all characters present in the text.txt will be added to the font.</p>
 <img src="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=146" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.imneio.com/2011/09/game-font-generator-bmfont/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Windows 7 下的串口調試</title>
		<link>http://www.imneio.com/2011/09/windows-7-rs232-debug/</link>
		<comments>http://www.imneio.com/2011/09/windows-7-rs232-debug/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 04:36:41 +0000</pubDate>
		<dc:creator>Neio</dc:creator>
				<category><![CDATA[经验之谈]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[RS232]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[串口]]></category>
		<category><![CDATA[調試]]></category>

		<guid isPermaLink="false">http://www.imneio.com/?p=142</guid>
		<description><![CDATA[最近的項目涉及到RS232通訊，創建虛擬的RS232串口來調試是開發時最方便的選擇。許多年前曾經可以用的一些虛擬串口工具在Windows 7下均失效了，於是又另外找了一個，與大家分享。 工具的名字叫：HW VSP3 , 推薦它因為他是FREEWARE，而且支持Windows 7 64bit。它的工作原理是虛擬出串口並且轉發到所設定的TCP地址。注意選SinglePort版本的，Multiport是commercial version。 這時候只需要一個TCP測試工具，例如 TCP&#38;UDP調試工具，即可與你當前的程序之間相互收發信息。當然也可以是你撰寫的單元測試工具，或者程序的客戶端模擬工具。]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-143" title="HW" src="http://www.imneio.com/wp-content/uploads/2011/09/HW-300x243.jpg" alt="" width="300" height="243" /></p>
<p>最近的項目涉及到RS232通訊，創建虛擬的RS232串口來調試是開發時最方便的選擇。許多年前曾經可以用的一些虛擬串口工具在Windows 7下均失效了，於是又另外找了一個，與大家分享。</p>
<p>工具的名字叫：<a title=\"HW VSP3\" href="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5ody1ncm91cC5jb20vcHJvZHVjdHMvaHdfdnNwL2luZGV4X2VuLmh0bWw=" target=\"_blank\">HW VSP3</a> , 推薦它因為他是FREEWARE，而且支持Windows 7 64bit。它的工作原理是虛擬出串口並且轉發到所設定的TCP地址。注意選SinglePort版本的，Multiport是commercial version。</p>
<p>這時候只需要一個TCP測試工具，例如 <a href="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy43ZWRvd24uY29tL3NvZnQvZG93bi9zb2Z0XzEzOTA5Lmh0bWw=" target=\"_blank\">TCP&amp;UDP調試工具</a>，即可與你當前的程序之間相互收發信息。當然也可以是你撰寫的單元測試工具，或者程序的客戶端模擬工具。</p>
 <img src="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=142" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.imneio.com/2011/09/windows-7-rs232-debug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>HLSL Notes 1</title>
		<link>http://www.imneio.com/2011/09/hlsl-notes-1/</link>
		<comments>http://www.imneio.com/2011/09/hlsl-notes-1/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 08:58:45 +0000</pubDate>
		<dc:creator>Neio</dc:creator>
				<category><![CDATA[经验之谈]]></category>
		<category><![CDATA[HLSL]]></category>
		<category><![CDATA[Shader]]></category>
		<category><![CDATA[著色器]]></category>

		<guid isPermaLink="false">http://www.imneio.com/?p=124</guid>
		<description><![CDATA[Getting Started Shader is a very powerful tool that enhanced the computer graphics. Since several years ago, computer graphic cards have supported hardware-accelerated shader. The picture below shows an example of shader effects. Shader is written in a so-called shader language. The shader language files are complied and are put into the graphic hardware running [...]]]></description>
			<content:encoded><![CDATA[<h3><strong>Getting Started</strong></h3>
<p><strong>Shader</strong> is a very powerful tool that enhanced the computer graphics. Since several years ago, computer graphic cards have supported hardware-accelerated shader. The picture below shows an example of shader effects.</p>
<p><img class="alignleft" title="Shader example 1" src="http://http.developer.nvidia.com/GPUGems2/elementLinks/17_softedged_04.jpg" alt="" width="250" height="187" /></p>
<p>Shader is written in a so-called shader language. The shader language files are complied and are put into the graphic hardware running in parallel.   There are some different kinds of shader languages. OpenGL provided a C-liked  shader language, called <em>OpenGL Shader Language (GLSL)</em>. In Microsoft <em>DirectX 9</em> or later, shaders are programmed by <em>High Level Shader Language (HLSL)</em>.</p>
<h3>Concept</h3>
<p>In shader programming, pixels are processed in parallel. So in shading language, we are dealing with single pixels. To simply the shader programming, the shader can be written in the following formulation:</p>
<p><strong>F(x,y,z) = value</strong></p>
<p>It tell the system what color will be shown in the position (x,y,z).</p>
<p><strong>Vertex Shader &amp; Pixel Shader</strong></p>
<p><img class="alignright" title="Pipeline" src="http://www.geeks3d.com/public/jegx/200808/graphics-rendering-pipelines-big.jpg" alt="" width="323" height="205" /></p>
<p>Due to the limitation of hardware pipeline, shader are divided into different types, such as vertex shader and pixel shader. They are processed in sequence in the graphics pipeline. (The latest newest shader model, the unified shader model has already simplified and unified the shading programming) However, since there are still many machine that does not support the latest shader model, this note will focus just on shader model 2.0.</p>
<h3>HLSL example</h3>
<p>In HLSL, like C programming, there will be an entry function, such as main().</p>
<p>For example:</p>
<p>sampler2D inputTexture : register(s0);</p>
<p>float4 ps_main (float2 texCoord: TEXCOORD0) : COLOR</p>
<p>{</p>
<p>float4 color = tex2D(inputTexture, texCoord);</p>
<p>return color;</p>
<p>}</p>
<p>This shader do NOTHING changed like directly rendering.</p>
 <img src="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=124" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.imneio.com/2011/09/hlsl-notes-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>LaTeX in WordPress</title>
		<link>http://www.imneio.com/2011/04/latex/</link>
		<comments>http://www.imneio.com/2011/04/latex/#comments</comments>
		<pubDate>Sat, 23 Apr 2011 08:47:40 +0000</pubDate>
		<dc:creator>Neio</dc:creator>
				<category><![CDATA[生活随笔]]></category>
		<category><![CDATA[BYY]]></category>
		<category><![CDATA[LaTeX]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.imneio.com/?p=119</guid>
		<description><![CDATA[今天尝试下在Wordpress上显示公式，看样子 WP LaTeX 插件不错。下面展示一个例子： 上面的式子是Bayesian Ying-Yang Matching function. 是徐雷教授的机器学习理论，用这个可以推出EM,K-means等特例。]]></description>
			<content:encoded><![CDATA[<p>今天尝试下在Wordpress上显示公式，看样子 WP LaTeX 插件不错。下面展示一个例子：</p>
<p><img src='http://s0.wp.com/latex.php?latex=BYY%28p%7C%7Cq%29%3D%5Cint_%7BX%2CR%7Dp%28R%7CX%29p%28X%29%5Cln%5Cfrac%7Bp%28R%7CX%29p%28X%29%7D%7Bq%28X%7CR%29q%28R%29%7DdXdR&#038;bg=ffffff&#038;fg=000&#038;s=0' alt='BYY(p||q)=&#92;int_{X,R}p(R|X)p(X)&#92;ln&#92;frac{p(R|X)p(X)}{q(X|R)q(R)}dXdR' title='BYY(p||q)=&#92;int_{X,R}p(R|X)p(X)&#92;ln&#92;frac{p(R|X)p(X)}{q(X|R)q(R)}dXdR' class='latex' /></p>
<p>上面的式子是Bayesian Ying-Yang Matching function. 是徐雷教授的机器学习理论，用这个可以推出EM,K-means等特例。</p>
 <img src="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=119" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.imneio.com/2011/04/latex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>My Current Research in CUHK</title>
		<link>http://www.imneio.com/2010/10/researchincuhk/</link>
		<comments>http://www.imneio.com/2010/10/researchincuhk/#comments</comments>
		<pubDate>Fri, 08 Oct 2010 14:38:43 +0000</pubDate>
		<dc:creator>Neio</dc:creator>
				<category><![CDATA[生活随笔]]></category>

		<guid isPermaLink="false">http://www.imneio.com/?p=103</guid>
		<description><![CDATA[It has been more one month, since I began my study in The Chinese University of Hong Kong.  Hong Kong impressed me in its order and efficiency.  It's transport system is really perfect that I can nearly go anywhere on time. I just have a little problem with its local language, the Cantonese, which I'm [...]]]></description>
			<content:encoded><![CDATA[<p>It has been more one month, since I began my study in The Chinese University of Hong Kong.  Hong Kong impressed me in its order and efficiency.  It's transport system is really perfect that I can nearly go anywhere on time. I just have a little problem with its local language, the Cantonese, which I'm really very poor.</p>
<p>I'm now with professor <a href="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5jc2UuY3Voay5lZHUuaGsvfmtod29uZy8=" target=\"_blank\">K.H. Wong</a> in CUHK and doing research in Computer Vision.  I the first term, I selected courses of Data Mining, Computer Vision and Semantic Web, along with PROJECT I, in which I have to take researches and keep thinking new ideas in implementing the technology of computer vision.</p>
<p>I will introduce later, in my blog, about what I'm studying.  The link will be updated here, too.</p>
 <img src="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=103" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.imneio.com/2010/10/researchincuhk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>NoSQL小记</title>
		<link>http://www.imneio.com/2009/12/nosql/</link>
		<comments>http://www.imneio.com/2009/12/nosql/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 13:01:59 +0000</pubDate>
		<dc:creator>Neio</dc:creator>
				<category><![CDATA[前沿理论]]></category>
		<category><![CDATA[生活随笔]]></category>
		<category><![CDATA[ACID]]></category>
		<category><![CDATA[BASE]]></category>
		<category><![CDATA[CAP]]></category>
		<category><![CDATA[HBase]]></category>
		<category><![CDATA[hypertable]]></category>
		<category><![CDATA[Key-Value]]></category>
		<category><![CDATA[NoSQL]]></category>
		<category><![CDATA[RDBMS]]></category>
		<category><![CDATA[RowColumn]]></category>

		<guid isPermaLink="false">http://www.imneio.com/?p=87</guid>
		<description><![CDATA[--Neio 我是在今年（2009年）夏天的“NoSQL”运动后(链接)才深入将Key-Value型存储方式引入现有的工作中的。早先对Google的Bigtable略有了解，知道其对数据存储思想的影响，但始终没有深入去了解它，所以现在也算是了去了一个遗憾。 我认为，NoSQL运动的意义并不是完全反对SQL，而是在于告诉被关系型数据库(RDBMS)这座宏伟的大山挡住视线的人们，SQL并非唯一的数据存储方式。也就是后来人们说的"Not Only SQL"——这一简短精辟的诠释"NoSQL"的短语。 目前我使用的Hypertable, HBase（HBase为参照使用），都是基于Bigtable模型的Key-Value型(更准确说是RowColumn型)分布式存储方式。选择它们，也是在于Bigtable盛名之下的缘故。 NoSQL运动中的模型并非Bigtable模型只此一家，而是如同春秋时期的诸子百家，整体呈现出了百家争鸣的局面。 Why NoSQL? 三个关键字：ACID, BASE, CAP ACID是DBMS中强调的，分别是原子性(Atomicity)、一致性(Consistency)、隔离性(Isolation)、持久性 (Durability)。对于这四个名词不了解的，请参考维基百科对于ACID的描述。总体来说，ACID的目的就是通过事务支持，保证数据的完整性和正确性。 CAP: CAP是一个经验理论，由Brewer所提。三个字母分别是 Consistency, Availability 和 Partition Tolerance的缩写，分别可以翻译为一致性、有效性和网络分离容忍度。三个目标无法兼得，ACID在一致性和有效性卓有成效，而在Partition tolerance上的努力, 则非常艰难。而目前互联网应用情形下的海量数据，将单台计算机的处理能力压榨殆尽，单台计算机上的关系型数据库很难满足应用需求；而如果将关系型数据库的表分割存储在不同的计算机上，其有效性将很难保证。 于是乎，BASE被渐渐从记忆中挖掘出来，渐渐成为hot word。这个名词同样是Brewer所提。分别是英文：Basically Available， Soft-state, Eventual Consistency的缩写，正好与ACID这个缩写在字面上的意思相对应。这个理论认为，只需要满足Eventual Consistency（最终一致性）即可，而且可以是无连接的(Soft-state)。值得一提的是，eBay正是根据BASE的原理设计起架构。有兴趣的朋友可以参考《 BASE: An Acid Alternative》。 这三个名词与 NoSQL什么关系？ NoSQL做的，就是通过降低对数据一致性、完整性的要求，转而偏向于CAP中的A和P，通过增加Tolerance to network partition(P)的支持, 甚至与追求P来达到满足高并发的需求。而这背后，就需要BASE理论的支撑，才敢如此的放肆。因为放弃了对一致性的高要求，只需要满足BASE的Eventual Consistency, 也能最终达到一致。 后记 面向高并发的软件架构，特别是电子商务型的网站，更是要在CAP中三个度量中做取舍。核心的业务需要一致性的保证，偏向于用通过关系型数据库来保证，而一些对于一致性要求不高的数据，通过使用Key-Value型数据存储方式，又可以满足大量访问的要求。 ACID与BASE，这两个中和一下，不正是我们所需要的么？ 所以, Why not NoSQL? ---------------------- PS. 文章在Draft停留了1个月，一直未完稿。始终还没调整好工作的节奏, 困于工作中啊。 [...]]]></description>
			<content:encoded><![CDATA[<p>--Neio</p>
<p>我是在今年（2009年）夏天的“NoSQL”运动后(<a href="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9Ob1NRTA==" target=\"_blank\">链接</a>)才深入将Key-Value型存储方式引入现有的工作中的。早先对Google的Bigtable略有了解，知道其对数据存储思想的影响，但始终没有深入去了解它，所以现在也算是了去了一个遗憾。</p>
<p>我认为，NoSQL运动的意义并不是完全反对SQL，而是在于告诉被关系型数据库(RDBMS)这座宏伟的大山挡住视线的人们，SQL并非唯一的数据存储方式。也就是后来人们说的"Not Only SQL"——这一简短精辟的诠释"NoSQL"的短语。</p>
<p>目前我使用的Hypertable, HBase（HBase为参照使用），都是基于Bigtable模型的Key-Value型(更准确说是RowColumn型)分布式存储方式。选择它们，也是在于Bigtable盛名之下的缘故。</p>
<p>NoSQL运动中的模型并非Bigtable模型只此一家，而是如同春秋时期的诸子百家，整体呈现出了百家争鸣的局面。</p>
<p><strong>Why NoSQL?</strong></p>
<p>三个关键字：ACID, BASE, CAP</p>
<p>ACID是DBMS中强调的，分别是原子性(Atomicity)、一致性(Consistency)、隔离性(Isolation)、持久性 (Durability)。对于这四个名词不了解的，请参考<a href="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9BQ0lE">维基百科</a>对于ACID的描述。总体来说，ACID的目的就是通过事务支持，保证数据的完整性和正确性。</p>
<p>CAP: CAP是一个经验理论，由Brewer所提。三个字母分别是 <strong>C</strong>onsistency, <strong>A</strong>vailability 和 <strong>P</strong>artition Tolerance的缩写，分别可以翻译为一致性、有效性和网络分离容忍度。<strong>三个目标无法兼得</strong>，ACID在一致性和有效性卓有成效，而在Partition tolerance上的努力, 则非常艰难。而目前互联网应用情形下的海量数据，将单台计算机的处理能力压榨殆尽，单台计算机上的关系型数据库很难满足应用需求；而如果将关系型数据库的表分割存储在不同的计算机上，其有效性将很难保证。</p>
<p>于是乎，BASE被渐渐从记忆中挖掘出来，渐渐成为hot word。这个名词同样是Brewer所提。分别是英文：<strong>B</strong>asically <strong>A</strong>vailable， <strong>S</strong>oft-state, <strong>E</strong>ventual Consistency的缩写，正好与ACID这个缩写在字面上的意思相对应。这个理论认为，只需要满足Eventual Consistency（最终一致性）即可，而且可以是无连接的(Soft-state)。值得一提的是，eBay正是根据BASE的原理设计起架构。有兴趣的朋友可以参考《<br />
<a href="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3F1ZXVlLmFjbS5vcmcvZGV0YWlsLmNmbT9pZD0xMzk0MTI4">BASE: An Acid Alternative</a>》。</p>
<p>这三个名词与 NoSQL什么关系？</p>
<p>NoSQL做的，就是通过降低对数据一致性、完整性的要求，转而偏向于CAP中的A和P，通过增加Tolerance to network partition(P)的支持, 甚至与追求P来达到满足高并发的需求。而这背后，就需要BASE理论的支撑，才敢如此的放肆。因为放弃了对一致性的高要求，只需要满足BASE的Eventual Consistency, 也能最终达到一致。</p>
<p><strong>后记</strong></p>
<p>面向高并发的软件架构，特别是电子商务型的网站，更是要在CAP中三个度量中做取舍。核心的业务需要一致性的保证，偏向于用通过关系型数据库来保证，而一些对于一致性要求不高的数据，通过使用Key-Value型数据存储方式，又可以满足大量访问的要求。</p>
<p>ACID与BASE，这两个中和一下，不正是我们所需要的么？ 所以, Why not NoSQL?</p>
<p>----------------------<br />
PS. 文章在Draft停留了1个月，一直未完稿。始终还没调整好工作的节奏, 困于工作中啊。<br />
----------------------</p>
 <img src="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=87" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.imneio.com/2009/12/nosql/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Recruit [Out-dated]</title>
		<link>http://www.imneio.com/2009/11/recruit/</link>
		<comments>http://www.imneio.com/2009/11/recruit/#comments</comments>
		<pubDate>Mon, 16 Nov 2009 15:41:32 +0000</pubDate>
		<dc:creator>Neio</dc:creator>
				<category><![CDATA[生活随笔]]></category>

		<guid isPermaLink="false">http://www.imneio.com/?p=88</guid>
		<description><![CDATA[Updated on Dec. 8, 2010 我现在已经离开正在上学。 以前的公司现在仍然在大力招人。 ---------------------------------- 目前我们公司正在招纳新人，具体情况详见： http://www.qzqx.net/about/Invite.aspx 公司全名：泉州市视通光电网络有限公司 工作地点：公司总部，福建省泉州市中山中路旁（中心市区） 工作要求：如果你有以下资历之一，非常欢迎你的加盟。 1、GIS应用开发2年或以上经验，且为主要项目负责人； 2、精通算法，懂得数学建模的；熟练掌握C++或C#的优先； 3、拥有5年或以上团队经验，且有担任项目经理经验； 4、拥有企业软件设计5年或以上经验者。 拥有以上其中一项资历者，在我们公司可以找到很好的才华展示机会。 积极进取、勇于创新 有意者请将简历或相关材料发到我的邮箱(neio.zhou~~gmail.com)，也可以直接通过上面的链接地址上的联系方式联系。]]></description>
			<content:encoded><![CDATA[<p>Updated on Dec. 8, 2010</p>
<p>我现在已经离开正在上学。</p>
<p>以前的公司现在仍然在大力招人。</p>
<p>----------------------------------</p>
<p>目前我们公司正在招纳新人，具体情况详见：</p>
<p><a href="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5xenF4Lm5ldC9hYm91dC9JbnZpdGUuYXNweA==">http://www.qzqx.net/about/Invite.aspx</a></p>
<p>公司全名：泉州市视通光电网络有限公司<br />
工作地点：公司总部，福建省泉州市中山中路旁（中心市区）<br />
工作要求：如果你有以下资历<strong><span style="color: #ff0000;">之一</span></strong>，非常欢迎你的加盟。</p>
<p>1、GIS应用开发2年或以上经验，<strong>且</strong>为主要项目负责人；<br />
2、精通算法，懂得数学建模的；熟练掌握C++或C#的优先；<br />
3、拥有5年或以上团队经验，且有担任项目经理经验；<br />
4、拥有企业软件设计5年或以上经验者。</p>
<p>拥有以上其中一项资历者，在我们公司可以找到很好的才华展示机会。</p>
<p>积极进取、勇于创新</p>
<p>有意者请将简历或相关材料发到我的邮箱(neio.zhou~~gmail.com)，也可以直接通过上面的链接地址上的联系方式联系。</p>
 <img src="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=88" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.imneio.com/2009/11/recruit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Thrift C＃for Hypertable Issue</title>
		<link>http://www.imneio.com/2009/10/thrift-csharp-hypertable-issue/</link>
		<comments>http://www.imneio.com/2009/10/thrift-csharp-hypertable-issue/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 16:31:48 +0000</pubDate>
		<dc:creator>Neio</dc:creator>
				<category><![CDATA[经验之谈]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[hypertable]]></category>
		<category><![CDATA[Thrift]]></category>

		<guid isPermaLink="false">http://www.imneio.com/?p=75</guid>
		<description><![CDATA[前言 近日在为Hypertable做一层.NET(C#)的封装，遇到了一个较为严重的问题：用Thrift封装的Hypertable C#客户端在连接Hypertable ThriftBroker的时候被主动断开，造成数据无法读取的现象。 过程 1、用Wireshark检查了TCP封包，观察到在发送第一笔数据后就被Hypertable ThriftBrokeryper主动发送FIN结束了连接，于是后面发送数据就丢掉了，更不用说接收信息； 2、检查Hypertable中的日志，查看到以下信息： TConnection : transition() Negative Frame Size -2147418111, remote side not using TFramedTransport? 注意到这里可以看出，Hypertable使用了TFramedTransport作为其传输层接口。然而，C＃的Thrift中尚无此接口。 可见, Thrift C#还跟不上其主要语言C＋＋的开发脚步。 3、补充：进一步分析，Hypertable使用的是TNonblockingServer作为其服务的方式，而这个TServer的实现有别与其他TSimpleServer, TThreadedServer等实现，在数据的开头加入了数据长度的数据，也正是这一点造成了数据的不兼容。在C++版本中的Thrift将TNonblockingServer与其他TServer的实现分开，单独生成libthriftnb库。而TFramedTransport，正是建立在TNonblockingSocket之上的。 解决方法 请参考：https://issues.apache.org/jira/browse/THRIFT-210 目前官方的代码版本库中还没有相应的代码，为了方便大家理解，我将TFramedTransport.cs的代码放在这里，遇到同样问题的朋友可以从这里拿代码补充到Thrift中编译： 下面是解释如何使用TFramedTransport： ----------------------------------------------------------]]></description>
			<content:encoded><![CDATA[<h2>前言</h2>
<p>近日在为Hypertable做一层.NET(C#)的封装，遇到了一个较为严重的问题：用Thrift封装的Hypertable C#客户端在连接Hypertable ThriftBroker的时候被主动断开，造成数据无法读取的现象。</p>
<h2>过程</h2>
<p>1、用Wireshark检查了TCP封包，观察到在发送第一笔数据后就被Hypertable ThriftBrokeryper主动发送FIN结束了连接，于是后面发送数据就丢掉了，更不用说接收信息；</p>
<p>2、检查Hypertable中的日志，查看到以下信息：<br />
TConnection : transition() Negative Frame Size -2147418111, remote side not using TFramedTransport?<br />
注意到这里可以看出，Hypertable使用了TFramedTransport作为其传输层接口。然而，C＃的Thrift中尚无此接口。<br />
<span id="more-75"></span><br />
可见, Thrift C#还跟不上其主要语言C＋＋的开发脚步。</p>
<p>3、补充：进一步分析，Hypertable使用的是TNonblockingServer作为其服务的方式，而这个TServer的实现有别与其他TSimpleServer, TThreadedServer等实现，在数据的开头加入了数据长度的数据，也正是这一点造成了数据的不兼容。在C++版本中的Thrift将TNonblockingServer与其他TServer的实现分开，单独生成libthriftnb库。而TFramedTransport，正是建立在TNonblockingSocket之上的。</p>
<h2>解决方法</h2>
<p>请参考：<a href="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cHM6Ly9pc3N1ZXMuYXBhY2hlLm9yZy9qaXJhL2Jyb3dzZS9USFJJRlQtMjEw" target=\"_self\">https://issues.apache.org/jira/browse/THRIFT-210</a><br />
目前官方的代码版本库中还没有相应的代码，为了方便大家理解，我将<strong>TFramedTransport.cs</strong>的代码放在这里，遇到同样问题的朋友可以从这里拿代码补充到Thrift中编译：</p>
<pre class="brush: csharp; title: ; notranslate">
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * &quot;License&quot;); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

using System;
using System.Text;
using Thrift.Transport;

namespace Thrift.Protocol
{
	public class TBinaryProtocol : TProtocol
	{
		protected const uint VERSION_MASK = 0xffff0000;
		protected const uint VERSION_1 = 0x80010000;

		protected bool strictRead_ = false;
		protected bool strictWrite_ = true;

		protected int readLength_;
		protected bool checkReadLength_ = false;

		#region BinaryProtocol Factory
		 /**
		  * Factory
		  */
		  public class Factory : TProtocolFactory {

			  protected bool strictRead_ = false;
			  protected bool strictWrite_ = true;

			  public Factory()
				  :this(false, true)
			  {
			  }

			  public Factory(bool strictRead, bool strictWrite)
			  {
				  strictRead_ = strictRead;
				  strictWrite_ = strictWrite;
			  }

			public TProtocol GetProtocol(TTransport trans) {
			  return new TBinaryProtocol(trans, strictRead_, strictWrite_);
			}
		  }

		#endregion

		public TBinaryProtocol(TTransport trans)
			: this(trans, false, true)
		{
		}

		public TBinaryProtocol(TTransport trans, bool strictRead, bool strictWrite)
			:base(trans)
		{
			strictRead_ = strictRead;
			strictWrite_ = strictWrite;
		}

		#region Write Methods

		public override void WriteMessageBegin(TMessage message)
		{
			if (strictWrite_)
			{
				uint version = VERSION_1 | (uint)(message.Type);
				WriteI32((int)version);
				WriteString(message.Name);
				WriteI32(message.SeqID);
			}
			else
			{
				WriteString(message.Name);
				WriteByte((byte)message.Type);
				WriteI32(message.SeqID);
			}
		}

		public override void WriteMessageEnd()
		{
		}

		public override void WriteStructBegin(TStruct struc)
		{
		}

		public override void WriteStructEnd()
		{
		}

		public override void WriteFieldBegin(TField field)
		{
			WriteByte((byte)field.Type);
			WriteI16(field.ID);
		}

		public override void WriteFieldEnd()
		{
		}

		public override void WriteFieldStop()
		{
			WriteByte((byte)TType.Stop);
		}

		public override void WriteMapBegin(TMap map)
		{
			WriteByte((byte)map.KeyType);
			WriteByte((byte)map.ValueType);
			WriteI32(map.Count);
		}

		public override void WriteMapEnd()
		{
		}

		public override void WriteListBegin(TList list)
		{
			WriteByte((byte)list.ElementType);
			WriteI32(list.Count);
		}

		public override void WriteListEnd()
		{
		}

		public override void WriteSetBegin(TSet set)
		{
			WriteByte((byte)set.ElementType);
			WriteI32(set.Count);
		}

		public override void WriteSetEnd()
		{
		}

		public override void WriteBool(bool b)
		{
			WriteByte(b ? (byte)1 : (byte)0);
		}

		private byte[] bout = new byte[1];
		public override void WriteByte(byte b)
		{
			bout[0] = b;
			trans.Write(bout, 0, 1);
		}

		private byte[] i16out = new byte[2];
		public override void WriteI16(short s)
		{
			i16out[0] = (byte)(0xff &amp; (s &gt;&gt; 8));
			i16out[1] = (byte)(0xff &amp; s);
			trans.Write(i16out, 0, 2);
		}

		private byte[] i32out = new byte[4];
		public override void WriteI32(int i32)
		{
			i32out[0] = (byte)(0xff &amp; (i32 &gt;&gt; 24));
			i32out[1] = (byte)(0xff &amp; (i32 &gt;&gt; 16));
			i32out[2] = (byte)(0xff &amp; (i32 &gt;&gt; 8));
			i32out[3] = (byte)(0xff &amp; i32);
			trans.Write(i32out, 0, 4);
		}

		private byte[] i64out = new byte[8];
		public override void WriteI64(long i64)
		{
			i64out[0] = (byte)(0xff &amp; (i64 &gt;&gt; 56));
			i64out[1] = (byte)(0xff &amp; (i64 &gt;&gt; 48));
			i64out[2] = (byte)(0xff &amp; (i64 &gt;&gt; 40));
			i64out[3] = (byte)(0xff &amp; (i64 &gt;&gt; 32));
			i64out[4] = (byte)(0xff &amp; (i64 &gt;&gt; 24));
			i64out[5] = (byte)(0xff &amp; (i64 &gt;&gt; 16));
			i64out[6] = (byte)(0xff &amp; (i64 &gt;&gt; 8));
			i64out[7] = (byte)(0xff &amp; i64);
			trans.Write(i64out, 0, 8);
		}

		public override void WriteDouble(double d)
		{
			WriteI64(BitConverter.DoubleToInt64Bits(d));
		}

		public override void WriteBinary(byte[] b)
		{
			WriteI32(b.Length);
			trans.Write(b, 0, b.Length);
		}

		#endregion

		#region ReadMethods

		public override TMessage ReadMessageBegin()
		{
			TMessage message = new TMessage();
			int size = ReadI32();
			if (size &lt; 0)
			{
				uint version = (uint)size &amp; VERSION_MASK;
				if (version != VERSION_1)
				{
					throw new TProtocolException(TProtocolException.BAD_VERSION, &quot;Bad version in ReadMessageBegin: &quot; + version);
				}
				message.Type = (TMessageType)(size &amp; 0x000000ff);
				message.Name = ReadString();
				message.SeqID = ReadI32();
			}
			else
			{
				if (strictRead_)
				{
					throw new TProtocolException(TProtocolException.BAD_VERSION, &quot;Missing version in readMessageBegin, old client?&quot;);
				}
				message.Name = ReadStringBody(size);
				message.Type = (TMessageType)ReadByte();
				message.SeqID = ReadI32();
			}
			return message;
		}

		public override void ReadMessageEnd()
		{
		}

		public override TStruct ReadStructBegin()
		{
			return new TStruct();
		}

		public override void ReadStructEnd()
		{
		}

		public override TField ReadFieldBegin()
		{
			TField field = new TField();
			field.Type = (TType)ReadByte();

			if (field.Type != TType.Stop)
			{
				field.ID = ReadI16();
			}

			return field;
		}

		public override void ReadFieldEnd()
		{
		}

		public override TMap ReadMapBegin()
		{
			TMap map = new TMap();
			map.KeyType = (TType)ReadByte();
			map.ValueType = (TType)ReadByte();
			map.Count = ReadI32();

			return map;
		}

		public override void ReadMapEnd()
		{
		}

		public override TList ReadListBegin()
		{
			TList list = new TList();
			list.ElementType = (TType)ReadByte();
			list.Count = ReadI32();

			return list;
		}

		public override void ReadListEnd()
		{
		}

		public override TSet ReadSetBegin()
		{
			TSet set = new TSet();
			set.ElementType = (TType)ReadByte();
			set.Count = ReadI32();

			return set;
		}

		public override void ReadSetEnd()
		{
		}

		public override bool ReadBool()
		{
			return ReadByte() == 1;
		}

		private byte[] bin = new byte[1];
		public override byte ReadByte()
		{
			ReadAll(bin, 0, 1);
			return bin[0];
		}

		private byte[] i16in = new byte[2];
		public override short ReadI16()
		{
			ReadAll(i16in, 0, 2);
			return (short)(((i16in[0] &amp; 0xff) &lt;&lt; 8 ) | ((i16in[1] &amp; 0xff)));
		}

		private byte[] i32in = new byte[4];
		public override int ReadI32()
		{
			ReadAll(i32in, 0, 4);
			return (int)(((i32in[0] &amp; 0xff) &lt;&lt; 24) | ((i32in[1] &amp; 0xff) &lt;&lt; 16) | ((i32in[2] &amp; 0xff) &lt;&lt; 8 ) | ((i32in[3] &amp; 0xff)));
		}

		private byte[] i64in = new byte[8];
		public override long ReadI64()
		{
			ReadAll(i64in, 0, 8);
			return (long)(((long)(i64in[0] &amp; 0xff) &lt;&lt; 56) | ((long)(i64in[1] &amp; 0xff) &lt;&lt; 48 ) | ((long)(i64in[2] &amp; 0xff ) &lt;&lt;   40 ) |  ((long)(i64in[3] &amp; 0xff) &lt;&lt; 32) |
				((long)(i64in[4] &amp; 0xff) &lt;&lt; 24) | ((long)(i64in[5] &amp; 0xff) &lt;&lt; 16) | ((long)(i64in[6] &amp; 0xff)  &lt;&lt;  8  ) | ((long)(i64in[7] &amp; 0xff)));
		}

		public override double ReadDouble()
		{
			return BitConverter.Int64BitsToDouble(ReadI64());
		}

		public void SetReadLength(int readLength)
		{
			readLength_ = readLength;
			checkReadLength_ = true;
		}

		protected void CheckReadLength(int length)
		{
			if (checkReadLength_)
			{
				readLength_ -= length;
				if (readLength_ &lt; 0)
				{
					throw new Exception(&quot;Message length exceeded: &quot; + length);
				}
			}
		}

		public override byte[] ReadBinary()
		{
			int size = ReadI32();
			CheckReadLength(size);
			byte[] buf = new byte[size];
			trans.ReadAll(buf, 0, size);
			return buf;
		}
		private  string ReadStringBody(int size)
		{
			CheckReadLength(size);
			byte[] buf = new byte[size];
			trans.ReadAll(buf, 0, size);
			return Encoding.UTF8.GetString(buf);
		}

		private int ReadAll(byte[] buf, int off, int len)
		{
			CheckReadLength(len);
			return trans.ReadAll(buf, off, len);
		}

		#endregion
	}
}
</pre>
<p>下面是解释如何使用TFramedTransport：</p>
<pre class="brush: csharp; title: ; notranslate">
TSocket socket = new TSocket(&quot;127.0.0.1&quot;, 38080);
TTransport trans = new TFramedTransport(socket);
TProtocol protocol = new TBinaryProtocol(trans);
HqlService.Client client = new HqlService.Client(protocol);
</pre>
<p>----------------------------------------------------------</p>
 <img src="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=75" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.imneio.com/2009/10/thrift-csharp-hypertable-issue/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Thrift简介</title>
		<link>http://www.imneio.com/2009/10/thrift-intro/</link>
		<comments>http://www.imneio.com/2009/10/thrift-intro/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 08:33:49 +0000</pubDate>
		<dc:creator>Neio</dc:creator>
				<category><![CDATA[经验之谈]]></category>
		<category><![CDATA[Introduction]]></category>
		<category><![CDATA[Thrift]]></category>

		<guid isPermaLink="false">http://www.imneio.com/?p=65</guid>
		<description><![CDATA[Thrift是一个跨语言服务部署框架，最初由Facebook于2007年开发，后于2008年进入Apache孵化器(Apache Incubator)。 类似于SOAP，COM 和CORBA，Thrift通过定义一个中间定义语言和Thrift代码生成工具，生成指定语言的代码。目前，Thrift支持C++,Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk和OCaml的代码生成。 简单分析其机理，Thrift就是实现C/S模式，通过代码生成工具将接口定义文件生成服务器端和客户端代码（可以为不同语言），从而实现服务端和客户端跨语言的支持。 Thrift可以分为传输层和协议层： 1、传输层定义了数据的传输方式，可以为TCP/IP传输，内存共享或者文件共享等形式； 2、协议层定义了数据的传输格式，可以为二进制流或者XML等形式。 简单例子： 中间语言定义： Python客户端代码： 服务器端代码： 参考资料 1. http://incubator.apache.org/thrift]]></description>
			<content:encoded><![CDATA[<p>Thrift是一个跨语言服务部署框架，最初由Facebook于2007年开发，后于2008年进入Apache孵化器(Apache Incubator)。</p>
<p>类似于SOAP，COM 和CORBA，Thrift通过定义一个中间定义语言和Thrift代码生成工具，生成指定语言的代码。目前，Thrift支持C++,Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk和OCaml的代码生成。</p>
<p>简单分析其机理，Thrift就是实现C/S模式，通过代码生成工具将接口定义文件生成服务器端和客户端代码（可以为不同语言），从而实现服务端和客户端跨语言的支持。</p>
<p>Thrift可以分为传输层和协议层：</p>
<p>1、传输层定义了数据的传输方式，可以为TCP/IP传输，内存共享或者文件共享等形式；<br />
2、协议层定义了数据的传输格式，可以为二进制流或者XML等形式。</p>
<p>简单例子：</p>
<p>中间语言定义：</p>
<pre class="brush: plain; title: ; notranslate">
struct UserProfile {
1: i32 uid,
2: string name,
3: string blurb
}
service UserStorage {
void store(1: UserProfile user),
UserProfile retrieve(1: i32 uid)
}
</pre>
<p>Python客户端代码：</p>
<pre class="brush: python; title: ; notranslate">
# Make an object
up = UserProfile(uid=1,
                 name=&quot;Mark Slee&quot;,
                 blurb=&quot;I'll find something to put here.&quot;)

# Talk to a server via TCP sockets, using a binary protocol
transport = TSocket.TSocket(&quot;localhost&quot;, 9090)
transport.open()
protocol = TBinaryProtocol.TBinaryProtocol(transport)

# Use the service we already defined
service = UserStorage.Client(protocol)
service.store(up)

# Retrieve something as well
up2 = service.retrieve(2)
</pre>
<p>服务器端代码：</p>
<pre class="brush: cpp; title: ; notranslate">
class UserStorageHandler : virtual public UserStorageIf {
 public:
  UserStorageHandler() {
    // Your initialization goes here
  }

  void store(const UserProfile&amp; user) {
    // Your implementation goes here
    printf(&quot;store\n&quot;);
  }

  void retrieve(UserProfile&amp; _return, const int32_t uid) {
    // Your implementation goes here
    printf(&quot;retrieve\n&quot;);
  }
};

int main(int argc, char **argv) {
  int port = 9090;
  shared_ptr&lt;UserStorageHandler&gt; handler(new UserStorageHandler());
  shared_ptr&lt;TProcessor&gt; processor(new UserStorageProcessor(handler));
  shared_ptr&lt;TServerTransport&gt; serverTransport(new TServerSocket(port));
  shared_ptr&lt;TTransportFactory&gt; transportFactory(new TBufferedTransportFactory());
  shared_ptr&lt;TProtocolFactory&gt; protocolFactory(new TBinaryProtocolFactory());
  TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
  server.serve();
  return 0;
}
</pre>
<p><strong>参考资料</strong></p>
<p>1.<a href="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=IGh0dHA6Ly9pbmN1YmF0b3IuYXBhY2hlLm9yZy90aHJpZnQ=" target=\"_blank\"> http://incubator.apache.org/thrift</a></p>
 <img src="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=65" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.imneio.com/2009/10/thrift-intro/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>First C++ Programming Experience with Hypertable(A)</title>
		<link>http://www.imneio.com/2009/10/hypertable_cpp_a/</link>
		<comments>http://www.imneio.com/2009/10/hypertable_cpp_a/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 05:31:33 +0000</pubDate>
		<dc:creator>Neio</dc:creator>
				<category><![CDATA[经验之谈]]></category>
		<category><![CDATA[boost]]></category>
		<category><![CDATA[freebase]]></category>
		<category><![CDATA[hypertable]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.imneio.com/?p=55</guid>
		<description><![CDATA[前言 目前正在为Hypertable做一层封装，使之通过ZeroMQ或RabbitMQ提供一个通用数据访问接口。 说来蛮郁闷的，编译一个Hypertable的example耗费了我一天半的时间。一来，网速慢，下载boost, thrift, log4cpp等库，耗费了很多时间；二来，没有在Linux下做过项目。 下面我以example里面的freebase作为例子，说明编译环境的配。 编译Freebase例子 一、环境 Ubuntu 8.10 hypertable 0.9.2.7  （hypertable-0.9.2.7-linux-i386.deb） 二、编译所需库 1. libboost1.40-dev 注意: Ubuntu 8.10上的libboost-dev是1.34的版本，需要另外找1.4的，否则编译的时候会出现 undefined reference to boost::system:: 之类的错误。 可以用一下两种方式解决： 一是找debian的官方源，然后用apt-get install的方式安装: 在sources.list下面添加: deb http://ftp2.de.debian.org/debian unstable main contrib non-free 然后运行： sudo apt-get update sudo apt-get install libboost1.40-all-dev 若出现没有公钥(NO_PUBKEY)的错误，请参考这里解决。 二是下载boost的deb包后安装; 三是从Boost官方网站下载源代码来编译。 2.配置CMakeList.txt 以下是我根据我的环境配置的CMakeList.txt的内容，请读者根据自己的环境调整。 include_directories( ./ /usr/include/boost/ /usr/include/log4cpp/ /usr/local/include /opt/hypertable/current/include /usr/include/thrift ) [...]]]></description>
			<content:encoded><![CDATA[<h2>前言</h2>
<p>目前正在为Hypertable做一层封装，使之通过ZeroMQ或RabbitMQ提供一个通用数据访问接口。</p>
<p>说来蛮郁闷的，编译一个Hypertable的example耗费了我一天半的时间。一来，网速慢，下载boost, thrift, log4cpp等库，耗费了很多时间；二来，没有在Linux下做过项目。</p>
<p>下面我以example里面的freebase作为例子，说明编译环境的配。</p>
<h2>编译Freebase例子</h2>
<p>一、环境</p>
<p>Ubuntu 8.10</p>
<p>hypertable 0.9.2.7  （<a href="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3BhY2thZ2UuaHlwZXJ0YWJsZS5vcmcv" target=\"_blank\">hypertable-0.9.2.7-linux-i386.deb</a>）<span id="more-55"></span></p>
<p>二、编译所需库</p>
<p>1. libboost1.40-dev</p>
<p><strong>注意</strong>: Ubuntu 8.10上的libboost-dev是1.34的版本，需要另外找1.4的，否则编译的时候会出现 undefined reference to boost::system:: 之类的错误。</p>
<p>可以用一下两种方式解决：</p>
<p>一是找debian的官方源，然后用apt-get install的方式安装:</p>
<blockquote><p>在sources.list下面添加:</p>
<p>deb http://ftp2.de.debian.org/debian unstable main contrib non-free</p>
<p>然后运行：</p>
<p>sudo apt-get update</p>
<p>sudo apt-get install libboost1.40-all-dev</p>
<p>若出现<strong>没有公钥(NO_PUBKEY)</strong>的错误，请参考<a href="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5pbW5laW8uY29tLzIwMDkvMTAvdWJ1bnR1LXB1YmtleS8=" target=\"_blank\">这里</a>解决。</p></blockquote>
<p>二是下载boost的deb包后安装;</p>
<p>三是从Boost官方网站下载源代码来编译。</p>
<p>2.配置CMakeList.txt</p>
<p>以下是我根据我的环境配置的CMakeList.txt的内容，请读者根据自己的环境调整。</p>
<blockquote><p>include_directories( ./<br />
/usr/include/boost/<br />
/usr/include/log4cpp/<br />
/usr/local/include<br />
/opt/hypertable/current/include<br />
/usr/include/thrift<br />
)</p>
<p>link_directories(<br />
/opt/hypertable/current/lib/<br />
/usr/local/lib/<br />
/usr/lib/<br />
)</p>
<p>add_executable(freebase_load freebase_load.cc freebase_parser.cc)</p>
<p>target_link_libraries(</p>
<p>freebase_load<br />
libHyperThrift.a<br />
libHypertable.a<br />
libHyperComm.a<br />
libHyperspace.a<br />
libHyperCommon.a<br />
libHyperTools.a<br />
libHyperDfsBroker.a<br />
libHyperDfsCmds.a<br />
libHyperRanger.a<br />
libsigar-x86-linux.so<br />
libdb_cxx-4.6.so<br />
libboost_filesystem.so<br />
libboost_iostreams.so<br />
libboost_program_options.so<br />
libboost_regex.so<br />
libboost_system.so<br />
libboost_signals.so<br />
libboost_thread.so<br />
libboost_date_time.so<br />
libexpat.so<br />
libgcc_s.so<br />
libthrift.so<br />
libthriftnb.so<br />
libstdc++.so<br />
libpthread.so<br />
libz.so<br />
liblog4cpp.so<br />
libtcmalloc_minimal.so<br />
libdl.so<br />
libevent.so<br />
libcurses.so</p>
<p>)</p></blockquote>
<p>3.为程序编写配置文件</p>
<p>在程序运行目录相对地址（例如:/opt/hyperspace/current/examples/freebase）下，添加conf/hypertable.cfg文件。</p>
<p>往里面添加配置内容，例如我的：</p>
<blockquote><p>Hypersapce.Master.Host=localhost</p>
<p>Hyperspace.Master.Port=38040</p>
<p>Hyperspace.Master.Dir=hyperspace</p>
<p>Hyperspace.Master.Workers=20</p></blockquote>
<p>4. 编译运行</p>
<p>首先，在hypertable中添加freebase的数据结构，即create-table-freebase.hql里面的内容。</p>
<p>然后，运行以下几句编译和运行</p>
<p>$sudo cmake ./</p>
<p>$sudo make</p>
<p>$./freebase  aircraft_model.tsv</p>
<p>至此，试验大功告成。接接下去就是开始设计自己的分装了。</p>
 <img src="http://www.imneio.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=55" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.imneio.com/2009/10/hypertable_cpp_a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license>
	</item>
	</channel>
</rss>

