-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
218 lines (191 loc) · 14.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!DOCTYPE html>
<html lang="cn">
<head>
<meta charset="utf-8" />
<title>facat' blog</title>
<link rel="stylesheet" href="http://facat.github.io/theme/css/main.css" />
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body id="index" class="home">
<header id="banner" class="body">
<h1><a href="http://facat.github.io/">facat' blog </a></h1>
<nav><ul>
<li><a href="http://facat.github.io/category/bian-cheng-programming.html">编程Programming</a></li>
<li><a href="http://facat.github.io/category/bian-yi.html">编译</a></li>
<li><a href="http://facat.github.io/category/bian-yi-compile.html">编译Compile</a></li>
<li><a href="http://facat.github.io/category/sui-yi.html">随意</a></li>
<li><a href="http://facat.github.io/category/tech.html">Tech</a></li>
</ul></nav>
</header><!-- /#banner -->
<aside id="featured" class="body">
<article>
<h1 class="entry-title"><a href="http://facat.github.io/fix-too-many-connections-in-golang.html">Fix "Too Many Connections" in Golang</a></h1>
<footer class="post-info">
<abbr class="published" title="2014-08-17T00:50:35.309203">
2014-08-17</br>00:50:35
</abbr>
<address class="vcard author" style="font-style: normal;">
作者: <a class="url fn" href="http://facat.github.io/author/facat.html">facat</a>
</address>
<p>分类: <a href="http://facat.github.io/category/bian-cheng-programming.html">编程Programming</a>. </p>
<p>Tags: <a href="http://facat.github.io/tag/go.html">go</a><a href="http://facat.github.io/tag/golang.html">golang</a><a href="http://facat.github.io/tag/mysql.html">Mysql</a></p>
</footer><!-- /.post-info --><p>Sometimes people may come into <strong><em>Too Many Connections</em></strong> error when using Mysql in Golang. A few things should be noted to avoid this error.</p>
<ol>
<li>
<p>Remember to use DB.COMMIT() if transaction is used. Connections to Mysql are released only if the transaction is commited. As far as I concern, DB.Exec doesn't have this problem.</p>
</li>
<li>
<p>Use Row.Close() after you do a query.</p>
</li>
</ol>
<p>For example:</p>
<div class="highlight"><pre><span class="n">row</span><span class="p">,</span> <span class="n">err</span> <span class="o">:=</span> <span class="n">db</span><span class="p">.</span><span class="n">Query</span><span class="p">(</span><span class="s">"select a from b limit 1"</span><span class="p">)</span>
<span class="k">if</span> <span class="n">row</span> <span class="o">!=</span> <span class="n">nil</span> <span class="p">{</span>
<span class="n">defer</span> <span class="n">row</span><span class="p">.</span><span class="n">Close</span><span class="p">()</span>
<span class="p">}</span>
</pre></div>
<p>row.Close() is very important, otherwise Golang will keep that connection.</p><p>There are <a href="http://facat.github.io/fix-too-many-connections-in-golang.html#disqus_thread">comments</a>.</p> </article>
</aside><!-- /#featured -->
<section id="content" class="body">
<h1>Other articles</h1>
<hr />
<ol id="posts-list" class="hfeed">
<li><article class="hentry">
<header>
<h1><a href="http://facat.github.io/a-php-based-reverse-proxy.html" rel="bookmark"
title="Permalink to A PHP based Reverse Proxy">A PHP based Reverse Proxy</a></h1>
</header>
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="2014-08-12T11:48:21">
2014-08-12</br>11:48:21
</abbr>
<address class="vcard author" style="font-style: normal;">
作者: <a class="url fn" href="http://facat.github.io/author/facat.html">facat</a>
</address>
<p>分类: <a href="http://facat.github.io/category/tech.html">Tech</a>. </p>
<p>Tags: <a href="http://facat.github.io/tag/github.html">Github</a><a href="http://facat.github.io/tag/bae.html">BAE</a></p>
</footer><!-- /.post-info --> <p>You can visit <a href="http://en.wikipedia.org/wiki/Reverse_proxy">wikipedia</a> to find out what a reverse proxy is.</p>
<p>Here's quote:</p>
<blockquote>
<p>In computer networks, a reverse proxy is a type of proxy server that retrieves resources on behalf of a client from one or more servers. These resources are then returned to the client as though ...</p></blockquote>
<a class="readmore" href="http://facat.github.io/a-php-based-reverse-proxy.html">read more</a>
<p>There are <a href="http://facat.github.io/a-php-based-reverse-proxy.html#disqus_thread">comments</a>.</p> </div><!-- /.entry-content -->
</article></li>
<li><article class="hentry">
<header>
<h1><a href="http://facat.github.io/kai-shi-jie-hong-golang.html" rel="bookmark"
title="Permalink to 开始接触golang">开始接触golang</a></h1>
</header>
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="2014-07-27T00:45:45.655681">
2014-07-27</br>00:45:45
</abbr>
<address class="vcard author" style="font-style: normal;">
作者: <a class="url fn" href="http://facat.github.io/author/facat.html">facat</a>
</address>
<p>分类: <a href="http://facat.github.io/category/bian-cheng-programming.html">编程Programming</a>. </p>
<p>Tags: <a href="http://facat.github.io/tag/go.html">go</a><a href="http://facat.github.io/tag/golang.html">golang</a></p>
</footer><!-- /.post-info --> <p>最近听说go比较多,也开始学习go了。只现在已经基本入门了,这多亏了go的语法比较简单。用了一些,开始喜欢上这个语言了。</p>
<p>喜欢上go有两个原因,一是它的干爹是google,技术支持没得说。二是因为它编译的时字节文件,和C语言编译的一样,而且几乎可以互相调用。据说
go是21世纪的C语言,希望如此吧。我也觉得C太过简单,C++又太复杂,很多功能都用不上,编写调试都头大。</p>
<a class="readmore" href="http://facat.github.io/kai-shi-jie-hong-golang.html">read more</a>
<p>There are <a href="http://facat.github.io/kai-shi-jie-hong-golang.html#disqus_thread">comments</a>.</p> </div><!-- /.entry-content -->
</article></li>
<li><article class="hentry">
<header>
<h1><a href="http://facat.github.io/cross-compile-mongodb-for-arm.html" rel="bookmark"
title="Permalink to Cross Compile MongoDB for ARM">Cross Compile MongoDB for ARM</a></h1>
</header>
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="2014-07-21T10:29:59.818874">
2014-07-21</br>10:29:59
</abbr>
<address class="vcard author" style="font-style: normal;">
作者: <a class="url fn" href="http://facat.github.io/author/facat.html">facat</a>
</address>
<p>分类: <a href="http://facat.github.io/category/bian-yi-compile.html">编译Compile</a>. </p>
<p>Tags: <a href="http://facat.github.io/tag/arm.html">ARM</a><a href="http://facat.github.io/tag/cubieboard.html">Cubieboard</a><a href="http://facat.github.io/tag/cross-compile.html">Cross-compile</a><a href="http://facat.github.io/tag/mongodb.html">MongoDB</a></p>
</footer><!-- /.post-info --> <p><a href="http://www.mongodb.org/">MongoDB</a> is an document-oriented nosql server. Currently MongoDB(latest verstion 2.6.3) doesn't support ARM.
I have a cubieboard, which is an arm-based mini pc. I want MongoDB to run on my cubieboard. Unfortunately, debian wheezy doesn't provide MongoDB package. I have to compile it myself. I ...</p>
<a class="readmore" href="http://facat.github.io/cross-compile-mongodb-for-arm.html">read more</a>
<p>There are <a href="http://facat.github.io/cross-compile-mongodb-for-arm.html#disqus_thread">comments</a>.</p> </div><!-- /.entry-content -->
</article></li>
<li><article class="hentry">
<header>
<h1><a href="http://facat.github.io/ru-he-zai-ubuntu-1404-zhong-shi-yong-ipopt.html" rel="bookmark"
title="Permalink to 如何在Ubuntu 14.04 中使用Ipopt">如何在Ubuntu 14.04 中使用Ipopt</a></h1>
</header>
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="2014-07-20T00:36:57.798140">
2014-07-20</br>00:36:57
</abbr>
<address class="vcard author" style="font-style: normal;">
作者: <a class="url fn" href="http://facat.github.io/author/facat.html">facat</a>
</address>
<p>分类: <a href="http://facat.github.io/category/bian-yi.html">编译</a>. </p>
<p>Tags: <a href="http://facat.github.io/tag/ubuntu.html">Ubuntu</a><a href="http://facat.github.io/tag/gcc.html">GCC</a><a href="http://facat.github.io/tag/matlab.html">Matlab</a><a href="http://facat.github.io/tag/ipopt.html">Ipopt</a></p>
</footer><!-- /.post-info --> <p>以前只在Windows平台下编译过,还写了文章做记录放在CSDN上,不过已经被封,不管了。</p>
<p>Ipopt毕竟是开源软件,在Linux下编译还是比较方便的。进入contrib/MatlatInterface/src 看到Makefile后make就可以了。不过好像有个小bug,就是在脚本自动链接的时候提示找不到matlabexception.o 之类的库文件。出的进入src下的.lib 文件夹,执行</p>
<div class="highlight"><pre><span class="n">cp</span> <span class="o">*</span> <span class="p">.</span><span class="o">/</span><span class="p">..</span><span class="o">/</span>
</pre></div>
<p>把所有编译好的.o文件拷出来,然后在make就可以正常链接了。</p>
<p>把得到的mex文件路径加入到matlab中。此时在matlab中仍不能用,因为matlab自带的库太老了,要用系统的库替换。</p>
<p>我是64位的Ubuntu Kylin,把/usr/lib/x86_64-linux-gnu/下的libgcc_s.so.1 libstdc++.so.6 libgfortran.so.3 链接到matlab安装目录的/sys/os/glnxa64文件夹下。最好之前备份一下matlab的原文件。这样就能用了。</p>
<hr />
<p>2014.06.06 ...</p>
<a class="readmore" href="http://facat.github.io/ru-he-zai-ubuntu-1404-zhong-shi-yong-ipopt.html">read more</a>
<p>There are <a href="http://facat.github.io/ru-he-zai-ubuntu-1404-zhong-shi-yong-ipopt.html#disqus_thread">comments</a>.</p> </div><!-- /.entry-content -->
</article></li>
<li><article class="hentry">
<header>
<h1><a href="http://facat.github.io/wei-shi-yao-ba-blogqian-yi-dao-github.html" rel="bookmark"
title="Permalink to 为什么把Blog迁移到Github">为什么把Blog迁移到Github</a></h1>
</header>
<div class="entry-content">
<footer class="post-info">
<abbr class="published" title="2014-06-01T10:20:00">
2014-06-01</br>10:20:00
</abbr>
<address class="vcard author" style="font-style: normal;">
作者: <a class="url fn" href="http://facat.github.io/author/facat.html">facat</a>
</address>
<p>分类: <a href="http://facat.github.io/category/sui-yi.html">随意</a>. </p>
<p>Tags: <a href="http://facat.github.io/tag/github.html">Github</a></p>
</footer><!-- /.post-info --> <p>之前在CSDN上写了一些关于编译某些开源库的文章,只是为了怕自己忘记所以才写在上面的。发布后很长一段时间都不会上去看,只有用到的时候才看一下。最近发现我在CSDN上面的博客被管理员关闭了,貌似是因为有人盗用了我CSDN的号发表了一些不和谐的东西。我的电脑都没有中过毒,居然还被盗密码了,真是匪夷所思。后来我想了一下,可能和之前CSDN密码被泄露有关。算了,国内的博客网站虽然访问速度快,但太容易被和谐了,还是玩玩美帝的东西吧。</p>
<a class="readmore" href="http://facat.github.io/wei-shi-yao-ba-blogqian-yi-dao-github.html">read more</a>
<p>There are <a href="http://facat.github.io/wei-shi-yao-ba-blogqian-yi-dao-github.html#disqus_thread">comments</a>.</p> </div><!-- /.entry-content -->
</article></li>
</ol><!-- /#posts-list -->
<p class="paginator">
页 1 / 1
</p>
</section><!-- /#content -->
<section id="extras" class="body">
</section><!-- /#extras -->
<footer id="contentinfo" class="body">
<address id="about" class="vcard body">
Proudly powered by <a href="http://getpelican.com/">Pelican</a>, which takes great advantage of <a href="http://python.org">Python</a>.
</address><!-- /#about -->
<p>The theme is by <a href="http://coding.smashingmagazine.com/2009/08/04/designing-a-html-5-layout-from-scratch/">Smashing Magazine</a>, thanks!</p>
</footer><!-- /#contentinfo -->
<script type="text/javascript">
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3Fc7b9776918503e35c2b2ac6519de4dde' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
"use strict";
var disqus_shortname = 'facat';
(function () {
var s = document.createElement('script'); s.async = true;
s.type = 'text/javascript';
s.src = 'http://' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
</body>
</html>