<?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>apt-blog.net   无证程序员的PT桑 &#187; Blogger Tech</title> <atom:link href="http://apt-blog.net/category/tech/blogger_tech/feed" rel="self" type="application/rss+xml" /><link>http://apt-blog.net</link> <description>潜逃中。</description> <lastBuildDate>Sun, 05 Feb 2012 10:35:00 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Manage multiple wordpresses with new Vimpress</title><link>http://apt-blog.net/manage-multiple-wordpresses-with-new-vimpress</link> <comments>http://apt-blog.net/manage-multiple-wordpresses-with-new-vimpress#comments</comments> <pubDate>Thu, 10 Mar 2011 07:40:53 +0000</pubDate> <dc:creator>BOYPT</dc:creator> <category><![CDATA[Blogger Tech]]></category> <category><![CDATA[Programming]]></category> <category><![CDATA[Python]]></category> <category><![CDATA[Shell]]></category> <category><![CDATA[Unix/Linux]]></category> <category><![CDATA[Vim]]></category> <category><![CDATA[Blog]]></category> <category><![CDATA[vimpress]]></category> <guid
isPermaLink="false">http://apt-blog.net/manage-multiple-wordpresses-with-new-vimpress</guid> <description><![CDATA[Update Vimpress 已经升级到2.x版本，使用、配置都有改进，请关注在vim.org的插件页面： Vimpress had been updated to 2.x, usage and configurations are now different, read the officle page in vim.org: http://www.vim.org/scripts/script.php?script_id=3510 If you noticed Vimpress before and got more than one wordpress to write, must glad now to know this VimRePressed support multiple configs and swith freely. The new VimRePressed (Version: 1.2.0) Changes: Add: [...]]]></description> <content:encoded><![CDATA[<p><strong> Update </strong><br
/> Vimpress 已经升级到2.x版本，使用、配置都有改进，请关注在vim.org的插件页面：</p><p>Vimpress had been updated to 2.x, usage and configurations are now different, read the officle page in vim.org:</p><p><a
href="http://www.vim.org/scripts/script.php?script_id=3510">http://www.vim.org/scripts/script.php?script_id=3510</a></p><hr
/><p>If you noticed <a
href="http://apt-blog.net/tag/vimpress">Vimpress</a> before and got more than one wordpress to write, must glad now to know this VimRePressed support multiple configs and swith freely.</p><p>The new VimRePressed (Version: 1.2.0) Changes:</p><div
class="wp_syntax"><div
class="code"><pre class="text" style="font-family:monospace;">      Add: MarkdownPreview command to preiview markdown in browser.
      Add: MarkdownNewPost command to convert a markdown
           written post into html and set to the new post view.
      Add: Move blog configs info to personal .vimrc
      Add: Multiple config is now supported, and with :BlogSwitch
           command added.
      Add: Show which blog your editing at :BlogList view.
      Fix: Running :BlogList in the List view got error.</pre></div></div><p>Now you got to wirte your blog config in your own ~/.vimrc file. (CAREFUL when your share your vim configure with others then. Use a <code>source my_vimpress.vimrc</code> instead. )</p><div
class="wp_syntax"><div
class="code"><pre class="text" style="font-family:monospace;">let VIMPRESS=[{'username':'user',
              \'password':'pass',
              \'blog_url':'http://your-first-blog.com/'
              \},
              \{'username':'user',
              \'password':'pass',
              \'blog_url':'http://your-second-blog.com/'
              \}]</pre></div></div><p>The syntax looks just like python or json, dictionarys in a list(or array), only that line brake need to write in the vim way.</p><p>BlogSwitch command rotate you from the first blog to the last, then the first. If you got confused, BlogList command can show you which one you're connecting to.</p><p>Then the Markdown support. I added two command to save my time saving .mkd file then convert them into html then check in a browser, MarkdownPreview command can do this for me. When flawless, the MarkdownNewPost command switch me to the new post view with all thing I write into html, which is ready to publish.</p><p>Download: <a
