blogv3_html/posts/9.html
2017-08-16 18:01:06 +08:00

281 lines
11 KiB
HTML
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page 9 - 风笑痴</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="lunny">
<meta name="keywords" content="lunny,golang,xorm,tango,blog"/>
<meta name="description" content="风笑痴,一个脱离了低级懒惰的人"/>
<link href="/css/pure-min.css" type="text/css" rel="stylesheet" media="all">
<link href="/css/blog.css" type="text/css" rel="stylesheet" media="all">
<link href="/css/railscasts.css" type="text/css" rel="stylesheet" media="all"/>
</head>
<body class="post-list" data-perma="post-page-9">
<div class="pure-g-r" id="layout">
<div class="sidebar pure-u">
<header class="header">
<hgroup>
<h1 class="brand-title">
<a href="/" class="brand-title">风笑痴</a>
</h1>
<h2 class="brand-tagline">一个脱离了低级懒惰的人</h2>
</hgroup>
<nav class="nav">
<ul class="nav-list">
<li class="">
<a href="/">文章</a>
</li>
<li class="">
<a href="/archive">归档</a>
</li>
<li class="">
<a href="/about" target="_blank" >关于</a>
</li>
</ul>
</nav>
</header>
</div>
<div class="pure-u-1">
<div class="content">
<div class="page-header">
<h1>所有文章</h1>
</div>
<div class="post">
<h3 class="post-header"><a href="/2010/11/22/%e5%8f%91%e5%b8%83Chrome%e6%89%a9%e5%b1%95%ef%bc%9aGoogle-Reader-RSS-Subscriber-Plus.html">发布Chrome扩展Google Reader RSS Subscriber Plus</a></h3>
<div class="post-meta">
<small>2010-11-22</small>
</div>
<div class="post-description"><p>写这个扩展是因为原先一直用的Google Reader RSS Subscriber扩展基本停止更新了几个必须的关键特性不支持只好自己动手丰衣足食。扩展地址为<a href="https://chrome.google.com/extensions/detail/ngjinemddlnikfdlbnbdbajdhagbcjmg">https://chrome.google.com/extensions/detail/ngjinemddlnikfdlbnbdbajdhagbcjmg</a>。支持如下特性一键订阅支持https支持当前页支持订阅检测支持黑名单。</p>
</div>
<div class="more">
<a href="/2010/11/22/%e5%8f%91%e5%b8%83Chrome%e6%89%a9%e5%b1%95%ef%bc%9aGoogle-Reader-RSS-Subscriber-Plus.html" class="btn pure-button pure-button-primary">继续阅读..</a>
</div>
</div>
<div class="post">
<h3 class="post-header"><a href="/2010/1/12/Go%e8%af%ad%e8%a8%80%e7%9a%84%e7%ae%80%e4%bb%8b%e5%8f%8aUbuntu%e4%b8%8b%e7%9a%84%e5%ae%89%e8%a3%85%e5%92%8c%e7%bc%96%e8%af%91.html">Go语言的简介及Ubuntu下的安装和编译</a></h3>
<div class="post-meta">
<small>2010-1-12</small>
</div>
<div class="post-description"><p><strong>简介</strong></p>
<p>GO语言是Google基于BSD发布的开源系统级编程语言目标是融合Python的开发效率和C的运行时效率于一体。该项目的网址是<a href="http://golang.org。目前只支持Linuxfreebsd和Mac">http://golang.org。目前只支持Linuxfreebsd和Mac</a> OS X平台的amd64和386架构。</p>
<h1 id="安装">安装</h1>
<p>有一个快速的编译器安装说明,见<a href="http://golang.org/doc/install.html">http://golang.org/doc/install.html</a>。我在虚拟机中的Ubuntu9.10下安装过程如下:</p>
<p>1.设置环境变量</p>
<p>一共需要设置4个变量</p>
<pre><code class="language-sh">export GOROOT=$HOME/go
export GOARCH=386
export GOOS=linux
export GOBIN=$HOME/bin
</code></pre>
<p>如果你的平台是AMD64请将GOARCH替换成amd64另外GOBIN是可选的可以</p>
<pre><code class="language-sh">mkdir ~/bin
</code></pre>
<p>这里是存放GO语言编译器连接器的目录需要加入到PATH</p>
<pre><code class="language-sh">PATH=${PATH}:$HOME/bin
</code></pre>
<p>将以上这行和上面4个export拷贝到你的.bashrc中。重新打开终端窗口。</p>
<p>2.获取GO源码</p>
<p>GO使用C写的需要获取源码后编译在命令行执行以下命令</p>
<pre><code class="language-sh">apt-get install python-setuptools python-dev
sudo easy_install mercurial
hg clone -r release https://go.googlecode.com/hg/ $GOROOT
sudo apt-get install bison gcc libc6-dev ed make
cd $GOROOT/src
make all
</code></pre>
<p>等到出现:</p>
<pre><code>--- cd ../test
N known bugs; 0 unexpected bugs
</code></pre>
<p>N为某个数字我这里为4后编译完成。</p>
<h1 id="编写hello-go">编写Hello GO!</h1>
<p>针对不同的架构,编译器和链接器都是不一样的:</p>
<p>386对应的编译器是8g链接器是8l</p>
<p>amd64对应的编译器是6g链接器是6l</p>
<p>OK.我们来编写一个最简单的GO程序代码如下</p>
<pre><code class="language-go">package main
import &quot;fmt&quot;
func main() {
fmt.Printf(&quot;hello, world\n&quot;)
}
</code></pre>
<p>将上面的代码保存为hello.go并编译之</p>
<pre><code class="language-sh">8g hello.go
</code></pre>
<p>编译后生成hello.8,再链接:</p>
<pre><code class="language-sh">8l hello.8
</code></pre>
<p>生成hello.out执行</p>
<pre><code class="language-sh">./hello.out
</code></pre>
<p>终端上将显示:</p>
<pre><code>Hello, GO!
</code></pre>
<p>如果要编写大型程序Make工具依然有效。</p>
<h1 id="语法及类库文档">语法及类库文档</h1>
<p>语法见这里:</p>
<p><a href="http://golang.org/doc/go_spec.html">http://golang.org/doc/go_spec.html</a></p>
<p>类库见这里:</p>
<p><a href="http://golang.org/pkg/">http://golang.org/pkg/</a></p>
<p>有用的文档:</p>
<p><a href="http://golang.org/doc/effective_go.html">http://golang.org/doc/effective_go.html</a></p>
<p><a href="http://golang.org/doc/go_tutorial.html">http://golang.org/doc/go_tutorial.html</a></p>
<p>如果以前学习的C++可以参考这里:</p>
<p><a href="http://golang.org/doc/go_for_cpp_programmers.html">http://golang.org/doc/go_for_cpp_programmers.html</a></p>
<h1 id="保持最新版本">保持最新版本</h1>
<p>目前GO语言还在不断完善中还没有到可以进入生产环境的时候如果想及时更新最新的版本如下</p>
<pre><code class="language-sh">hg pull
hg update release
make all
</code></pre>
</div>
<div class="more">
<a href="/2010/1/12/Go%e8%af%ad%e8%a8%80%e7%9a%84%e7%ae%80%e4%bb%8b%e5%8f%8aUbuntu%e4%b8%8b%e7%9a%84%e5%ae%89%e8%a3%85%e5%92%8c%e7%bc%96%e8%af%91.html" class="btn pure-button pure-button-primary">继续阅读..</a>
</div>
</div>
<div class="post">
<h3 class="post-header"><a href="/2008/3/14/Firefox-%e6%89%a9%e5%b1%95-Flashblock.html">Firefox 扩展 Flashblock</a></h3>
<div class="post-meta">
<small>2008-3-14</small>
</div>
<div class="post-description"><p>现在用Flash的东东太多广告/网络视频/某些网络应用等等估计将来这个趋势也将会继续。这个Firefox扩展可以阻止</p>
<ul>
<li>Macromedia Flash</li>
<li>Macromedia Shockwave</li>
<li>Macromedia Authorware</li>
</ul>
<p>等,安装页面:
<a href="https://addons.mozilla.org/en-US/firefox/addon/433">https://addons.mozilla.org/en-US/firefox/addon/433</a></p>
</div>
<div class="more">
<a href="/2008/3/14/Firefox-%e6%89%a9%e5%b1%95-Flashblock.html" class="btn pure-button pure-button-primary">继续阅读..</a>
</div>
</div>
<div class="post">
<h3 class="post-header"><a href="/2007/12/9/IpMsg-for-Linux%28Ubuntu%29%e5%ae%89%e8%a3%85%e6%89%8b%e8%ae%b0.html">IpMsg for Linux(Ubuntu)安装手记</a></h3>
<div class="post-meta">
<small>2007-12-9</small>
</div>
<div class="post-description"><p>ipmsg是一个开源的局域网消息和文件传送工具其最大的优点是可以直接传送文件夹并且传送速度非常快。ipmsg目前已有了windows, mac, linux版本。为了从我的LinuxUbuntu 7.04传送文件到局域网内一台windows机器我试着安装了一下。</p>
<p>1.先下载源码</p>
<p>我下载的是for gnome2版本的源码
<a href="http://www.ipmsg.org/archive/g2ipmsg-0.9.1.tar.gz">http://www.ipmsg.org/archive/g2ipmsg-0.9.1.tar.gz</a>
目前最新的版本是0.9.3不过这个版本在编译是会出现问题所以我选择了0.9.1版本,差别不大。</p>
<p>2.解压
在ubuntu中用命令行</p>
<pre><code class="language-sh">tar xzvf g2ipmsg-0.9.1.tar.gz
</code></pre>
<p>或者菜单右键用归档管理器解压即可。</p>
<p>3.修改语言
用文本编辑工具比如gedit打开src/codeset.c文件将其中的CP932更改为CP936英文或者GBK中文并保存。</p>
<p>4.安装编译依赖项</p>
<pre><code class="language-sh">sudo apt-get install libxml-parser-perl libgnomeui-dev libpanel-applet2-dev
sudo apt-get install gettext intltool
</code></pre>
<p>5.编译</p>
<pre><code class="language-sh">./configure enable-systray
make
sudo make install
</code></pre>
<p>这下可用了重启后在主菜单的附件中将会有Gnome2 IP Messenger的快捷方式。
OK完成可以在windows和linux之间传送文件或者文件夹了。</p>
</div>
<div class="more">
<a href="/2007/12/9/IpMsg-for-Linux%28Ubuntu%29%e5%ae%89%e8%a3%85%e6%89%8b%e8%ae%b0.html" class="btn pure-button pure-button-primary">继续阅读..</a>
</div>
</div>
</div>
<div class="pagination pure-g">
<ul>
<li class="prev pure-u-1-3"><a href="/posts/8.html">← 更新的</a></li>
<li class="next pure-u-1-3"><a href="/posts/10.html">以前的 →</a></li>
</ul>
</div>
<div class="footer">
<p>&copy; 风笑痴 2015
powered by <a href="http://github.com/go-xiaohei/pugo">PuGo</a> with <a href="http://purecss.io" target="_blank">Pure</a>
</p>
</div>
</div>
</div>
<script src="/js/jquery-2.1.4.min.js"></script>
<script src="/js/highlight.pack.js"></script>
<script>
$(document).ready(function() {
$('pre code').each(function(i, block) {
hljs.highlightBlock(block);
});
});
</script>
</body>
</html>