<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <!--[if lte IE 9]><meta http-equiv="refresh" content="0;url=/ie.html"><![endif]-->

    <title></title>
    <meta name="description" content="">
    <link rel="icon" type="image/png" href="/assets/img/favicon.png" />
    <link rel="stylesheet" type="text/css" href="/assets/css/style.css">

    <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "//hm.baidu.com/hm.js?70050943457813e886719a379bd9b067";
      var s = document.getElementsByTagName("script")[0]; 
      s.parentNode.insertBefore(hm, s);
    })();
    </script>


    
    
  </head>
  <body>
    <aside id="sidebar">
      <nav id="tags">
        <a href="/index.html" id="avatar"></a>

        <ul id="tags__ul">
          <li id="js-label1" class="tags__li tags-btn active">All</li>
          <li id="js-label2" class="tags__li tags-btn">iOS</li>
          <li id="js-label3" class="tags__li tags-btn">Java</li>
          <li id="js-label4" class="tags__li tags-btn">Python</li>
          <li id="js-label5" class="tags__li tags-btn">Other</li>
          <li id="js-label6" class="tags__li tags-btn">About</li>
        </ul>

        <div id="tags__bottom">
          <a href="mailto:412775083@qq.com" id="icon-email" class="tags-btn fontello"></a>
          <a href="/rss.xml" id="icon-feed" class="tags-btn fontello"></a>
        </div>
      </nav> <!-- end #tags -->

      <div id="posts-list">
        <form action="" id="search-form">
          <a href="/index.html" id="mobile-avatar"></a>
          <!-- NOTE: input field is disabled by default -->
          <!--<input id="search-input" type="text" placeholder="爱生活，爱Coding" disabled >-->
          <div style="padding: 20px 20px 20px; font-size: 18px;font-family: inherit; color: #1B813F;
"> Coding, Sharing </div>
        </form>

        <nav id="pl__container">
        
          <a class="php pl__all" href="/php/2015/07/02/php%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95.html"><span class="pl__circle"></span><span class="pl__title">php基础语法</span><span class="pl__date">15-07-02</span></a>
        
          <a class="ios pl__all" href="/ios/2015/06/29/NSJSONSerialization.html"><span class="pl__circle"></span><span class="pl__title">NSJSONSerialization中各参数说明</span><span class="pl__date">15-06-29</span></a>
        
          <a class="python pl__all" href="/python/2015/04/07/%E5%9C%A8XCode%E4%B8%AD%E4%BD%BF%E7%94%A8%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E7%89%88.html"><span class="pl__circle"></span><span class="pl__title">在XCode中使用自定义模版</span><span class="pl__date">15-04-07</span></a>
        
          <a class="python pl__all" href="/python/2015/04/01/%E5%9C%A8linux%E5%8F%91%E5%B8%83python%E6%9C%8D%E5%8A%A1%E5%99%A8.html"><span class="pl__circle"></span><span class="pl__title">在linux（ubantu）上部署django工程</span><span class="pl__date">15-04-01</span></a>
        
          <a class="other pl__all" href="/other/2015/03/26/HTML%EF%BC%8BCSS%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0.html"><span class="pl__circle"></span><span class="pl__title">HTML＋CSS学习笔记</span><span class="pl__date">15-03-26</span></a>
        
          <a class="ios pl__all" href="/ios/2015/03/05/%E6%94%AF%E4%BB%98SDK.html"><span class="pl__circle"></span><span class="pl__title">支付SDK</span><span class="pl__date">15-03-05</span></a>
        
          <a class="ios pl__all" href="/ios/2015/03/05/%E6%8A%8A%E9%A1%B9%E7%9B%AE%E4%BD%BF%E7%94%A8Pod%E7%AE%A1%E7%90%86.html"><span class="pl__circle"></span><span class="pl__title">把项目使用Pod管理</span><span class="pl__date">15-03-05</span></a>
        
          <a class="other pl__all" href="/other/2015/03/05/sublime%E6%8F%92%E4%BB%B6%E5%AE%89%E8%A3%85.html"><span class="pl__circle"></span><span class="pl__title">sublime3在mac环境下安装linter</span><span class="pl__date">15-03-05</span></a>
        
          <a class="python pl__all" href="/python/2015/03/05/Django%E9%A1%B9%E7%9B%AE.html"><span class="pl__circle"></span><span class="pl__title">Django项目</span><span class="pl__date">15-03-05</span></a>
        
          <a class="python pl__all" href="/python/2015/02/20/linux%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4.html"><span class="pl__circle"></span><span class="pl__title">linux常用命令</span><span class="pl__date">15-02-20</span></a>
        
        </nav>
      </div> <!-- end #posts-list -->
    </aside> <!-- end #sidebar -->

    <div id="post">
      <div id="pjax">
        <article id="post__content">
  <h1 id="post__title" data-identifier=""></h1>
  <?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Javen Blog</title>
    <link></link>
    <atom:link href="/rss.xml" rel="self" type="application/rss+xml" />
    <description>Javen的博客</description>
    <language></language>
    <pubDate>Wed, 16 Sep 2015 17:51:41 +0000</pubDate>
    <lastBuildDate>Wed, 16 Sep 2015 17:51:41 +0000</lastBuildDate>

    
    <item>
      <title>php基础语法</title>
      <link>/php/2015/07/02/php%E5%9F%BA%E6%9C%AC%E8%AF%AD%E6%B3%95.html</link>
      <!-- <pubDate>Thu, 02 Jul 2015 15:27:31 +0000</pubDate> -->
      <author>Javen Liu</author>
      <guid>/php/2015/07/02/php基本语法</guid>
      <description>&lt;p&gt;174&lt;/p&gt;

&lt;p&gt;$var&lt;/p&gt;

