<?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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Yi Wang&#039;s Tech Notes</title>
	<atom:link href="http://cxwangyi.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://cxwangyi.wordpress.com</link>
	<description>A blog ported from http://cxwangyi.blogspot.com</description>
	<lastBuildDate>Fri, 17 May 2013 02:45:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='cxwangyi.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Yi Wang&#039;s Tech Notes</title>
		<link>http://cxwangyi.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://cxwangyi.wordpress.com/osd.xml" title="Yi Wang&#039;s Tech Notes" />
	<atom:link rel='hub' href='http://cxwangyi.wordpress.com/?pushpress=hub'/>
		<item>
		<title>用daemon命令负责任务的自动重启</title>
		<link>http://cxwangyi.wordpress.com/2013/04/14/%e7%94%a8daemon%e5%91%bd%e4%bb%a4%e8%b4%9f%e8%b4%a3%e4%bb%bb%e5%8a%a1%e7%9a%84%e8%87%aa%e5%8a%a8%e9%87%8d%e5%90%af/</link>
		<comments>http://cxwangyi.wordpress.com/2013/04/14/%e7%94%a8daemon%e5%91%bd%e4%bb%a4%e8%b4%9f%e8%b4%a3%e4%bb%bb%e5%8a%a1%e7%9a%84%e8%87%aa%e5%8a%a8%e9%87%8d%e5%90%af/#comments</comments>
		<pubDate>Sun, 14 Apr 2013 03:08:43 +0000</pubDate>
		<dc:creator>cxwangyi</dc:creator>
				<category><![CDATA[System Config Skill]]></category>

		<guid isPermaLink="false">http://cxwangyi.wordpress.com/?p=1439</guid>
		<description><![CDATA[不知道大家主意过daemon这个命令行工具没有。这是一个Linux下的工具，也有BSD版本和MacOSX port。它可以启动和管理一个进程，包括这个进程的自动重启。 很多大规模机器学习系统（和其他大规模分布式计算系统）都需要有自动重启的功能。很多大公司有自己的分布式操作系统可以负责自动重启失败的任务（tasks）。可以如果没有这样的分布式操作系统怎么办？daemon命令可以是一个“穷人“的的解法。 启动一个任务 wangyi@localhost:~$ps daemon --name=data_server_1 --respawn -- sleep 999 启动一个任务，名字是data_server_1（对应/tmp/data_server_1.pid这个文件；这个文件用来保证不能再运行同一个daemon命令来启动同一个任务），这个任务执行命令 sleep 999。其中&#8211;respawn参数的意思是：如果 &#8212; 之后的命令（任务）挂了，daemon应该自动重启之。 此时，启动了一个daemon进程，它会fork（spawn）出来一个进程来执行命令sleep 999: wangyi@localhost:~$ps auxwww &#124; grep sleep wangyi 15129 0.0 0.0 2432748 472 ?? S 10:47AM 0:00.00 sleep 999 wangyi 15128 0.0 0.0 2432896 312 ?? Ss 10:47AM 0:00.00 daemon --name=data_server_1 --respawn -- sleep 999 另外，/tmp/data_server_1.pid里存放的是daemon命令得到的process id： wangyi@localhost:~$cat /tmp/data_server_1.pid [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1439&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>不知道大家主意过daemon这个命令行工具没有。这是一个Linux下的工具，也有BSD版本和MacOSX port。它可以启动和管理一个进程，包括这个进程的自动重启。</p>
<p>很多大规模机器学习系统（和其他大规模分布式计算系统）都需要有自动重启的功能。很多大公司有自己的分布式操作系统可以负责自动重启失败的任务（tasks）。可以如果没有这样的分布式操作系统怎么办？daemon命令可以是一个“穷人“的的解法。</p>
<p><strong>启动一个任务</strong></p>
<p><code>wangyi@localhost:~$ps daemon --name=data_server_1 --respawn -- sleep 999</code></p>
<p>启动一个任务，名字是data_server_1（对应/tmp/data_server_1.pid这个文件；这个文件用来保证不能再运行同一个daemon命令来启动同一个任务），这个任务执行命令 sleep 999。其中&#8211;respawn参数的意思是：如果 &#8212; 之后的命令（任务）挂了，daemon应该自动重启之。</p>
<p>此时，启动了一个daemon进程，它会fork（spawn）出来一个进程来执行命令sleep 999:</p>
<p><code>wangyi@localhost:~$ps auxwww | grep sleep<br />
wangyi 15129 0.0 0.0 2432748 472 ?? S 10:47AM 0:00.00 sleep 999<br />
wangyi 15128 0.0 0.0 2432896 312 ?? Ss 10:47AM 0:00.00 daemon --name=data_server_1 --respawn -- sleep 999</code></p>
<p>另外，/tmp/data_server_1.pid里存放的是daemon命令得到的process id：</p>
<p><code>wangyi@localhost:~$cat /tmp/data_server_1.pid<br />
15128</code></p>
<p><strong>任务的自动重启：</strong></p>
<p>如果我们杀死一个由daemon fork的进程：</p>
<p><code>wangyi@localhost: kill 15129</code></p>
<p>Fork这个进程的daemon 进程会自动重启这个任务：</p>
<p><code>wangyi@localhost:~$ps auxwww | grep sleep<br />
wangyi 15147 0.0 0.0 2432748 472 ?? S 10:47AM 0:00.00 sleep 999<br />
wangyi 15128 0.0 0.0 2432896 312 ?? Ss 10:47AM 0:00.00 daemon --name=data_server_1 --respawn -- sleep 999</code></p>
<p>可以看到，任务15129虽然被杀死了，但是一个新的任务 15147 被启动来执行sleep 999</p>
<p><strong>再启动一个任务</strong></p>
<p>可以启动另一个任务，只要名字和之前的不同，执行的命令可以是同一个：</p>
<p><code>wangyi@localhost:~$daemon --name=data_server_2 --respawn -- sleep 999</p>
<p>wangyi@localhost:~$ps auxwww | grep sleep<br />
wangyi 15201 0.0 0.0 2432748 472 ?? S 10:52AM 0:00.00 sleep 999<br />
wangyi 15200 0.0 0.0 2432896 312 ?? Ss 10:52AM 0:00.00 daemon --name=data_server_2 --respawn -- sleep 999<br />
wangyi 15129 0.0 0.0 2432748 472 ?? S 10:47AM 0:00.00 sleep 999<br />
wangyi 15128 0.0 0.0 2432896 312 ?? Ss 10:47AM 0:00.00 daemon --name=data_server_1 --respawn -- sleep 999</code></p>
<p>这样我们就会有两个pid文件：</p>
<p><code>wangyi@localhost:~$ls /tmp/data_server*<br />
/tmp/data_server_1.pid /tmp/data_server_2.pid</p>
<p>wangyi@localhost:~$cat /tmp/data_server*<br />
15128<br />
15200</code></p>
<p><strong>停止任务：</strong></p>
<p>用命令行参数&#8211;stop和&#8211;name来杀死任务：</p>
<p><code>wangyi@localhost:~$daemon --stop --name=data_server_1<br />
wangyi@localhost:~$daemon --stop --name=data_server_2<br />
wangyi@localhost:~$ps auxwww | grep sleep</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cxwangyi.wordpress.com/1439/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cxwangyi.wordpress.com/1439/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1439&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cxwangyi.wordpress.com/2013/04/14/%e7%94%a8daemon%e5%91%bd%e4%bb%a4%e8%b4%9f%e8%b4%a3%e4%bb%bb%e5%8a%a1%e7%9a%84%e8%87%aa%e5%8a%a8%e9%87%8d%e5%90%af/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/aa326442e1afcccad56609d49b3c5a63?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cxwangyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Why Asynchronous SGD Works Better than Its Synchronous Counterpart?</title>
		<link>http://cxwangyi.wordpress.com/2013/04/09/why-asynchronous-sgd-works-better-than-its-synchronous-counterpart/</link>
		<comments>http://cxwangyi.wordpress.com/2013/04/09/why-asynchronous-sgd-works-better-than-its-synchronous-counterpart/#comments</comments>
		<pubDate>Tue, 09 Apr 2013 04:31:26 +0000</pubDate>
		<dc:creator>cxwangyi</dc:creator>
				<category><![CDATA[Machine Learning]]></category>

		<guid isPermaLink="false">http://cxwangyi.wordpress.com/?p=1434</guid>
		<description><![CDATA[In this NIPS 2012 paper, Large Scale Distributed Deep Networks, researchers at Google presented their work on distributed learning of deep neural networks. One of the most interesting points in this paper is the asynchronous SGD algorithm, which enables a parallel (distributed) software architecture that is scalable and can make use of thousands CPUs. To [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1434&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In this NIPS 2012 paper, Large Scale Distributed Deep Networks, researchers at Google presented their work on distributed learning of deep neural networks.</p>
<p>One of the most interesting points in this paper is the asynchronous SGD algorithm, which enables a parallel (distributed) software architecture that is scalable and can make use of thousands CPUs.</p>
<blockquote><p>To apply SGD to large data sets, we introduce Downpour SGD, a variant of asynchronous stochastic gradient descent that uses multiple replicas of a single DistBelief model. The basic approach is as follows: We divide the training data into a number of subsets and run a copy of the model on each of these subsets. The models communicate updates through a centralized parameter server, which keeps the current state of all parameters for the model, sharded across many machines (e.g., if we have 10 parameter server shards, each shard is responsible for storing and applying updates to 1/10th of the model parameters) (Figure 2). This approach is asynchronous in two distinct aspects: the model replicas run independently of each other, and the parameter server shards also run independently of one another.</p></blockquote>
<p>Intuitively, the asynchronous algorithm looks like a hack, or a compromise between the effectiveness of the mathematical algorithm and the scalability of the distributed system. But to our surprise, the authors claimed that the asynchronous algorithm works more effective than synchronous SGD.</p>
<p>Why??</p>
<p>My understand is that traditional gradient-based optimization is like a bee flying along the direction defined by the current gradient. In batch learning, the direction is computed using the whole training data set. In SGD, the direction is computed using a randomly selected mini-batch of the data.</p>
<p>In contrast, the asynchronous parallel SGD works like a swamp of bees, each flies along a distinct direction. These directions vary because they are computed from the asynchronously updated parameters at the beginning of each mini-batch. For the same reason, these bees wouldn’t be far away.</p>
<p>The swamp of bees optimize collaboratively and covers a region like region-based optimization, where the region is composed of a set of points. This, I think, is the reason that parallel asynchronous SGD works better than traditional gradient-base optimization algorithms.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cxwangyi.wordpress.com/1434/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cxwangyi.wordpress.com/1434/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1434&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cxwangyi.wordpress.com/2013/04/09/why-asynchronous-sgd-works-better-than-its-synchronous-counterpart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/aa326442e1afcccad56609d49b3c5a63?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cxwangyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Specify the local directory for HDFS storage</title>
		<link>http://cxwangyi.wordpress.com/2013/03/25/specify-the-local-directory-for-hdfs-storage/</link>
		<comments>http://cxwangyi.wordpress.com/2013/03/25/specify-the-local-directory-for-hdfs-storage/#comments</comments>
		<pubDate>Mon, 25 Mar 2013 08:45:33 +0000</pubDate>
		<dc:creator>cxwangyi</dc:creator>
				<category><![CDATA[hadoop]]></category>

		<guid isPermaLink="false">http://cxwangyi.wordpress.com/?p=1431</guid>
		<description><![CDATA[You need to add a hadoop.tmp.dir property into $HADOOP/conf/core-site.xml. For example:<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1431&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>You need to add a hadoop.tmp.dir property into $HADOOP/conf/core-site.xml. For example:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;configuration&gt;
  &lt;property&gt;
    &lt;name&gt;fs.default.name&lt;/name&gt;
    &lt;value&gt;hdfs://localhost:9000&lt;/value&gt;
  &lt;/property&gt;

  &lt;property&gt;
    &lt;name&gt;hadoop.tmp.dir&lt;/name&gt;
    &lt;value&gt;/Users/${user.name}/hdfs-${user.name}&lt;/value&gt;
    &lt;final&gt;true&lt;/final&gt;
  &lt;/property&gt;
&lt;/configuration&gt;
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cxwangyi.wordpress.com/1431/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cxwangyi.wordpress.com/1431/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1431&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cxwangyi.wordpress.com/2013/03/25/specify-the-local-directory-for-hdfs-storage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/aa326442e1afcccad56609d49b3c5a63?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cxwangyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Link All Symbols in a Library into Binaries</title>
		<link>http://cxwangyi.wordpress.com/2013/03/24/link-all-symbols-in-a-library-into-binaries/</link>
		<comments>http://cxwangyi.wordpress.com/2013/03/24/link-all-symbols-in-a-library-into-binaries/#comments</comments>
		<pubDate>Sun, 24 Mar 2013 14:42:55 +0000</pubDate>
		<dc:creator>cxwangyi</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[System Config Skill]]></category>

		<guid isPermaLink="false">http://cxwangyi.wordpress.com/?p=1428</guid>
		<description><![CDATA[Morden linkers are smart. But sometimes too smart than what we need, that we would have to tell them what exactly we want. Say, that a binary A uses some, but not all, symbols in a static library B, the linker would extract those symbol in-use from B and put them into A. But sometimes, [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1428&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Morden linkers are smart. But sometimes too smart than what we need, that we would have to tell them what exactly we want.</p>
<p>Say, that a binary A uses some, but not all, symbols in a static library B, the linker would extract those symbol in-use from B and put them into A.</p>
<p>But sometimes, we do not want the linker to be as smart as this; instead, we might want all symbols in B are put into A.</p>
<p>To do so using GNU ln (usually comes with Linux), we say</p>
<pre><code>g++ -o A -Wl,-whole-archive libB.a -Wl,-no-whole-archive A.cc</code></pre>
<p>To do exactly the same thing using ln from Mac OS X, we say</p>
<pre><code>g++ -o A A.cc -all_load libB.a</code></pre>
<p>A typical situation that depends on above tricks is to link a self-registering class factory, and here is an <a href="http://stackoverflow.com/questions/10080351/linking-a-self-registering-abstract-factory">example</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cxwangyi.wordpress.com/1428/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cxwangyi.wordpress.com/1428/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1428&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cxwangyi.wordpress.com/2013/03/24/link-all-symbols-in-a-library-into-binaries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/aa326442e1afcccad56609d49b3c5a63?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cxwangyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Use Git and Subversion Together</title>
		<link>http://cxwangyi.wordpress.com/2013/03/17/use-git-and-subversion-together/</link>
		<comments>http://cxwangyi.wordpress.com/2013/03/17/use-git-and-subversion-together/#comments</comments>
		<pubDate>Sun, 17 Mar 2013 15:04:51 +0000</pubDate>
		<dc:creator>cxwangyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://cxwangyi.wordpress.com/?p=1423</guid>
		<description><![CDATA[I like this short explanation from Learn.Github: Cloning a Subversion Repository The first step is to actually clone a Subversion repository using Git. This is accomplished by executing the ‘git svn clone’: $ git svn clone &#60;subversion-url&#62; ?optional-directory-name? For example, $ git svn clone file:///Users/blair/git-svn/SVNROOT git_repo Initialized empty Git repository in /Users/blair/git-svn/git_repo/.git/ r1 = e1e2a18c6537614f2bebc5c0dfb4ac6f8c829a3b [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1423&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I like this short <a href="http://learn.github.com/p/git-svn.html">explanation</a> from Learn.Github:</p>
<h3 id="cloning_a_subversion_repository">Cloning a Subversion Repository</h3>
<p>The first step is to actually clone a Subversion repository using Git. This is accomplished by executing the ‘git svn clone’:</p>
<pre><code>$ git svn clone &lt;subversion-url&gt; ?optional-directory-name?</code></pre>
<p>For example,</p>
<pre><code>$ git svn clone file:///Users/blair/git-svn/SVNROOT git_repo
Initialized empty Git repository in /Users/blair/git-svn/git_repo/.git/
r1 = e1e2a18c6537614f2bebc5c0dfb4ac6f8c829a3b (git-svn)
	A	file1.c
	A	Makefile
r2 = 58e044c16678b0a8b92e4dbed8f0a69d48ba9ec1 (git-svn)
Checked out HEAD:
  file:///Users/blair/git-svn/SVNROOT/trunk r2</code></pre>
<p>As you can see, this creates a new Git repository in the directory named ‘MyGitRepository’, populates the Git history with all Subversion commits to the trunk, and checks out the latest HEAD.</p>
<p>Note that this operation will generally take longer than a corresponding ‘git clone’ command, as the entire history for the Subversion repository in question must be downloaded commit by commit. For large projects, this process can take hours. Thus it’s best to execute this command only when you have some time to kill.</p>
<h3 id="synchronizing_with_upstream">Synchronizing With Upstream</h3>
<p>When using Subversion, you synchronize with upstream changes by running ‘svn update’, which pulls down all of the changes made to your Subversion branch and merges your working copy with those changes.</p>
<p>With git-svn, you accomplish a similar task via the ‘git svn rebase’ command.</p>
<pre><code>bucky:git_repo blair$ git svn rebase
	M	Makefile
r3 = ae409c2f5fe0831f22d6dc891652b5f9159f35de (git-svn)
First, rewinding head to replay your work on top of it...
Applying: Local git commit.</code></pre>
<p>So what does this tell us? Well, first, you see a list of modified files. The next line informs us that revision 3 from Subversion is being stored as commit ae409c2 in our local Git repository. No problems thus far. But, what about that line informing us Git is rewinding and replaying our work? Well, this is where ‘svn update’ and ‘git svn rebase’ differ slightly.</p>
<p>Remember that, with a Subversion repository, you don’t have the concept of offline commits. So when ‘svn update’ executes, all it does is pull down all of the commits from the Subversion repository, and replay the changes in your working copy.</p>
<p>Under Git, you’ve likely been making a series of changes and committing them in nice small pieces (you <em>are</em> making regular commits, aren’t you?). So, when ‘git svn rebase’ is executed, it rolls back all of your local commits, pulls down all of the commits from Subversion, and then <em>reapplies</em> your local commits as if you had made them on the current HEAD of the Subversion branch. This has much the same logical effect as ‘svn update’ (all of your local changes are applied on top of the current Subversion HEAD), but may appear a little odd at first glance.</p>
<p>Just like ‘svn update’, it’s a good idea to execute ‘git svn rebase’ periodically in order to limit the number of conflicts you encounter when it comes time to integrate your changes back into the main repository.</p>
<h3 id="pushing_changes_upstream">Pushing Changes Upstream</h3>
<p>So you’ve been hacking away in your Git repository and now have a series of local commits that need to be pushed back to the main Subversion repository. The first step is to execute ‘git svn rebase’ and make sure your local Git repository is up-to-date with the Subversion repository. Next, use the command ‘git svn dcommit’ to push all of your local Git commits back to the Subversion repository.</p>
<pre><code>bucky:git_repo blair$ git svn dcommit
Committing to file:///Users/blair/git-svn/SVNROOT/trunk ...
	M	file1.c
Committed r4
	M	file1.c
r4 = 31a4b40b05e1b42f34dd22c34936f43dd5be90ec (git-svn)
No changes between current HEAD and refs/remotes/git-svn
Resetting to the latest refs/remotes/git-svn</code></pre>
<p>Now all of your local Git commits are present in the Subversion repository and you can continue hacking away locally.</p>
<h3 id="rules_and_guidelines">Rules and Guidelines</h3>
<p>There are a few rules you should follow when using Git as a Subversion client. Many of these are due to the fact that Git is a much more capable system than Subversion and some of the Git features simply do not work in Subversion.</p>
<ul>
<li>Do not dcommit Git merge commits to the Subversion repository. Subversion doesn’t handle merges in the same way as Git, and this will cause problems. <em><strong><span style="color:#800000;">This means you should keep your Git development history linear (i.e., no merging from other branches, just rebasing).</span></strong></em></li>
<li>Do not amend, reorder, or otherwise change commits that have been dcommited to Subversion. This is essentially the same rule as not changing Git commits that have been pushed to public repositories. Subversion cannot handle modifying or reordering commits.</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cxwangyi.wordpress.com/1423/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cxwangyi.wordpress.com/1423/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1423&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cxwangyi.wordpress.com/2013/03/17/use-git-and-subversion-together/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/aa326442e1afcccad56609d49b3c5a63?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cxwangyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Compare git merge and git rebase</title>
		<link>http://cxwangyi.wordpress.com/2013/03/17/compare-git-merge-and-git-rebase/</link>
		<comments>http://cxwangyi.wordpress.com/2013/03/17/compare-git-merge-and-git-rebase/#comments</comments>
		<pubDate>Sun, 17 Mar 2013 15:03:03 +0000</pubDate>
		<dc:creator>cxwangyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://cxwangyi.wordpress.com/?p=1421</guid>
		<description><![CDATA[I got this concise and precise explanation from StackOverflow: Short version: Merge takes all the changes in one branch and merge them into another branch in one commit. Rebase says I want the point at which I branched to move to a new starting point So when do you use either one? Merge Let&#8217;s say [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1421&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I got this concise and precise <a href="http://stackoverflow.com/questions/804115/git-rebase-vs-git-merge">explanation</a> from StackOverflow:</p>
<p>Short version:</p>
<ul>
<li>Merge takes all the changes in one branch and merge them into another branch in one commit.</li>
<li>Rebase says I want the point at which I branched to move to a new starting point</li>
</ul>
<p>So when do you use either one?</p>
<h2>Merge</h2>
<ul>
<li>Let&#8217;s say you have created a branch for the purpose of developing a single feature. When you want to bring those changes back to master, you probably want <strong>merge</strong> (you don&#8217;t care about maintaining all of the interim commits).</li>
</ul>
<h2>Rebase</h2>
<ul>
<li>A second scenario would be if you started doing some development and then another developer made an unrelated change. You probably want to pull and then <strong>rebase</strong> to base your changes from the current version from the repo.</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cxwangyi.wordpress.com/1421/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cxwangyi.wordpress.com/1421/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1421&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cxwangyi.wordpress.com/2013/03/17/compare-git-merge-and-git-rebase/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/aa326442e1afcccad56609d49b3c5a63?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cxwangyi</media:title>
		</media:content>
	</item>
		<item>
		<title>XeTeX is Great!</title>
		<link>http://cxwangyi.wordpress.com/2013/03/17/xetex-is-great/</link>
		<comments>http://cxwangyi.wordpress.com/2013/03/17/xetex-is-great/#comments</comments>
		<pubDate>Sun, 17 Mar 2013 08:38:13 +0000</pubDate>
		<dc:creator>cxwangyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cxwangyi.wordpress.com/?p=1419</guid>
		<description><![CDATA[XeTeX is a new TeX implementation supporting Unicode and system fonts. I will never use latex again.  Here is how to configure XeTeX and Chinese fonts under Mac OS X: http://blog.jqian.net/post/14213106049/xelatex<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1419&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>XeTeX is a new TeX implementation supporting Unicode and system fonts. I will never use latex again.  Here is how to configure XeTeX and Chinese fonts under Mac OS X: http://blog.jqian.net/post/14213106049/xelatex</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cxwangyi.wordpress.com/1419/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cxwangyi.wordpress.com/1419/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1419&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cxwangyi.wordpress.com/2013/03/17/xetex-is-great/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/aa326442e1afcccad56609d49b3c5a63?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cxwangyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Facebook广告体验</title>
		<link>http://cxwangyi.wordpress.com/2013/02/02/facebook%e5%b9%bf%e5%91%8a%e4%bd%93%e9%aa%8c/</link>
		<comments>http://cxwangyi.wordpress.com/2013/02/02/facebook%e5%b9%bf%e5%91%8a%e4%bd%93%e9%aa%8c/#comments</comments>
		<pubDate>Sat, 02 Feb 2013 23:36:16 +0000</pubDate>
		<dc:creator>cxwangyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cxwangyi.wordpress.com/?p=1412</guid>
		<description><![CDATA[身在国内，很少能上facebook，当然也就没有点过facebook广告。前一段时间搞了个vpn，体验了一下facebook的广告。以下是对facebook广告的一些体验。结合我自己做广告系统的经验，大概能看出来facebook广告系统中的一些策略。 Facebook广告（非mobile device广告）展示在电脑屏幕的右边。实际上广告即内容，或者说ads就是sponsored content。如果自己做了content（比如页面、相册之类），要sponsor一下是很容易的。这里就不多说广告投放的体验了。 以上是背景。以下是这种背景下我的体验： 一开始很多page view里压根儿没有广告。后来出了一个为“外籍人士推荐床垫”的广告： 注意，这里因为我用了加拿大的vpn，Facebook好像把我识别成来西方世界的海外人士了。这里有“地域定向&#8221;feature。 随后又出了一个”外籍人士在美国报税的代理“的广告。把我当做”移民“，（可能是因为我很久之前用这个账号登陆Facebook时是在国内，那时它还没被封），这说明地域feature和时间feature是有某种cross的。 点击了上面床垫广告之后，接下来几屏幕都是满满的广告。这里有”广告点击欲望识别“feature。 而那个点过的床垫广告，总是出现在靠前的位置，比如： 说明有情境广告点击重定向。这个挺好，既然我对那个床垫感兴趣，多出几次避免我找不着。 随后，我在Facebook的搜索功能里搜了一个“App推广”，之后给我出的广告里就多了一项“海外游戏推广”，而且这个广告多次刷屏之后一直都在靠前的位置。这不就是搜索广告重定向吗？ 注意：不同Facebook页面里，右侧广告位宽度不同；而Facebook会自动重排列同样的creatives，以适应不同广告位的宽度。 最后，广告即内容（请注意下面抓图中最后一个不是广告而是photo album；上面抓图里也有events）： 以上是十分钟内的Facebook广告初体验。稍微总结一下，能看出来的一些product features： 广告点击欲望识别（只给愿意点击广告的用户展示广告；既能提高点击率，又能提高相关性） 地域定向 时间feature的引入 情境广告重定向（点击了的情境广告再次展示给用户） 搜索广告重定向（搜索结果体现用户兴趣，用来触发广告） creative自动适应广告位大小 广告即内容<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1412&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>身在国内，很少能上facebook，当然也就没有点过facebook广告。前一段时间搞了个vpn，体验了一下facebook的广告。以下是对facebook广告的一些体验。结合我自己做广告系统的经验，大概能看出来facebook广告系统中的一些策略。</p>
<p>Facebook广告（非mobile device广告）展示在电脑屏幕的右边。实际上广告即内容，或者说ads就是sponsored content。如果自己做了content（比如页面、相册之类），要sponsor一下是很容易的。这里就不多说广告投放的体验了。</p>
<p>以上是背景。以下是这种背景下我的体验：</p>
<ol>
<li>一开始很多page view里压根儿没有广告。后来出了一个为“外籍人士推荐床垫”的广告：<br />
<img alt="Inline image 1" src="https://mail.google.com/mail/u/0/?ui=2&amp;ik=c7fb8f1ec3&amp;view=att&amp;th=13c7f46120fd5be7&amp;attid=0.1&amp;disp=emb&amp;zw&amp;atsh=1" /><br />
注意，这里因为我用了加拿大的vpn，Facebook好像把我识别成来西方世界的海外人士了。这里有“地域定向&#8221;feature。<br />
随后又出了一个”外籍人士在美国报税的代理“的广告。把我当做”移民“，（可能是因为我很久之前用这个账号登陆Facebook时是在国内，那时它还没被封），这说明地域feature和时间feature是有某种cross的。</li>
<li>点击了上面床垫广告之后，接下来几屏幕都是满满的广告。这里有”广告点击欲望识别“feature。<br />
而那个点过的床垫广告，总是出现在靠前的位置，比如：<br />
<img alt="Inline image 2" src="https://mail.google.com/mail/u/0/?ui=2&amp;ik=c7fb8f1ec3&amp;view=att&amp;th=13c7f46120fd5be7&amp;attid=0.2&amp;disp=emb&amp;zw&amp;atsh=1" /><br />
说明有情境广告点击重定向。这个挺好，既然我对那个床垫感兴趣，多出几次避免我找不着。</li>
<li>随后，我在Facebook的搜索功能里搜了一个“App推广”，之后给我出的广告里就多了一项“海外游戏推广”，而且这个广告多次刷屏之后一直都在靠前的位置。这不就是搜索广告重定向吗？<br />
<img alt="Inline image 3" src="https://mail.google.com/mail/u/0/?ui=2&amp;ik=c7fb8f1ec3&amp;view=att&amp;th=13c7f46120fd5be7&amp;attid=0.3&amp;disp=emb&amp;zw&amp;atsh=1" /><br />
注意：不同Facebook页面里，右侧广告位宽度不同；而Facebook会自动重排列同样的creatives，以适应不同广告位的宽度。</li>
<li>最后，广告即内容（请注意下面抓图中最后一个不是广告而是photo album；上面抓图里也有events）：<br />
<img alt="Inline image 4" src="https://mail.google.com/mail/u/0/?ui=2&amp;ik=c7fb8f1ec3&amp;view=att&amp;th=13c7f46120fd5be7&amp;attid=0.4&amp;disp=emb&amp;zw&amp;atsh=1" /></li>
</ol>
<div>以上是十分钟内的Facebook广告初体验。稍微总结一下，能看出来的一些product features：</div>
<div>
<ol>
<li>广告点击欲望识别（只给愿意点击广告的用户展示广告；既能提高点击率，又能提高相关性）</li>
<li>地域定向</li>
<li>时间feature的引入</li>
<li>情境广告重定向（点击了的情境广告再次展示给用户）</li>
<li>搜索广告重定向（搜索结果体现用户兴趣，用来触发广告）</li>
<li>creative自动适应广告位大小</li>
<li>广告即内容</li>
</ol>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cxwangyi.wordpress.com/1412/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cxwangyi.wordpress.com/1412/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1412&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cxwangyi.wordpress.com/2013/02/02/facebook%e5%b9%bf%e5%91%8a%e4%bd%93%e9%aa%8c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/aa326442e1afcccad56609d49b3c5a63?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cxwangyi</media:title>
		</media:content>

		<media:content url="https://mail.google.com/mail/u/0/?ui=2&#38;ik=c7fb8f1ec3&#38;view=att&#38;th=13c7f46120fd5be7&#38;attid=0.1&#38;disp=emb&#38;zw&#38;atsh=1" medium="image">
			<media:title type="html">Inline image 1</media:title>
		</media:content>

		<media:content url="https://mail.google.com/mail/u/0/?ui=2&#38;ik=c7fb8f1ec3&#38;view=att&#38;th=13c7f46120fd5be7&#38;attid=0.2&#38;disp=emb&#38;zw&#38;atsh=1" medium="image">
			<media:title type="html">Inline image 2</media:title>
		</media:content>

		<media:content url="https://mail.google.com/mail/u/0/?ui=2&#38;ik=c7fb8f1ec3&#38;view=att&#38;th=13c7f46120fd5be7&#38;attid=0.3&#38;disp=emb&#38;zw&#38;atsh=1" medium="image">
			<media:title type="html">Inline image 3</media:title>
		</media:content>

		<media:content url="https://mail.google.com/mail/u/0/?ui=2&#38;ik=c7fb8f1ec3&#38;view=att&#38;th=13c7f46120fd5be7&#38;attid=0.4&#38;disp=emb&#38;zw&#38;atsh=1" medium="image">
			<media:title type="html">Inline image 4</media:title>
		</media:content>
	</item>
		<item>
		<title>Build Your Own GDB on Mac OS X</title>
		<link>http://cxwangyi.wordpress.com/2013/01/23/build-your-own-gdb-on-mac-os-x/</link>
		<comments>http://cxwangyi.wordpress.com/2013/01/23/build-your-own-gdb-on-mac-os-x/#comments</comments>
		<pubDate>Wed, 23 Jan 2013 02:04:14 +0000</pubDate>
		<dc:creator>cxwangyi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cxwangyi.wordpress.com/2013/01/23/build-your-own-gdb-on-mac-os-x/</guid>
		<description><![CDATA[The GDB coming with XCode 4.5.1 on Mac OS X is an old version (6.3.50).  It is too old that cannot be used to debug Go programs or to work with Emacs 24.  Fortunately, the solution is easy – to build a newer version, say, 7.5 – and every thing would be fine.  To use [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1411&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The GDB coming with XCode 4.5.1 on Mac OS X is an old version (6.3.50).  It is too old that cannot be used to debug Go programs or to work with Emacs 24.  Fortunately, the solution is easy – to build a newer version, say, 7.5 – and every thing would be fine.  To use GDB 7.5 with Emacs 24, do not forget to use the –i=mi parameter:</p>
<p>~/usr/bin/gdb -i=mi hello_world</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cxwangyi.wordpress.com/1411/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cxwangyi.wordpress.com/1411/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1411&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cxwangyi.wordpress.com/2013/01/23/build-your-own-gdb-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/aa326442e1afcccad56609d49b3c5a63?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cxwangyi</media:title>
		</media:content>
	</item>
		<item>
		<title>Run Both SSHD and Nginx on Port 80</title>
		<link>http://cxwangyi.wordpress.com/2012/12/25/run-both-sshd-and-nginx-on-port-80/</link>
		<comments>http://cxwangyi.wordpress.com/2012/12/25/run-both-sshd-and-nginx-on-port-80/#comments</comments>
		<pubDate>Tue, 25 Dec 2012 05:27:25 +0000</pubDate>
		<dc:creator>cxwangyi</dc:creator>
				<category><![CDATA[nginx]]></category>
		<category><![CDATA[System Config Skill]]></category>

		<guid isPermaLink="false">http://cxwangyi.wordpress.com/?p=1408</guid>
		<description><![CDATA[I have a computer (bridge) in the lab, which is highly restricted by the firewall &#8211; it can access the Internet, but only those services listening on port 80. What I want is to use bridge as a proxy, so when I am working on the development workstation (dev) in the lab, I can access [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1408&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I have a computer (<code>bridge</code>) in the lab, which is highly restricted by the firewall &#8211; it can access the Internet, but only those services listening on port 80.</p>
<p>What I want is to use <code>bridge</code> as a proxy, so when I am working on the development workstation (<code>dev</code>) in the lab, I can access the Internet, including Github, Google and other services.</p>
<p>Due to the firewall restriction, <code>bridge</code> along cannot be a full-fledged proxy; but I am lucky to have a VPS (<code>free</code>) in the Internet. So what I really need is to set up a tunnel from bridge to free using dynamic forwarding:</p>
<pre><code>bridge$ ssh -D 7777 `free` -p 80
</code></pre>
<p>Note that since <code>bridge</code> can only access services listening on port 80, we must configure SSHD on <code>free</code> to listen on 80.</p>
<p>However, <code>free</code> is a Web server and the Nginx running on it already takes port 80. So we need to multiplex port 80 for both Nginx and SSD on free. After Googling around, I found the magical program SSLH (<a href="http://www.rutschle.net/tech/sslh.shtml" rel="nofollow">http://www.rutschle.net/tech/sslh.shtml</a>).</p>
<p>SSLH is a light port-de-multiplexing server in 2000 lines of C code. It listens on specified port, and forward connections to the port to other services by testing on the first data packet and judging the protocol of the connection.</p>
<p>Here follows how I use SSLH to multiplex port 80 on <code>free</code>.</p>
<p>First, I download and build SSLH. On <code>bridge</code>, issue the following commands:</p>
<pre><code>wget http://www.rutschle.net/tech/sslh-1.14.tar.gz
tar xzf sslh-1.14.tar.gz
cd sslh
make
</code></pre>
<p>Building sshlh requires libconfig and libwrap. To install them on Ubuntu systems, use:</p>
<pre><code>sudo apt-get install libwrap0-dev libconfig8-dev
</code></pre>
<p>To make sure how to install them on Debian or other systems, please refer to the README file distributed with SSLH code.</p>
<p>Once successfully built, we would have two binary files: sslh-fork and sslh-select. The former forwards by forking processes, and is thus slow; whereas the latter forwards by using select, which is much more efficient. However, sslh-fork had been tested in many use cases and is guaranteed robust, whereas sslh-select requires more tests. Since <code>free</code> runs a simple Web service, I just sslh-fork:</p>
<pre><code>sudo cp sslh-fork /usr/sbin
</code></pre>
<p>I also copied the default configuration file and start shell script:</p>
<pre><code>sudo cp ./scripts/etc.default.sslh /etc/default/sslh
sudo cp scripts/etc.init.d.sslh /etc/init.d/sslh
</code></pre>
<p>Then edit /etc/default/sslh to be as follows:</p>
<pre><code>LISTEN=0.0.0.0:80
HTTP=localhost:8080
SSH=localhost:22
SSL=localhost:443
USER=nobody
PID=/var/run/sslh.pid
</code></pre>
<p>The first line makes SSLH listens on port 80 of all network interfaces. The second line specifies the server (Nginx) to which HTTP connections are forwarded. The third line specifies the SSHD.</p>
<p>To enable above configuration, I also need to edit /etc/init.d/sslh, to ensure that the SSLH will be started by the following command line:</p>
<pre><code>$DAEMON --user ${USER} --pidfile ${PID} --listen ${LISTEN} --ssh ${SSH} --ssl ${SSL} --http ${HTTP}
</code></pre>
<p>Note that variables LISTEN, SSH, SSL, and HTTP are read from above configuration file.</p>
<p>Since the SSHD on <code>free</code> had already been configured to listen on port 22, I do nothing to it. But I need to make Nginx listens on localhost:8080 (port 8080 on the loop back interface) instead of 0.0.0.0:80 (port 80 on all network interfaces).</p>
<p>My Nginx is installed in /usr/local/nginx and configuration files are in /usr/local/nginx/conf. What I did is to ensure that all virtual servers defined in /usr/local/nginx/conf/nginx.conf and other config files included by nginx.conf listen on localhost:8080. A fast command is:</p>
<pre><code>sudo sed -i'' 's/listen *80/listen localhost:8080/' *.conf
</code></pre>
<p>Then we restart Nginx, and make sure that no service is listening on port 80 by using the following command:</p>
<pre><code>netstat -tpln | grep 80
</code></pre>
<p>At this moment, it is correct if we cannot access the Web service served by Nginx from any computer other than localhost. (Because we edited the nginx.conf to bind all Nginx virtual servers to the loop back interface, localhost.)</p>
<p>Then we start the SSLH service:</p>
<pre><code>sudo /etc/init.d/sslh start
</code></pre>
<p>Everything is done!</p>
<p>If everything is ok, we should be able to connect to <code>free</code> via SSH and port 80:</p>
<pre><code>ssh free -p 80
</code></pre>
<p>We should also be able to access Nginx server on <code>free</code> from a Web browser with URL <code><a href="http://free" rel="nofollow">http://free</a></code>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/cxwangyi.wordpress.com/1408/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/cxwangyi.wordpress.com/1408/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=cxwangyi.wordpress.com&#038;blog=11093547&#038;post=1408&#038;subd=cxwangyi&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://cxwangyi.wordpress.com/2012/12/25/run-both-sshd-and-nginx-on-port-80/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/aa326442e1afcccad56609d49b3c5a63?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">cxwangyi</media:title>
		</media:content>
	</item>
	</channel>
</rss>