href="http://code.google.com/p/ptcoding/downloads/detail?name=vimpress_1.2.5-r55.zip">from google code</a></p><p>SVN Version also available:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
</pre></td><td
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> checkout http:<span style="color: #000000; font-weight: bold;">//</span>ptcoding.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>vimpress</pre></td></tr></table></div> ]]></content:encoded> <wfw:commentRss>http://apt-blog.net/manage-multiple-wordpresses-with-new-vimpress/feed</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>使用wp-super-cache插件静态缓冲的nginx rewrite规则</title><link>http://apt-blog.net/nginx-rewrite-rules-for-wp-super-cache</link> <comments>http://apt-blog.net/nginx-rewrite-rules-for-wp-super-cache#comments</comments> <pubDate>Thu, 03 Mar 2011 14:39:07 +0000</pubDate> <dc:creator>BOYPT</dc:creator> <category><![CDATA[Blogger Tech]]></category> <category><![CDATA[Unix/Linux]]></category> <category><![CDATA[Cache]]></category> <category><![CDATA[nginx]]></category> <category><![CDATA[WordPress]]></category> <guid
isPermaLink="false">http://apt-blog.net/nginx-rewrite-rules-for-wp-super-cache</guid> <description><![CDATA[WordPress的缓冲插件wp-super-cache默认支持apahce的缓冲方式，在生成了静态页面数据后，通过.htaccess的规则直接让apache读取静态文件，完全不经过PHP，可以很大的提高博客的页面性能。 但是Nginx的改写规则就没这么容易让代码来配置了，虽然wp-super-cache的第二种缓存方式就是为这种使用环境设计，但实际上是用了PHP来提供静态数据了，在使用apache benchmark压力的时候，php-cgi依然占很高的CPU占有率。 通过编写nginx的rewrite规则还是可以让nginx直接读取静态文件，参考来自Code Exchange: nginx rewrite rules for WordPress + WP Super Cache，这里的配置被很多地方引用过，但实际尝试使用过程看到那里面的代码还需要微调。 server { listen 80; server_name apt-blog.net; root /var/www/pt-sites/wordpress; index index.html index.htm index.php; location / { # enable search for precompressed files ending in .gz # nginx needs to be complied using –-with-http_gzip_static_module # for this to work, comment out if using [...]]]></description> <content:encoded><![CDATA[<p>WordPress的缓冲插件wp-super-cache默认支持apahce的缓冲方式，在生成了静态页面数据后，通过.htaccess的规则直接让apache读取静态文件，完全不经过PHP，可以很大的提高博客的页面性能。</p><p>但是Nginx的改写规则就没这么容易让代码来配置了，虽然wp-super-cache的第二种缓存方式就是为这种使用环境设计，但实际上是用了PHP来提供静态数据了，在使用apache benchmark压力的时候，php-cgi依然占很高的CPU占有率。</p><p>通过编写nginx的rewrite规则还是可以让nginx直接读取静态文件，参考来自<a
href="http://forum.slicehost.com/comments.php?DiscussionID=2087">Code Exchange: nginx rewrite rules for WordPress + WP Super Cache</a>，这里的配置被很多地方引用过，但实际尝试使用过程看到那里面的代码还需要微调。</p><div
class="wp_syntax"><div
class="code"><pre class="text" style="font-family:monospace;">    server {
        listen          80;
        server_name     apt-blog.net;
        root    /var/www/pt-sites/wordpress;
        index   index.html index.htm index.php;
        location / {
                # enable search for precompressed files ending in .gz
                # nginx needs to be complied using –-with-http_gzip_static_module
                # for this to work, comment out if using nginx from aptitude
                gzip_static on;
&nbsp;
# if the requested file exists, return it immediately
                if (-f $request_filename) {
                        break;
                }
&nbsp;
set $supercache_file '';
                set $supercache_uri $request_uri;
&nbsp;
if ($request_method = POST) {
                        set $supercache_uri '';
                }
&nbsp;
# Using pretty permalinks, so bypass the cache for any query string
                if ($query_string) {
                        set $supercache_uri '';
                }
&nbsp;
if ($http_cookie ~* &quot;comment_author_|wordpress|wp-postpass_&quot; ) {
                        set $supercache_uri '';
                }
&nbsp;
# !!!! IMPORTANT
                # if we haven't bypassed the cache, specify our supercache file
                if ($supercache_uri ~ ^(.+)$) {
                        set $supercache_file /wp-content/cache/supercache/$http_host/$1/index.html;
                }
&nbsp;
# only rewrite to the supercache file if it actually exists
                if (-f $document_root$supercache_file) {
                        rewrite ^(.*)$ $supercache_file break;
                }
&nbsp;
# all other requests go to Wordpress
                if (!-e $request_filename) {
                        rewrite ^(.*)$ /index.php?q=$1 last;
                }
&nbsp;
}
        location ~ \.php$ {
              include        fastcgi_params;
              fastcgi_pass   127.0.0.1:9000;
              fastcgi_index  index.php;
              fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        }
    }</pre></div></div><p><strong>需要重点关注的是<code>set $supercache_uri</code>这一行，这里的路径是wp-super-cache生成静态文件的路径，配置文件起作用的时候，这个路径会和$document_root组成最终静态文件的绝对路径，最终输出文件。所以如果这个路径不对的话，最终还是交给了<code>index.php</code>，缓冲就不起作用了。</strong></p><p>wp-super-cache在wordpress目录<code>/wp-content/cache/supercache/$http_host/</code>下生成了各个请求url的目录，目录下是一个index.html静态文件，可以在wordpress工作时候，在这个目录下用命令<code>watch find</code>观察（在缓冲不多的情况下），总之小心的把这个路径写好，因为估计每个博客的permanent link的样式都不一样，wp-super-cache生成的目录也不一样，需要仔细调试一下。</p><p>当然这里的规则并没有安全包含了wp-super-cache 插件的功能，比如识别手机客户端之类的，如果需要还得仔细根据插件生成的.htaccess规则来添加到nginx。</p><p>完成后用apache benchmark压一下，Request per second应该很容易上百，而且php-cgi应该不会出现在top的列表前面了，CPU应该集中在nginx的子进程上，而且都是个位数CPU占有率，系统的load非常低。</p><p>Tips: 发现测试结果不对时，可以尝试删除/wp-content/cache整个目录，让wp重新生成所有缓冲。</p><p>顺便说一下，如果仅使用ab测试压力，用不着安装整个apache2，只需要<code>apt-get install apache2-utils</code>。</p> ]]></content:encoded> <wfw:commentRss>http://apt-blog.net/nginx-rewrite-rules-for-wp-super-cache/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Vim中写WordPress博客 - VimRepress</title><link>http://apt-blog.net/release-of-vimrepress_cn</link> <comments>http://apt-blog.net/release-of-vimrepress_cn#comments</comments> <pubDate>Sun, 27 Feb 2011 14:10:51 +0000</pubDate> <dc:creator>BOYPT</dc:creator> <category><![CDATA[Blogger Tech]]></category> <category><![CDATA[Python]]></category> <category><![CDATA[Vim]]></category> <category><![CDATA[plugin]]></category> <category><![CDATA[vimpress]]></category> <guid