&lt;p&gt;define(&amp;#39;TEST&amp;#39;, &amp;#39;test&amp;#39;);&lt;/p&gt;

&lt;p&gt;echo &amp;quot;{$a} ${a}&amp;quot;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FUNCITON&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;METHOD&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CLASS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;var_dump();&lt;/p&gt;

&lt;h3&gt;增加环境路径&lt;/h3&gt;

&lt;p&gt;mac增加环境路径
~/.zshrc
export PATH=&amp;quot;/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin&amp;quot;&lt;/p&gt;

&lt;p&gt;mac自启动目录
/Users/liu/Library/LaunchAgents&lt;/p&gt;

&lt;h3&gt;php&lt;/h3&gt;

&lt;p&gt;php.ini默认路径
/usr/local/etc/php/5.5&lt;/p&gt;

&lt;h3&gt;Nginx&lt;/h3&gt;

&lt;p&gt;nginx路径
/usr/local/etc/nginx&lt;/p&gt;

&lt;p&gt;nginx默认服务器路径
/usr/local/var/www&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;sudo nginx 启动
sudo nginx -s stop 停止
sudo nginx -s reload 刷新配置
sudo nginx -t 检测配置是否有误
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;php-fpm&lt;/h3&gt;

&lt;p&gt;php-fpm路径
/usr/local/sbin&lt;/p&gt;

&lt;p&gt;php-fpm配置文件路径
/usr/local/sbin/php-fpm.conf&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;php-fpm 启动
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;apache&lt;/h3&gt;

&lt;p&gt;apache默认服务器路径
/Library/WebServer/Documents&lt;/p&gt;

&lt;p&gt;apache配置文件路径
/etc/apache2/httpd.conf&lt;/p&gt;

&lt;p&gt;更改
DocumentRoot &amp;quot;/Users/username/Sites&amp;quot;
&lt;Directory &quot;/Users/username/Sites&quot;&gt;
    ...
&lt;/Directory&gt;&lt;/p&gt;

&lt;p&gt;对apache使用的php版本也进行了修改
在/etc/apache2/httpd.conf下增加
LoadModule php5_module /usr/local/Cellar/php55/5.5.8/libexec/apache2/libphp5.so&lt;/p&gt;

&lt;p&gt;apache命令&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;sudo apachectl start
sudo apachectl restart
sudo apachectl stop
sudo apachectl -t
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;MongoDB&lt;/h3&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;sudo mongod 启动
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h3&gt;RockMongo&lt;/h3&gt;

&lt;h3&gt;MySQL&lt;/h3&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;mysql.server start
mysql.server stop
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;来启动／停止，启动后默认应为空密码，可以通过mysqladmin设置一个密码&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;mysqladmin -uroot password &amp;quot;mypassword&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;但是在操作的时候出现了空密码无法登入的情况，最终只能通过mysqld&lt;em&gt;safe来设置
```
sudo mysqld&lt;/em&gt;safe --skip-grant-tables
mysql -u root
mysql&amp;gt; UPDATE mysql.user SET Password=PASSWORD(&amp;#39;mypassword&amp;#39;) WHERE User=&amp;#39;root&amp;#39;;
mysql&amp;gt; FLUSH PRIVILEGES;
&lt;code&gt;
最后将MySQL加入开机启动
&lt;/code&gt;
cp /usr/local/Cellar/mysql/5.6.22/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
```&lt;/p&gt;

&lt;h3&gt;PHPMyAdmin&lt;/h3&gt;

&lt;p&gt;phpmyadmin几乎是管理mysql最容易的web应用了吧，每次我都顺道装上。&lt;/p&gt;

&lt;p&gt;去官网下载最新的版本
解压到~/Sites/phpmyadmin下
在phpmyadmin目录下创建一个可写的config目录
打开http://localhost/phpmyadmin/setup，安装一个服务，最后保存（这里只需要输入帐号密码就够了）
将config下生成的config.inc.php移到phpmyadmin根目录下
删除config
这样就装好了，虽然可能有点小复杂，但是来一次就习惯了。&lt;/p&gt;

&lt;p&gt;这里很可能会遇到2002错误，就是找不到mysql.sock的问题，用下面方法解决&lt;/p&gt;

&lt;p&gt;sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>NSJSONSerialization中各参数说明</title>
      <link>/ios/2015/06/29/NSJSONSerialization.html</link>
      <!-- <pubDate>Mon, 29 Jun 2015 01:13:31 +0000</pubDate> -->
      <author>Javen Liu</author>
      <guid>/ios/2015/06/29/NSJSONSerialization</guid>
      <description>&lt;h2&gt;用法&lt;/h2&gt;

&lt;h4&gt;jsonString to object&lt;/h4&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-objectivec&quot; data-lang=&quot;objectivec&quot;&gt;&lt;span class=&quot;bp&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;jsonString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;@&amp;quot;{&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;test&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;abc&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&amp;quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;}&amp;quot;&lt;/span&gt;
&lt;span class=&quot;bp&quot;&gt;NSData&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;self&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;dataUsingEncoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSUTF8StringEncoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;bp&quot;&gt;NSError&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;kt&quot;&gt;id&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;NSJSONSerialization&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;JSONObjectWithData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSJSONReadingMutableContainers&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;NSLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&amp;quot;result %@&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4&gt;object to jsonString&lt;/h4&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-objectivec&quot; data-lang=&quot;objectivec&quot;&gt;&lt;span class=&quot;bp&quot;&gt;NSDictionary&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dict&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;l&quot;&gt;@{&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&amp;quot;test&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&amp;quot;abc&amp;quot;&lt;/span&gt;&lt;span class=&quot;l&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;bp&quot;&gt;NSError&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;error&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;nil&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;bp&quot;&gt;NSData&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;NSJSONSerialization&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;dataWithJSONObject&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dict&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;options&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSJSONWritingPrettyPrinted&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;bp&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;jsonString&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[[&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;NSString&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;alloc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;initWithData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;NSUTF8StringEncoding&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;NSLog&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;@&amp;quot;jsonString %@&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;jsonString&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;NSJSONReadingOptions说明&lt;/h2&gt;

&lt;h4&gt;先看定义&lt;/h4&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-objectivec&quot; data-lang=&quot;objectivec&quot;&gt;&lt;span class=&quot;k&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;NS_OPTIONS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;NSUInteger&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NSJSONReadingOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSJSONReadingMutableContainers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1UL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSJSONReadingMutableLeaves&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1UL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSJSONReadingAllowFragments&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1UL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NS_ENUM_AVAILABLE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4&gt;再看官方文档的说明&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;NSJSONReadingMutableContainers&lt;/code&gt;&lt;br&gt;
Specifies that arrays and dictionaries are created as mutable objects.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;NSJSONReadingMutableLeaves&lt;/code&gt;&lt;br&gt;
Specifies that leaf strings in the JSON object graph are created as instances of NSMutableString.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;NSJSONReadingAllowFragments&lt;/code&gt;&lt;br&gt;
Specifies that the parser should allow top-level objects that are not an instance of NSArray or NSDictionary.&lt;/p&gt;

&lt;h4&gt;解释一下&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;NSJSONReadingMutableContainers&lt;/code&gt;&lt;br&gt;
意思是返回的数组和字典都是&lt;strong&gt;NSMutableArray&lt;/strong&gt;和&lt;strong&gt;NSMutableDictionay&lt;/strong&gt;类型，固可以作后续修改。&lt;/p&gt;

&lt;p&gt;&lt;code&gt;NSJSONReadingMutableLeaves&lt;/code&gt;&lt;br&gt;
意思是返回的的字符串是&lt;strong&gt;NSMutableSting&lt;/strong&gt;类型，这里实践后是不行的，网上查了很多资料说是苹果的&lt;strong&gt;bug&lt;/strong&gt;，到目前ios8中也没有修复。&lt;/p&gt;

&lt;p&gt;&lt;code&gt;NSJSONReadingAllowFragments&lt;/code&gt;&lt;br&gt;
意思是需要格式化的json字符串最外层可以不是数组和字典，只要是正确的json格式就行。&lt;/p&gt;

&lt;h4&gt;总结&lt;/h4&gt;

&lt;p&gt;如果需要后续进行修改，则需要使用&lt;code&gt;NSJSONReadingMutableContainers&lt;/code&gt;，返回可变类型，其他的选项中的数字和字典都是不可变的。&lt;/p&gt;

&lt;p&gt;如果需要兼容所有的json格式，则使用&lt;code&gt;NSJSONReadingAllowFragments&lt;/code&gt;，因为使用&lt;code&gt;NSJSONReadingMutableContainers&lt;/code&gt;和&lt;code&gt;NSJSONReadingMutableLeaves&lt;/code&gt;转换最外层不是字典或数组的字符串会报错，导致转换失败，即使是正确的json字符串（如&lt;code&gt;&amp;quot;test&amp;quot;&lt;/code&gt;,&lt;code&gt;123&lt;/code&gt;,&lt;code&gt;false&lt;/code&gt;等）。&lt;/p&gt;

&lt;p&gt;至于&lt;code&gt;NSJSONReadingMutableLeaves&lt;/code&gt;，在bug修复前没有使用的必要了，既不能返回可变类型，也不能兼容所有的json格式。&lt;/p&gt;

&lt;p&gt;PS：是否正确的json字符串，苹果是这样定义的&lt;/p&gt;

&lt;p&gt;The top level object is an NSArray or NSDictionary.&lt;br&gt;
All objects are instances of NSString, NSNumber, NSArray, NSDictionary, or NSNull.&lt;br&gt;
All dictionary keys are instances of NSString.&lt;br&gt;
Numbers are not NaN or infinity.&lt;/p&gt;

&lt;p&gt;最外层必须是数组或者字典（可以看出&lt;code&gt;NSJSONReadingAllowFragments&lt;/code&gt;是个例外）&lt;br&gt;
所有的对象必须是&lt;code&gt;NSString&lt;/code&gt;、&lt;code&gt;NSNumber&lt;/code&gt;、&lt;code&gt;NSArray&lt;/code&gt;、&lt;code&gt;NSDictionary&lt;/code&gt;、&lt;code&gt;NSNull&lt;/code&gt;的实例&lt;br&gt;
所有字典的键值key必须是NSString类型&lt;br&gt;
数字对象不能是非数值或无穷&lt;/p&gt;

&lt;hr&gt;

&lt;h2&gt;NSJSONReadingOptions说明&lt;/h2&gt;

&lt;h4&gt;先看定义&lt;/h4&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-objectivec&quot; data-lang=&quot;objectivec&quot;&gt;&lt;span class=&quot;k&quot;&gt;typedef&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;NS_OPTIONS&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;NSUInteger&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NSJSONWritingOptions&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;NSJSONWritingPrettyPrinted&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1UL&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;NS_ENUM_AVAILABLE&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_7&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;_0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h4&gt;再看官方文档的说明&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;NSJSONWritingPrettyPrinted&lt;/code&gt;&lt;br&gt;
Specifies that the JSON data should be generated with whitespace designed to make the output more readable. If this option is not set, the most compact possible JSON representation is generated.&lt;/p&gt;

&lt;p&gt;意思就是生成的json字符串是带换行和缩进的，更加易读。如果要生成单行不带缩进的就直接设0。&lt;br&gt;
（PS:这里有点小坑，直接多写个枚举&lt;code&gt;NSJSONWritingSingleLine&lt;/code&gt;多好，简单易读，If this option is not set这里说的选项不设置，害我猜了半天什么意思，还以为有另外一个方法是不需要穿参数的，结果没有...）&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>在XCode中使用自定义模版</title>
      <link>/python/2015/04/07/%E5%9C%A8XCode%E4%B8%AD%E4%BD%BF%E7%94%A8%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A8%A1%E7%89%88.html</link>
      <!-- <pubDate>Tue, 07 Apr 2015 15:27:31 +0000</pubDate> -->
      <author>Javen Liu</author>
      <guid>/python/2015/04/07/在XCode中使用自定义模版</guid>
      <description>&lt;p&gt;把Path加入到项目的Group中，命名为key
（如果写Grooup会不存在则自动创建，不过不填Group就不加入分组）&lt;/p&gt;

&lt;p&gt;iOS特定的模版&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;基类模版&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/Applications/Xcode.app/Contents/Developer/Library/Xcode/Templates&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;1.添加自定义模版到XCode&lt;/h3&gt;

&lt;p&gt;把&lt;code&gt;TorayApplication.xctemplate.zip&lt;/code&gt;解压到XCode目录&lt;code&gt;/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Templates/Project Templates/iOS/Application/TorayApplication.xctemplate&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;2.创建自定义模版&lt;/h3&gt;

&lt;p&gt;打开XCode-&amp;gt;File-&amp;gt;New-&amp;gt;Project，选择TorayApplication
创建成功的话看到项目模版已经出来了，但是别着急，这时候还不能bulid成功。&lt;/p&gt;

&lt;h3&gt;3.配置工程&lt;/h3&gt;

&lt;p&gt;1.删除AppDelegate.h AppDelegate.m&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;因为自定义模版里已经带了AppDelegate（在[proejct name]/Application/AppDelegate），导致与基础模版自动生成的AppDelegate冲突，所以删除之&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;2.在Build Settingzh中引入PrefixHeader.pch&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;注意：&lt;/p&gt;

&lt;p&gt;1.PrefixHeader.pch是&lt;code&gt;[proejct name]/PrefixHeader.pch&lt;/code&gt;下&lt;/p&gt;

&lt;p&gt;2.因为XCode6的默认模版不生成pch文件，所以要手动引入&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;3.更新pod&lt;/h3&gt;

&lt;p&gt;在工程目录下运行&lt;code&gt;pod install&lt;/code&gt;,等安装完成后，就可以进入工程build了，如果一切正常，就会bulid success,自定义模版就完成了。&lt;/p&gt;

&lt;p&gt;参考资料
http://www.th7.cn/Program/IOS/201312/162518.shtml&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>在linux（ubantu）上部署django工程</title>
      <link>/python/2015/04/01/%E5%9C%A8linux%E5%8F%91%E5%B8%83python%E6%9C%8D%E5%8A%A1%E5%99%A8.html</link>
      <!-- <pubDate>Wed, 01 Apr 2015 15:27:31 +0000</pubDate> -->
      <author>Javen Liu</author>
      <guid>/python/2015/04/01/在linux发布python服务器</guid>
      <description>&lt;h3&gt;门槛&lt;/h3&gt;

&lt;p&gt;文章是在默认你已经掌握以下基础知识编写，如果在阅读过程中发现对以下基础知识不太了解，可以先查看相关资料&lt;/p&gt;

&lt;p&gt;1.基本的linux命令行，如基本的&lt;code&gt;cd&lt;/code&gt;、&lt;code&gt;cat&lt;/code&gt;、&lt;code&gt;vi&lt;/code&gt;、&lt;code&gt;sudo&lt;/code&gt;操作&lt;/p&gt;

&lt;p&gt;2.懂得使用git进行代码管理，如基本的&lt;code&gt;git pull&lt;/code&gt;、&lt;code&gt;git push&lt;/code&gt;、&lt;code&gt;git clone&lt;/code&gt;操作&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;服务器会通过git来同步代码&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;3.会使用ssh连接服务器，如&lt;code&gt;ssh root@[hostname]&lt;/code&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;服务器都连不上的话，还谈什么部署...&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;4.有一个能运行django框架,能使用&lt;code&gt;python manage.py runserver&lt;/code&gt;运行&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;那怕是输出一个hello world也够了，因为目的是部署，不是实现服务器的功能&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;前言&lt;/h3&gt;

&lt;p&gt;先介绍用到的几个术语&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pip             python包管理工具
django          多功能python框架
git             代码管理神器
gunicorn        高性能python服务器
gevent          python并发框架
supervisor      管理python服务器的开启、关闭、查看状态
nginx           高性能的 HTTP 和 反向代理
fabric          自动化部署框架
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;这里只是简单说明一下用到的术语，更多深入详细的了解读者可以自行google&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;快速上手&lt;/h2&gt;

&lt;p&gt;我的服务器环境是Ubantu 64位，Django1.6.6，python2.7，给各位参照下，如果版本不同的话或许会出现其他异常情况&lt;/p&gt;

&lt;h4&gt;1.前期准备&lt;/h4&gt;

&lt;blockquote&gt;
&lt;p&gt;如果你已经准备了一个可执行的django， 用git管理代码了，可以跳过这一步了&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;准备一个可以运行的django项目&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;python manage.py runserver
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;用git管理代码，初始化git&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;git init
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;添加远程仓库&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;git remote add origin [remote git url]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;代码加入git管理&lt;code&gt;git add .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;提交更新&lt;code&gt;git commit -am &amp;#39;[change log]&amp;#39;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;推上服务器&lt;code&gt;git push&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;好，在开发机器的工作完成了，下面进入服务器部分。&lt;/p&gt;

&lt;h4&gt;1.配置服务器环境&lt;/h4&gt;

&lt;p&gt;首先用ssh连接服务器&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;ssh root@[hostname]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;安装需要用到环境&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;`apt-get install pip`

`apt-get install nginx`

`apt-get install git`

`apt-get install supervisor`

`pip install gunicorn`

`pip install django`
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;如果&lt;code&gt;apt-get install xxx&lt;/code&gt;出现无法下载的情况，可以试下先&lt;code&gt;apt-get update&lt;/code&gt;刷新一下&lt;/p&gt;

&lt;p&gt;安装环境后把代码同步下来&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;git clone [git url]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;或者&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;git pull
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;在项目路径下，尝试运行django&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;gunicorn [project name].wsgi
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;如果运行成功，说明django项目和gunicron都没有问题&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;如果需要root权限的在命令前面加上sudo，如 &lt;code&gt;sudo apt-get install pip&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;python库用pip安装，其他库用apt-get安装&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;2.写配置文件&lt;/h4&gt;

&lt;p&gt;编写nginx配置文件&lt;code&gt;nginx.conf&lt;/code&gt;，保存到&lt;code&gt;/etc/nginx/&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;user www-data;
worker_processes 2;
pid /var/run/nginx.pid;

events {
    worker_connections 768;
}

http {
    server {
        listen       80;
        #server_name  localhost;

        #access_log  logs/host.access.log  main;

        location ~ ^\/static\/.*$ {
            root /home/ScraperService;
        }

        location / {
            proxy_pass http://127.0.0.1:9000;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;PS:如果发现nginx访问static没有权限，可以把user改为root，或者给static添加权限。&lt;/p&gt;

&lt;p&gt;检测一下配置有没有问题&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;/etc/init.d/nginx configtest
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;nginx配置详细请移步&lt;a href=&quot;http://nginx.org/en/docs/beginners_guide.html&quot;&gt;nginx官网文档&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;编写supervisor配置文件&lt;code&gt;[project name].conf&lt;/code&gt;，保存到&lt;code&gt;/etc/supervisor/conf.d/&lt;/code&gt;&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;[program:[project name]]
command     = gunicorn_django [project path]/[project name]/settings.py -b 0.0.0.0:9000 -w 2 -k gevent
directory   = [project path]
user        = www-data
startsecs   = 3

redirect_stderr         = true
stdout_logfile_maxbytes = 50MB
stdout_logfile_backups  = 10
stdout_logfile          = [log path]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;其中[project name]、[project path]、[log path]要改成对应的路径&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;gunicorn参数 -w 线程数 -b 127.0.0.1:8000 监听的端口 -k gevent 运行方式，详细配置请移步&lt;a href=&quot;http://docs.gunicorn.org/en/latest/run.html&quot;&gt;gunicorn官网文档&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;supervisor详细配置请移步&lt;a href=&quot;http://supervisord.org/&quot;&gt;supervisor官网&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h4&gt;3.启动服务&lt;/h4&gt;

&lt;p&gt;更新nginx配置&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;nginx reload
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;重启nginx&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;nginx restart
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href=&quot;blogimage/013.png&quot;&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;更新supervisor配置&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;supervisorctl reread
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;重启supervisor&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;supervisorctl update
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;停止已经开启的项目&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;supervisorctl stop [project name]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;重新启动项目&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;supervisorctl start [project name]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;没有报错就启动成功了，报错的可以去[log path]查看log&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;supervisor默认log在/var/log/supervisor，nginx默认log在/var/log/nginx&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;启动以后可以随时查看项目状态&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;supervisorctl status
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;流程
用supervisor负责管理监控gunicorn
用gunicorn启动web service
启动nginx做反向代理和静态服务&lt;/p&gt;

&lt;h4&gt;4.自动部署&lt;/h4&gt;

&lt;p&gt;通过以上步骤已经可以部署成功，但是每次修改代码后，都重新登录服务更新代码、重启supervisor服务、重启nginx服务，非常麻烦。就没有更加geek的方法吗？当然有！
在开发机器安装fabric&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pip install fabric
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;编写fabfile.py放在项目里&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;# -*- coding:utf-8 -*-

from fabric.api import *

# 服务器登录用户名:
env.user = &amp;#39;root&amp;#39;
# 服务器地址，可以有多个，依次部署:
env.hosts = [&amp;#39;hostname&amp;#39;, ]

env.passwords = {
    &amp;#39;root@[hostname]&amp;#39;: &amp;#39;[password]&amp;#39;,
}

#不用密码也可以用ssh登录
# env.key_filename = &amp;#39;~/.ssh/id_rsa&amp;#39;

_REMOTE_BASE_DIR = &amp;#39;[project path]&amp;#39;

def deploy():
    # 切换到项目目录
    with cd(_REMOTE_BASE_DIR):
        run(&amp;#39;git pull origin dev&amp;#39;)

    # 重启supervisor服务和nginx服务器:
    with settings(warn_only=True):
        run(&amp;#39;supervisorctl stop ScraperService&amp;#39;)
        run(&amp;#39;supervisorctl start ScraperService&amp;#39;)
        run(&amp;#39;/etc/init.d/nginx reload&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;以后更改代码后，不需要再登录服务器，直接运行fab命令，就可以自动部署了&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;fab deploy
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;&lt;img src=&quot;/blog_image/013.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;fabric会自动帮你登录服务器，并执行预先设定的命令&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;什么？每次更改后都要执行&lt;code&gt;fab deploy&lt;/code&gt;，还是觉得不够geek?还有更懒（shuǎng）的方法，git hook&lt;/p&gt;

&lt;h3&gt;5.git hook自动部署&lt;/h3&gt;

&lt;p&gt;git hook
web hook
待续...&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;还可以用linux软链接的方式来管理部署路径，主要作用是方便切换版本，这里只是给个引子，主页菌也还没有详细研究，有兴趣的读者们可以自行了解。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;常见问题&lt;/h2&gt;

&lt;p&gt;1.使用gunicorn -k gevent时出现You need gevent installed to use this worker&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pip install greenlet
pip install gevent
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;2.&lt;code&gt;pip install xxx&lt;/code&gt;出现 command &amp;#39;x86_64-linux-gnu-gcc&amp;#39; failed with exit status 1&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;sudo apt-get install python-dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
    </item>
    
    <item>
      <title>HTML＋CSS学习笔记</title>
      <link>/other/2015/03/26/HTML%EF%BC%8BCSS%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0.html</link>
      <!-- <pubDate>Thu, 26 Mar 2015 15:27:31 +0000</pubDate> -->
      <author>Javen Liu</author>
      <guid>/other/2015/03/26/HTML＋CSS学习笔记</guid>
      <description>&lt;p&gt;符号&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&amp;amp; &lt;code&gt;&amp;amp;amp;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;“ &lt;code&gt;&amp;amp;ldquo;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;” &lt;code&gt;&amp;amp;rdquo;&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;p style=&amp;quot;font-size:18&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;link href=&amp;quot;styles.css&amp;quot; rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;选择符 {属性:值;}&lt;/p&gt;

&lt;p&gt;分组选择（逗号分隔）&lt;/p&gt;

&lt;p&gt;选择符,选择符... {属性:值;属性:值;...}&lt;/p&gt;

&lt;p&gt;上下文选择（空格分隔）&lt;/p&gt;

&lt;p&gt;选择符 选择符... {属性:值;属性:值;...}&lt;/p&gt;

&lt;p&gt;子选择符 &amp;gt;&lt;/p&gt;

&lt;p&gt;选择符 &amp;gt; 选择符... {属性:值;属性:值;...}&lt;/p&gt;

&lt;p&gt;紧邻同胞选择符 +&lt;/p&gt;

&lt;p&gt;选择符 + 选择符...&lt;/p&gt;

&lt;p&gt;一般同胞选择符 ~&lt;/p&gt;

&lt;p&gt;选择符 ~ 选择符...&lt;/p&gt;

&lt;p&gt;通用选择符 *&lt;/p&gt;

&lt;p&gt;选择符 ＊ 选择符...&lt;/p&gt;

&lt;p&gt;类选择符 .&lt;/p&gt;

&lt;p&gt;.类名&lt;/p&gt;

&lt;p&gt;&lt;p class=&quot;specialtext featured&quot;&gt;&lt;/p&gt;

&lt;p&gt;ID选择符 ＃&lt;/p&gt;

&lt;p&gt;属性选择符 []&lt;/p&gt;

&lt;p&gt;以我现在做的一个项目为例子，讲解一下如何把自己工程做成一个pod库&lt;/p&gt;

&lt;p&gt;使用&lt;code&gt;pod spec&lt;/code&gt;命令创建一个&lt;strong&gt;.podsepc&lt;/strong&gt;文件&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod spec create Peanut
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;可以使用&lt;code&gt;vi&lt;/code&gt;直接编辑&lt;strong&gt;.podsepc&lt;/strong&gt;，我个人是习惯把&lt;strong&gt;.podsepc&lt;/strong&gt;加入到工程中去，方便查看和查看）&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;vi Peanut.podspec
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;通过&lt;strong&gt;pod spec&lt;/strong&gt;命令生成&lt;strong&gt;.podsepc&lt;/strong&gt;已经是一个详细的模版，里面的说明也非常详细，有几个地方是必须要修改的&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.name         = &amp;quot;WeiDianSDK&amp;quot;
s.version      = &amp;quot;0.0.2&amp;quot;
s.source       = { :git =&amp;gt; &amp;quot;https://coding.net/javenliu/WeiDianSDK.git&amp;quot;, :tag =&amp;gt; &amp;quot;0.0.2&amp;quot; }
s.source_files  = &amp;quot;WeiDianSDK/SDK/*.{h,m}&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;有依赖库要写上&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.framework = &amp;#39;UIKit&amp;#39;
s.libraries = &amp;quot;iconv&amp;quot;, &amp;quot;xml2&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;有依赖的pod要写上&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.dependency &amp;#39;AFNetworking&amp;#39;, &amp;#39;~&amp;gt; 2.5.1&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;以上是必须填写，但是有些还是建议写上，方便自己和其他人查看&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.summary      = &amp;quot;WeiDian iOS SDK.&amp;quot;
s.homepage     = &amp;quot;https://coding.net/u/javenliu/p/WeiDianSDK/git&amp;quot;
s.license      = { :type =&amp;gt; &amp;quot;MIT&amp;quot;, :file =&amp;gt; &amp;quot;LICENSE&amp;quot; }
s.author             = { &amp;quot;Javen_liu&amp;quot; =&amp;gt; &amp;quot;412775083@qq.com&amp;quot; }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;写上适用的系统版本往往是个很好的习惯，避免使用时出现不可预料的状况&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.platform     = :ios, &amp;quot;6.0&amp;quot;
s.ios.deployment_target = &amp;quot;6.0&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;完成.podspec后，建议使用｀pod spec lint｀验证一下文件，该命令会对podspec文件做详细的分析，给出警告、错误等提示&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod spec lint WeiDianSDK.podspec
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;验证成功如下图&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;blog_images/lint_pass.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;注意：&lt;/p&gt;

&lt;p&gt;1.如果库仅仅是自己使用的话，验证并不是必须的，验证不通过的文件有时候也可以使用，但可能会在某些情况下出现异常，所以还是做一次验证。&lt;/p&gt;

&lt;p&gt;2.如果想要上传到pods公共库的话，验证是必须，不通过验证不能上传&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;做好以上工作，push以后就可以使用了&lt;/p&gt;

&lt;hr&gt;

&lt;p&gt;下面再简单说明一下如何使用&lt;/p&gt;

&lt;p&gt;在项目的podfile中加入&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod &amp;#39;WeiDianSDK&amp;#39;, :git =&amp;gt; &amp;#39;https://coding.net/javenliu/WeiDianSDK.git&amp;#39;#, :tag =&amp;gt; &amp;#39;0.0.1&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;使用==pod update==&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod update
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;如果update成功，就可以任性使用了，如果自行使用，以上就足够了，但是如果要让所有人都能使用，还需要下面几个步骤&lt;/p&gt;

&lt;p&gt;使用&lt;code&gt;pod trunk register&lt;/code&gt;为自己的设备做一个注册，填写自己的邮箱和姓名&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod trunk register xxx@xxx.com &amp;quot;YOUR NICKNAME&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;成功的话，会发送一封邮件到你的邮箱，进入邮箱验证以后，就可以使用&lt;code&gt;pod trunk push&lt;/code&gt;提交了&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod trunk push &amp;#39;xxx.podspec&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;注意：提交的.podspec必须已经通过&lt;code&gt;pod lint&lt;/code&gt;验证，如果出现&lt;code&gt;pod lint&lt;/code&gt;验证通过，&lt;code&gt;pod trunk push&lt;/code&gt;验证不通过的情况，可以使用&lt;code&gt;pod trunk push &amp;#39;xxx.podspec&amp;#39; --verbose&lt;/code&gt;，把验证过程输出来，查看问题所在。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;等一下，是不是觉得跟一般的使用不一样？一般是可以自己
还需要把.podsepc提交到到公共数据库中，这样所有人都可以很简单的使用，只需要在Podfile中加入如下声明即可：&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod &amp;#39;WeiDianSDK&amp;#39;, &amp;#39;0.0.2&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;至此，自己的Pods依赖库已经发布完成，可以&lt;strong&gt;任性&lt;/strong&gt;使用了。&lt;/p&gt;

&lt;hr&gt;

&lt;hr&gt;

&lt;p&gt;下面是官网的一个例子，&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;Pod::Spec.new do |spec|
  spec.name         = &amp;#39;Reachability&amp;#39;
  spec.version      = &amp;#39;3.1.0&amp;#39;
  spec.license      = { :type =&amp;gt; &amp;#39;BSD&amp;#39; }
  spec.homepage     = &amp;#39;https://github.com/tonymillion/Reachability&amp;#39;
  spec.authors      = { &amp;#39;Tony Million&amp;#39; =&amp;gt; &amp;#39;tonymillion@gmail.com&amp;#39; }
  spec.summary      = &amp;#39;ARC and GCD Compatible Reachability Class for iOS and OS X.&amp;#39;
  spec.source       = { :git =&amp;gt; &amp;#39;https://github.com/tonymillion/Reachability.git&amp;#39;, :tag =&amp;gt; &amp;#39;v3.1.0&amp;#39; }
  spec.source_files = &amp;#39;Reachability.{h,m}&amp;#39;
  spec.framework    = &amp;#39;SystemConfiguration&amp;#39;
end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;更多细节和详细，可以去查看官网的说明 &lt;a href=&quot;http://cocoapods.org/&quot;&gt;http://cocoapods.org/&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>支付SDK</title>
      <link>/ios/2015/03/05/%E6%94%AF%E4%BB%98SDK.html</link>
      <!-- <pubDate>Thu, 05 Mar 2015 15:27:31 +0000</pubDate> -->
      <author>Javen Liu</author>
      <guid>/ios/2015/03/05/支付SDK</guid>
      <description>&lt;p&gt;支付宝&lt;/p&gt;

&lt;p&gt;加入库
AlipaySDK.framework&lt;/p&gt;

&lt;p&gt;SystemConfiguration.framework&lt;/p&gt;

&lt;p&gt;加入schemes
URL Types&lt;/p&gt;

&lt;p&gt;我得&lt;/p&gt;

&lt;h3&gt;说明&lt;/h3&gt;

&lt;p&gt;sublime是轻量级的编辑器，简单易用，功能强大，比运行运行庞大IDE要流畅。今天来说说在mac环境下如何给sublime3安装语法检测插件，以安装js，css，html语法检测插件（分别是jshint、CSSLint、htmlhint）为例子，其他语法检测器操作步骤相识，可以自行尝试。&lt;/p&gt;

&lt;p&gt;PS：本文只是针对mac环境下sublime3的配置，在windos环境下或者在sublime2下的配置会略有不同。&lt;/p&gt;

&lt;h3&gt;一.安装packect control&lt;/h3&gt;

&lt;p&gt;1.按&lt;code&gt;CTRL+`&lt;/code&gt;调出console&lt;/p&gt;

&lt;p&gt;2.粘贴以下代码到底部命令行并回车：
&lt;code&gt;python
import urllib.request,os; pf = &amp;#39;Package Control.sublime-package&amp;#39;; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), &amp;#39;wb&amp;#39;).write(urllib.request.urlopen( &amp;#39;http://sublime.wbond.net/&amp;#39; + pf.replace(&amp;#39; &amp;#39;,&amp;#39;%20&amp;#39;)).read())
&lt;/code&gt;
3.重启Sublime Text 3。
如果在&lt;strong&gt;Perferences-&amp;gt;package settings&lt;/strong&gt;中看到&lt;strong&gt;package control&lt;/strong&gt;这一项，则安装成功。&lt;/p&gt;

&lt;p&gt;PS：顺便贴下Sublime Text2 的代码
&lt;code&gt;
import urllib2,os; pf=&amp;#39;Package Control.sublime-package&amp;#39;; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler( ))); open( os.path.join( ipp, pf), &amp;#39;wb&amp;#39; ).write( urllib2.urlopen( &amp;#39;http://sublime.wbond.net/&amp;#39; +pf.replace( &amp;#39; &amp;#39;,&amp;#39;%20&amp;#39; )).read()); print( &amp;#39;Please restart Sublime Text to finish installation&amp;#39;)
&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;二、通过packect control安装其他插件&lt;/h3&gt;

&lt;p&gt;packect control安装完成后，按下&lt;code&gt;Ctrl+Shift+P&lt;/code&gt;调出命令面板&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://javen-blog-image.oss-cn-shenzhen.aliyuncs.com/control_package.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;

&lt;p&gt;输入&lt;code&gt;Install Package&lt;/code&gt;，然后在列表中选中要安装的插件。&lt;/p&gt;

&lt;p&gt;其他一些常用
&lt;code&gt;list package&lt;/code&gt; 查看已安装的插件&lt;/p&gt;

&lt;p&gt;&lt;code&gt;enable package&lt;/code&gt; 启用已安装的插件&lt;/p&gt;

&lt;p&gt;&lt;code&gt;enable package&lt;/code&gt;  禁用已安装的插件&lt;/p&gt;

&lt;p&gt;&lt;code&gt;upgrade package&lt;/code&gt; 升级已安装的插件&lt;/p&gt;

&lt;p&gt;&lt;code&gt;remove package&lt;/code&gt; 移除已安装的插件&lt;/p&gt;

&lt;p&gt;其他更多的命令可以自己在命令面板查看&lt;/p&gt;

&lt;h3&gt;三、安装linter的依赖&lt;/h3&gt;

&lt;p&gt;由于CSSLint,jshint,htmlhint都是依赖node-js的，所以要先安装node-js，安装了brew的同学可以直接在Terminal使用以下命令&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;brew install node
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;没有安装brew的可以自行google一下nodejs的安装方法。&lt;/p&gt;

&lt;p&gt;node安装完成后，然后在Terminal输入&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;npm install -g csslint
npm install -g jslint
npm install -g htmllint
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;安装完应该会自动加入到环境路径中，找个文件测试一下&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;csslint test.css
jshint test.js
htmlhint test.html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;如果有返回结果，说明安装成功了。&lt;/p&gt;

&lt;p&gt;如果显示command not found:说明还没安装成功，检测一下上面步骤是否有错。&lt;/p&gt;

&lt;h3&gt;四、安装SublimeLinter及相应Linter&lt;/h3&gt;

&lt;p&gt;1.安装SublimeLinter&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Ctrl+Shift+P&lt;/code&gt;-&amp;gt;&lt;code&gt;Install Package&lt;/code&gt;-&amp;gt;&lt;code&gt;SublimeLinter&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2.安装SublimeLinter-CSSLint&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Ctrl+Shift+P&lt;/code&gt;-&amp;gt;&lt;code&gt;Install Package&lt;/code&gt;-&amp;gt;&lt;code&gt;SublimeLinter-CSSLint&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;3.安装SublimeLinter-jshint&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Ctrl+Shift+P&lt;/code&gt;-&amp;gt;&lt;code&gt;Install Package&lt;/code&gt;-&amp;gt;&lt;code&gt;SublimeLinter-jshint&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;4.安装SublimeLinter-htmlhint&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Ctrl+Shift+P&lt;/code&gt;-&amp;gt;&lt;code&gt;Install Package&lt;/code&gt;-&amp;gt;&lt;code&gt;SublimeLinter-htmlhint&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;安装成功后就可以到sublime里测试了，右键SublimeLinter-&amp;gt;Show All Erroes，就会有提示了。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://javen-blog-image.oss-cn-shenzhen.aliyuncs.com/linter2.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;

&lt;p&gt;SublimeLinter的详细配置可以查看&lt;a href=&quot;http://sublimelinter.readthedocs.org/en/latest/&quot;&gt;SublimeLinter官方说明文档&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;提示&lt;/h4&gt;

&lt;p&gt;如果在Terminal能检测出结果，sublime没有检测出来，可以在通过下面操作打开调试模式，&lt;/p&gt;

&lt;p&gt;1.在sublime下&lt;code&gt;右键&lt;/code&gt;-&amp;gt;&lt;code&gt;SublimeLinter&lt;/code&gt;-&amp;gt;&lt;code&gt;勾上Debug Mode&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2.按下&lt;code&gt;CTRL+`&lt;/code&gt;调出console&lt;/p&gt;

&lt;p&gt;打开调试模式后就能在console看到运行的结果了，看下是否报错，根据错误提示应该就能找到解决方法了。&lt;/p&gt;

&lt;p&gt;输出的log如下图&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://javen-blog-image.oss-cn-shenzhen.aliyuncs.com/show_log.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;

&lt;h3&gt;注意&lt;/h3&gt;

&lt;p&gt;SublimeLinter是一个linter管理器，本身并不包含有linter，需要什么linter要自行安装，linter的名字统一为&lt;code&gt;SublimeLinter-‘linter name’&lt;/code&gt;，都是带有&lt;strong&gt;SublimeLinter&lt;/strong&gt;前缀的如css linter的名字是&lt;code&gt;SublimeLinter-CSSLint&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;&lt;code&gt;jslint&lt;/code&gt;,&lt;code&gt;CSSlint&lt;/code&gt;这些没有SublimeLinter前缀的与有前缀的不一样的，那些都是独立的linter，不需要通过SublimeLinter来管理。
两者的实现的功能是相识的，区别单独的linter你跑不同的文件要调用不同的linter来检测，而使用SublimeLinter的话，都是调用SublimeLinter即可，它会判断你当前的文件类型来使用不用的linter，更加方便一些。&lt;/p&gt;

&lt;p&gt;所以还是推荐大家使用SublimeLinter，可以统一管理统一配置，也方便使用，笔者试过用&lt;code&gt;jslint&lt;/code&gt;,&lt;code&gt;CSSlint&lt;/code&gt;，检测结果都是输出在命令行，不够直观，而SublimeLinter是在有问题行前面做标记，更加清晰。（笔者只试过这2个linter，或许有其他linter也能以标记形式提示，没有研究，就不做说明了。）&lt;/p&gt;

&lt;p&gt;jslint的结果&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://javen-blog-image.oss-cn-shenzhen.aliyuncs.com/jslint.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;

&lt;p&gt;SublimeLinter-jshint的结果&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://javen-blog-image.oss-cn-shenzhen.aliyuncs.com/sublimelinter.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>把项目使用Pod管理</title>
      <link>/ios/2015/03/05/%E6%8A%8A%E9%A1%B9%E7%9B%AE%E4%BD%BF%E7%94%A8Pod%E7%AE%A1%E7%90%86.html</link>
      <!-- <pubDate>Thu, 05 Mar 2015 15:27:31 +0000</pubDate> -->
      <author>Javen Liu</author>
      <guid>/ios/2015/03/05/把项目使用Pod管理</guid>
      <description>&lt;p&gt;以我现在做的一个项目为例子，讲解一下如何把自己工程做成一个pod库&lt;/p&gt;

&lt;p&gt;使用&lt;code&gt;pod spec&lt;/code&gt;命令创建一个&lt;strong&gt;.podsepc&lt;/strong&gt;文件&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod spec create WeiDianSDK
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;可以使用&lt;code&gt;vi&lt;/code&gt;直接编辑&lt;strong&gt;.podsepc&lt;/strong&gt;，我个人是习惯把&lt;strong&gt;.podsepc&lt;/strong&gt;加入到工程中去，方便查看和查看）&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;vi Peanut.podspec
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;通过&lt;strong&gt;pod spec&lt;/strong&gt;命令生成&lt;strong&gt;.podsepc&lt;/strong&gt;已经是一个详细的模版，里面的说明也非常详细，有几个地方是必须要修改的&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.name         = &amp;quot;WeiDianSDK&amp;quot;
s.version      = &amp;quot;0.0.2&amp;quot;
s.source       = { :git =&amp;gt; &amp;quot;https://coding.net/javenliu/WeiDianSDK.git&amp;quot;, :tag =&amp;gt; &amp;quot;0.0.2&amp;quot; }
s.source_files  = &amp;quot;WeiDianSDK/SDK/*.{h,m}&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;有依赖库要写上&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.framework = &amp;#39;UIKit&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;s.libraries = &amp;quot;iconv&amp;quot;, &amp;quot;xml2&amp;quot;&lt;/p&gt;

&lt;p&gt;有依赖的pod要写上&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.dependency &amp;#39;AFNetworking&amp;#39;, &amp;#39;~&amp;gt; 2.5.1&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;以上是必须填写，但是有些还是建议写上，方便自己和其他人查看&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.summary      = &amp;quot;WeiDian iOS SDK.&amp;quot;
s.homepage     = &amp;quot;https://coding.net/u/javenliu/p/WeiDianSDK/git&amp;quot;
s.license      = { :type =&amp;gt; &amp;quot;MIT&amp;quot;, :file =&amp;gt; &amp;quot;LICENSE&amp;quot; }
s.author             = { &amp;quot;Javen_liu&amp;quot; =&amp;gt; &amp;quot;412775083@qq.com&amp;quot; }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;写上适用的系统版本往往是个很好的习惯，避免使用时出现不可预料的状况&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.platform     = :ios, &amp;quot;6.0&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;s.ios.deployment_target = &amp;quot;6.0&amp;quot;&lt;/p&gt;

&lt;p&gt;完成.podspec后，建议使用｀pod spec lint｀验证一下文件，该命令会对podspec文件做详细的分析，给出警告、错误等提示&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod spec lint WeiDianSDK.podspec
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;验证成功如下图&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;blog_images/lint_pass.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;注意：&lt;/p&gt;

&lt;p&gt;1.如果库仅仅是自己使用的话，验证并不是必须的，验证不通过的文件有时候也可以使用，但可能会在某些情况下出现异常，所以还是做一次验证。&lt;/p&gt;

&lt;p&gt;2.如果想要上传到pods公共库的话，验证是必须，不通过验证不能上传&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;做好以上工作，push以后就可以使用了&lt;/p&gt;

&lt;hr&gt;

&lt;p&gt;下面再简单说明一下如何使用&lt;/p&gt;

&lt;p&gt;在项目的podfile中加入&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod &amp;#39;WeiDianSDK&amp;#39;, :git =&amp;gt; &amp;#39;https://coding.net/javenliu/WeiDianSDK.git&amp;#39;#, :tag =&amp;gt; &amp;#39;0.0.1&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;使用==pod update==&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod update
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;如果update成功，就可以任性使用了，如果自行使用，以上就足够了，但是如果要让所有人都能使用，还需要下面几个步骤&lt;/p&gt;

&lt;p&gt;使用&lt;code&gt;pod trunk register&lt;/code&gt;为自己的设备做一个注册，填写自己的邮箱和姓名&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod trunk register xxx@xxx.com &amp;quot;YOUR NICKNAME&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;成功的话，会发送一封邮件到你的邮箱，进入邮箱验证以后，就可以使用&lt;code&gt;pod trunk push&lt;/code&gt;提交了&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod trunk push &amp;#39;xxx.podspec&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;注意：提交的.podspec必须已经通过&lt;code&gt;pod lint&lt;/code&gt;验证，如果出现&lt;code&gt;pod lint&lt;/code&gt;验证通过，&lt;code&gt;pod trunk push&lt;/code&gt;验证不通过的情况，可以使用&lt;code&gt;pod trunk push &amp;#39;xxx.podspec&amp;#39; --verbose&lt;/code&gt;，把验证过程输出来，查看问题所在。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;等一下，是不是觉得跟一般的使用不一样？一般是可以自己
还需要把.podsepc提交到到公共数据库中，这样所有人都可以很简单的使用，只需要在Podfile中加入如下声明即可：&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod &amp;#39;WeiDianSDK&amp;#39;, &amp;#39;0.0.2&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;至此，自己的Pods依赖库已经发布完成，可以&lt;strong&gt;任性&lt;/strong&gt;使用了。&lt;/p&gt;

&lt;hr&gt;

&lt;hr&gt;

&lt;p&gt;下面是官网的一个例子，&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;Pod::Spec.new do |spec|
  spec.name         = &amp;#39;Reachability&amp;#39;
  spec.version      = &amp;#39;3.1.0&amp;#39;
  spec.license      = { :type =&amp;gt; &amp;#39;BSD&amp;#39; }
  spec.homepage     = &amp;#39;https://github.com/tonymillion/Reachability&amp;#39;
  spec.authors      = { &amp;#39;Tony Million&amp;#39; =&amp;gt; &amp;#39;tonymillion@gmail.com&amp;#39; }
  spec.summary      = &amp;#39;ARC and GCD Compatible Reachability Class for iOS and OS X.&amp;#39;
  spec.source       = { :git =&amp;gt; &amp;#39;https://github.com/tonymillion/Reachability.git&amp;#39;, :tag =&amp;gt; &amp;#39;v3.1.0&amp;#39; }
  spec.source_files = &amp;#39;Reachability.{h,m}&amp;#39;
  spec.framework    = &amp;#39;SystemConfiguration&amp;#39;
end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;更多细节和详细，可以去查看官网的说明 &lt;a href=&quot;http://cocoapods.org/&quot;&gt;http://cocoapods.org/&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>sublime3在mac环境下安装linter</title>
      <link>/other/2015/03/05/sublime%E6%8F%92%E4%BB%B6%E5%AE%89%E8%A3%85.html</link>
      <!-- <pubDate>Thu, 05 Mar 2015 15:27:31 +0000</pubDate> -->
      <author>Javen Liu</author>
      <guid>/other/2015/03/05/sublime插件安装</guid>
      <description>&lt;h2&gt;说明&lt;/h2&gt;

&lt;p&gt;sublime是轻量级的编辑器，简单易用，功能强大，比运行运行庞大IDE要流畅。今天来说说在mac环境下如何给sublime3安装语法检测插件，以安装js，css，html语法检测插件（分别是jshint、CSSLint、htmlhint）为例子，其他语法检测器操作步骤相识，可以自行尝试。&lt;/p&gt;

&lt;p&gt;PS：本文只是针对mac环境下sublime3的配置，在windos环境下或者在sublime2下的配置会略有不同。&lt;/p&gt;

&lt;h2&gt;一.安装packect control&lt;/h2&gt;

&lt;p&gt;1.按&lt;code&gt;CTRL+`&lt;/code&gt;调出console&lt;/p&gt;

&lt;p&gt;2.粘贴以下代码到底部命令行并回车：&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-python&quot; data-lang=&quot;python&quot;&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;urllib.request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;nn&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;Package Control.sublime-package&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;ipp&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;sublime&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;installed_packages_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;urllib&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;install_opener&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;urllib&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;build_opener&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;urllib&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ProxyHandler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;);&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;open&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;path&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;join&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;ipp&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;wb&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;write&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;urllib&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;urlopen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&amp;#39;http://sublime.wbond.net/&amp;#39;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;pf&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;replace&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39; &amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&amp;#39;%20&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;3.重启Sublime Text 3&lt;/p&gt;

&lt;p&gt;如果在&lt;strong&gt;Perferences-&amp;gt;package settings&lt;/strong&gt;中看到&lt;strong&gt;package control&lt;/strong&gt;这一项，则安装成功。&lt;/p&gt;

&lt;p&gt;PS：顺便贴下Sublime Text2 的代码&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;import urllib2,os; pf=&amp;#39;Package Control.sublime-package&amp;#39;; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler( ))); open( os.path.join( ipp, pf), &amp;#39;wb&amp;#39; ).write( urllib2.urlopen( &amp;#39;http://sublime.wbond.net/&amp;#39; +pf.replace( &amp;#39; &amp;#39;,&amp;#39;%20&amp;#39; )).read()); print( &amp;#39;Please restart Sublime Text to finish installation&amp;#39;)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h2&gt;二、通过packect control安装其他插件&lt;/h2&gt;

&lt;p&gt;packect control安装完成后，按下&lt;code&gt;Ctrl+Shift+P&lt;/code&gt;调出命令面板&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://javen-blog-image.oss-cn-shenzhen.aliyuncs.com/control_package.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;

&lt;p&gt;输入&lt;code&gt;Install Package&lt;/code&gt;，然后在列表中选中要安装的插件。&lt;/p&gt;

&lt;p&gt;其他一些常用
&lt;code&gt;list package&lt;/code&gt; 查看已安装的插件&lt;/p&gt;

&lt;p&gt;&lt;code&gt;enable package&lt;/code&gt; 启用已安装的插件&lt;/p&gt;

&lt;p&gt;&lt;code&gt;enable package&lt;/code&gt;  禁用已安装的插件&lt;/p&gt;

&lt;p&gt;&lt;code&gt;upgrade package&lt;/code&gt; 升级已安装的插件&lt;/p&gt;

&lt;p&gt;&lt;code&gt;remove package&lt;/code&gt; 移除已安装的插件&lt;/p&gt;

&lt;p&gt;其他更多的命令可以自己在命令面板查看&lt;/p&gt;

&lt;h2&gt;三、安装linter的依赖&lt;/h2&gt;

&lt;p&gt;由于CSSLint,jshint,htmlhint都是依赖node-js的，所以要先安装node-js，安装了brew的同学可以直接在Terminal使用以下命令&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;brew install node
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;没有安装brew的可以自行google一下nodejs的安装方法。&lt;/p&gt;

&lt;p&gt;node安装完成后，然后在Terminal输入&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;npm install -g csslint
npm install -g jslint
npm install -g htmllint
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;安装完应该会自动加入到环境路径中，找个文件测试一下&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;csslint test.css
jshint test.js
htmlhint test.html
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;如果有返回结果，说明安装成功了。&lt;/p&gt;

&lt;p&gt;如果显示command not found:说明还没安装成功，检测一下上面步骤是否有错。&lt;/p&gt;

&lt;h2&gt;四、安装SublimeLinter及相应Linter&lt;/h2&gt;

&lt;p&gt;1.安装SublimeLinter&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Ctrl+Shift+P&lt;/code&gt;-&amp;gt;&lt;code&gt;Install Package&lt;/code&gt;-&amp;gt;&lt;code&gt;SublimeLinter&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2.安装SublimeLinter-CSSLint&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Ctrl+Shift+P&lt;/code&gt;-&amp;gt;&lt;code&gt;Install Package&lt;/code&gt;-&amp;gt;&lt;code&gt;SublimeLinter-CSSLint&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;3.安装SublimeLinter-jshint&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Ctrl+Shift+P&lt;/code&gt;-&amp;gt;&lt;code&gt;Install Package&lt;/code&gt;-&amp;gt;&lt;code&gt;SublimeLinter-jshint&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;4.安装SublimeLinter-htmlhint&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Ctrl+Shift+P&lt;/code&gt;-&amp;gt;&lt;code&gt;Install Package&lt;/code&gt;-&amp;gt;&lt;code&gt;SublimeLinter-htmlhint&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;安装成功后就可以到sublime里测试了，右键SublimeLinter-&amp;gt;Show All Erroes，就会有提示了。&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://javen-blog-image.oss-cn-shenzhen.aliyuncs.com/linter2.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;

&lt;p&gt;SublimeLinter的详细配置可以查看&lt;a href=&quot;http://sublimelinter.readthedocs.org/en/latest/&quot;&gt;SublimeLinter官方说明文档&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;提示&lt;/h3&gt;

&lt;p&gt;如果在Terminal能检测出结果，sublime没有检测出来，可以在通过下面操作打开调试模式，&lt;/p&gt;

&lt;p&gt;1.在sublime下&lt;code&gt;右键&lt;/code&gt;-&amp;gt;&lt;code&gt;SublimeLinter&lt;/code&gt;-&amp;gt;&lt;code&gt;勾上Debug Mode&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;2.按下&lt;code&gt;CTRL+`&lt;/code&gt;调出console&lt;/p&gt;

&lt;p&gt;打开调试模式后就能在console看到运行的结果了，看下是否报错，根据错误提示应该就能找到解决方法了。&lt;/p&gt;

&lt;p&gt;输出的log如下图&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://javen-blog-image.oss-cn-shenzhen.aliyuncs.com/show_log.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;

&lt;h2&gt;注意&lt;/h2&gt;

&lt;p&gt;SublimeLinter是一个linter管理器，本身并不包含有linter，需要什么linter要自行安装，linter的名字统一为&lt;code&gt;SublimeLinter-‘linter name’&lt;/code&gt;，都是带有&lt;strong&gt;SublimeLinter&lt;/strong&gt;前缀的如css linter的名字是&lt;code&gt;SublimeLinter-CSSLint&lt;/code&gt;。&lt;/p&gt;

&lt;p&gt;&lt;code&gt;jslint&lt;/code&gt;,&lt;code&gt;CSSlint&lt;/code&gt;这些没有SublimeLinter前缀的与有前缀的不一样的，那些都是独立的linter，不需要通过SublimeLinter来管理。
两者的实现的功能是相识的，区别单独的linter你跑不同的文件要调用不同的linter来检测，而使用SublimeLinter的话，都是调用SublimeLinter即可，它会判断你当前的文件类型来使用不用的linter，更加方便一些。&lt;/p&gt;

&lt;p&gt;所以还是推荐大家使用SublimeLinter，可以统一管理统一配置，也方便使用，笔者试过用&lt;code&gt;jslint&lt;/code&gt;,&lt;code&gt;CSSlint&lt;/code&gt;，检测结果都是输出在命令行，不够直观，而SublimeLinter是在有问题行前面做标记，更加清晰。（笔者只试过这2个linter，或许有其他linter也能以标记形式提示，没有研究，就不做说明了。）&lt;/p&gt;

&lt;p&gt;jslint的结果&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://javen-blog-image.oss-cn-shenzhen.aliyuncs.com/jslint.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;

&lt;p&gt;SublimeLinter-jshint的结果&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://javen-blog-image.oss-cn-shenzhen.aliyuncs.com/sublimelinter.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Django项目</title>
      <link>/python/2015/03/05/Django%E9%A1%B9%E7%9B%AE.html</link>
      <!-- <pubDate>Thu, 05 Mar 2015 15:27:31 +0000</pubDate> -->
      <author>Javen Liu</author>
      <guid>/python/2015/03/05/Django项目</guid>
      <description>&lt;p&gt;django-admin startproject&lt;/p&gt;

&lt;p&gt;pyhton manager.py sqlall &lt;code&gt;projectname&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;同步数据库
1.6以前
south&lt;/p&gt;

&lt;p&gt;1.7以后
pyhton manager.py migrate&lt;/p&gt;

&lt;p&gt;创建用户
python manage.py createsuperuser&lt;/p&gt;

&lt;p&gt;error
from django.core.management.validation import get&lt;em&gt;validation&lt;/em&gt;errors
ImportError: No module named validation
mod = util.import&lt;em&gt;module(&amp;quot;gunicorn.app.django&lt;/em&gt;wsgi&amp;quot;)
版本不对 请使用django1.6&lt;/p&gt;

&lt;p&gt;查看django版本
import django
django.VERSION&lt;/p&gt;

&lt;p&gt;升级／降级包
pip install --upgrade django==1.6.6&lt;/p&gt;

&lt;p&gt;django-admin.py startproject mysite。这样会在你的当前目录下创建一个目录&lt;/p&gt;

&lt;p&gt;python manage.py runserver 8080&lt;/p&gt;

&lt;p&gt;STATIC_URL = &amp;#39;/static/&amp;#39;&lt;/p&gt;

&lt;p&gt;STATICFILES_DIRS = (
    (&amp;#39;static&amp;#39;, &amp;#39;./static/&amp;#39;)
)&lt;/p&gt;

&lt;p&gt;with open(&amp;#39;./static/welcome.html&amp;#39;, &amp;#39;r&amp;#39;) as f:
    s = f.readlines()
    f.flush()&lt;/p&gt;

&lt;p&gt;以我现在做的一个项目为例子，讲解一下如何把自己工程做成一个pod库&lt;/p&gt;

&lt;p&gt;使用&lt;code&gt;pod spec&lt;/code&gt;命令创建一个&lt;strong&gt;.podsepc&lt;/strong&gt;文件&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod spec create Peanut
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;可以使用&lt;code&gt;vi&lt;/code&gt;直接编辑&lt;strong&gt;.podsepc&lt;/strong&gt;，我个人是习惯把&lt;strong&gt;.podsepc&lt;/strong&gt;加入到工程中去，方便查看和查看）&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;vi Peanut.podspec
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;通过&lt;strong&gt;pod spec&lt;/strong&gt;命令生成&lt;strong&gt;.podsepc&lt;/strong&gt;已经是一个详细的模版，里面的说明也非常详细，有几个地方是必须要修改的&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.name         = &amp;quot;WeiDianSDK&amp;quot;
s.version      = &amp;quot;0.0.2&amp;quot;
s.source       = { :git =&amp;gt; &amp;quot;https://coding.net/javenliu/WeiDianSDK.git&amp;quot;, :tag =&amp;gt; &amp;quot;0.0.2&amp;quot; }
s.source_files  = &amp;quot;WeiDianSDK/SDK/*.{h,m}&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;有依赖库要写上&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.framework = &amp;#39;UIKit&amp;#39;
s.libraries = &amp;quot;iconv&amp;quot;, &amp;quot;xml2&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;有依赖的pod要写上&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.dependency &amp;#39;AFNetworking&amp;#39;, &amp;#39;~&amp;gt; 2.5.1&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;以上是必须填写，但是有些还是建议写上，方便自己和其他人查看&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.summary      = &amp;quot;WeiDian iOS SDK.&amp;quot;
s.homepage     = &amp;quot;https://coding.net/u/javenliu/p/WeiDianSDK/git&amp;quot;
s.license      = { :type =&amp;gt; &amp;quot;MIT&amp;quot;, :file =&amp;gt; &amp;quot;LICENSE&amp;quot; }
s.author             = { &amp;quot;Javen_liu&amp;quot; =&amp;gt; &amp;quot;412775083@qq.com&amp;quot; }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;写上适用的系统版本往往是个很好的习惯，避免使用时出现不可预料的状况&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;s.platform     = :ios, &amp;quot;6.0&amp;quot;
s.ios.deployment_target = &amp;quot;6.0&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;完成.podspec后，建议使用｀pod spec lint｀验证一下文件，该命令会对podspec文件做详细的分析，给出警告、错误等提示&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod spec lint WeiDianSDK.podspec
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;验证成功如下图&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;blog_images/lint_pass.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;注意：&lt;/p&gt;

&lt;p&gt;1.如果库仅仅是自己使用的话，验证并不是必须的，验证不通过的文件有时候也可以使用，但可能会在某些情况下出现异常，所以还是做一次验证。&lt;/p&gt;

&lt;p&gt;2.如果想要上传到pods公共库的话，验证是必须，不通过验证不能上传&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;做好以上工作，push以后就可以使用了&lt;/p&gt;

&lt;hr&gt;

&lt;p&gt;下面再简单说明一下如何使用&lt;/p&gt;

&lt;p&gt;在项目的podfile中加入&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod &amp;#39;WeiDianSDK&amp;#39;, :git =&amp;gt; &amp;#39;https://coding.net/javenliu/WeiDianSDK.git&amp;#39;#, :tag =&amp;gt; &amp;#39;0.0.1&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;使用==pod update==&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod update
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;如果update成功，就可以任性使用了，如果自行使用，以上就足够了，但是如果要让所有人都能使用，还需要下面几个步骤&lt;/p&gt;

&lt;p&gt;使用&lt;code&gt;pod trunk register&lt;/code&gt;为自己的设备做一个注册，填写自己的邮箱和姓名&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod trunk register xxx@xxx.com &amp;quot;YOUR NICKNAME&amp;quot;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;成功的话，会发送一封邮件到你的邮箱，进入邮箱验证以后，就可以使用&lt;code&gt;pod trunk push&lt;/code&gt;提交了&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod trunk push &amp;#39;xxx.podspec&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;blockquote&gt;
&lt;p&gt;注意：提交的.podspec必须已经通过&lt;code&gt;pod lint&lt;/code&gt;验证，如果出现&lt;code&gt;pod lint&lt;/code&gt;验证通过，&lt;code&gt;pod trunk push&lt;/code&gt;验证不通过的情况，可以使用&lt;code&gt;pod trunk push &amp;#39;xxx.podspec&amp;#39; --verbose&lt;/code&gt;，把验证过程输出来，查看问题所在。&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;等一下，是不是觉得跟一般的使用不一样？一般是可以自己
还需要把.podsepc提交到到公共数据库中，这样所有人都可以很简单的使用，只需要在Podfile中加入如下声明即可：&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;pod &amp;#39;WeiDianSDK&amp;#39;, &amp;#39;0.0.2&amp;#39;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;至此，自己的Pods依赖库已经发布完成，可以&lt;strong&gt;任性&lt;/strong&gt;使用了。&lt;/p&gt;

&lt;hr&gt;

&lt;hr&gt;

&lt;p&gt;下面是官网的一个例子，&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-text&quot; data-lang=&quot;text&quot;&gt;Pod::Spec.new do |spec|
  spec.name         = &amp;#39;Reachability&amp;#39;
  spec.version      = &amp;#39;3.1.0&amp;#39;
  spec.license      = { :type =&amp;gt; &amp;#39;BSD&amp;#39; }
  spec.homepage     = &amp;#39;https://github.com/tonymillion/Reachability&amp;#39;
  spec.authors      = { &amp;#39;Tony Million&amp;#39; =&amp;gt; &amp;#39;tonymillion@gmail.com&amp;#39; }
  spec.summary      = &amp;#39;ARC and GCD Compatible Reachability Class for iOS and OS X.&amp;#39;
  spec.source       = { :git =&amp;gt; &amp;#39;https://github.com/tonymillion/Reachability.git&amp;#39;, :tag =&amp;gt; &amp;#39;v3.1.0&amp;#39; }
  spec.source_files = &amp;#39;Reachability.{h,m}&amp;#39;
  spec.framework    = &amp;#39;SystemConfiguration&amp;#39;
end
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;更多细节和详细，可以去查看官网的说明 &lt;a href=&quot;http://cocoapods.org/&quot;&gt;http://cocoapods.org/&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>linux常用命令</title>
      <link>/python/2015/02/20/linux%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4.html</link>
      <!-- <pubDate>Fri, 20 Feb 2015 15:27:31 +0000</pubDate> -->
      <author>Javen Liu</author>
      <guid>/python/2015/02/20/linux常用命令</guid>
      <description>&lt;p&gt;安装目录 /etc
服务器存放 /srv&lt;/p&gt;

&lt;p&gt;wget 下载
curl 传输文件&lt;/p&gt;

&lt;p&gt;查看ssh版本 &lt;code&gt;ssh -V&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;建立ssh连接 &lt;code&gt;ssh root@[hostname]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;列出端口 &lt;code&gt;lsof -i :80&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;停止mac自带apache &lt;code&gt;sudo apachectl stop&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;创建一个django工程 &lt;code&gt;django-admin.py startproject HelloServer&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;列出相关进程 &lt;code&gt;ps ax | grep loop.py&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;网络监测 &lt;code&gt;netstat -an | grep &amp;#39;:80&amp;#39;&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;赋予权限 &lt;code&gt;chmod&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;http://www.oschina.net/question/565065_86025&lt;/p&gt;

&lt;p&gt;mac环境路径
/usr/local/bin&lt;/p&gt;

&lt;p&gt;java下载安装
/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk&lt;/p&gt;

&lt;p&gt;/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>
</article> <!-- end #post__content -->

<!-- <div id="post__share">
  <a id="icon-twitter" class="fontello" href="https://twitter.com/intent/tweet?url=http://zhenchen.me//rss.xml&text=" target="_blank"></a>
  <a id="icon-cc" class="fontello" href="http://creativecommons.org/licenses/by-nc-sa/3.0" target="_blank"></a>
  <a id="icon-weibo" class="fontello" href="http://v.t.sina.com.cn/share/share.php?url=http://zhenchen.me//rss.xml&title=" target="_blank"></a>
</div>  -->

<!-- end #post__share -->

<!-- <div id="disqus_thread"></div>
<script type="text/javascript">
    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
    var disqus_shortname = 'javenblog'; // required: replace example with your forum shortname

    /* * * DON'T EDIT BELOW THIS LINE * * */
    (function() {
        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
        dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> -->

<div class="ds-thread" data-thread-key="" data-title="" data-url="/rss.xml"></div>
<!-- 多说评论框 end -->
<!-- 多说公共JS代码 start (一个网页只需插入一次) -->
<script type="text/javascript">
var duoshuoQuery = {short_name:"javenblog"};
  (function() {
    var ds = document.createElement('script');
    ds.type = 'text/javascript';ds.async = true;
    ds.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + '//static.duoshuo.com/embed.js';
    ds.charset = 'UTF-8';
    (document.getElementsByTagName('head')[0] 
     || document.getElementsByTagName('body')[0]).appendChild(ds);
  })();
</script>

<section style="width:250px;">
  <h3>最近访问</h3>
  <ul class="ds-recent-visitors" data-num-items="4" data-avatar-size="45" style="margin-top:10px;"></ul>
</section>
    
<p id="copyright"><a href="http://javenl.github.io" target="_blank">Javen Blog</a> • Copyright © 2015 <a href="https://github.com/javenl" target="_blank">Javen</a>.<br> Powerd by <a href="http://jekyllrb.com" target="_blank">Jekyll</a>, Host In <a href="https://pages.github.com/" target="_blank">Github Pages</a></p>

      </div> <!-- end #pjax -->

      <div id="post__toc-trigger">
        <div id="post__toc">
          <span id="post__toc-title">Table of Contents</span>
          <ul id="post__toc-ul"></ul>
        </div>
      </div>
    </div> <!-- end #post -->

    <button id="js-fullscreen"><span id="icon-arrow" class="fontello"></span></button>

    <script src="/assets/js/jquery-2.0.3.min.js"></script>
    <script src="/assets/js/jquery.pjax.js"></script>
    <script src="/assets/js/nprogress.js"></script>
    <script src="/assets/js/script.js"></script>
    <script type="text/javascript">
    var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
    document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F8df9f41c154d89488e1b1cc18038ab8f' type='text/javascript'%3E%3C/script%3E"));
</script>

  </body>
</html>