isPermaLink="false">http://apt-blog.net/release-of-vimrepress_cn</guid> <description><![CDATA[Update Vimpress 已经升级到2.x版本，使用、配置都有改进，请关注在vim.org的插件页面： http://www.vim.org/scripts/script.php?script_id=3510 WordPress的客户端其实不少，从live writter到scribefire，用户都不少。但是有时候我们只需要一篇博客包含简洁的HTML，这时候这些所见所得编辑器出来的结果都不一定都让人那么满意，经常需要登录到博客后台去编辑源码。 实际上最适合的还是方法还是先用markdown/reStructed/Tex/WikiText之类的语法写成，然后编译成HTML，再发布到博客。 Vim有个vimpress插件可以直接在Vim当中编辑博客，相当适合这个任务。不过由于官方页面上的vimpress已经久无人维护已经不能用了，之前对vimpress的代码做了 一些改写重构，而且得到外国网友的关注 ，而且冠名 VimRepress ，现在正式发布一个VimRepressed的版本。 比起原版的Vimpress，VimRepress有了更友好的错误提示，带了上传图片等的功能，改善了几个命令的可用性： BlogList &#60;count&#62; 列表文章，可以用参数定义列出多少篇文章。默认最近30篇。 BlogNew 新文章命令，会将当前的buffer内容作为文章的内容。 BlogOpen &#60;id&#62; 打开文章，需要手动输入post id. BlogSave &#60;draft&#124;publish&#62; 保存文章，可以保存为草稿、或者直接发布。 BlogPreview &#60;draft&#124;publish&#62; 预览文章，实际和BlogSave命令相同，之后会打开浏览器窗口预览文章。但如果你是保存成草稿的，还得在浏览器登录才能看到。 BlogUpload &#60;file&#62; 可上传图片等文件到博客。自动添加链接代码到光标后。 BlogCode &#60;code type&#62; 代码片段，添加一个&#60;pre&#62;元素的块，对程序博客特别有用，目前默认用wp-syntax插件的高亮模式。 下载: From Google Code SVN 版本: svn co http://ptcoding.googlecode.com/svn/trunk/vimpress/ 安装： 下载以上.zip文件，解压到~/.vim目录: cd ~/.vim unzip /where/you/downlaod/vimpress-1.x.x.zip 配置： 编辑 ~/.vim/plugin/blog.vim, 查找Settings，将会找到如下的一块代码： ##################### [...]]]></description> <content:encoded><![CDATA[<p><strong> Update </strong><br
/> Vimpress 已经升级到2.x版本，使用、配置都有改进，请关注在vim.org的插件页面：</p><p><a
href="http://www.vim.org/scripts/script.php?script_id=3510">http://www.vim.org/scripts/script.php?script_id=3510</a></p><hr
/><p>WordPress的客户端其实不少，从live writter到scribefire，用户都不少。但是有时候我们只需要一篇博客包含简洁的HTML，这时候这些所见所得编辑器出来的结果都不一定都让人那么满意，经常需要登录到博客后台去编辑源码。</p><p>实际上最适合的还是方法还是先用markdown/reStructed/Tex/WikiText之类的语法写成，然后编译成HTML，再发布到博客。</p><p>Vim有个vimpress插件可以直接在Vim当中编辑博客，相当适合这个任务。不过由于官方页面上的vimpress已经久无人维护已经不能用了，之前对vimpress的代码做了<a
href="http://apt-blog.net/an-improved-vimpress"> 一些改写重构，而且得到外国网友的关注 </a>，而且冠名<a
href="http://fzysqr.com/2010/12/12/vimrepressed/"> VimRepress </a>，现在正式发布一个VimRepressed的版本。</p><p>比起原版的Vimpress，VimRepress有了更友好的错误提示，带了上传图片等的功能，改善了几个命令的可用性：</p><ul><li><code>BlogList &lt;count&gt;</code> 列表文章，可以用参数定义列出多少篇文章。默认最近30篇。</li><li><code>BlogNew</code> 新文章命令，会将当前的buffer内容作为文章的内容。</li><li><code>BlogOpen &lt;id&gt;</code> 打开文章，需要手动输入post id.</li><li><code>BlogSave &lt;draft|publish&gt;</code> 保存文章，可以保存为草稿、或者直接发布。</li><li><code>BlogPreview &lt;draft|publish&gt;</code> 预览文章，实际和<code>BlogSave</code>命令相同，之后会打开浏览器窗口预览文章。但如果你是保存成草稿的，还得在浏览器登录才能看到。</li><li><code>BlogUpload &lt;file&gt;</code> 可上传图片等文件到博客。自动添加链接代码到光标后。</li><li><code>BlogCode &lt;code type&gt;</code> 代码片段，添加一个&lt;pre&gt;元素的块，对程序博客特别有用，目前默认用<code>wp-syntax</code>插件的高亮模式。</li></ul><p><strong>下载</strong>: <a
href="http://code.google.com/p/ptcoding/downloads/detail?name=vimpress-1.1.2-r45.zip">From Google Code</a></p><p><strong>SVN 版本</strong>: <code>svn co http://ptcoding.googlecode.com/svn/trunk/vimpress/</code></p><p><strong>安装：</strong></p><p>下载以上.zip文件，解压到<code>~/.vim</code>目录:</p><div
class="wp_syntax"><div
class="code"><pre class="bash" style="font-family:monospace;">  <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>.vim
  <span style="color: #c20cb9; font-weight: bold;">unzip</span> <span style="color: #000000; font-weight: bold;">/</span>where<span style="color: #000000; font-weight: bold;">/</span>you<span style="color: #000000; font-weight: bold;">/</span>downlaod<span style="color: #000000; font-weight: bold;">/</span>vimpress-<span style="color: #000000;">1</span>.x.x.zip</pre></div></div><p><strong>配置：</strong></p><p>编辑 <code>~/.vim/plugin/blog.vim</code>, 查找<code>Settings</code>，将会找到如下的一块代码：</p><div
class="wp_syntax"><div
class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#####################</span>
<span style="color: #808080; font-style: italic;">#      Settings     #</span>
<span style="color: #808080; font-style: italic;">#####################</span>
&nbsp;
blog_username = <span style="color: #483d8b;">'user'</span>
blog_password = <span style="color: #483d8b;">'pass'</span>
blog_url = <span style="color: #483d8b;">'http://yourblog.com'</span></pre></div></div><p>填入你的用户名、密码、博客地址，保存即可。</p><p>然后重新打开一个Vim，就可以敲<code>:BlogList</code>命令试试了。</p> ]]></content:encoded> <wfw:commentRss>http://apt-blog.net/release-of-vimrepress_cn/feed</wfw:commentRss> <slash:comments>12</slash:comments> </item> <item><title>Nginx与奶瓶腿（Dabr）</title><link>http://apt-blog.net/nginx_and_dabr</link> <comments>http://apt-blog.net/nginx_and_dabr#comments</comments> <pubDate>Mon, 27 Sep 2010 10:43:37 +0000</pubDate> <dc:creator>BOYPT</dc:creator> <category><![CDATA[Blogger Tech]]></category> <category><![CDATA[Unix/Linux]]></category> <guid
isPermaLink="false">http://apt-blog.net/nginx_and_dabr</guid> <description><![CDATA[上个月买了台在美帝的超廉价vps，基本上跑跑openvpn什么的，一个月下来流量一个百分点都没过，于是试试架点别的服务，先试试奶瓶腿。 VPS的内存就是钱。虽然这台VPS有384M内存，不算小，但apache什么的内存大户还是不考虑了，直接上nginx+fastcgi。 此前有做过这个组合的笔记《简单配置nginx+fastcgi后端的WordPress服务器》，不做博客的话mysql就省掉了。 但是启动php-cgi是个问题，还好有人写了不错的启动脚本/etc/init.d/php-fastcgi，Nginx, PHP and a PHP FastCGI daemon init script。而这篇How to set up nginx with PHP on Ubuntu的脚本稍微简化一点，而且是用Unix Socket来绑定nginx跟fastcgi的通讯。这样就免除了lo interface的依赖。 假设奶瓶Dabr是没什么难度的事情，奶瓶腿的话，我从项目的SVN checkout出源码后，下载 user_oauth.php并改名覆盖原来的common/user.php，以支持后台自动oauth登录Twitter；然后配置到nginx的虚拟主机目录下，基本就结了。 当然兽兽Showfom的Dabr教程里面提到了使用nginx的伪静态改写规则，这必须的（跟用wordpress一样）： 1 2 3 if &#40;!-e $request_filename&#41; &#123; rewrite ^/&#40;.*&#41;$ /index.php?q=$1 last; &#125; 最后遇到的问题是，访问奶瓶腿的Setting，保存后502错误，查看error.log看到报的是： 24219#0: *40 upstream sent too big header while reading response header from upstream 直接Google找到答案，就是调大nginx的fastcgi缓冲区。 1 2 [...]]]></description> <content:encoded><![CDATA[<p>上个月买了台在美帝的超廉价vps，基本上跑跑openvpn什么的，一个月下来流量一个百分点都没过，于是试试架点别的服务，先试试奶瓶腿。</p><p>VPS的内存就是钱。虽然这台VPS有384M内存，不算小，但apache什么的内存大户还是不考虑了，直接上nginx+fastcgi。</p><p>此前有做过这个组合的笔记<a
href="http://apt-blog.net/setup_nginx">《简单配置nginx+fastcgi后端的WordPress服务器》</a>，不做博客的话mysql就省掉了。</p><p>但是启动php-cgi是个问题，还好有人写了不错的启动脚本<code>/etc/init.d/php-fastcgi</code>，<a
href="http://blog.codefront.net/2007/06/11/nginx-php-and-a-php-fastcgi-daemon-init-script/">Nginx, PHP and a PHP FastCGI daemon init script</a>。而这篇<a
href="http://igorpartola.com/tag/ubuntu-php-nginx-fastcgi-vps-performance">How to set up nginx with PHP on Ubuntu</a>的脚本稍微简化一点，而且是用Unix Socket来绑定nginx跟fastcgi的通讯。这样就免除了lo interface的依赖。</p><p>假设奶瓶Dabr是没什么难度的事情，<a
href="https://code.google.com/p/netputweets/source/checkout">奶瓶腿的话</a>，我从项目的SVN checkout出源码后，<a
href="https://code.google.com/p/netputweets/downloads/list">下载 user_oauth.php</a>并改名覆盖原来的common/user.php，以支持后台自动oauth登录Twitter；然后配置到nginx的虚拟主机目录下，基本就结了。</p><p>当然<a
href="http://zou.lu/dabr/">兽兽Showfom的Dabr教程</a>里面提到了使用nginx的伪静态改写规则，这必须的（<a
href="http://apt-blog.net/setup_nginx">跟用wordpress一样</a>）：</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
</pre></td><td
class="code"><pre class="bash" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>-e <span style="color: #007800;">$request_filename</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        rewrite ^<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>.<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>$ <span style="color: #000000; font-weight: bold;">/</span>index.php?<span style="color: #007800;">q</span>=<span style="color: #007800;">$1</span> <span style="color: #c20cb9; font-weight: bold;">last</span>;
    <span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></td></tr></table></div><p>最后遇到的问题是，访问奶瓶腿的Setting，保存后502错误，查看error.log看到报的是：</p><pre>
24219#0: *40 upstream sent too big header while reading response header from upstream
</pre><p>直接Google找到答案，就是调大nginx的fastcgi缓冲区。</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
2
3
4
5
</pre></td><td
class="code"><pre class="bash" style="font-family:monospace;">fastcgi_connect_timeout <span style="color: #000000;">60</span>;
fastcgi_send_timeout <span style="color: #000000;">180</span>;
fastcgi_read_timeout <span style="color: #000000;">180</span>;
fastcgi_buffer_size 128k;
fastcgi_buffers <span style="color: #000000;">4</span> 128k;</pre></td></tr></table></div><p>把这段加入到虚拟主机的配置下面，完了。没什么营养。</p><p><strong>Update: 2011-02-28</strong></p><p>2010版的奶瓶里面改用了itap作为oauth代理，但是itap对改写的规则跟奶瓶不兼容，如果使用nginx配置，需要配置两个Location域：</p><div
class="wp_syntax"><div
class="code"><pre class="text" style="font-family:monospace;">server {
    listen   80; ## listen for ipv4
    server_name     your.server.com;
    access_log /var/log/nginx/netputtweet.access.log;
    error_log /var/log/nginx/netputtweet.error.log;
    root    /var/www/netputweets/;
    index   index.html index.htm index.php;
    location / {
            if (!-e $request_filename) {
                    rewrite ^/(.*)$ /index.php?q=$1 last;
            }
    }
    location /oauthproxy/ {
            if (!-e $request_filename) {
                    rewrite . /oauthproxy/index.php last;
            }
    }
    location ~ \.php$ {
          include        fastcgi_params;
          fastcgi_pass   127.0.0.1:9000;
          fastcgi_index  index.php;
          #fastcgi_param  HTTPS on; #if you use HTTPS
          fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }
}</pre></div></div> ]]></content:encoded> <wfw:commentRss>http://apt-blog.net/nginx_and_dabr/feed</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>An improved Vimpress</title><link>http://apt-blog.net/an-improved-vimpress</link> <comments>http://apt-blog.net/an-improved-vimpress#comments</comments> <pubDate>Sat, 03 Jul 2010 11:14:34 +0000</pubDate> <dc:creator>PT</dc:creator> <category><![CDATA[Blogger Tech]]></category> <category><![CDATA[Python]]></category> <category><![CDATA[Vim]]></category> <category><![CDATA[vimpress]]></category> <guid
isPermaLink="false">http://apt-blog.net/an-improved-vimpress</guid> <description><![CDATA[Vim has been so graceful that I like to have any text editing work done in her, especially coding and blogging. As a Firefox user, I previously use scribefire to write to my wordpress blog, actually I was working with HTML, I don't like WYSIWYG editing, which always creates dirty codes. However, scribefire is not [...]]]></description> <content:encoded><![CDATA[<p>Vim has been so graceful that I like to have any text editing work done in her, especially coding and blogging.</p><p>As a Firefox user, I previously use <a
href="http://www.scribefire.com/">scribefire</a> to write to my wordpress blog, actually I was working with HTML, I don't like WYSIWYG editing, which always creates dirty codes. However, scribefire is not good enought to me, many of my blogs includes codes, they needed to be surround by <code>&lt;pre&gt;</code> element to be syntax high-lighted, scribefire doesn't always works that well with code symbols, sometimes got translated into codes that hardly understand, I have to login into my blog to correct those lines.</p><p>What's more importantly, scribefire isn't good enough as an editor.</p><p>Then I found <a
href="http://www.vim.org/scripts/script.php?script_id=1953">vimpress</a>, and sadly found it was totaly broken, which haven't updated since 2007-07-13. Vimpress's official page is also <a
href="http://www.friggeri.net/projets/vimblog/">broken</a>. I googled for it, found that vimpress was noticed by many other blogger, they improved it, and hosting working versions of vimpress in their own repository.</p><p>The version by pigeond, <a
href="http://pigeond.net/blog/2009/05/07/vimpress-again/">he posted a blog about his improvement</a>, this's first working version I got.</p><p>Then the other post by Erik, he had vimpress in another git repository, and <a
href="http://www.ralree.com/2009/02/28/test-post-using-vimpress/">discussed about his using about vimpress</a>, what's worth another mention here is, vimpress is communicating to your wordpress blog through the XML-RPC protocol, unless your blog uses HTTPS(then use https url in vimpress), or you password would be transfered in plain text.</p><p>When I found vimpress is written in Python, I feel eager to improve it. Firstly it didn't support for wp-slug, which is called as 'postname' in wordpress, this is supposed to be a url friendly pattern, won't hurt if people write posts in English, wordpress simply translate spaces in Title into hyphen. But in other language like Chinese, such transfer would be ugly, I often use an English postname for every post.</p><p>And then the image upload. Scribefire allow me to upload images to blog and insert the img element to the edit. I added this feature to vimpress.</p><p>I added more friendly notifications for exceptions proccess, and many functions rewritten.</p><p>Now vimpress is mature enough to fulfill my blogging works. I firstly write my blog in <a
href="http://daringfireball.net/projects/markdown/">Markdown</a>, save as a temp file, then open a new buffer, type :BlogNew, then :r !markdown my_tmp.mkd , my post will translate into pretty HTML. Then fillin those title meta data, then :BlogSave publish, done. Pretty, Simple.</p><p>I still think I should have markdown ingranted to support with Markdown.</p><p>My version of vimpress could be retrived in my google code repository:</p><div
class="wp_syntax"><table><tr><td
class="line_numbers"><pre>1
</pre></td><td
class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> checkout http:<span style="color: #000000; font-weight: bold;">//</span>ptcoding.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>vimpress</pre></td></tr></table></div> ]]></content:encoded> <wfw:commentRss>http://apt-blog.net/an-improved-vimpress/feed</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>ScribeFire等XML-RPC工具发布WordPress出现HTML格式混乱的解决</title><link>http://apt-blog.net/fixing_mass_articles_posted_by_xmlprc_to_wordpress</link> <comments>http://apt-blog.net/fixing_mass_articles_posted_by_xmlprc_to_wordpress#comments</comments> <pubDate>Tue, 14 Apr 2009 10:22:21 +0000</pubDate> <dc:creator>PT</dc:creator> <category><![CDATA[Blogger Tech]]></category> <category><![CDATA[HTML]]></category> <category><![CDATA[libxml]]></category> <category><![CDATA[Scribefire]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[XML-RPC]]></category> <category><![CDATA[格式混乱]]></category> <guid
isPermaLink="false">http://apt-blog.net/?p=284</guid> <description><![CDATA[最近给我博客提供服务器的朋友把系统升级到新版的CentOS，习惯使用ScribeFire写博客的我遇上麻烦了：在Scribefire里面发布的任何东西格式都一团糟，发布的代码断肢缺臂，所有的HTML标记的尖括号都不翼而飞，原来的&#60;p&#62;就被剥光剩“p”，&#60;/p&#62;&#60;p&#62;&#60;/p&#62;的话就当然剩下3p了，不得不进入WordPress的后台编辑器重新修改，如此几天下来，不胜其烦。 于是在网上搜了一个中午，发现国内的形势一片大好，没任何人提到有这样的问题！！！难道是RP？后来想到，国内使用Linux主机的博客寥寥可数，在其中跟潮流使用新发行版的服务器更是少数了……因为这个问题的根源是新版libxml2库引起的！ 在这里可以看到不少生活在在水深火热中的西方人有这个问题，里面跟贴留言的人提到，在他的FC9系统里面安装libxml2-2.6.32-1.fc9没有问题，但是一升级到libxml2-2.7.1-1.fc9就不行了！而且这个问题不是最近才有的，可以看到抱怨该问题的帖子从08年10月后就出现了。 关于这个问题，考究过程是相当纠结的： WordPress 知道: XMLRPC api stripping leading angle brackets Php 知道: libxml2 2.7.1 causes breakage with character data in xml_parse() libxml2 知道 Release of libxml2-2.7.1 所有人都知道这个问题，但是距离完全修复还远着，一般用户如果能管理服务器，可以尝试把libxml2降级回2.6.3x，或者重新编译PHP，使用expat来替代libxml2的xml解析器。这两个方法对多数人来说都很不现实。在这些纠结得以解决之前，WordPress的用户一般要双手解决问题，WordPress patch for problamatic libxml2 version提供了修改wp中的三个文件的补丁方法，很明显，问题的根源是因为xml_parse()把我们文章里的HTML标记当成错误符号给吃掉了。不过对很多用户来说这依然不是个好方法，修改代码烦不说，还容易出错。 在这里推荐一般用户安装LibXML2 Fix这个WordPress插件，少快好省地搞定这个问题。当然，插件也提示说使用这个插件只是一个权宜之计，要真正修复这个问题，需要在服务器上把PHP更新到PHP 5.2.9+、libxml2 2.7.3+。]]></description> <content:encoded><![CDATA[<p>最近给我博客提供服务器的朋友把系统升级到新版的CentOS，习惯使用ScribeFire写博客的我遇上麻烦了：在Scribefire里面发布的任何东西格式都一团糟，发布的代码断肢缺臂，所有的HTML标记的尖括号都不翼而飞，原来的&lt;p&gt;就被剥光剩“p”，<span
style="font-weight: bold;">&lt;/p&gt;&lt;p&gt;&lt;/p&gt;的话就当然剩下3p了</span>，不得不进入WordPress的后台编辑器重新修改，如此几天下来，不胜其烦。</p><p>于是在网上搜了一个中午，发现<big
style="font-weight: bold;">国内的形势<span
style="text-decoration: underline;">一片大好</span></big>，没任何人提到有这样的问题！！！难道是RP？后来想到，国内使用Linux主机的博客寥寥可数，在其中跟潮流使用新发行版的服务器更是少数了……因为这个问题的根源是新版libxml2库引起的！</p><p>在<a
href="http://www.geekyramblings.org/2008/09/20/wordpress-xml-rpc-error/" target="_blank">这里</a>可以看到不少生活在在水深火热中的西方人有这个问题，里面跟贴留言的人提到，在他的FC9系统里面安装libxml2-2.6.32-1.fc9没有问题，但是一升级到libxml2-2.7.1-1.fc9就不行了！而且这个问题不是最近才有的，可以看到抱怨该问题的帖子从08年10月后就出现了。</p><p>关于这个问题，考究过程是相当纠结的：</p><ul><li><a
class="st_tag internal_tag" title="Posts tagged with wordpress" rel="tag">WordPress</a> 知道: <a
href="http://trac.wordpress.org/ticket/7771">XMLRPC api stripping leading angle brackets</a></li><li>Php 知道: <a
href="http://bugs.php.net/bug.php?id=45996">libxml2 2.7.1 causes breakage with character data in xml_parse()</a></li><li>libxml2 知道 <a
href="http://thread.gmane.org/gmane.comp.gnome.lib.xml.general/14595/focus=14610">Release of libxml2-2.7.1</a></li></ul><p>所有人都知道这个问题，但是距离完全修复还远着，一般用户如果能管理服务器，可以尝试<span
style="text-decoration: underline;">把libxml2降级回2.6.3x</span>，或者<span
style="text-decoration: underline;">重新编译PHP，使用</span><a
style="text-decoration: underline;" href="http://expat.sourceforge.net/">expat</a><span
style="text-decoration: underline;">来替代libxml2的xml解析器</span>。这两个方法对多数人来说都很不现实。在这些纠结得以解决之前，WordPress的用户一般要<span
style="text-decoration: underline;">双手解决问题</span>，<a
href="http://blog.hoofoo.net/2009/01/14/wordpress-patch-for-problamatic-libxml2-version/" target="_blank">WordPress patch for problamatic libxml2 version</a>提供了修改wp中的三个文件的补丁方法，很明显，问题的根源是因为xml_parse()把我们文章里的HTML标记当成错误符号给吃掉了。不过对很多用户来说这依然不是个好方法，修改代码烦不说，还容易出错。</p><p>在这里<big><span
style="font-weight: bold;">推荐一般用户安装<a
href="http://wordpress.org/extend/plugins/libxml2-fix/" target="_blank">LibXML2 Fix</a>这个WordPress插件</span></big>，少快好省地搞定这个问题。当然，插件也提示说使用这个插件只是一个权宜之计，要真正修复这个问题，需要在服务器上把PHP更新到PHP 5.2.9+、libxml2 2.7.3+。</p> ]]></content:encoded> <wfw:commentRss>http://apt-blog.net/fixing_mass_articles_posted_by_xmlprc_to_wordpress/feed</wfw:commentRss> <slash:comments>6</slash:comments> </item> <item><title>Twitter入门</title><link>http://apt-blog.net/using-twitter</link> <comments>http://apt-blog.net/using-twitter#comments</comments> <pubDate>Wed, 25 Feb 2009 07:56:51 +0000</pubDate> <dc:creator>PT</dc:creator> <category><![CDATA[Blogger Tech]]></category> <category><![CDATA[小玩意]]></category> <category><![CDATA[Blog]]></category> <category><![CDATA[Twitter]]></category> <guid
isPermaLink="false">http://apt-blog.net/archives/88.html</guid> <description><![CDATA[今天正式开始玩Twitter，是在awflasher博主的带领下入门的。 Twitter是什么？原先我以为，不就和QQ签名那样嘛，写一句话，显示到好友（Follower）那边。现在来看，确实没错，但是却少了一层信息分享的意味。比如说，自己突然想起一句话，想和大家分享，但是又不可能这样就写一篇博客，或者到QQ甚至打电话发信息和别人说，很多创意和想法就这样生生憋回去了……另外Twitter作为最新消息的传播平台，已经形成了一种氛围，很多主流媒体看不到的信息都能在第一时间通过Twitter传播（如此前的孟买袭击、CCAV着火……） 在任何时间、任何方式发表任何信息，分享给希望获知这些信息的人； 在第一时间、任一方式获知你所关注的人（或事）的最新进展； 这是awflasher对Twitter的概括，相当精炼。 重点推荐下awFlasher博客里面关于Twitter的几篇文章： 扫盲系列 - 什么是Twitter？ 变个花样玩Twitter（上）- 推荐6款优秀的第三方应用 呼吁大家更安全地使用Twitter 其他]]></description> <content:encoded><![CDATA[<p>今天正式开始玩Twitter，是在awflasher博主的带领下入门的。</p><p>Twitter是什么？原先我以为，不就和QQ签名那样嘛，写一句话，显示到好友（Follower）那边。现在来看，确实没错，但是却少了一层信息分享的意味。比如说，自己突然想起一句话，想和大家分享，但是又不可能这样就写一篇博客，或者到QQ甚至打电话发信息和别人说，很多创意和想法就这样生生憋回去了……另外Twitter作为最新消息的传播平台，已经形成了一种氛围，很多主流媒体看不到的信息都能在第一时间通过Twitter传播（如此前的孟买袭击、CCAV着火……）<ol><li>在<strong>任何时间</strong>、任何方式<strong>发表任何信息</strong>，分享给希望获知这些信息的人；</li><li>在<strong>第一时间</strong>、任一方式<strong>获知</strong>你所关注的人（或事）的<strong>最新进展</strong>；</li></ol><p>这是awflasher对Twitter的概括，相当精炼。</p><p>重点推荐下awFlasher博客里面关于Twitter的几篇文章：<ul><li><a
href="http://www.awflasher.com/blog/archives/1635" rel="bookmark" title="Permalink to 扫盲系列 - 什么是Twitter？">扫盲系列 - 什么是Twitter？</a></li><li><a
href="http://www.awflasher.com/blog/archives/1637" target="_blank">变个花样玩Twitter（上）- 推荐6款优秀的第三方应用</a></li><li><a
href="http://www.awflasher.com/blog/archives/1651" target="_blank">呼吁大家更安全地使用Twitter</a></li><li><a
href="http://www.awflasher.com/blog/tag/twitter/" target="_blank">其他</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://apt-blog.net/using-twitter/feed</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Scribefire中分隔WordPress的文章输出</title><link>http://apt-blog.net/split-article-in-scribfie</link> <comments>http://apt-blog.net/split-article-in-scribfie#comments</comments> <pubDate>Mon, 02 Feb 2009 08:50:45 +0000</pubDate> <dc:creator>PT</dc:creator> <category><![CDATA[Blogger Tech]]></category> <category><![CDATA[小玩意]]></category> <category><![CDATA[Scribefire]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[分隔]]></category> <guid
isPermaLink="false">http://apt-blog.net/archives/40.html</guid> <description><![CDATA[WordPress中使用&#60;!--more--&#62;标签分隔文章在首页和单页中输出的功能很方便，在原编辑器中可以单击分隔按钮添加，但是习惯在Scribefire发文章，却无奈Scribefire没有这样的按钮。 这天无意中发现，Scribefire提供的“添加分割线”功能，虽然插入的是&#60;hr&#62;标签，但是文章发上去后自动转成&#60;!--more--&#62;标签： 仔细看一下，Scribefire插入的是&#60;hr class="jump" /&#62;，估计WordPress中有相应机制能完成相应的转换吧。]]></description> <content:encoded><![CDATA[<p>WordPress中使用&lt;!--more--&gt;标签分隔文章在首页和单页中输出的功能很方便，在原编辑器中可以单击分隔按钮添加，但是习惯在Scribefire发文章，却无奈Scribefire没有这样的按钮。<img
style="float: right; margin-top: 10px; margin-bottom: 10px; margin-left: 10px;" src="http://apt-blog.net/wp-content/uploads/2009/02/scribefire-sep.png" /></p><p>这天无意中发现，Scribefire提供的“添加分割线”功能，虽然插入的是&lt;hr&gt;标签，但是文章发上去后自动转成&lt;!--more--&gt;标签：</p><p>仔细看一下，Scribefire插入的是&lt;hr class="jump" /&gt;，估计WordPress中有相应机制能完成相应的转换吧。</p> ]]></content:encoded> <wfw:commentRss>http://apt-blog.net/split-article-in-scribfie/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>人品爆发了？获得无限空间……</title><link>http://apt-blog.net/%e4%ba%ba%e5%93%81%e7%88%86%e5%8f%91%e4%ba%86%ef%bc%9f%e8%8e%b7%e5%be%97%e6%97%a0%e9%99%90%e7%a9%ba%e9%97%b4%e2%80%a6%e2%80%a6</link> <comments>http://apt-blog.net/%e4%ba%ba%e5%93%81%e7%88%86%e5%8f%91%e4%ba%86%ef%bc%9f%e8%8e%b7%e5%be%97%e6%97%a0%e9%99%90%e7%a9%ba%e9%97%b4%e2%80%a6%e2%80%a6#comments</comments> <pubDate>Mon, 02 Feb 2009 06:41:26 +0000</pubDate> <dc:creator>PT</dc:creator> <category><![CDATA[Blogger Tech]]></category> <category><![CDATA[空间]]></category> <guid
isPermaLink="false">http://apt-blog.net/archives/31.html</guid> <description><![CDATA[今天登陆了一下cPanel，发现原来使用已经近半的空间使用量为0，再仔细一看，限额是正无穷……怎么回事？月夜出来解释一下！！！]]></description> <content:encoded><![CDATA[<p>今天登陆了一下cPanel，发现原来使用已经近半的空间使用量为0，再仔细一看，限额是正无穷……怎么回事？月夜出来解释一下！！！</p><p><img
style="max-width: 800px;" src="http://apt-blog.net/wp-content/uploads/2009/02/space1.gif" alt="" /></p><div
class="zemanta-pixie"><img
class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=93ab5201-7f33-4e14-b8c3-f47a59c2ca6e" /></div> ]]></content:encoded> <wfw:commentRss>http://apt-blog.net/%e4%ba%ba%e5%93%81%e7%88%86%e5%8f%91%e4%ba%86%ef%bc%9f%e8%8e%b7%e5%be%97%e6%97%a0%e9%99%90%e7%a9%ba%e9%97%b4%e2%80%a6%e2%80%a6/feed</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
